From 40b19db21635a294a5f09b4d11838e3b19e0f88b Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 12 Jun 2024 08:22:17 +0200 Subject: [PATCH 01/48] Add SignerProvider generic to the wallet --- Cargo.lock | 3 + node-gui/backend/src/backend_impl.rs | 128 +++++++++++++----- wallet/src/lib.rs | 3 +- wallet/src/signer/mod.rs | 21 ++- wallet/src/signer/software_signer/mod.rs | 63 ++++++--- wallet/src/signer/software_signer/tests.rs | 4 +- wallet/src/wallet/mod.rs | 47 ++++--- wallet/src/wallet/tests.rs | 85 +++++++++--- wallet/wallet-cli-lib/src/cli_event_loop.rs | 23 +++- wallet/wallet-controller/Cargo.toml | 2 + wallet/wallet-controller/src/lib.rs | 53 +++++--- wallet/wallet-controller/src/read.rs | 16 ++- wallet/wallet-controller/src/sync/mod.rs | 9 +- .../src/synced_controller.rs | 59 ++++---- .../src/handles_client/mod.rs | 18 ++- wallet/wallet-rpc-lib/Cargo.toml | 1 + wallet/wallet-rpc-lib/src/lib.rs | 34 +++-- wallet/wallet-rpc-lib/src/rpc/mod.rs | 50 +++++-- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 18 ++- wallet/wallet-rpc-lib/src/service/handle.rs | 21 +-- wallet/wallet-rpc-lib/src/service/mod.rs | 15 +- wallet/wallet-rpc-lib/src/service/worker.rs | 91 ++++++++----- wallet/wallet-rpc-lib/tests/utils.rs | 18 ++- 23 files changed, 554 insertions(+), 228 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca961e1edf..738cff4b53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8808,6 +8808,8 @@ dependencies = [ "rstest", "serde", "serialization", + "storage", + "storage-inmemory", "test-utils", "thiserror", "tokio", @@ -8899,6 +8901,7 @@ dependencies = [ "utils-networking", "wallet", "wallet-controller", + "wallet-storage", "wallet-test-node", "wallet-types", ] diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index 99e8010ae9..25c7cc32bd 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -30,7 +30,12 @@ use tokio::{ sync::mpsc::{UnboundedReceiver, UnboundedSender}, task::JoinHandle, }; -use wallet::{account::transaction_list::TransactionList, wallet::Error, WalletError}; +use wallet::{ + account::transaction_list::TransactionList, + signer::{software_signer::SoftwareSignerProvider, SignerProvider}, + wallet::Error, + WalletError, +}; use wallet_cli_commands::{ get_repl_command, parse_input, CommandHandler, ConsoleCommand, ManageableWalletCommand, WalletCommand, @@ -69,12 +74,12 @@ const IN_TOP_X_MB: usize = 5; enum GuiHotColdController { Hot( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, ), Cold( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, ), } @@ -86,7 +91,9 @@ struct WalletData { } impl WalletData { - fn hot_wallet(&mut self) -> Option<&mut WalletRpc> { + fn hot_wallet( + &mut self, + ) -> Option<&mut WalletRpc> { match &mut self.controller { GuiHotColdController::Hot(w, _) => Some(w), GuiHotColdController::Cold(_, _) => None, @@ -205,10 +212,14 @@ impl Backend { } } - async fn get_account_info( - controller: &WalletRpc, + async fn get_account_info( + controller: &WalletRpc, account_index: U31, - ) -> Result<(AccountId, AccountInfo), BackendError> { + ) -> Result<(AccountId, AccountInfo), BackendError> + where + T: NodeInterface + Clone + Send + Sync + Debug + 'static, + P: SignerProvider + Clone + Send + Sync + Debug + 'static, + { let name = controller .wallet_info() .await @@ -283,6 +294,7 @@ impl Backend { &mnemonic, import, wallet_events, + SoftwareSignerProvider::new(), ) .await?; @@ -299,7 +311,14 @@ impl Backend { let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); let (wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self - .create_wallet(client, file_path.clone(), &mnemonic, import, wallet_events) + .create_wallet( + client, + file_path.clone(), + &mnemonic, + import, + wallet_events, + SoftwareSignerProvider::new(), + ) .await?; let wallet_data = WalletData { @@ -332,36 +351,47 @@ impl Backend { Ok(wallet_info) } - async fn create_wallet( + async fn create_wallet( &mut self, handles_client: N, file_path: PathBuf, mnemonic: &wallet::wallet::Mnemonic, import: ImportOrCreate, wallet_events: GuiWalletEvents, + signer_provider: P, ) -> Result< ( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, (Id, BlockHeight), BTreeMap, BTreeMap, ), BackendError, - > { + > + where + N: NodeInterface + Clone + Debug + Send + Sync + 'static, + P: SignerProvider + Clone + Send + Sync + Debug + 'static, + { let wallet_service = WalletService::start( self.chain_config.clone(), None, false, vec![], handles_client, + signer_provider.clone(), ) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; let wallet_handle = wallet_service.handle(); let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); - let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); + let wallet_rpc = WalletRpc::new( + wallet_handle, + node_rpc.clone(), + chain_config.clone(), + signer_provider, + ); wallet_rpc .create_wallet( file_path, @@ -446,7 +476,14 @@ impl Backend { best_block, accounts_info, accounts_data, - ) = self.open_wallet(handles_client, file_path.clone(), wallet_events).await?; + ) = self + .open_wallet( + handles_client, + file_path.clone(), + wallet_events, + SoftwareSignerProvider::new(), + ) + .await?; let wallet_data = WalletData { controller: GuiHotColdController::Hot(wallet_rpc, command_handler), @@ -467,7 +504,14 @@ impl Backend { best_block, accounts_info, accounts_data, - ) = self.open_wallet(client, file_path.clone(), wallet_events).await?; + ) = self + .open_wallet( + client, + file_path.clone(), + wallet_events, + SoftwareSignerProvider::new(), + ) + .await?; let wallet_data = WalletData { controller: GuiHotColdController::Cold(wallet_rpc, command_handler), @@ -497,35 +541,46 @@ impl Backend { Ok(wallet_info) } - async fn open_wallet( + async fn open_wallet( &mut self, handles_client: N, file_path: PathBuf, wallet_events: GuiWalletEvents, + signer_provider: P, ) -> Result< ( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, EncryptionState, (Id, BlockHeight), BTreeMap, BTreeMap, ), BackendError, - > { + > + where + N: NodeInterface + Clone + Debug + Send + Sync + 'static, + P: SignerProvider + Clone + Debug + Send + Sync + 'static, + { let wallet_service = WalletService::start( self.chain_config.clone(), None, false, vec![], handles_client, + signer_provider.clone(), ) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; let wallet_handle = wallet_service.handle(); let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); - let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); + let wallet_rpc = WalletRpc::new( + wallet_handle, + node_rpc.clone(), + chain_config.clone(), + signer_provider, + ); wallet_rpc .open_wallet(file_path, None, false) .await @@ -680,7 +735,7 @@ impl Backend { fn hot_wallet( &mut self, wallet_id: WalletId, - ) -> Result<&mut WalletRpc, BackendError> { + ) -> Result<&mut WalletRpc, BackendError> { self.wallets .get_mut(&wallet_id) .ok_or(BackendError::UnknownWalletIndex(wallet_id))? @@ -1250,10 +1305,14 @@ impl Backend { } } -async fn get_account_balance( - controller: &WalletRpc, +async fn get_account_balance( + controller: &WalletRpc, account_index: U31, -) -> Result { +) -> Result +where + N: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Clone + Send + Sync + 'static, +{ controller .get_balance( account_index, @@ -1264,11 +1323,15 @@ async fn get_account_balance( .map_err(|e| BackendError::WalletError(e.to_string())) } -async fn encrypt_action( +async fn encrypt_action( action: EncryptionAction, - controller: &mut WalletRpc, + controller: &mut WalletRpc, wallet_id: WalletId, -) -> Result<(WalletId, EncryptionState), BackendError> { +) -> Result<(WalletId, EncryptionState), BackendError> +where + T: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Clone + Send + Sync + 'static, +{ match action { EncryptionAction::SetPassword(password) => controller .encrypt_private_keys(password) @@ -1290,14 +1353,15 @@ async fn encrypt_action( .map_err(|err| BackendError::WalletError(err.to_string())) } -async fn select_acc_and_execute_cmd( - c: &mut CommandHandler>, +async fn select_acc_and_execute_cmd( + c: &mut CommandHandler>, account_id: AccountId, command: ManageableWalletCommand, chain_config: &ChainConfig, ) -> Result where - N: NodeInterface + Clone + Send + Sync + Debug + 'static, + N: NodeInterface + Clone + Send + Sync + 'static + Debug, + P: SignerProvider + Clone + Send + Sync + 'static + Debug, { c.handle_manageable_wallet_command( chain_config, diff --git a/wallet/src/lib.rs b/wallet/src/lib.rs index 45274623be..7a12058a66 100644 --- a/wallet/src/lib.rs +++ b/wallet/src/lib.rs @@ -23,9 +23,10 @@ pub mod wallet; pub mod wallet_events; mod utils; +use signer::software_signer::SoftwareSignerProvider; pub use crate::account::Account; pub use crate::send_request::SendRequest; pub use crate::wallet::{Wallet, WalletError, WalletResult}; -pub type DefaultWallet = Wallet; +pub type DefaultWallet = Wallet; diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 4cb41035c7..0ea15bcf96 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -13,20 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; + use common::chain::{ partially_signed_transaction::PartiallySignedTransaction, signature::{ inputsig::arbitrary_message::{ArbitraryMessageSignature, SignArbitraryMessageError}, DestinationSigError, }, - Destination, SignedTransactionIntent, SignedTransactionIntentError, Transaction, + ChainConfig, Destination, SignedTransactionIntent, SignedTransactionIntentError, Transaction, }; -use crypto::key::hdkd::derivable::DerivationError; +use crypto::key::hdkd::{derivable::DerivationError, u31::U31}; +use wallet_storage::WalletStorageReadUnlocked; use wallet_types::signature_status::SignatureStatus; use crate::key_chain::{AccountKeyChains, KeyChainError}; pub mod software_signer; +// pub mod trezor_signer; /// KeyChain errors #[derive(thiserror::Error, Debug, Eq, PartialEq)] @@ -56,9 +60,10 @@ type SignerResult = Result; pub trait Signer { /// Sign a partially signed transaction and return the before and after signature statuses. fn sign_tx( - &self, + &mut self, tx: PartiallySignedTransaction, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult<( PartiallySignedTransaction, Vec, @@ -67,10 +72,11 @@ pub trait Signer { /// Sign an arbitrary message for a destination known to this key chain. fn sign_challenge( - &self, + &mut self, message: &[u8], destination: &Destination, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult; /// Sign a transaction intent. The number of `input_destinations` must be the same as @@ -82,5 +88,12 @@ pub trait Signer { input_destinations: &[Destination], intent: &str, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult; } + +pub trait SignerProvider { + type S: Signer; + + fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S; +} diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index 06f8bab5e6..b45489c72a 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -49,28 +49,28 @@ use wallet_types::signature_status::SignatureStatus; use crate::key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}; -use super::{Signer, SignerError, SignerResult}; +use super::{Signer, SignerError, SignerProvider, SignerResult}; -pub struct SoftwareSigner<'a, T> { - db_tx: &'a T, +pub struct SoftwareSigner { chain_config: Arc, account_index: U31, } -impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { - pub fn new(db_tx: &'a T, chain_config: Arc, account_index: U31) -> Self { +impl SoftwareSigner { + pub fn new(chain_config: Arc, account_index: U31) -> Self { Self { - db_tx, chain_config, account_index, } } - fn derive_account_private_key(&self) -> SignerResult { + fn derive_account_private_key( + &self, + db_tx: &impl WalletStorageReadUnlocked, + ) -> SignerResult { let account_path = make_account_path(&self.chain_config, self.account_index); - let root_key = - MasterKeyChain::load_root_key(self.db_tx)?.derive_absolute_path(&account_path)?; + let root_key = MasterKeyChain::load_root_key(db_tx)?.derive_absolute_path(&account_path)?; Ok(root_key) } @@ -78,21 +78,22 @@ impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { &self, destination: &Destination, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult> { - let xpriv = self.derive_account_private_key()?; + let xpriv = self.derive_account_private_key(db_tx)?; match key_chain.find_public_key(destination) { Some(FoundPubKey::Hierarchy(xpub)) => { get_private_key(&xpriv, &xpub).map(|pk| Some(pk.private_key())) } Some(FoundPubKey::Standalone(acc_public_key)) => { - let standalone_pk = - self.db_tx.get_account_standalone_private_key(&acc_public_key)?; + let standalone_pk = db_tx.get_account_standalone_private_key(&acc_public_key)?; Ok(standalone_pk) } None => Ok(None), } } + #[allow(clippy::too_many_arguments)] fn sign_input( &self, tx: &Transaction, @@ -101,6 +102,7 @@ impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { inputs_utxo_refs: &[Option<&TxOutput>], key_chain: &impl AccountKeyChains, htlc_secret: &Option, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult<(Option, SignatureStatus)> { match destination { Destination::AnyoneCanSpend => Ok(( @@ -109,7 +111,7 @@ impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { )), Destination::PublicKey(_) | Destination::PublicKeyHash(_) => { let sig = self - .get_private_key_for_destination(destination, key_chain)? + .get_private_key_for_destination(destination, key_chain, db_tx)? .map(|private_key| { let sighash_type = SigHashType::try_from(SigHashType::ALL).expect("Should not fail"); @@ -158,6 +160,7 @@ impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { inputs_utxo_refs, current_signatures, key_chain, + db_tx, )?; let signature = encode_multisig_spend(&sig, inputs_utxo_refs[input_index]); @@ -178,6 +181,7 @@ impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { input_utxos: &[Option<&TxOutput>], mut current_signatures: AuthorizedClassicalMultisigSpend, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult<( AuthorizedClassicalMultisigSpend, SignatureStatus, @@ -204,6 +208,7 @@ impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { if let Some(private_key) = self.get_private_key_for_destination( &Destination::PublicKey(public_key.clone()), key_chain, + db_tx, )? { let res = sign_classical_multisig_spending( &self.chain_config, @@ -237,11 +242,12 @@ impl<'a, T: WalletStorageReadUnlocked> SoftwareSigner<'a, T> { } } -impl<'a, T: WalletStorageReadUnlocked> Signer for SoftwareSigner<'a, T> { +impl Signer for SoftwareSigner { fn sign_tx( - &self, + &mut self, ptx: PartiallySignedTransaction, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult<( PartiallySignedTransaction, Vec, @@ -292,6 +298,7 @@ impl<'a, T: WalletStorageReadUnlocked> Signer for SoftwareSigner<'a, T> { &inputs_utxo_refs, sig_components, key_chain, + db_tx, )?; let signature = @@ -326,6 +333,7 @@ impl<'a, T: WalletStorageReadUnlocked> Signer for SoftwareSigner<'a, T> { &inputs_utxo_refs, key_chain, htlc_secret, + db_tx, )?; Ok((sig, SignatureStatus::NotSigned, status)) } @@ -340,13 +348,14 @@ impl<'a, T: WalletStorageReadUnlocked> Signer for SoftwareSigner<'a, T> { } fn sign_challenge( - &self, + &mut self, message: &[u8], destination: &Destination, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult { let private_key = self - .get_private_key_for_destination(destination, key_chain)? + .get_private_key_for_destination(destination, key_chain, db_tx)? .ok_or(SignerError::DestinationNotFromThisWallet)?; let sig = ArbitraryMessageSignature::produce_uniparty_signature( @@ -365,13 +374,14 @@ impl<'a, T: WalletStorageReadUnlocked> Signer for SoftwareSigner<'a, T> { input_destinations: &[Destination], intent: &str, key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult { SignedTransactionIntent::produce_from_transaction( transaction, input_destinations, intent, |dest| { - self.get_private_key_for_destination(dest, key_chain)? + self.get_private_key_for_destination(dest, key_chain, db_tx)? .ok_or(SignerError::DestinationNotFromThisWallet) }, make_true_rng(), @@ -393,5 +403,22 @@ fn get_private_key( } } +#[derive(Clone, Debug)] +pub struct SoftwareSignerProvider; + +impl SoftwareSignerProvider { + pub fn new() -> Self { + Self {} + } +} + +impl SignerProvider for SoftwareSignerProvider { + type S = SoftwareSigner; + + fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S { + SoftwareSigner::new(chain_config, account_index) + } +} + #[cfg(test)] mod tests; diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index 780c8947a1..820a0b8688 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -128,8 +128,8 @@ fn sign_transaction(#[case] seed: Seed) { let req = SendRequest::from_transaction(tx, utxos.clone(), &|_| None).unwrap(); let ptx = req.into_partially_signed_tx().unwrap(); - let signer = SoftwareSigner::new(&db_tx, config.clone(), DEFAULT_ACCOUNT_INDEX); - let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain()).unwrap(); + let mut signer = SoftwareSigner::new(config.clone(), DEFAULT_ACCOUNT_INDEX); + let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); assert!(ptx.all_signatures_available()); diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 11755f16bb..ad7e64babb 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -31,7 +31,7 @@ use crate::send_request::{ make_issue_token_outputs, IssueNftArguments, SelectedInputs, StakePoolDataArguments, }; use crate::signer::software_signer::SoftwareSigner; -use crate::signer::{Signer, SignerError}; +use crate::signer::{Signer, SignerError, SignerProvider}; use crate::wallet_events::{WalletEvents, WalletEventsNoOp}; use crate::{Account, SendRequest}; pub use bip39::{Language, Mnemonic}; @@ -264,13 +264,14 @@ pub enum WalletPoolsFilter { Stake, } -pub struct Wallet { +pub struct Wallet { chain_config: Arc, db: Store, key_chain: MasterKeyChain, accounts: BTreeMap, latest_median_time: BlockTimestamp, next_unused_account: (U31, Account), + signer_provider: P, } #[derive(PartialEq, Eq, PartialOrd, Ord)] @@ -287,7 +288,12 @@ pub fn create_wallet_in_memory() -> WalletResult> { Ok(Store::new(DefaultBackend::new_in_memory())?) } -impl Wallet { +impl Wallet +where + B: storage::Backend + 'static, + P: SignerProvider, +{ + #[allow(clippy::too_many_arguments)] pub fn create_new_wallet( chain_config: Arc, db: Store, @@ -296,6 +302,7 @@ impl Wallet { save_seed_phrase: StoreSeedPhrase, best_block: (BlockHeight, Id), wallet_type: WalletType, + signer_provider: P, ) -> WalletResult { let mut wallet = Self::new_wallet( chain_config, @@ -304,6 +311,7 @@ impl Wallet { passphrase, save_seed_phrase, wallet_type, + signer_provider, )?; wallet.set_best_block(best_block.0, best_block.1)?; @@ -318,6 +326,7 @@ impl Wallet { passphrase: Option<&str>, save_seed_phrase: StoreSeedPhrase, wallet_type: WalletType, + signer_provider: P, ) -> WalletResult { Self::new_wallet( chain_config, @@ -326,6 +335,7 @@ impl Wallet { passphrase, save_seed_phrase, wallet_type, + signer_provider, ) } @@ -336,6 +346,7 @@ impl Wallet { passphrase: Option<&str>, save_seed_phrase: StoreSeedPhrase, wallet_type: WalletType, + signer_provider: P, ) -> WalletResult { let mut db_tx = db.transaction_rw_unlocked(None)?; @@ -352,7 +363,7 @@ impl Wallet { db_tx.set_lookahead_size(LOOKAHEAD_SIZE)?; db_tx.set_wallet_type(wallet_type)?; - let default_account = Wallet::::create_next_unused_account( + let default_account = Wallet::::create_next_unused_account( U31::ZERO, chain_config.clone(), &key_chain, @@ -360,7 +371,7 @@ impl Wallet { None, )?; - let next_unused_account = Wallet::::create_next_unused_account( + let next_unused_account = Wallet::::create_next_unused_account( U31::ONE, chain_config.clone(), &key_chain, @@ -378,6 +389,7 @@ impl Wallet { accounts: [default_account].into(), latest_median_time, next_unused_account, + signer_provider, }; Ok(wallet) @@ -709,7 +721,7 @@ impl Wallet { .0 .plus_one() .map_err(|_| WalletError::AbsoluteMaxNumAccountsExceeded(last_account.0))?; - Wallet::::create_next_unused_account( + Wallet::::create_next_unused_account( next_account_index, chain_config.clone(), &key_chain, @@ -726,6 +738,7 @@ impl Wallet { pre_migration: F, wallet_type: WalletType, force_change_wallet_type: bool, + signer_provider: P, ) -> WalletResult { if let Some(password) = password { db.unlock_private_keys(&password)?; @@ -769,6 +782,7 @@ impl Wallet { accounts, latest_median_time, next_unused_account, + signer_provider, }) } @@ -983,13 +997,14 @@ impl Wallet { error_mapper: impl FnOnce(WalletError) -> WalletError, ) -> WalletResult<(SignedTransaction, AddlData)> { let (_, block_height) = self.get_best_block_for_account(account_index)?; + self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { let (request, additional_data) = f(account, db_tx)?; let ptx = request.into_partially_signed_tx()?; - let signer = SoftwareSigner::new(db_tx, Arc::new(chain_config.clone()), account_index); - let ptx = signer.sign_tx(ptx, account.key_chain()).map(|(ptx, _, _)| ptx)?; + let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); + let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); let is_fully_signed = ptx.destinations().iter().enumerate().zip(ptx.witnesses()).all( @@ -1404,14 +1419,14 @@ impl Wallet { let signed_intent = self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { - let signer = - SoftwareSigner::new(db_tx, Arc::new(chain_config.clone()), account_index); + let signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); Ok(signer.sign_transaction_intent( signed_tx.transaction(), &input_destinations, &intent, account.key_chain(), + db_tx, )?) })?; @@ -1852,8 +1867,8 @@ impl Wallet { let ptx = request.into_partially_signed_tx()?; - let signer = SoftwareSigner::new(db_tx, Arc::new(chain_config.clone()), account_index); - let ptx = signer.sign_tx(ptx, account.key_chain()).map(|(ptx, _, _)| ptx)?; + let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); + let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; if ptx.all_signatures_available() { return Err(WalletError::FullySignedTransactionInDecommissionReq); @@ -1983,9 +1998,9 @@ impl Wallet { account.tx_to_partially_signed_tx(tx, latest_median_time)? } }; - let signer = SoftwareSigner::new(db_tx, Arc::new(chain_config.clone()), account_index); + let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); - let res = signer.sign_tx(ptx, account.key_chain())?; + let res = signer.sign_tx(ptx, account.key_chain(), db_tx)?; Ok(res) }) } @@ -1997,8 +2012,8 @@ impl Wallet { destination: &Destination, ) -> WalletResult { self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { - let signer = SoftwareSigner::new(db_tx, Arc::new(chain_config.clone()), account_index); - let msg = signer.sign_challenge(challenge, destination, account.key_chain())?; + let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); + let msg = signer.sign_challenge(challenge, destination, account.key_chain(), db_tx)?; Ok(msg) }) } diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 3aaebc9d89..2bada033d7 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -16,6 +16,7 @@ use crate::{ key_chain::{make_account_path, LOOKAHEAD_SIZE}, send_request::{make_address_output, make_create_delegation_output}, + signer::software_signer::SoftwareSignerProvider, wallet_events::WalletEventsNoOp, DefaultWallet, }; @@ -69,12 +70,20 @@ const MNEMONIC2: &str = const NETWORK_FEE: u128 = 10000; -fn get_best_block(wallet: &DefaultWallet) -> (Id, BlockHeight) { +fn get_best_block(wallet: &Wallet) -> (Id, BlockHeight) +where + B: storage::Backend + 'static, + P: SignerProvider, +{ *wallet.get_best_block().first_key_value().unwrap().1 } #[track_caller] -fn scan_wallet(wallet: &mut DefaultWallet, height: BlockHeight, blocks: Vec) { +fn scan_wallet(wallet: &mut Wallet, height: BlockHeight, blocks: Vec) +where + B: storage::Backend + 'static, + P: SignerProvider, +{ for account in wallet.get_best_block().keys() { wallet .scan_new_blocks(*account, height, blocks.clone(), &WalletEventsNoOp) @@ -173,7 +182,11 @@ fn get_address( .unwrap() } -fn get_coin_balance_for_acc(wallet: &DefaultWallet, account: U31) -> Amount { +fn get_coin_balance_for_acc(wallet: &Wallet, account: U31) -> Amount +where + B: storage::Backend + 'static, + P: SignerProvider, +{ let coin_balance = wallet .get_balance(account, UtxoState::Confirmed.into(), WithLocked::Unlocked) .unwrap() @@ -183,7 +196,11 @@ fn get_coin_balance_for_acc(wallet: &DefaultWallet, account: U31) -> Amount { coin_balance } -fn get_coin_balance_with_inactive(wallet: &DefaultWallet) -> Amount { +fn get_coin_balance_with_inactive(wallet: &Wallet) -> Amount +where + B: storage::Backend + 'static, + P: SignerProvider, +{ let coin_balance = wallet .get_balance( DEFAULT_ACCOUNT_INDEX, @@ -197,11 +214,19 @@ fn get_coin_balance_with_inactive(wallet: &DefaultWallet) -> Amount { coin_balance } -fn get_coin_balance(wallet: &DefaultWallet) -> Amount { +fn get_coin_balance(wallet: &Wallet) -> Amount +where + B: storage::Backend + 'static, + P: SignerProvider, +{ get_coin_balance_for_acc(wallet, DEFAULT_ACCOUNT_INDEX) } -fn get_currency_balances(wallet: &DefaultWallet) -> (Amount, Vec<(TokenId, Amount)>) { +fn get_currency_balances(wallet: &Wallet) -> (Amount, Vec<(TokenId, Amount)>) +where + B: storage::Backend + 'static, + P: SignerProvider, +{ let mut currency_balances = wallet .get_balance( DEFAULT_ACCOUNT_INDEX, @@ -223,11 +248,14 @@ fn get_currency_balances(wallet: &DefaultWallet) -> (Amount, Vec<(TokenId, Amoun } #[track_caller] -fn verify_wallet_balance( +fn verify_wallet_balance( chain_config: &Arc, - wallet: &DefaultWallet, + wallet: &Wallet, expected_balance: Amount, -) { +) where + B: storage::Backend + 'static, + P: SignerProvider, +{ let coin_balance = get_coin_balance(wallet); assert_eq!(coin_balance, expected_balance); @@ -240,23 +268,24 @@ fn verify_wallet_balance( |_| Ok(()), WalletType::Hot, false, + SoftwareSignerProvider::new(), ) .unwrap(); + + wallet.get_best_block(); + let coin_balance = get_coin_balance(&wallet); // Check that the loaded wallet has the same balance assert_eq!(coin_balance, expected_balance); } #[track_caller] -fn create_wallet(chain_config: Arc) -> Wallet { +fn create_wallet(chain_config: Arc) -> DefaultWallet { create_wallet_with_mnemonic(chain_config, MNEMONIC) } #[track_caller] -fn create_wallet_with_mnemonic( - chain_config: Arc, - mnemonic: &str, -) -> Wallet { +fn create_wallet_with_mnemonic(chain_config: Arc, mnemonic: &str) -> DefaultWallet { let db = create_wallet_in_memory().unwrap(); let genesis_block_id = chain_config.genesis_block_id(); Wallet::create_new_wallet( @@ -267,18 +296,23 @@ fn create_wallet_with_mnemonic( StoreSeedPhrase::DoNotStore, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, + SoftwareSignerProvider::new(), ) .unwrap() } #[track_caller] -fn create_block( +fn create_block( chain_config: &Arc, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, transactions: Vec, reward: Amount, block_height: u64, -) -> (Address, Block) { +) -> (Address, Block) +where + B: storage::Backend + 'static, + P: SignerProvider, +{ let address = wallet.get_new_address(DEFAULT_ACCOUNT_INDEX).unwrap().1; let block1 = Block::new( @@ -325,6 +359,7 @@ fn wallet_creation_in_memory() { |_| Ok(()), WalletType::Hot, false, + SoftwareSignerProvider::new(), ) { Ok(_) => panic!("Wallet loading should fail"), Err(err) => assert_eq!(err, WalletError::WalletNotInitialized), @@ -342,6 +377,7 @@ fn wallet_creation_in_memory() { |_| Ok(()), WalletType::Hot, false, + SoftwareSignerProvider::new(), ) .unwrap(); } @@ -376,6 +412,7 @@ fn wallet_migration_to_v2(#[case] seed: Seed) { StoreSeedPhrase::DoNotStore, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, + SoftwareSignerProvider::new(), ) .unwrap(); verify_wallet_balance(&chain_config, &wallet, genesis_amount); @@ -426,6 +463,7 @@ fn wallet_migration_to_v2(#[case] seed: Seed) { |_| Ok(()), WalletType::Hot, false, + SoftwareSignerProvider::new(), ) .unwrap(); @@ -474,6 +512,7 @@ fn wallet_seed_phrase_retrieval(#[case] seed: Seed) { StoreSeedPhrase::Store, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, + SoftwareSignerProvider::new(), ) .unwrap(); @@ -563,6 +602,7 @@ fn wallet_seed_phrase_check_address() { StoreSeedPhrase::Store, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, + SoftwareSignerProvider::new(), ) .unwrap(); @@ -583,6 +623,7 @@ fn wallet_seed_phrase_check_address() { StoreSeedPhrase::Store, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, + SoftwareSignerProvider::new(), ) .unwrap(); @@ -867,11 +908,14 @@ fn wallet_balance_parent_child_transactions() { } #[track_caller] -fn test_wallet_accounts( +fn test_wallet_accounts( chain_config: &Arc, - wallet: &DefaultWallet, + wallet: &Wallet, expected_accounts: Vec, -) { +) where + B: storage::Backend + 'static, + P: SignerProvider, +{ let accounts = wallet.account_indexes().cloned().collect::>(); assert_eq!(accounts, expected_accounts); @@ -883,6 +927,7 @@ fn test_wallet_accounts( |_| Ok(()), WalletType::Hot, false, + SoftwareSignerProvider::new(), ) .unwrap(); let accounts = wallet.account_indexes().cloned().collect::>(); diff --git a/wallet/wallet-cli-lib/src/cli_event_loop.rs b/wallet/wallet-cli-lib/src/cli_event_loop.rs index a18ac644d9..e994f70741 100644 --- a/wallet/wallet-cli-lib/src/cli_event_loop.rs +++ b/wallet/wallet-cli-lib/src/cli_event_loop.rs @@ -17,6 +17,7 @@ use std::{fmt::Debug, sync::Arc}; use common::chain::ChainConfig; use tokio::sync::{mpsc, oneshot}; +use wallet::signer::software_signer::SoftwareSignerProvider; use wallet_cli_commands::{CommandHandler, ConsoleCommand, ManageableWalletCommand}; use wallet_rpc_client::{handles_client::WalletRpcHandlesClient, rpc_client::ClientWalletRpc}; use wallet_rpc_lib::types::{ControllerConfig, NodeInterface}; @@ -58,16 +59,28 @@ pub async fn run( node_rpc, wallet_rpc_config, } => { - let wallet_service = - WalletService::start(chain_config.clone(), None, false, vec![], node_rpc) - .await - .map_err(|err| WalletCliError::InvalidConfig(err.to_string()))?; + let signer_provider = SoftwareSignerProvider::new(); + let wallet_service = WalletService::start( + chain_config.clone(), + None, + false, + vec![], + node_rpc, + signer_provider.clone(), + ) + .await + .map_err(|err| WalletCliError::InvalidConfig(err.to_string()))?; let wallet_handle = wallet_service.handle(); let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); - let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); + let wallet_rpc = WalletRpc::new( + wallet_handle, + node_rpc.clone(), + chain_config.clone(), + signer_provider, + ); let server_rpc = if let Some(rpc_config) = wallet_rpc_config { let builder = rpc::Builder::new(rpc_config.bind_addr, rpc_config.auth_credentials) .with_method_list("list_methods") diff --git a/wallet/wallet-controller/Cargo.toml b/wallet/wallet-controller/Cargo.toml index 4f1b001da1..fee41f4b2d 100644 --- a/wallet/wallet-controller/Cargo.toml +++ b/wallet/wallet-controller/Cargo.toml @@ -20,6 +20,8 @@ node-comm = { path = "../wallet-node-client" } rpc-description = { path = "../../rpc/description" } randomness = { path = "../../randomness" } serialization = { path = "../../serialization" } +storage = { path = "../../storage" } +storage-inmemory = { path = "../../storage/inmemory" } utils = { path = "../../utils" } utils-networking = { path = "../../utils/networking" } wallet = { path = ".." } diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 1a365b82d1..4af320c874 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -46,6 +46,7 @@ use types::{ Balances, GenericCurrencyTransferToTxOutputConversionError, InspectTransaction, SeedWithPassPhrase, SignatureStats, TransactionToInspect, ValidatedSignatures, WalletInfo, }; +use wallet_storage::DefaultBackend; use read::ReadOnlyController; use sync::InSync; @@ -84,9 +85,10 @@ use wallet::{ TransactionToSign, }, destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, + signer::SignerProvider, wallet::WalletPoolsFilter, wallet_events::WalletEvents, - DefaultWallet, WalletError, WalletResult, + Wallet, WalletError, WalletResult, }; pub use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, @@ -155,33 +157,42 @@ pub struct ControllerConfig { pub broadcast_to_mempool: bool, } -pub struct Controller { +pub struct Controller { chain_config: Arc, rpc_client: T, - wallet: DefaultWallet, + wallet: Wallet, staking_started: BTreeSet, wallet_events: W, } -impl std::fmt::Debug for Controller { +impl std::fmt::Debug + for Controller +{ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Controller").finish() } } -pub type RpcController = Controller; -pub type HandlesController = Controller; -pub type ColdController = Controller; - -impl Controller { +pub type RpcController = Controller; +pub type HandlesController = + Controller; +pub type ColdController = + Controller; + +impl Controller +where + T: NodeInterface + Clone + Send + Sync + 'static, + W: WalletEvents, + P: SignerProvider, +{ pub async fn new( chain_config: Arc, rpc_client: T, - wallet: DefaultWallet, + wallet: Wallet, wallet_events: W, ) -> Result> { let mut controller = Self { @@ -201,7 +212,7 @@ impl Controll pub fn new_unsynced( chain_config: Arc, rpc_client: T, - wallet: DefaultWallet, + wallet: Wallet, wallet_events: W, ) -> Self { Self { @@ -213,6 +224,7 @@ impl Controll } } + #[allow(clippy::too_many_arguments)] pub fn create_wallet( chain_config: Arc, file_path: impl AsRef, @@ -221,7 +233,8 @@ impl Controll whether_to_store_seed_phrase: StoreSeedPhrase, best_block: (BlockHeight, Id), wallet_type: WalletType, - ) -> Result> { + signer_provider: P, + ) -> Result, ControllerError> { utils::ensure!( !file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -240,6 +253,7 @@ impl Controll whether_to_store_seed_phrase, best_block, wallet_type, + signer_provider, ) .map_err(ControllerError::WalletError)?; @@ -253,7 +267,8 @@ impl Controll passphrase: Option<&str>, whether_to_store_seed_phrase: StoreSeedPhrase, wallet_type: WalletType, - ) -> Result> { + signer_provider: P, + ) -> Result, ControllerError> { utils::ensure!( !file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -271,6 +286,7 @@ impl Controll passphrase, whether_to_store_seed_phrase, wallet_type, + signer_provider, ) .map_err(ControllerError::WalletError)?; @@ -310,7 +326,8 @@ impl Controll password: Option, wallet_type: WalletType, force_change_wallet_type: bool, - ) -> Result> { + signer_provider: P, + ) -> Result, ControllerError> { utils::ensure!( file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -329,6 +346,7 @@ impl Controll |version| Self::make_backup_wallet_file(file_path.as_ref(), version), wallet_type, force_change_wallet_type, + signer_provider, ) .map_err(ControllerError::WalletError)?; @@ -699,7 +717,7 @@ impl Controll &mut self, account_index: U31, config: ControllerConfig, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { self.sync_once().await?; Ok(SyncedController::new( &mut self.wallet, @@ -712,7 +730,10 @@ impl Controll )) } - pub fn readonly_controller(&self, account_index: U31) -> ReadOnlyController { + pub fn readonly_controller( + &self, + account_index: U31, + ) -> ReadOnlyController<'_, T, DefaultBackend, P> { ReadOnlyController::new( &self.wallet, self.rpc_client.clone(), diff --git a/wallet/wallet-controller/src/read.rs b/wallet/wallet-controller/src/read.rs index a5cc00d704..837dfb7890 100644 --- a/wallet/wallet-controller/src/read.rs +++ b/wallet/wallet-controller/src/read.rs @@ -31,8 +31,9 @@ use node_comm::node_traits::NodeInterface; use utils::tap_log::TapLog; use wallet::{ account::{transaction_list::TransactionList, DelegationData, PoolData, TxInfo}, + signer::SignerProvider, wallet::WalletPoolsFilter, - DefaultWallet, + Wallet, }; use wallet_types::{ account_info::StandaloneAddresses, @@ -47,8 +48,8 @@ use crate::{ ControllerError, }; -pub struct ReadOnlyController<'a, T> { - wallet: &'a DefaultWallet, +pub struct ReadOnlyController<'a, T, B: storage::Backend + 'static, P> { + wallet: &'a Wallet, rpc_client: T, chain_config: &'a ChainConfig, account_index: U31, @@ -57,9 +58,14 @@ pub struct ReadOnlyController<'a, T> { /// A Map between the derived child number and the Address with whether it is marked as used or not type MapAddressWithUsage = BTreeMap, bool)>; -impl<'a, T: NodeInterface> ReadOnlyController<'a, T> { +impl<'a, T, B, P> ReadOnlyController<'a, T, B, P> +where + T: NodeInterface, + B: storage::Backend + 'static, + P: SignerProvider, +{ pub fn new( - wallet: &'a DefaultWallet, + wallet: &'a Wallet, rpc_client: T, chain_config: &'a ChainConfig, account_index: U31, diff --git a/wallet/wallet-controller/src/sync/mod.rs b/wallet/wallet-controller/src/sync/mod.rs index 8e638f4e16..453f425209 100644 --- a/wallet/wallet-controller/src/sync/mod.rs +++ b/wallet/wallet-controller/src/sync/mod.rs @@ -24,7 +24,8 @@ use logging::log; use node_comm::node_traits::NodeInterface; use utils::{once_destructor::OnceDestructor, set_flag::SetFlag}; use wallet::{ - wallet::WalletSyncingState, wallet_events::WalletEvents, DefaultWallet, WalletResult, + signer::SignerProvider, wallet::WalletSyncingState, wallet_events::WalletEvents, Wallet, + WalletResult, }; use crate::ControllerError; @@ -52,7 +53,11 @@ pub trait SyncingWallet { fn update_median_time(&mut self, median_time: BlockTimestamp) -> WalletResult<()>; } -impl SyncingWallet for DefaultWallet { +impl SyncingWallet for Wallet +where + B: storage::Backend + 'static, + P: SignerProvider, +{ fn syncing_state(&self) -> WalletSyncingState { self.get_syncing_state() } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 181ee1dcdf..14956e42d3 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -51,9 +51,10 @@ use wallet::{ make_address_output, make_address_output_token, make_create_delegation_output, make_data_deposit_output, SelectedInputs, StakePoolDataArguments, }, + signer::SignerProvider, wallet::WalletPoolsFilter, wallet_events::WalletEvents, - DefaultWallet, WalletError, WalletResult, + Wallet, WalletError, WalletResult, }; use wallet_types::{ signature_status::SignatureStatus, @@ -68,8 +69,8 @@ use crate::{ ControllerConfig, ControllerError, }; -pub struct SyncedController<'a, T, W> { - wallet: &'a mut DefaultWallet, +pub struct SyncedController<'a, T, W, B: storage::Backend + 'static, P> { + wallet: &'a mut Wallet, rpc_client: T, chain_config: &'a ChainConfig, wallet_events: &'a W, @@ -78,9 +79,15 @@ pub struct SyncedController<'a, T, W> { config: ControllerConfig, } -impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { +impl<'a, T, W, B, P> SyncedController<'a, T, W, B, P> +where + B: storage::Backend + 'static, + P: SignerProvider, + T: NodeInterface, + W: WalletEvents, +{ pub fn new( - wallet: &'a mut DefaultWallet, + wallet: &'a mut Wallet, rpc_client: T, chain_config: &'a ChainConfig, wallet_events: &'a W, @@ -270,7 +277,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.issue_new_token( account_index, @@ -298,7 +305,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.issue_new_nft( account_index, @@ -322,7 +329,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; @@ -347,7 +354,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; @@ -371,7 +378,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; @@ -397,7 +404,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { wallet.freeze_token( @@ -421,7 +428,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { wallet.unfreeze_token( @@ -446,7 +453,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { wallet.change_token_authority( @@ -495,7 +502,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_transaction_to_addresses( account_index, @@ -526,7 +533,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_transaction_to_addresses( account_index, @@ -571,7 +578,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_sweep_transaction( account_index, @@ -609,7 +616,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_sweep_from_delegation_transaction( account_index, @@ -834,7 +841,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_delegation( account_index, @@ -858,7 +865,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_transaction_to_addresses( account_index, @@ -899,7 +906,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_transaction_to_addresses_from_delegation( account_index, @@ -927,7 +934,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; @@ -986,7 +993,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.create_stake_pool_tx( account_index, @@ -1022,7 +1029,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut Wallet, account_index: U31| { wallet.decommission_stake_pool( account_index, @@ -1249,7 +1256,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { /// Create a transaction and broadcast it async fn create_and_send_tx< - F: FnOnce(FeeRate, FeeRate, &mut DefaultWallet, U31) -> WalletResult, + F: FnOnce(FeeRate, FeeRate, &mut Wallet, U31) -> WalletResult, >( &mut self, tx_maker: F, @@ -1278,7 +1285,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { F: FnOnce( FeeRate, FeeRate, - &mut DefaultWallet, + &mut Wallet, U31, &UnconfirmedTokenInfo, ) -> WalletResult, @@ -1332,7 +1339,7 @@ impl<'a, T: NodeInterface, W: WalletEvents> SyncedController<'a, T, W> { /// e.g. newly issued token, nft or delegation id async fn create_and_send_tx_with_id< ID, - F: FnOnce(FeeRate, FeeRate, &mut DefaultWallet, U31) -> WalletResult<(ID, SignedTransaction)>, + F: FnOnce(FeeRate, FeeRate, &mut Wallet, U31) -> WalletResult<(ID, SignedTransaction)>, >( &mut self, tx_maker: F, diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index b30051c49a..01bb414c4a 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -57,8 +57,8 @@ use crate::wallet_rpc_traits::{ FromRpcInput, PartialOrSignedTx, SignRawTransactionResult, WalletInterface, }; -pub struct WalletRpcHandlesClient { - wallet_rpc: WalletRpc, +pub struct WalletRpcHandlesClient { + wallet_rpc: WalletRpc, server_rpc: Option, } @@ -77,8 +77,12 @@ pub enum WalletRpcHandlesClientError { AddressError(#[from] AddressError), } -impl WalletRpcHandlesClient { - pub fn new(wallet_rpc: WalletRpc, server_rpc: Option) -> Self { +impl WalletRpcHandlesClient +where + N: NodeInterface + Clone + Send + Sync + 'static + Debug, + P: SignerProvider + Clone + Send + Sync + 'static, +{ + pub fn new(wallet_rpc: WalletRpc, server_rpc: Option) -> Self { Self { wallet_rpc, server_rpc, @@ -87,8 +91,10 @@ impl WalletRpcHandlesC } #[async_trait::async_trait] -impl WalletInterface - for WalletRpcHandlesClient +impl WalletInterface for WalletRpcHandlesClient +where + N: NodeInterface + Clone + Send + Sync + 'static + Debug, + P: SignerProvider + Clone + Send + Sync + 'static, { type Error = WalletRpcHandlesClientError; diff --git a/wallet/wallet-rpc-lib/Cargo.toml b/wallet/wallet-rpc-lib/Cargo.toml index 27376d9c9b..7d3b48c11e 100644 --- a/wallet/wallet-rpc-lib/Cargo.toml +++ b/wallet/wallet-rpc-lib/Cargo.toml @@ -22,6 +22,7 @@ utils = { path = "../../utils" } utils-networking = { path = "../../utils/networking" } wallet = { path = ".." } wallet-controller = { path = "../wallet-controller" } +wallet-storage = { path = "../storage" } wallet-types = { path = "../types" } p2p-types = { path = "../../p2p/types" } diff --git a/wallet/wallet-rpc-lib/src/lib.rs b/wallet/wallet-rpc-lib/src/lib.rs index ed94f27c3e..6a94325dfa 100644 --- a/wallet/wallet-rpc-lib/src/lib.rs +++ b/wallet/wallet-rpc-lib/src/lib.rs @@ -26,6 +26,7 @@ pub use service::{ CreatedWallet, Event, EventStream, TxState, WalletHandle, /* WalletResult, */ WalletService, }; +use wallet::signer::{software_signer::SoftwareSignerProvider, SignerProvider}; use wallet_controller::{NodeInterface, NodeRpcClient}; use std::{fmt::Debug, time::Duration}; @@ -76,15 +77,27 @@ pub async fn run( StartupError::WalletService(service::InitError::::NodeRpc(err)) })?; - let (wallet_service, rpc_server) = - start_services(wallet_config, rpc_config, node_rpc, false).await?; + let (wallet_service, rpc_server) = start_services( + wallet_config, + rpc_config, + node_rpc, + false, + SoftwareSignerProvider::new(), + ) + .await?; wait_for_shutdown(wallet_service, rpc_server).await; } NodeRpc::ColdWallet => { let node_rpc = wallet_controller::make_cold_wallet_rpc_client(wallet_config.chain_config.clone()); - let (wallet_service, rpc_server) = - start_services(wallet_config, rpc_config, node_rpc, true).await?; + let (wallet_service, rpc_server) = start_services( + wallet_config, + rpc_config, + node_rpc, + true, + SoftwareSignerProvider::new(), + ) + .await?; wait_for_shutdown(wallet_service, rpc_server).await; } } @@ -92,14 +105,16 @@ pub async fn run( Ok(()) } -pub async fn start_services( +pub async fn start_services( wallet_config: WalletServiceConfig, rpc_config: WalletRpcConfig, node_rpc: N, cold_wallet: bool, -) -> Result<(WalletService, rpc::Rpc), StartupError> + signer_provider: P, +) -> Result<(WalletService, rpc::Rpc), StartupError> where - N: NodeInterface + Clone + Sync + Send + Debug + 'static, + N: NodeInterface + Clone + Sync + Send + 'static + Debug, + P: SignerProvider + Clone + Send + Sync + 'static, { // Start the wallet service let wallet_service = WalletService::start( @@ -108,6 +123,7 @@ where wallet_config.force_change_wallet_type, wallet_config.start_staking_for_account, node_rpc, + signer_provider.clone(), ) .await?; @@ -122,6 +138,7 @@ where rpc_config, chain_config, cold_wallet, + signer_provider, ) .await .map_err(StartupError::Rpc)? @@ -131,9 +148,10 @@ where } /// Run a wallet daemon with RPC interface -pub async fn wait_for_shutdown(wallet_service: WalletService, rpc_server: rpc::Rpc) +pub async fn wait_for_shutdown(wallet_service: WalletService, rpc_server: rpc::Rpc) where N: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Clone + Send + Sync + 'static, { // Start the wallet service let wallet_handle = wallet_service.handle(); diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index b0000b1853..3c2f2c833e 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -94,20 +94,31 @@ use self::types::{ }; #[derive(Clone)] -pub struct WalletRpc { - wallet: WalletHandle, +pub struct WalletRpc { + wallet: WalletHandle, node: N, chain_config: Arc, + signer_provider: P, } type WRpcResult = Result>; -impl WalletRpc { - pub fn new(wallet: WalletHandle, node: N, chain_config: Arc) -> Self { +impl WalletRpc +where + N: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Clone + Sync + Send + 'static, +{ + pub fn new( + wallet: WalletHandle, + node: N, + chain_config: Arc, + signer_provider: P, + ) -> Self { Self { wallet, node, chain_config, + signer_provider, } } @@ -131,11 +142,19 @@ impl WalletRpc { passphrase: Option, skip_syncing: bool, ) -> WRpcResult { + let signer_provider = self.signer_provider.clone(); self.wallet .manage_async(move |wallet_manager| { Box::pin(async move { wallet_manager - .create_wallet(path, store_seed_phrase, mnemonic, passphrase, skip_syncing) + .create_wallet( + path, + store_seed_phrase, + mnemonic, + passphrase, + skip_syncing, + signer_provider, + ) .await }) }) @@ -148,12 +167,18 @@ impl WalletRpc { password: Option, force_migrate_wallet_type: bool, ) -> WRpcResult<(), N> { + let signer_provider = self.signer_provider.clone(); Ok(self .wallet .manage_async(move |wallet_manager| { Box::pin(async move { wallet_manager - .open_wallet(wallet_path, password, force_migrate_wallet_type) + .open_wallet( + wallet_path, + password, + force_migrate_wallet_type, + signer_provider, + ) .await }) }) @@ -2236,19 +2261,24 @@ impl WalletRpc { } } -pub async fn start( - wallet_handle: WalletHandle, +pub async fn start( + wallet_handle: WalletHandle, node_rpc: N, config: WalletRpcConfig, chain_config: Arc, cold_wallet: bool, -) -> anyhow::Result { + signer_provider: P, +) -> anyhow::Result +where + N: NodeInterface + Clone + Send + Sync + 'static + Debug, + P: SignerProvider + Clone + Send + Sync + 'static, +{ let WalletRpcConfig { bind_addr, auth_credentials, } = config; - let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc, chain_config); + let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc, chain_config, signer_provider); let builder = rpc::Builder::new(bind_addr, auth_credentials) .with_method_list("list_methods") .register(ColdWalletRpcServer::into_rpc(wallet_rpc.clone())); diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index 90a3525bb8..11c815c4dc 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -58,8 +58,10 @@ use crate::{ use super::types::{NewOrder, RpcHashedTimelockContract}; #[async_trait::async_trait] -impl WalletEventsRpcServer - for WalletRpc +impl WalletEventsRpcServer for WalletRpc +where + N: NodeInterface + Clone + Send + Sync + 'static + Debug, + P: SignerProvider + Clone + Send + Sync + 'static, { async fn subscribe_wallet_events( &self, @@ -71,8 +73,10 @@ impl WalletEventsRpcSe } #[async_trait::async_trait] -impl ColdWalletRpcServer - for WalletRpc +impl ColdWalletRpcServer for WalletRpc +where + N: NodeInterface + Clone + Send + Sync + 'static + Debug, + P: SignerProvider + Clone + Send + Sync + 'static, { async fn shutdown(&self) -> rpc::RpcResult<()> { rpc::handle_result(self.shutdown()) @@ -304,7 +308,11 @@ impl ColdWalletRpcServ } #[async_trait::async_trait] -impl WalletRpcServer for WalletRpc { +impl WalletRpcServer for WalletRpc +where + N: NodeInterface + Clone + Send + Sync + 'static + Debug, + P: SignerProvider + Clone + Sync + Send + 'static, +{ async fn rescan(&self) -> rpc::RpcResult<()> { rpc::handle_result(self.rescan().await) } diff --git a/wallet/wallet-rpc-lib/src/service/handle.rs b/wallet/wallet-rpc-lib/src/service/handle.rs index 7caaa8ebd1..b4bc0ff06e 100644 --- a/wallet/wallet-rpc-lib/src/service/handle.rs +++ b/wallet/wallet-rpc-lib/src/service/handle.rs @@ -18,6 +18,7 @@ use futures::future::{BoxFuture, Future}; use utils::shallow_clone::ShallowClone; +use wallet::signer::SignerProvider; use wallet_controller::NodeInterface; use crate::{ @@ -29,13 +30,17 @@ pub use crate::service::worker::EventStream; /// Wallet handle allows the user to control the wallet service, perform queries etc. #[derive(Clone)] -pub struct WalletHandle(worker::CommandSender); +pub struct WalletHandle(worker::CommandSender); -impl WalletHandle { +impl WalletHandle +where + N: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Clone + Sync + Send + 'static, +{ /// Asynchronous wallet service call pub fn call_async> + Send + 'static>( &self, - action: impl FnOnce(&mut WalletController) -> BoxFuture> + Send + 'static, + action: impl FnOnce(&mut WalletController) -> BoxFuture> + Send + 'static, ) -> impl Future>, SubmitError>> { let (tx, rx) = tokio::sync::oneshot::channel(); let command = WalletCommand::Call(Box::new(move |opt_controller| match opt_controller { @@ -58,7 +63,7 @@ impl WalletHandle { /// Wallet service call pub fn call> + Send + 'static>( &self, - action: impl FnOnce(&mut WalletController) -> Result + Send + 'static, + action: impl FnOnce(&mut WalletController) -> Result + Send + 'static, ) -> impl Future>, SubmitError>> { self.call_async(|controller| { let res = action(controller); @@ -68,7 +73,7 @@ impl WalletHandle { pub fn manage_async( &self, - action_fn: impl FnOnce(&mut WalletWorker) -> BoxFuture + Send + 'static, + action_fn: impl FnOnce(&mut WalletWorker) -> BoxFuture + Send + 'static, ) -> impl Future> { let (tx, rx) = tokio::sync::oneshot::channel(); let command = WalletCommand::Manage(Box::new(move |wallet_manager| { @@ -106,16 +111,16 @@ impl WalletHandle { self.0.closed().await } - fn send_raw(&self, cmd: WalletCommand) -> Result<(), SubmitError> { + fn send_raw(&self, cmd: WalletCommand) -> Result<(), SubmitError> { self.0.send(cmd).map_err(|_| SubmitError::Send) } } -pub fn create(sender: worker::CommandSender) -> WalletHandle { +pub fn create(sender: worker::CommandSender) -> WalletHandle { WalletHandle(sender) } -impl ShallowClone for WalletHandle { +impl ShallowClone for WalletHandle { fn shallow_clone(&self) -> Self { Self(worker::CommandSender::clone(&self.0)) } diff --git a/wallet/wallet-rpc-lib/src/service/mod.rs b/wallet/wallet-rpc-lib/src/service/mod.rs index 5eb343b4bc..a0f41ab152 100644 --- a/wallet/wallet-rpc-lib/src/service/mod.rs +++ b/wallet/wallet-rpc-lib/src/service/mod.rs @@ -25,6 +25,7 @@ use utils::shallow_clone::ShallowClone; pub use events::{Event, TxState}; pub use handle::{EventStream, SubmitError, WalletHandle}; +use wallet::signer::SignerProvider; use wallet_controller::{ControllerConfig, NodeInterface}; pub use worker::{CreatedWallet, WalletController, WalletControllerError}; @@ -33,9 +34,9 @@ use events::WalletServiceEvents; // pub type WalletResult = Result; /// Wallet service -pub struct WalletService { +pub struct WalletService { task: tokio::task::JoinHandle<()>, - command_tx: worker::CommandSender, + command_tx: worker::CommandSender, node_rpc: N, chain_config: Arc, } @@ -50,13 +51,18 @@ pub enum InitError { Controller(#[from] WalletControllerError), } -impl WalletService { +impl WalletService +where + N: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Clone + Send + Sync + 'static, +{ pub async fn start( chain_config: Arc, wallet_file: Option, force_change_wallet_type: bool, start_staking_for_account: Vec, node_rpc: N, + signer_provider: P, ) -> Result> { let (wallet_events, events_rx) = WalletServiceEvents::new(); let (command_tx, command_rx) = tokio::sync::mpsc::unbounded_channel(); @@ -71,6 +77,7 @@ impl WalletService { wallet_password, node_rpc.is_cold_wallet_node(), force_change_wallet_type, + signer_provider, )? }; @@ -122,7 +129,7 @@ impl WalletService { } /// Get wallet service handle - pub fn handle(&self) -> WalletHandle { + pub fn handle(&self) -> WalletHandle { handle::create(worker::CommandSender::clone(&self.command_tx)) } diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index ec31ed6389..b8c3957b83 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -21,6 +21,7 @@ use tokio::{sync::mpsc, task::JoinHandle}; use logging::log; use utils_networking::broadcaster::Broadcaster; +use wallet::signer::SignerProvider; use wallet::wallet::Mnemonic; use wallet_controller::{ControllerError, NodeInterface}; use wallet_types::seed_phrase::StoreSeedPhrase; @@ -31,22 +32,23 @@ use crate::Event; use super::WalletServiceEvents; -pub type WalletController = wallet_controller::RpcController; +pub type WalletController = + wallet_controller::RpcController; pub type WalletControllerError = wallet_controller::ControllerError; -pub type CommandReceiver = mpsc::UnboundedReceiver>; -pub type CommandSender = mpsc::UnboundedSender>; +pub type CommandReceiver = mpsc::UnboundedReceiver>; +pub type CommandSender = mpsc::UnboundedSender>; pub type EventStream = utils_networking::broadcaster::Receiver; -type CommandFn = dyn Send + FnOnce(&mut Option>) -> BoxFuture<()>; -type ManageFn = dyn Send + FnOnce(&mut WalletWorker) -> BoxFuture<()>; +type CommandFn = dyn Send + FnOnce(&mut Option>) -> BoxFuture<()>; +type ManageFn = dyn Send + FnOnce(&mut WalletWorker) -> BoxFuture<()>; /// Commands to control the wallet task -pub enum WalletCommand { +pub enum WalletCommand { /// Make the controller perform an action - Call(Box>), + Call(Box>), /// Manage the Wallet itself, i.e. Create/Open/Close - Manage(Box>), + Manage(Box>), /// Shutdown the wallet service task Stop, @@ -58,9 +60,9 @@ pub enum CreatedWallet { } /// Represents the wallet worker task. It handles external commands and keeps the wallet in sync. -pub struct WalletWorker { - controller: Option>, - command_rx: CommandReceiver, +pub struct WalletWorker { + controller: Option>, + command_rx: CommandReceiver, chain_config: Arc, node_rpc: N, events_bcast: Broadcaster, @@ -68,12 +70,16 @@ pub struct WalletWorker { wallet_events: WalletServiceEvents, } -impl WalletWorker { +impl WalletWorker +where + N: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Sync + Send + 'static, +{ fn new( - controller: Option>, + controller: Option>, chain_config: Arc, node_rpc: N, - command_rx: CommandReceiver, + command_rx: CommandReceiver, events_rx: mpsc::UnboundedReceiver, wallet_events: WalletServiceEvents, ) -> Self { @@ -89,25 +95,6 @@ impl WalletWorker { } } - pub fn spawn( - controller: Option>, - chain_config: Arc, - node_rpc: N, - command_rx: CommandReceiver, - events_rx: mpsc::UnboundedReceiver, - wallet_events: WalletServiceEvents, - ) -> JoinHandle<()> { - let worker = Self::new( - controller, - chain_config, - node_rpc, - command_rx, - events_rx, - wallet_events, - ); - tokio::spawn(worker.event_loop()) - } - async fn event_loop(mut self) { loop { tokio::select! { @@ -141,7 +128,10 @@ impl WalletWorker { } } - pub async fn process_command(&mut self, command: Option>) -> ControlFlow<()> { + pub async fn process_command( + &mut self, + command: Option>, + ) -> ControlFlow<()> { match command { Some(WalletCommand::Call(call)) => { call(&mut self.controller).await; @@ -173,6 +163,7 @@ impl WalletWorker { wallet_path: PathBuf, password: Option, force_migrate_wallet_type: bool, + signer_provider: P, ) -> Result<(), ControllerError> { utils::ensure!( self.controller.is_none(), @@ -185,6 +176,7 @@ impl WalletWorker { password, self.node_rpc.is_cold_wallet_node(), force_migrate_wallet_type, + signer_provider, )?; let controller = WalletController::new( @@ -206,6 +198,7 @@ impl WalletWorker { mnemonic: Option, passphrase: Option, skip_syncing: bool, + signer_provider: P, ) -> Result> { utils::ensure!( self.controller.is_none(), @@ -231,6 +224,7 @@ impl WalletWorker { whether_to_store_seed_phrase, (info.best_block_height, info.best_block_id), self.node_rpc.is_cold_wallet_node(), + signer_provider, ) } else { WalletController::recover_wallet( @@ -240,6 +234,7 @@ impl WalletWorker { passphrase_ref, whether_to_store_seed_phrase, self.node_rpc.is_cold_wallet_node(), + signer_provider, ) } .map_err(RpcError::Controller)?; @@ -267,7 +262,7 @@ impl WalletWorker { } async fn background_task( - controller_opt: &mut Option>, + controller_opt: &mut Option>, ) -> Result> { match controller_opt.as_mut() { Some(controller) => controller.run().await, @@ -275,3 +270,29 @@ impl WalletWorker { } } } + +impl WalletWorker +where + N: NodeInterface + Clone + Send + Sync + 'static, + P: SignerProvider + Sync + Send + 'static, +{ + pub fn spawn( + controller: Option>, + chain_config: Arc, + node_rpc: N, + command_rx: CommandReceiver, + events_rx: mpsc::UnboundedReceiver, + wallet_events: WalletServiceEvents, + ) -> JoinHandle<()> { + let worker = WalletWorker::new( + controller, + chain_config, + node_rpc, + command_rx, + events_rx, + wallet_events, + ); + + tokio::spawn(worker.event_loop()) + } +} diff --git a/wallet/wallet-rpc-lib/tests/utils.rs b/wallet/wallet-rpc-lib/tests/utils.rs index 6a8cafe418..b2f90407e7 100644 --- a/wallet/wallet-rpc-lib/tests/utils.rs +++ b/wallet/wallet-rpc-lib/tests/utils.rs @@ -25,6 +25,7 @@ use common::{ }; use rpc::RpcAuthData; use test_utils::{test_dir::TestRoot, test_root}; +use wallet::signer::software_signer::SoftwareSignerProvider; use wallet_controller::NodeRpcClient; use wallet_rpc_lib::{config::WalletServiceConfig, types::AccountArg, WalletHandle, WalletService}; use wallet_test_node::{RPC_PASSWORD, RPC_USERNAME}; @@ -39,7 +40,7 @@ pub const ACCOUNT0_ARG: AccountArg = AccountArg(0); pub const ACCOUNT1_ARG: AccountArg = AccountArg(1); pub struct TestFramework { - pub wallet_service: WalletService, + pub wallet_service: WalletService, pub shutdown_trigger: subsystem::ShutdownTrigger, pub node_manager_task: subsystem::ManagerJoinHandle, pub test_root: TestRoot, @@ -72,6 +73,7 @@ impl TestFramework { wallet_types::seed_phrase::StoreSeedPhrase::DoNotStore, (BlockHeight::new(0), chain_config.genesis_block_id()), WalletType::Hot, + SoftwareSignerProvider::new(), ) .unwrap(); @@ -125,9 +127,15 @@ impl TestFramework { .await .unwrap(); - wallet_rpc_lib::start_services(ws_config, rpc_config, node_rpc, false) - .await - .unwrap() + wallet_rpc_lib::start_services( + ws_config, + rpc_config, + node_rpc, + false, + SoftwareSignerProvider::new(), + ) + .await + .unwrap() }; TestFramework { @@ -155,7 +163,7 @@ impl TestFramework { rpc::new_ws_client(rpc_addr, rpc_auth).await.unwrap() } - pub fn handle(&self) -> WalletHandle { + pub fn handle(&self) -> WalletHandle { self.wallet_service.handle() } From aabfca50aa316a1a93378cf7f379aa6cbff4802a Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 18 Jun 2024 10:56:24 +0200 Subject: [PATCH 02/48] Add optional trezor signer support --- wallet/src/signer/mod.rs | 7 +- wallet/src/signer/software_signer/mod.rs | 2 +- wallet/src/signer/trezor_signer/mod.rs | 422 +++++++++++++++++++++++ wallet/src/signer/trezor_signer/tests.rs | 154 +++++++++ wallet/src/wallet/mod.rs | 178 ++++++---- 5 files changed, 684 insertions(+), 79 deletions(-) create mode 100644 wallet/src/signer/trezor_signer/mod.rs create mode 100644 wallet/src/signer/trezor_signer/tests.rs diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 0ea15bcf96..b0a9d05c8c 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -30,7 +30,8 @@ use wallet_types::signature_status::SignatureStatus; use crate::key_chain::{AccountKeyChains, KeyChainError}; pub mod software_signer; -// pub mod trezor_signer; +#[cfg(feature = "trezor")] +pub mod trezor_signer; /// KeyChain errors #[derive(thiserror::Error, Debug, Eq, PartialEq)] @@ -51,6 +52,8 @@ pub enum SignerError { SignArbitraryMessageError(#[from] SignArbitraryMessageError), #[error("Signed transaction intent error: {0}")] SignedTransactionIntentError(#[from] SignedTransactionIntentError), + #[error("{0}")] + SerializationError(#[from] serialization::Error), } type SignerResult = Result; @@ -83,7 +86,7 @@ pub trait Signer { /// the number of inputs in the transaction; all of the destinations must be known /// to this key chain. fn sign_transaction_intent( - &self, + &mut self, transaction: &Transaction, input_destinations: &[Destination], intent: &str, diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index b45489c72a..953dd9d530 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -369,7 +369,7 @@ impl Signer for SoftwareSigner { } fn sign_transaction_intent( - &self, + &mut self, transaction: &Transaction, input_destinations: &[Destination], intent: &str, diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs new file mode 100644 index 0000000000..f56bf9baed --- /dev/null +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -0,0 +1,422 @@ +// Copyright (c) 2024 RBB S.r.l +// opensource@mintlayer.org +// SPDX-License-Identifier: MIT +// Licensed under the MIT License; +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::{cell::RefCell, collections::BTreeMap, rc::Rc, sync::Arc}; + +use common::{ + address::Address, + chain::{ + output_value::OutputValue, + signature::{ + inputsig::{ + arbitrary_message::ArbitraryMessageSignature, + authorize_pubkey_spend::AuthorizedPublicKeySpend, + standard_signature::StandardInputSignature, InputWitness, + }, + sighash::{sighashtype::SigHashType, signature_hash}, + }, + ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, + TxOutput, + }, + partially_signed_transaction::PartiallySignedTransaction, +}; +use crypto::key::{ + extended::{ExtendedPrivateKey, ExtendedPublicKey}, + hdkd::{derivable::Derivable, u31::U31}, + PrivateKey, Signature, +}; +use itertools::Itertools; +use randomness::make_true_rng; +use serialization::Encode; +use trezor_client::{ + protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, + Trezor, +}; +use wallet_storage::WalletStorageReadUnlocked; +use wallet_types::signature_status::SignatureStatus; + +use crate::key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}; + +use super::{Signer, SignerError, SignerProvider, SignerResult}; + +pub struct TrezorSigner { + chain_config: Arc, + account_index: U31, + client: Rc>, +} + +impl TrezorSigner { + pub fn new( + chain_config: Arc, + account_index: U31, + client: Rc>, + ) -> Self { + Self { + chain_config, + account_index, + client, + } + } + + fn derive_account_private_key( + &self, + db_tx: &impl WalletStorageReadUnlocked, + ) -> SignerResult { + let account_path = make_account_path(&self.chain_config, self.account_index); + + let root_key = MasterKeyChain::load_root_key(db_tx)?.derive_absolute_path(&account_path)?; + Ok(root_key) + } + + fn get_private_key_for_destination( + &self, + destination: &Destination, + key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, + ) -> SignerResult> { + let xpriv = self.derive_account_private_key(db_tx)?; + match key_chain.find_public_key(destination) { + Some(FoundPubKey::Hierarchy(xpub)) => { + get_private_key(&xpriv, &xpub).map(|pk| Some(pk.private_key())) + } + Some(FoundPubKey::Standalone(acc_public_key)) => { + let standalone_pk = db_tx.get_account_standalone_private_key(&acc_public_key)?; + Ok(standalone_pk) + } + None => Ok(None), + } + } + + fn make_signature( + &self, + signature: &Option>, + destination: &Destination, + sighash_type: SigHashType, + key_chain: &impl AccountKeyChains, + ) -> SignerResult<(Option, SignatureStatus)> { + match destination { + Destination::AnyoneCanSpend => Ok(( + Some(InputWitness::NoSignature(None)), + SignatureStatus::FullySigned, + )), + Destination::PublicKey(_) | Destination::PublicKeyHash(_) => { + if let Some(signature) = signature { + let sig = Signature::from_data(signature)?; + let sig = AuthorizedPublicKeySpend::new(sig); + let sig = InputWitness::Standard(StandardInputSignature::new( + sighash_type, + sig.encode(), + )); + + Ok((Some(sig), SignatureStatus::FullySigned)) + } else { + Ok((None, SignatureStatus::NotSigned)) + } + } + Destination::ClassicMultisig(_) => { + if let Some(_challenge) = key_chain.find_multisig_challenge(destination) { + unimplemented!("add support for multisig in Trezor") + } + + Ok((None, SignatureStatus::NotSigned)) + } + Destination::ScriptHash(_) => Ok((None, SignatureStatus::NotSigned)), + } + } + + fn to_trezor_output_msgs( + &self, + ptx: &PartiallySignedTransaction, + ) -> Vec { + let outputs = ptx + .tx() + .outputs() + .iter() + .map(|out| { + match out { + TxOutput::Transfer(value, dest) => { + match value { + OutputValue::Coin(amount) => { + let mut out_req = MintlayerTransferTxOutput::new(); + // TODO: change to u128 in trezor + out_req.set_amount(amount.into_atoms() as u64); + out_req.set_address( + Address::new(&self.chain_config, dest.clone()) + .expect("addressable") + .into_string(), + ); + out_req + } + _ => unimplemented!("support transfer of tokens in trezor"), + } + } + _ => unimplemented!("support other output types in trezor"), + } + }) + .collect(); + outputs + } +} + +impl Signer for TrezorSigner { + fn sign_tx( + &mut self, + ptx: PartiallySignedTransaction, + key_chain: &impl AccountKeyChains, + _db_tx: &impl WalletStorageReadUnlocked, + ) -> SignerResult<( + PartiallySignedTransaction, + Vec, + Vec, + )> { + let inputs = to_trezor_input_msgs(&ptx); + let outputs = self.to_trezor_output_msgs(&ptx); + let utxos = to_trezor_utxo_msgs(&ptx, key_chain); + + let new_signatures = + self.client.borrow_mut().mintlayer_sign_tx(inputs, outputs, utxos).expect(""); + + let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); + + let (witnesses, prev_statuses, new_statuses) = ptx + .witnesses() + .iter() + .enumerate() + .zip(ptx.destinations()) + .map(|((i, witness), destination)| match witness { + Some(w) => match w { + InputWitness::NoSignature(_) => Ok(( + Some(w.clone()), + SignatureStatus::FullySigned, + SignatureStatus::FullySigned, + )), + InputWitness::Standard(sig) => match destination { + Some(destination) => { + let sighash = + signature_hash(sig.sighash_type(), ptx.tx(), &inputs_utxo_refs, i)?; + + if sig + .verify_signature(&self.chain_config, destination, &sighash) + .is_ok() + { + Ok(( + Some(w.clone()), + SignatureStatus::FullySigned, + SignatureStatus::FullySigned, + )) + } else if let Destination::ClassicMultisig(_) = destination { + unimplemented!("add support for multisig to Trezor"); + } else { + Ok(( + None, + SignatureStatus::InvalidSignature, + SignatureStatus::NotSigned, + )) + } + } + None => Ok(( + Some(w.clone()), + SignatureStatus::UnknownSignature, + SignatureStatus::UnknownSignature, + )), + }, + }, + None => match (destination, new_signatures.get(i)) { + (Some(destination), Some(sig)) => { + let sighash_type = + SigHashType::try_from(SigHashType::ALL).expect("Should not fail"); + let (sig, status) = + self.make_signature(sig, destination, sighash_type, key_chain)?; + Ok((sig, SignatureStatus::NotSigned, status)) + } + (Some(_) | None, None) | (None, Some(_)) => { + Ok((None, SignatureStatus::NotSigned, SignatureStatus::NotSigned)) + } + }, + }) + .collect::, SignerError>>()? + .into_iter() + .multiunzip(); + + Ok((ptx.new_witnesses(witnesses), prev_statuses, new_statuses)) + } + + fn sign_challenge( + &mut self, + message: Vec, + destination: Destination, + key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, + ) -> SignerResult { + let private_key = self + .get_private_key_for_destination(&destination, key_chain, db_tx)? + .ok_or(SignerError::DestinationNotFromThisWallet)?; + + let sig = ArbitraryMessageSignature::produce_uniparty_signature( + &private_key, + &destination, + &message, + make_true_rng(), + )?; + + Ok(sig) + } + + fn sign_transaction_intent( + &mut self, + transaction: &Transaction, + input_destinations: &[Destination], + intent: &str, + key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, + ) -> SignerResult { + unimplemented!("FIXME") + } +} + +fn to_trezor_input_msgs(ptx: &PartiallySignedTransaction) -> Vec { + let inputs = ptx + .tx() + .inputs() + .iter() + .zip(ptx.input_utxos()) + .map(|(inp, utxo)| match (inp, utxo) { + (TxInput::Utxo(outpoint), Some(TxOutput::Transfer(value, _))) => { + let mut inp_req = MintlayerUtxoTxInput::new(); + let id = match outpoint.source_id() { + OutPointSourceId::Transaction(id) => id.to_hash().0, + OutPointSourceId::BlockReward(id) => id.to_hash().0, + }; + inp_req.set_prev_hash(id.to_vec()); + inp_req.set_prev_index(outpoint.output_index()); + match value { + OutputValue::Coin(amount) => { + // TODO: + inp_req.set_amount(amount.into_atoms() as u64); + } + OutputValue::TokenV1(_, _) | OutputValue::TokenV0(_) => { + unimplemented!("support for tokens") + } + } + + inp_req + } + (TxInput::Utxo(_) | TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => { + unimplemented!("accounting not supported yet with trezor") + } + }) + .collect(); + inputs +} + +fn to_trezor_utxo_msgs( + ptx: &PartiallySignedTransaction, + key_chain: &impl AccountKeyChains, +) -> BTreeMap<[u8; 32], BTreeMap> { + let utxos = ptx + .input_utxos() + .iter() + .zip(ptx.tx().inputs()) + .filter_map(|(utxo, inp)| utxo.as_ref().map(|utxo| (utxo, inp))) + .fold( + BTreeMap::new(), + |mut map: BTreeMap<[u8; 32], BTreeMap>, (utxo, inp)| { + match (inp, utxo) { + (TxInput::Utxo(outpoint), TxOutput::Transfer(value, dest)) => { + let mut out_req = MintlayerTransferTxOutput::new(); + match value { + OutputValue::Coin(amount) => { + // TODO: change to u128 in trezor + out_req.set_amount(amount.into_atoms() as u64); + } + OutputValue::TokenV0(_) | OutputValue::TokenV1(_, _) => { + unimplemented!("support tokens in trezor") + } + }; + + out_req.address_n = match key_chain.find_public_key(dest) { + Some(FoundPubKey::Hierarchy(xpub)) => xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(), + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") + } + None => unimplemented!("external keys with trezor"), + }; + + let id = match outpoint.source_id() { + OutPointSourceId::Transaction(id) => id.to_hash().0, + OutPointSourceId::BlockReward(id) => id.to_hash().0, + }; + + map.entry(id).or_default().insert(outpoint.output_index(), out_req); + } + (TxInput::Utxo(_), _) => unimplemented!("support other utxo types"), + (TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => { + panic!("can't have accounts as UTXOs") + } + } + map + }, + ); + utxos +} + +/// Get the private key that corresponds to the provided public key +fn get_private_key( + parent_key: &ExtendedPrivateKey, + requested_key: &ExtendedPublicKey, +) -> SignerResult { + let derived_key = + parent_key.clone().derive_absolute_path(requested_key.get_derivation_path())?; + if &derived_key.to_public_key() == requested_key { + Ok(derived_key) + } else { + Err(SignerError::KeysNotInSameHierarchy) + } +} + +#[derive(Clone)] +pub struct TrezorSignerProvider { + client: Rc>, +} + +impl std::fmt::Debug for TrezorSignerProvider { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TrezorSignerProvider") + } +} + +impl TrezorSignerProvider { + pub fn new(client: Trezor) -> Self { + Self { + client: Rc::new(RefCell::new(client)), + } + } +} + +impl SignerProvider for TrezorSignerProvider { + type S = TrezorSigner; + + fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S { + TrezorSigner::new(chain_config, account_index, self.client.clone()) + } +} + +#[cfg(test)] +mod tests; diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs new file mode 100644 index 0000000000..2769a23b17 --- /dev/null +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -0,0 +1,154 @@ +// Copyright (c) 2024 RBB S.r.l +// opensource@mintlayer.org +// SPDX-License-Identifier: MIT +// Licensed under the MIT License; +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::ops::{Add, Div, Mul, Sub}; +use std::{cell::RefCell, rc::Rc}; + +use super::*; +use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; +use crate::{Account, SendRequest}; +use common::chain::config::create_regtest; +use common::chain::output_value::OutputValue; +use common::chain::signature::verify_signature; +use common::chain::{GenBlock, Transaction, TxInput}; +use common::primitives::amount::UnsignedIntType; +use common::primitives::{Amount, Id, H256}; +use crypto::key::KeyKind; +use randomness::{Rng, RngCore}; +use rstest::rstest; +use test_utils::random::{make_seedable_rng, Seed}; +use trezor_client::find_devices; +use wallet_storage::{DefaultBackend, Store, Transactional}; +use wallet_types::account_info::DEFAULT_ACCOUNT_INDEX; +use wallet_types::seed_phrase::StoreSeedPhrase; +use wallet_types::KeyPurpose::{Change, ReceiveFunds}; + +const MNEMONIC: &str = + "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"; + +#[rstest] +#[trace] +#[case(Seed::from_entropy())] +fn sign_transaction(#[case] seed: Seed) { + let mut rng = make_seedable_rng(seed); + + let config = Arc::new(create_regtest()); + let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); + let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); + + let master_key_chain = MasterKeyChain::new_from_mnemonic( + config.clone(), + &mut db_tx, + MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + ) + .unwrap(); + + let key_chain = master_key_chain + .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) + .unwrap(); + let mut account = Account::new(config.clone(), &mut db_tx, key_chain, None).unwrap(); + + let amounts: Vec = (0..(2 + rng.next_u32() % 5)) + .map(|_| Amount::from_atoms(rng.next_u32() as UnsignedIntType)) + .collect(); + + let total_amount = amounts.iter().fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); + + let utxos: Vec = amounts + .iter() + .map(|a| { + let purpose = if rng.gen_bool(0.5) { + ReceiveFunds + } else { + Change + }; + + TxOutput::Transfer( + OutputValue::Coin(*a), + account.get_new_address(&mut db_tx, purpose).unwrap().1.into_object(), + ) + }) + .collect(); + + let inputs: Vec = utxos + .iter() + .map(|_txo| { + let source_id = if rng.gen_bool(0.5) { + Id::::new(H256::random_using(&mut rng)).into() + } else { + Id::::new(H256::random_using(&mut rng)).into() + }; + TxInput::from_utxo(source_id, rng.next_u32()) + }) + .collect(); + + let dest_amount = total_amount.div(10).unwrap().mul(5).unwrap(); + let lock_amount = total_amount.div(10).unwrap().mul(1).unwrap(); + let burn_amount = total_amount.div(10).unwrap().mul(1).unwrap(); + let change_amount = total_amount.div(10).unwrap().mul(2).unwrap(); + let outputs_amounts_sum = [dest_amount, lock_amount, burn_amount, change_amount] + .iter() + .fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); + let _fee_amount = total_amount.sub(outputs_amounts_sum).unwrap(); + + let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); + + let outputs = vec![ + TxOutput::Transfer( + OutputValue::Coin(dest_amount), + Destination::PublicKey(dest_pub), + ), + // TxOutput::LockThenTransfer( + // OutputValue::Coin(lock_amount), + // Destination::AnyoneCanSpend, + // OutputTimeLock::ForSeconds(rng.next_u64()), + // ), + // TxOutput::Burn(OutputValue::Coin(burn_amount)), + TxOutput::Transfer( + OutputValue::Coin(Amount::from_atoms(100)), + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), + ), + ]; + + let tx = Transaction::new(0, inputs, outputs).unwrap(); + + let req = SendRequest::from_transaction(tx, utxos.clone(), &|_| None).unwrap(); + let ptx = req.into_partially_signed_tx().unwrap(); + + let mut devices = find_devices(false); + assert!(!devices.is_empty()); + let client = devices.pop().unwrap().connect().unwrap(); + + let mut signer = TrezorSigner::new( + config.clone(), + DEFAULT_ACCOUNT_INDEX, + Rc::new(RefCell::new(client)), + ); + let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); + + assert!(ptx.is_fully_signed(&config)); + + let sig_tx = ptx.into_signed_tx(&config).unwrap(); + + let utxos_ref = utxos.iter().map(Some).collect::>(); + + for i in 0..sig_tx.inputs().len() { + let destination = + crate::get_tx_output_destination(utxos_ref[i].unwrap(), &|_| None).unwrap(); + verify_signature(&config, &destination, &sig_tx, &utxos_ref, i).unwrap(); + } +} diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index ad7e64babb..de1dee673d 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -30,7 +30,6 @@ use crate::key_chain::{ use crate::send_request::{ make_issue_token_outputs, IssueNftArguments, SelectedInputs, StakePoolDataArguments, }; -use crate::signer::software_signer::SoftwareSigner; use crate::signer::{Signer, SignerError, SignerProvider}; use crate::wallet_events::{WalletEvents, WalletEventsNoOp}; use crate::{Account, SendRequest}; @@ -969,11 +968,16 @@ where fn for_account_rw_unlocked( &mut self, account_index: U31, - f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked, &ChainConfig) -> WalletResult, + f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked, &ChainConfig, &mut P) -> WalletResult, ) -> WalletResult { let mut db_tx = self.db.transaction_rw_unlocked(None)?; let account = Self::get_account_mut(&mut self.accounts, account_index)?; - match f(account, &mut db_tx, &self.chain_config) { + match f( + account, + &mut db_tx, + &self.chain_config, + &mut self.signer_provider, + ) { Ok(value) => { // Abort the process if the DB transaction fails. See `for_account_rw` for more information. db_tx.commit().expect("RW transaction commit failed unexpectedly"); @@ -998,44 +1002,50 @@ where ) -> WalletResult<(SignedTransaction, AddlData)> { let (_, block_height) = self.get_best_block_for_account(account_index)?; - self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { - let (request, additional_data) = f(account, db_tx)?; - - let ptx = request.into_partially_signed_tx()?; - - let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); - let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; - - let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); - let is_fully_signed = ptx.destinations().iter().enumerate().zip(ptx.witnesses()).all( - |((i, destination), witness)| match (witness, destination) { - (None | Some(_), None) | (None, Some(_)) => false, - (Some(_), Some(destination)) => { - tx_verifier::input_check::signature_only_check::verify_tx_signature( - chain_config, - destination, - &ptx, - &inputs_utxo_refs, - i, - ) - .is_ok() - } - }, - ); - - if !is_fully_signed { - return Err(error_mapper(WalletError::FailedToConvertPartiallySignedTx( - ptx, - ))); - } + self.for_account_rw_unlocked( + account_index, + |account, db_tx, chain_config, signer_provider| { + let (request, additional_data) = f(account, db_tx)?; + + let ptx = request.into_partially_signed_tx()?; + + let mut signer = + signer_provider.provide(Arc::new(chain_config.clone()), account_index); + let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; + + let inputs_utxo_refs: Vec<_> = + ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); + let is_fully_signed = + ptx.destinations().iter().enumerate().zip(ptx.witnesses()).all( + |((i, destination), witness)| match (witness, destination) { + (None | Some(_), None) | (None, Some(_)) => false, + (Some(_), Some(destination)) => { + tx_verifier::input_check::signature_only_check::verify_tx_signature( + chain_config, + destination, + &ptx, + &inputs_utxo_refs, + i, + ) + .is_ok() + } + }, + ); + + if !is_fully_signed { + return Err(error_mapper(WalletError::FailedToConvertPartiallySignedTx( + ptx, + ))); + } - let tx = ptx - .into_signed_tx() - .map_err(|e| error_mapper(WalletError::TransactionCreation(e)))?; + let tx = ptx + .into_signed_tx() + .map_err(|e| error_mapper(WalletError::TransactionCreation(e)))?; - check_transaction(chain_config, block_height.next_height(), &tx)?; - Ok((tx, additional_data)) - }) + check_transaction(chain_config, block_height.next_height(), &tx)?; + Ok((tx, additional_data)) + }, + ) } fn for_account_rw_unlocked_and_check_tx( @@ -1227,7 +1237,7 @@ where private_key: PrivateKey, label: Option, ) -> WalletResult<()> { - self.for_account_rw_unlocked(account_index, |account, db_tx, _| { + self.for_account_rw_unlocked(account_index, |account, db_tx, _, _| { account.add_standalone_private_key(db_tx, private_key, label) }) } @@ -1417,9 +1427,11 @@ where |send_request| send_request.destinations().to_owned(), )?; - let signed_intent = - self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { - let signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); + let signed_intent = self.for_account_rw_unlocked( + account_index, + |account, db_tx, chain_config, signer_provider| { + let mut signer = + signer_provider.provide(Arc::new(chain_config.clone()), account_index); Ok(signer.sign_transaction_intent( signed_tx.transaction(), @@ -1428,7 +1440,8 @@ where account.key_chain(), db_tx, )?) - })?; + }, + )?; Ok((signed_tx, signed_intent)) } @@ -1856,25 +1869,29 @@ where output_address: Option, current_fee_rate: FeeRate, ) -> WalletResult { - self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { - let request = account.decommission_stake_pool_request( - db_tx, - pool_id, - pool_balance, - output_address, - current_fee_rate, - )?; + self.for_account_rw_unlocked( + account_index, + |account, db_tx, chain_config, signer_provider| { + let request = account.decommission_stake_pool_request( + db_tx, + pool_id, + pool_balance, + output_address, + current_fee_rate, + )?; - let ptx = request.into_partially_signed_tx()?; + let ptx = request.into_partially_signed_tx()?; - let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); - let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; + let mut signer = + signer_provider.provide(Arc::new(chain_config.clone()), account_index); + let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; - if ptx.all_signatures_available() { - return Err(WalletError::FullySignedTransactionInDecommissionReq); - } - Ok(ptx) - }) + if ptx.all_signatures_available() { + return Err(WalletError::FullySignedTransactionInDecommissionReq); + } + Ok(ptx) + }, + ) } pub fn create_htlc_tx( @@ -1991,18 +2008,22 @@ where Vec, )> { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { - let ptx = match tx { - TransactionToSign::Partial(ptx) => ptx, - TransactionToSign::Tx(tx) => { - account.tx_to_partially_signed_tx(tx, latest_median_time)? - } - }; - let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); + self.for_account_rw_unlocked( + account_index, + |account, db_tx, chain_config, signer_provider| { + let ptx = match tx { + TransactionToSign::Partial(ptx) => ptx, + TransactionToSign::Tx(tx) => { + account.tx_to_partially_signed_tx(tx, latest_median_time)? + } + }; + let mut signer = + signer_provider.provide(Arc::new(chain_config.clone()), account_index); - let res = signer.sign_tx(ptx, account.key_chain(), db_tx)?; - Ok(res) - }) + let res = signer.sign_tx(ptx, account.key_chain(), db_tx)?; + Ok(res) + }, + ) } pub fn sign_challenge( @@ -2011,11 +2032,16 @@ where challenge: &[u8], destination: &Destination, ) -> WalletResult { - self.for_account_rw_unlocked(account_index, |account, db_tx, chain_config| { - let mut signer = SoftwareSigner::new(Arc::new(chain_config.clone()), account_index); - let msg = signer.sign_challenge(challenge, destination, account.key_chain(), db_tx)?; - Ok(msg) - }) + self.for_account_rw_unlocked( + account_index, + |account, db_tx, chain_config, signer_provider| { + let mut signer = + signer_provider.provide(Arc::new(chain_config.clone()), account_index); + let msg = + signer.sign_challenge(challenge, destination, account.key_chain(), db_tx)?; + Ok(msg) + }, + ) } pub fn get_pos_gen_block_data( From a5639998fa94959a22958c9e422889c6905d3905 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Thu, 20 Jun 2024 05:58:09 +0200 Subject: [PATCH 03/48] add trezor-client generated code --- Cargo.lock | 1182 ++++++++++++++++++++++++++-------------------------- 1 file changed, 587 insertions(+), 595 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 738cff4b53..be9fe76492 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.29" +version = "0.2.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3672c180e71eeaaac3a541fbbc5f5ad4def8b747c595ad30d674e43049f7b0" +checksum = "79faae4620f45232f599d9bc7b290f88247a0834162c4495ab2f02d60004adfb" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -43,13 +43,19 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.24.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "adler2" version = "2.0.0" @@ -132,9 +138,9 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" [[package]] name = "allocator-api2" -version = "0.2.21" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android-activity" @@ -186,9 +192,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -201,43 +207,43 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "api-blockchain-scanner-daemon" @@ -412,9 +418,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.9" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arraytools" @@ -502,9 +508,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.4.0" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" +checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" dependencies = [ "async-lock", "cfg-if", @@ -532,9 +538,9 @@ dependencies = [ [[package]] name = "async-process" -version = "2.3.0" +version = "2.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" +checksum = "a8a07789659a4d385b79b18b9127fc27e1a59e1e89117c78c5ea3b806f016374" dependencies = [ "async-channel", "async-io", @@ -547,6 +553,7 @@ dependencies = [ "futures-lite", "rustix", "tracing", + "windows-sys 0.59.0", ] [[package]] @@ -557,7 +564,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -586,13 +593,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -603,24 +610,24 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.4.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" -version = "0.7.9" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core", "bytes", "futures-util", - "http 1.2.0", + "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.4.1", "hyper-util", "itoa", "matchit", @@ -633,9 +640,9 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper 1.0.1", "tokio", - "tower 0.5.1", + "tower", "tower-layer", "tower-service", "tracing", @@ -643,20 +650,20 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.2.0", + "http 1.1.0", "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.2", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", "tracing", @@ -664,17 +671,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.74" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", + "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", - "windows-targets 0.52.6", ] [[package]] @@ -703,9 +710,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bb8" -version = "0.8.6" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89aabfae550a5c44b43ab941844ffcd2e993cb6900b342debf59e9ea74acdb8" +checksum = "b10cf871f3ff2ce56432fddc2615ac7acc3aa22ca321f8fea800846fbb32f188" dependencies = [ "async-trait", "futures-util", @@ -757,9 +764,9 @@ dependencies = [ [[package]] name = "bip39" -version = "2.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33415e24172c1b7d6066f6d999545375ab8e1d95421d6784bdfff9496f292387" +checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes", "serde", @@ -791,21 +798,11 @@ dependencies = [ "bech32 0.9.1", ] -[[package]] -name = "bitcoin-internals" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" - [[package]] name = "bitcoin_hashes" -version = "0.13.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" -dependencies = [ - "bitcoin-internals", - "hex-conservative", -] +checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" [[package]] name = "bitflags" @@ -949,9 +946,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.3" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" dependencies = [ "borsh-derive", "cfg_aliases 0.2.1", @@ -959,25 +956,26 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.3" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", + "syn_derive", ] [[package]] name = "bstr" -version = "1.11.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.7", "serde", ] @@ -1001,9 +999,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-unit" -version = "5.1.6" +version = "5.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cd29c3c585209b0cbc7309bfe3ed7efd8c84c21b7af29c8bfae908f8777174" +checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" dependencies = [ "rust_decimal", "serde", @@ -1034,22 +1032,22 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.20.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.8.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" +checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -1060,9 +1058,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.9.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "calloop" @@ -1124,9 +1122,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.3" +version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" dependencies = [ "jobserver", "libc", @@ -1350,9 +1348,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1403,9 +1401,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -1413,9 +1411,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -1425,21 +1423,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "clipboard-win" @@ -1452,13 +1450,13 @@ dependencies = [ [[package]] name = "clipboard_macos" -version = "0.1.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7f4aaa047ba3c3630b080bb9860894732ff23e2aee290a418909aa6d5df38f" +checksum = "145a7f9e9b89453bc0a5e32d166456405d389cea5b578f57f1274b1397588a95" dependencies = [ - "objc2 0.5.2", - "objc2-app-kit", - "objc2-foundation", + "objc", + "objc-foundation", + "objc_id", ] [[package]] @@ -1492,9 +1490,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "com" @@ -1649,16 +1647,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-foundation" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1672,21 +1660,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.4", - "core-graphics-types 0.1.3", - "foreign-types 0.5.0", - "libc", -] - -[[package]] -name = "core-graphics" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" -dependencies = [ - "bitflags 2.6.0", - "core-foundation 0.10.0", - "core-graphics-types 0.2.0", + "core-foundation", + "core-graphics-types", "foreign-types 0.5.0", "libc", ] @@ -1698,18 +1673,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" -dependencies = [ - "bitflags 2.6.0", - "core-foundation 0.10.0", + "core-foundation", "libc", ] @@ -1736,9 +1700,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.16" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -1869,7 +1833,7 @@ checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ "bitflags 2.6.0", "crossterm_winapi", - "mio 1.0.3", + "mio 1.0.2", "parking_lot 0.12.3", "rustix", "signal-hook", @@ -1939,9 +1903,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.3.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ "csv-core", "itoa", @@ -1960,12 +1924,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.9" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2013,7 +1977,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2023,7 +1987,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" dependencies = [ "bitflags 2.6.0", - "libloading 0.8.6", + "libloading 0.8.5", "winapi", ] @@ -2048,7 +2012,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2059,7 +2023,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2096,7 +2060,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "unicode-xid", ] @@ -2182,7 +2146,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2197,7 +2161,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.6", + "libloading 0.8.5", ] [[package]] @@ -2310,9 +2274,9 @@ checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "encoding_rs" -version = "0.8.35" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -2331,14 +2295,14 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "enum-as-inner" -version = "0.6.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2358,7 +2322,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2379,7 +2343,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2390,19 +2354,19 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.10" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] name = "error-code" -version = "3.3.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" +checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" [[package]] name = "escape8259" @@ -2422,9 +2386,9 @@ dependencies = [ [[package]] name = "euclid" -version = "0.22.11" +version = "0.22.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48" +checksum = "e0f0eb73b934648cd7a4a61f1b15391cd95dab0b4da6e2e66c2a072c144b4a20" dependencies = [ "num-traits", ] @@ -2442,9 +2406,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" dependencies = [ "event-listener", "pin-project-lite", @@ -2486,9 +2450,9 @@ checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1" [[package]] name = "fastrand" -version = "2.3.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fd-lock" @@ -2503,9 +2467,9 @@ dependencies = [ [[package]] name = "fdeflate" -version = "0.3.7" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" dependencies = [ "simd-adler32", ] @@ -2550,12 +2514,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.35" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" +checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -2570,17 +2534,11 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foldhash" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" - [[package]] name = "font-types" -version = "0.7.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3971f9a5ca983419cdc386941ba3b9e1feba01a0ab888adf78739feb2798492" +checksum = "8f0189ccb084f77c5523e08288d418cbaa09c451a08515678a0aa265df9a8b60" dependencies = [ "bytemuck", ] @@ -2635,7 +2593,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -2693,9 +2651,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -2708,9 +2666,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -2718,15 +2676,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -2736,15 +2694,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" -version = "2.5.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ "fastrand", "futures-core", @@ -2755,26 +2713,26 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" @@ -2784,9 +2742,9 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -2802,9 +2760,9 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" +checksum = "979f00864edc7516466d6b3157706e06c032f22715700ddd878228a91d02bc56" dependencies = [ "cfg-if", "libc", @@ -2879,9 +2837,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "gl_generator" @@ -3026,7 +2984,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.7.0", + "indexmap 2.4.0", "slab", "tokio", "tokio-util", @@ -3062,17 +3020,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hashbrown" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] - [[package]] name = "hashlink" version = "0.9.1" @@ -3091,7 +3038,7 @@ dependencies = [ "bitflags 2.6.0", "com", "libc", - "libloading 0.8.6", + "libloading 0.8.5", "thiserror", "widestring", "winapi", @@ -3127,12 +3074,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-conservative" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" - [[package]] name = "hex-literal" version = "0.4.1" @@ -3147,9 +3088,9 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" [[package]] name = "hickory-client" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab9683b08d8f8957a857b0236455d80e1886eaa8c6178af556aa7871fb61b55" +checksum = "949d2fef0bbdd31a0f6affc6bf390b4a0017492903eff6f7516cb382d9e85536" dependencies = [ "cfg-if", "data-encoding", @@ -3166,9 +3107,9 @@ dependencies = [ [[package]] name = "hickory-proto" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" +checksum = "447afdcdb8afb9d0a852af6dc65d9b285ce720ed7a59e42a8bf2e931c67bc1b5" dependencies = [ "async-trait", "cfg-if", @@ -3177,7 +3118,7 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 0.4.0", + "idna 1.0.3", "ipnet", "once_cell", "rand 0.8.5", @@ -3190,9 +3131,9 @@ dependencies = [ [[package]] name = "hickory-server" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be0e43c556b9b3fdb6c7c71a9a32153a2275d02419e3de809e520bfcfe40c37" +checksum = "35e6d1c2df0614595224b32479c72dd6fc82c9bda85962907c45fdb95a691489" dependencies = [ "async-trait", "bytes", @@ -3230,9 +3171,9 @@ dependencies = [ [[package]] name = "http" -version = "1.2.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -3257,7 +3198,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.2.0", + "http 1.1.0", ] [[package]] @@ -3268,7 +3209,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.2.0", + "http 1.1.0", "http-body 1.0.1", "pin-project-lite", ] @@ -3281,9 +3222,9 @@ checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" -version = "1.9.5" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -3299,9 +3240,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.31" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -3323,14 +3264,14 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.2.0", + "http 1.1.0", "http-body 1.0.1", "httparse", "httpdate", @@ -3348,7 +3289,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.30", "log", "rustls 0.21.12", "rustls-native-certs 0.6.3", @@ -3363,7 +3304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.31", + "hyper 0.14.30", "native-tls", "tokio", "tokio-native-tls", @@ -3371,25 +3312,24 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.10" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ "bytes", "futures-util", - "http 1.2.0", + "http 1.1.0", "http-body 1.0.1", - "hyper 1.5.1", + "hyper 1.4.1", "pin-project-lite", "tokio", - "tower-service", ] [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3722,7 +3662,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -3733,9 +3673,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -3764,13 +3704,13 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.3" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 1.0.109", ] [[package]] @@ -3786,12 +3726,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.7.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.14.5", "serde", ] @@ -3821,9 +3761,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" @@ -3871,9 +3811,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jni" @@ -3908,11 +3848,10 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ - "once_cell", "wasm-bindgen", ] @@ -3942,7 +3881,7 @@ dependencies = [ "http 0.2.12", "jsonrpsee-core", "pin-project", - "rustls-native-certs 0.7.3", + "rustls-native-certs 0.7.2", "rustls-pki-types", "soketto", "thiserror", @@ -3964,7 +3903,7 @@ dependencies = [ "beef", "futures-timer", "futures-util", - "hyper 0.14.31", + "hyper 0.14.30", "jsonrpsee-types", "parking_lot 0.12.3", "pin-project", @@ -3985,7 +3924,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ccf93fc4a0bfe05d851d37d7c32b7f370fe94336b52a2f0efc5f1981895c2e5" dependencies = [ "async-trait", - "hyper 0.14.31", + "hyper 0.14.30", "hyper-rustls", "jsonrpsee-core", "jsonrpsee-types", @@ -3993,7 +3932,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tower 0.4.13", + "tower", "tracing", "url", ] @@ -4008,7 +3947,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -4019,7 +3958,7 @@ checksum = "12d8b6a9674422a8572e0b0abb12feeb3f2aeda86528c80d0350c2bd0923ab41" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.30", "jsonrpsee-core", "jsonrpsee-types", "pin-project", @@ -4031,7 +3970,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "tower 0.4.13", + "tower", "tracing", ] @@ -4077,7 +4016,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading 0.8.6", + "libloading 0.8.5", "pkg-config", ] @@ -4105,9 +4044,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" @@ -4121,9 +4060,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.6" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -4131,9 +4070,20 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.11" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" +dependencies = [ + "bitflags 2.6.0", + "libc", + "redox_syscall 0.4.1", +] [[package]] name = "libredox" @@ -4143,7 +4093,6 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", - "redox_syscall 0.5.7", ] [[package]] @@ -4234,7 +4183,7 @@ dependencies = [ "logging", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "tracing", "utils", ] @@ -4265,11 +4214,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ - "hashbrown 0.15.2", + "hashbrown 0.14.5", ] [[package]] @@ -4284,9 +4233,9 @@ dependencies = [ [[package]] name = "lyon_algorithms" -version = "1.0.5" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13c9be19d257c7d37e70608ed858e8eab4b2afcea2e3c9a622e892acbf43c08" +checksum = "a3bca95f9a4955b3e4a821fbbcd5edfbd9be2a9a50bb5758173e5358bfb4c623" dependencies = [ "lyon_path", "num-traits", @@ -4294,9 +4243,9 @@ dependencies = [ [[package]] name = "lyon_geom" -version = "1.0.6" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8af69edc087272df438b3ee436c4bb6d7c04aa8af665cfd398feae627dbd8570" +checksum = "edecfb8d234a2b0be031ab02ebcdd9f3b9ee418fb35e265f7a540a48d197bff9" dependencies = [ "arrayvec", "euclid", @@ -4305,9 +4254,9 @@ dependencies = [ [[package]] name = "lyon_path" -version = "1.0.6" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e0b8aec2f58586f6eef237985b9a9b7cb3a3aff4417c575075cf95bf925252e" +checksum = "9c08a606c7a59638d6c6aa18ac91a06aa9fb5f765a7efb27e6a4da58700740d7" dependencies = [ "lyon_geom", "num-traits", @@ -4375,9 +4324,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] @@ -4474,7 +4423,7 @@ checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" dependencies = [ "bitflags 2.6.0", "block", - "core-graphics-types 0.1.3", + "core-graphics-types", "foreign-types 0.5.0", "log", "objc", @@ -4487,6 +4436,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", + "simd-adler32", +] + [[package]] name = "miniz_oxide" version = "0.8.0" @@ -4494,7 +4453,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ "adler2", - "simd-adler32", ] [[package]] @@ -4566,10 +4524,11 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", @@ -4599,7 +4558,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -4632,7 +4591,7 @@ dependencies = [ "bitflags 2.6.0", "codespan-reporting", "hexf-parse", - "indexmap 2.7.0", + "indexmap 2.4.0", "log", "num-traits", "rustc-hash", @@ -4758,7 +4717,7 @@ dependencies = [ "subsystem", "thiserror", "tokio", - "tower 0.4.13", + "tower", "utils-networking", "wallet-types", ] @@ -4936,7 +4895,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -5008,7 +4967,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -5127,6 +5086,7 @@ checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ "bitflags 2.6.0", "block2 0.5.1", + "dispatch", "libc", "objc2 0.5.2", ] @@ -5176,18 +5136,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.5" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oneshot" @@ -5209,9 +5169,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.68" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -5230,7 +5190,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -5241,9 +5201,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.104" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -5259,11 +5219,11 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "orbclient" -version = "0.3.48" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba0b26cec2e24f08ed8bb31519a9333140a6599b867dac464bb150bdb796fd43" +checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" dependencies = [ - "libredox", + "libredox 0.0.2", ] [[package]] @@ -5317,7 +5277,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -5328,11 +5288,11 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "owned_ttf_parser" -version = "0.25.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec719bbf3b2a81c109a4e20b1f129b5566b7dce654bc3872f6a05abf82b2c4" +checksum = "490d3a563d3122bf7c911a59b0add9389e5ec0f5f0c3ac6b91ff235a0e6a7f90" dependencies = [ - "ttf-parser 0.25.1", + "ttf-parser 0.24.1", ] [[package]] @@ -5458,7 +5418,7 @@ dependencies = [ "by_address", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -5489,9 +5449,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.2.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -5536,7 +5496,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.7", + "redox_syscall 0.5.3", "smallvec", "windows-targets 0.52.6", ] @@ -5594,7 +5554,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -5608,29 +5568,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -5651,15 +5611,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plotters" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" dependencies = [ "num-traits", "plotters-backend", @@ -5670,37 +5630,37 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" [[package]] name = "plotters-svg" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" dependencies = [ "plotters-backend", ] [[package]] name = "png" -version = "0.17.15" +version = "0.17.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67582bd5b65bdff614270e2ea89a1cf15bef71245cc1e5f7ea126977144211d" +checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" dependencies = [ "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide", + "miniz_oxide 0.7.4", ] [[package]] name = "polling" -version = "3.7.4" +version = "3.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" +checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" dependencies = [ "cfg-if", "concurrent-queue", @@ -5778,9 +5738,9 @@ dependencies = [ [[package]] name = "postgres-types" -version = "0.2.8" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f66ea23a2d0e5734297357705193335e0a957696f34bed2f2faefacb2fec336f" +checksum = "02048d9e032fb3cc3413bbf7b83a15d84a5d419778e2628751896d856498eee9" dependencies = [ "bytes", "fallible-iterator 0.2.0", @@ -5871,11 +5831,34 @@ dependencies = [ "toml_edit", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -5888,16 +5871,16 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "version_check", "yansi", ] [[package]] name = "profiling" -version = "1.0.16" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" +checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" [[package]] name = "proptest" @@ -5913,7 +5896,7 @@ dependencies = [ "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift 0.3.0", - "regex-syntax 0.8.5", + "regex-syntax 0.8.4", "rusty-fork", "tempfile", "unarray", @@ -5921,9 +5904,9 @@ dependencies = [ [[package]] name = "psl" -version = "2.1.67" +version = "2.1.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b12d418db33ae2247c46f2685d2b1530b315de16b253da8fc964eeeb8eb8371" +checksum = "ce9398ad066421139b2e3afe16ea46772ffda30bd9ba57554dc035df5e26edc8" dependencies = [ "psl-types", ] @@ -5968,9 +5951,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-xml" -version = "0.36.2" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" +checksum = "6f24d770aeca0eacb81ac29dfbc55ebcc09312fdd1f8bbecdc7e4a84e000e3b4" dependencies = [ "memchr", ] @@ -6136,9 +6119,9 @@ dependencies = [ [[package]] name = "read-fonts" -version = "0.22.5" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a04b892cb6f91951f144c33321843790c8574c825aafdb16d815fd7183b5229" +checksum = "8c141b9980e1150201b2a3a32879001c8f975fe313ec3df5471a9b5c79a880cd" dependencies = [ "bytemuck", "font-types", @@ -6164,9 +6147,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ "bitflags 2.6.0", ] @@ -6178,7 +6170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", - "libredox", + "libredox 0.1.3", "thiserror", ] @@ -6220,19 +6212,19 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -6246,13 +6238,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax 0.8.4", ] [[package]] @@ -6263,9 +6255,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "relative-path" @@ -6308,7 +6300,7 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.30", "hyper-tls", "ipnet", "js-sys", @@ -6412,9 +6404,9 @@ dependencies = [ [[package]] name = "rlimit" -version = "0.10.2" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7043b63bd0cd1aaa628e476b80e6d4023a3b50eb32789f2728908107bd0c793a" +checksum = "3560f70f30a0f16d11d01ed078a07740fe6b489667abc7c7b029155d9f21c3d8" dependencies = [ "libc", ] @@ -6441,7 +6433,7 @@ dependencies = [ "crypto", "expect-test", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.30", "jsonrpsee", "logging", "randomness", @@ -6455,7 +6447,7 @@ dependencies = [ "test-utils", "thiserror", "tokio", - "tower 0.4.13", + "tower", "tower-http 0.4.4", "utils", "utils-networking", @@ -6475,7 +6467,7 @@ version = "1.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -6517,7 +6509,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.90", + "syn 2.0.87", "unicode-ident", ] @@ -6580,15 +6572,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.42" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys 0.4.14", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -6612,7 +6604,7 @@ dependencies = [ "log", "ring", "rustls-pki-types", - "rustls-webpki 0.102.8", + "rustls-webpki 0.102.6", "subtle", "zeroize", ] @@ -6631,12 +6623,12 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" dependencies = [ "openssl-probe", - "rustls-pemfile 2.2.0", + "rustls-pemfile 2.1.3", "rustls-pki-types", "schannel", "security-framework", @@ -6653,18 +6645,19 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.2.0" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ + "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" @@ -6678,9 +6671,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.8" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring", "rustls-pki-types", @@ -6689,9 +6682,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -6739,20 +6732,20 @@ dependencies = [ [[package]] name = "scc" -version = "2.2.5" +version = "2.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" +checksum = "aeb7ac86243095b70a7920639507b71d51a63390d1ba26c4f60a552fbb914a37" dependencies = [ "sdd", ] [[package]] name = "schannel" -version = "0.1.27" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -6823,16 +6816,16 @@ checksum = "70b31447ca297092c5a9916fc3b955203157b37c19ca8edde4f52e9843e602c7" dependencies = [ "ab_glyph", "log", - "memmap2 0.9.5", + "memmap2 0.9.4", "smithay-client-toolkit 0.18.1", "tiny-skia", ] [[package]] name = "sdd" -version = "3.0.4" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" +checksum = "0495e4577c672de8254beb68d01a9b62d0e8a13c099edecdbedccce3223cd29f" [[package]] name = "seahash" @@ -6842,9 +6835,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "secp256k1" -version = "0.29.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" +checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ "rand 0.8.5", "secp256k1-sys", @@ -6852,9 +6845,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.10.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" +checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" dependencies = [ "cc", ] @@ -6866,7 +6859,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation 0.9.4", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -6874,9 +6867,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.1" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -6884,9 +6877,9 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.1.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe" +checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" [[package]] name = "semver" @@ -6896,9 +6889,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] @@ -6914,20 +6907,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", "memchr", @@ -6953,14 +6946,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "serde_spanned" -version = "0.6.8" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -6988,15 +6981,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.7.0", + "indexmap 2.4.0", "serde", "serde_derive", "serde_json", @@ -7006,21 +6999,21 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "serial_test" -version = "3.2.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" +checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" dependencies = [ "futures", "log", @@ -7032,13 +7025,13 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.2.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" +checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -7083,7 +7076,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -7175,7 +7168,7 @@ checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", "mio 0.8.11", - "mio 1.0.3", + "mio 1.0.2", "signal-hook", ] @@ -7196,9 +7189,9 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "simdutf8" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "siphasher" @@ -7214,9 +7207,9 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "skrifa" -version = "0.22.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1c44ad1f6c5bdd4eefed8326711b7dbda9ea45dfd36068c427d332aa382cbe" +checksum = "abea4738067b1e628c6ce28b2c216c19e9ea95715cdb332680e821c3bec2ef23" dependencies = [ "bytemuck", "read-fonts", @@ -7267,7 +7260,7 @@ dependencies = [ "cursor-icon", "libc", "log", - "memmap2 0.9.5", + "memmap2 0.9.4", "rustix", "thiserror", "wayland-backend", @@ -7292,15 +7285,15 @@ dependencies = [ "cursor-icon", "libc", "log", - "memmap2 0.9.5", + "memmap2 0.9.4", "rustix", "thiserror", "wayland-backend", "wayland-client", "wayland-csd-frame", "wayland-cursor", - "wayland-protocols 0.32.5", - "wayland-protocols-wlr 0.3.5", + "wayland-protocols 0.32.3", + "wayland-protocols-wlr 0.3.3", "wayland-scanner", "xkeysym", ] @@ -7359,9 +7352,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.8" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -7369,25 +7362,26 @@ dependencies = [ [[package]] name = "softbuffer" -version = "0.4.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18051cdd562e792cad055119e0cdb2cfc137e44e3987532e0f9659a77931bb08" +checksum = "d623bff5d06f60d738990980d782c8c866997d9194cfe79ecad00aa2f76826dd" dependencies = [ "as-raw-xcb-connection", "bytemuck", "cfg_aliases 0.2.1", - "core-graphics 0.24.0", + "core-graphics", "drm", "fastrand", "foreign-types 0.5.0", "js-sys", "log", - "memmap2 0.9.5", + "memmap2 0.9.4", "objc2 0.5.2", + "objc2-app-kit", "objc2-foundation", "objc2-quartz-core", "raw-window-handle", - "redox_syscall 0.5.7", + "redox_syscall 0.5.3", "rustix", "tiny-xlib", "wasm-bindgen", @@ -7395,7 +7389,7 @@ dependencies = [ "wayland-client", "wayland-sys", "web-sys", - "windows-sys 0.59.0", + "windows-sys 0.52.0", "x11rb", ] @@ -7582,7 +7576,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -7610,15 +7604,15 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "svg_fmt" -version = "0.4.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce5d813d71d82c4cbc1742135004e4a79fd870214c155443451c139c9470a0aa" +checksum = "20e16a0f46cf5fd675563ef54f26e83e20f2366bcf027bcb3cc3ed2b98aaf2ca" [[package]] name = "swash" -version = "0.1.19" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd59f3f359ddd2c95af4758c18270eddd9c730dde98598023cdabff472c2ca2" +checksum = "93cdc334a50fcc2aa3f04761af3b28196280a6aaadb1ef11215c478ae32615ac" dependencies = [ "skrifa", "yazi", @@ -7638,15 +7632,27 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.90" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "sync_wrapper" version = "0.1.2" @@ -7655,9 +7661,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "synstructure" @@ -7667,14 +7673,14 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "sys-locale" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +checksum = "e801cf239ecd6ccd71f03d270d67dd53d13e90aab208bf4b8fe4ad957ea949b0" dependencies = [ "libc", ] @@ -7686,7 +7692,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.4", + "core-foundation", "system-configuration-sys", ] @@ -7708,9 +7714,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.14.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", @@ -7795,22 +7801,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.69" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.69" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -7825,9 +7831,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.37" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -7848,9 +7854,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.19" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -7884,13 +7890,13 @@ dependencies = [ [[package]] name = "tiny-xlib" -version = "0.2.4" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0324504befd01cab6e0c994f34b2ffa257849ee019d3fb3b64fb2c858887d89e" +checksum = "1d52f22673960ad13af14ff4025997312def1223bfa7c8e4949d099e6b3d5d1c" dependencies = [ "as-raw-xcb-connection", "ctor-lite", - "libloading 0.8.6", + "libloading 0.8.5", "pkg-config", "tracing", ] @@ -7951,14 +7957,14 @@ dependencies = [ [[package]] name = "tokio" -version = "1.42.0" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.3", + "mio 1.0.2", "parking_lot 0.12.3", "pin-project-lite", "signal-hook-registry", @@ -7976,7 +7982,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -7991,9 +7997,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.12" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5d3742945bc7d7f210693b0c58ae542c6fd47b17adbbda0885f3dcb34a6bdb" +checksum = "03adcf0147e203b6032c0b2d30be1415ba03bc348901f3ff1cc0df6a733e60c3" dependencies = [ "async-trait", "byteorder", @@ -8050,9 +8056,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -8062,9 +8068,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.13" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", @@ -8106,11 +8112,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.7.0", + "indexmap 2.4.0", "serde", "serde_spanned", "toml_datetime", @@ -8127,21 +8133,6 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper 0.1.2", "tokio", "tower-layer", "tower-service", @@ -8176,7 +8167,7 @@ checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "bitflags 2.6.0", "bytes", - "http 1.2.0", + "http 1.1.0", "http-body 1.0.1", "http-body-util", "pin-project-lite", @@ -8198,9 +8189,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "log", "pin-project-lite", @@ -8210,20 +8201,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -8242,9 +8233,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.2.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" dependencies = [ "serde", "tracing-core", @@ -8252,9 +8243,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term 0.46.0", @@ -8291,9 +8282,9 @@ checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" [[package]] name = "ttf-parser" -version = "0.25.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" [[package]] name = "tx-verifier" @@ -8338,7 +8329,7 @@ version = "1.0.0" dependencies = [ "itertools 0.13.0", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -8366,9 +8357,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-bidi" -version = "0.3.17" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-bidi-mirroring" @@ -8405,33 +8396,33 @@ dependencies = [ [[package]] name = "unicode-properties" -version = "0.1.3" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" +checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524" [[package]] name = "unicode-script" -version = "0.5.7" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb421b350c9aff471779e262955939f565ec18b86c15364e6bdf0d662ca7c1f" +checksum = "ad8d71f5726e5f285a935e9fe8edfd53f0491eb6e9a5774097fdabee7cd8c9cd" [[package]] name = "unicode-segmentation" -version = "1.12.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.14" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.6" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "universal-hash" @@ -8451,12 +8442,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.4" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", - "idna 1.0.3", + "idna 0.5.0", "percent-encoding", "serde", ] @@ -8555,9 +8546,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" [[package]] name = "valuable" @@ -8842,7 +8833,7 @@ dependencies = [ "subsystem", "thiserror", "tokio", - "tower 0.4.13", + "tower", "utils-networking", "wallet", "wallet-controller", @@ -8997,9 +8988,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", "once_cell", @@ -9008,23 +8999,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", + "once_cell", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -9034,9 +9026,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -9044,22 +9036,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-doc-gen" @@ -9067,7 +9059,7 @@ version = "1.0.0" dependencies = [ "anyhow", "clap", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -9108,9 +9100,9 @@ dependencies = [ [[package]] name = "wayland-backend" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" +checksum = "f90e11ce2ca99c97b940ee83edbae9da2d56a08f9ea8158550fd77fa31722993" dependencies = [ "cc", "downcast-rs", @@ -9122,9 +9114,9 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.7" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" +checksum = "7e321577a0a165911bdcfb39cf029302479d7527b517ee58ab0f6ad09edf0943" dependencies = [ "bitflags 2.6.0", "rustix", @@ -9145,9 +9137,9 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.31.7" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c" +checksum = "6ef9489a8df197ebf3a8ce8a7a7f0a2320035c3743f3c1bd0bdbccf07ce64f95" dependencies = [ "rustix", "wayland-client", @@ -9168,9 +9160,9 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.32.5" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd0ade57c4e6e9a8952741325c30bf82f4246885dca8bf561898b86d0c1f58e" +checksum = "62989625a776e827cc0f15d41444a3cea5205b963c3a25be48ae1b52d6b4daaa" dependencies = [ "bitflags 2.6.0", "wayland-backend", @@ -9206,22 +9198,22 @@ dependencies = [ [[package]] name = "wayland-protocols-wlr" -version = "0.3.5" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "782e12f6cd923c3c316130d56205ebab53f55d6666b7faddfad36cecaeeb4022" +checksum = "fd993de54a40a40fbe5601d9f1fbcaef0aebcc5fda447d7dc8f6dcbaae4f8953" dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client", - "wayland-protocols 0.32.5", + "wayland-protocols 0.32.3", "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.31.5" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" +checksum = "d7b56f89937f1cf2ee1f1259cf2936a17a1f45d8f0aa1019fae6d470d304cfa6" dependencies = [ "proc-macro2", "quick-xml", @@ -9230,9 +9222,9 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.31.5" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09" +checksum = "43676fe2daf68754ecf1d72026e4e6c15483198b5d24e888b74d3f22f887a148" dependencies = [ "dlib", "log", @@ -9296,7 +9288,7 @@ dependencies = [ "bitflags 2.6.0", "cfg_aliases 0.1.1", "codespan-reporting", - "indexmap 2.7.0", + "indexmap 2.4.0", "log", "naga", "once_cell", @@ -9324,7 +9316,7 @@ dependencies = [ "bitflags 2.6.0", "block", "cfg_aliases 0.1.1", - "core-graphics-types 0.1.3", + "core-graphics-types", "d3d12", "glow", "glutin_wgl_sys", @@ -9335,7 +9327,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.6", + "libloading 0.8.5", "log", "metal", "naga", @@ -9369,11 +9361,11 @@ dependencies = [ [[package]] name = "whoami" -version = "1.5.2" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ - "redox_syscall 0.5.7", + "redox_syscall 0.4.1", "wasite", "web-sys", ] @@ -9479,7 +9471,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -9490,7 +9482,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -9739,14 +9731,14 @@ dependencies = [ "bytemuck", "calloop 0.12.4", "cfg_aliases 0.1.1", - "core-foundation 0.9.4", - "core-graphics 0.23.2", + "core-foundation", + "core-graphics", "cursor-icon", "icrate", "js-sys", "libc", "log", - "memmap2 0.9.5", + "memmap2 0.9.4", "ndk", "ndk-sys", "objc2 0.4.1", @@ -9776,9 +9768,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -9843,7 +9835,7 @@ dependencies = [ "as-raw-xcb-connection", "gethostname", "libc", - "libloading 0.8.6", + "libloading 0.8.5", "once_cell", "rustix", "x11rb-protocol", @@ -9904,9 +9896,9 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" [[package]] name = "xml-rs" -version = "0.8.24" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432" +checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601" [[package]] name = "xxhash-rust" @@ -9946,7 +9938,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "synstructure", ] @@ -9992,7 +9984,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "zvariant_utils", ] @@ -10031,7 +10023,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -10051,7 +10043,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "synstructure", ] @@ -10072,7 +10064,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -10094,7 +10086,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] [[package]] @@ -10120,7 +10112,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", "zvariant_utils", ] @@ -10132,5 +10124,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.87", ] From 2b950b4a11638d945a26f9a837731d9e57a8cff8 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Thu, 20 Jun 2024 05:58:09 +0200 Subject: [PATCH 04/48] add trezor-client generated code --- Cargo.lock | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index be9fe76492..5965433982 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8262,6 +8262,20 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "trezor-client" +version = "0.1.4" +dependencies = [ + "bitcoin", + "byteorder", + "hex", + "protobuf", + "rusb", + "thiserror", + "tracing", + "unicode-normalization", +] + [[package]] name = "try-lock" version = "0.2.5" From 9fb7297c7272c6803bad31962fedca7e15da2615 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Thu, 20 Jun 2024 05:58:09 +0200 Subject: [PATCH 05/48] add trezor-client generated code --- Cargo.lock | 162 +- Cargo.toml | 1 + wallet/Cargo.toml | 1 + wallet/src/key_chain/mod.rs | 10 + wallet/src/signer/trezor_signer/mod.rs | 72 +- wallet/src/signer/trezor_signer/tests.rs | 52 +- wallet/trezor-client/.gitignore | 1 + wallet/trezor-client/Cargo.toml | 77 + wallet/trezor-client/LICENSE | 122 + wallet/trezor-client/README.md | 40 + wallet/trezor-client/build/Cargo.toml | 8 + wallet/trezor-client/build/README.md | 7 + wallet/trezor-client/build/src/main.rs | 34 + wallet/trezor-client/examples/change_pin.rs | 31 + wallet/trezor-client/examples/features.rs | 101 + wallet/trezor-client/examples/find.rs | 11 + wallet/trezor-client/examples/interaction.rs | 57 + wallet/trezor-client/examples/sign_message.rs | 40 + wallet/trezor-client/examples/sign_tx.rs | 119 + wallet/trezor-client/examples/solana.rs | 17 + wallet/trezor-client/scripts/build_messages | 110 + wallet/trezor-client/scripts/build_protos | 27 + wallet/trezor-client/src/client/bitcoin.rs | 95 + wallet/trezor-client/src/client/common.rs | 247 + wallet/trezor-client/src/client/ethereum.rs | 168 + wallet/trezor-client/src/client/mintlayer.rs | 130 + wallet/trezor-client/src/client/mod.rs | 266 + wallet/trezor-client/src/client/solana.rs | 16 + wallet/trezor-client/src/error.rs | 105 + wallet/trezor-client/src/flows/sign_tx.rs | 332 + wallet/trezor-client/src/lib.rs | 247 + .../trezor-client/src/messages/generated.rs | 306 + wallet/trezor-client/src/messages/mod.rs | 26 + .../src/protos/generated/messages.rs | 1963 +++ .../src/protos/generated/messages_binance.rs | 3083 ++++ .../src/protos/generated/messages_bitcoin.rs | 13682 ++++++++++++++++ .../protos/generated/messages_bootloader.rs | 767 + .../src/protos/generated/messages_cardano.rs | 10240 ++++++++++++ .../src/protos/generated/messages_common.rs | 2521 +++ .../src/protos/generated/messages_crypto.rs | 2956 ++++ .../src/protos/generated/messages_debug.rs | 3555 ++++ .../src/protos/generated/messages_eos.rs | 6536 ++++++++ .../src/protos/generated/messages_ethereum.rs | 4199 +++++ .../messages_ethereum_definitions.rs | 1001 ++ .../generated/messages_ethereum_eip712.rs | 1465 ++ .../protos/generated/messages_management.rs | 10842 ++++++++++++ .../protos/generated/messages_mintlayer.rs | 3772 +++++ .../src/protos/generated/messages_monero.rs | 12061 ++++++++++++++ .../src/protos/generated/messages_nem.rs | 4998 ++++++ .../src/protos/generated/messages_ripple.rs | 1241 ++ .../src/protos/generated/messages_solana.rs | 1594 ++ .../src/protos/generated/messages_stellar.rs | 6413 ++++++++ .../src/protos/generated/messages_tezos.rs | 4584 ++++++ .../src/protos/generated/messages_webauthn.rs | 1257 ++ wallet/trezor-client/src/protos/mod.rs | 44 + wallet/trezor-client/src/transport/error.rs | 49 + wallet/trezor-client/src/transport/mod.rs | 85 + .../trezor-client/src/transport/protocol.rs | 214 + wallet/trezor-client/src/transport/udp.rs | 159 + wallet/trezor-client/src/transport/webusb.rs | 173 + wallet/trezor-client/src/utils.rs | 73 + 61 files changed, 102508 insertions(+), 57 deletions(-) create mode 100644 wallet/trezor-client/.gitignore create mode 100644 wallet/trezor-client/Cargo.toml create mode 100644 wallet/trezor-client/LICENSE create mode 100644 wallet/trezor-client/README.md create mode 100644 wallet/trezor-client/build/Cargo.toml create mode 100644 wallet/trezor-client/build/README.md create mode 100644 wallet/trezor-client/build/src/main.rs create mode 100644 wallet/trezor-client/examples/change_pin.rs create mode 100644 wallet/trezor-client/examples/features.rs create mode 100644 wallet/trezor-client/examples/find.rs create mode 100644 wallet/trezor-client/examples/interaction.rs create mode 100644 wallet/trezor-client/examples/sign_message.rs create mode 100644 wallet/trezor-client/examples/sign_tx.rs create mode 100644 wallet/trezor-client/examples/solana.rs create mode 100755 wallet/trezor-client/scripts/build_messages create mode 100755 wallet/trezor-client/scripts/build_protos create mode 100644 wallet/trezor-client/src/client/bitcoin.rs create mode 100644 wallet/trezor-client/src/client/common.rs create mode 100644 wallet/trezor-client/src/client/ethereum.rs create mode 100644 wallet/trezor-client/src/client/mintlayer.rs create mode 100644 wallet/trezor-client/src/client/mod.rs create mode 100644 wallet/trezor-client/src/client/solana.rs create mode 100644 wallet/trezor-client/src/error.rs create mode 100644 wallet/trezor-client/src/flows/sign_tx.rs create mode 100644 wallet/trezor-client/src/lib.rs create mode 100644 wallet/trezor-client/src/messages/generated.rs create mode 100644 wallet/trezor-client/src/messages/mod.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_binance.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_bitcoin.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_bootloader.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_cardano.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_common.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_crypto.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_debug.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_eos.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_ethereum.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_management.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_mintlayer.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_monero.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_nem.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_ripple.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_solana.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_stellar.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_tezos.rs create mode 100644 wallet/trezor-client/src/protos/generated/messages_webauthn.rs create mode 100644 wallet/trezor-client/src/protos/mod.rs create mode 100644 wallet/trezor-client/src/transport/error.rs create mode 100644 wallet/trezor-client/src/transport/mod.rs create mode 100644 wallet/trezor-client/src/transport/protocol.rs create mode 100644 wallet/trezor-client/src/transport/udp.rs create mode 100644 wallet/trezor-client/src/transport/webusb.rs create mode 100644 wallet/trezor-client/src/utils.rs diff --git a/Cargo.lock b/Cargo.lock index 5965433982..608dea5487 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -738,6 +738,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +[[package]] +name = "bech32" +version = "0.10.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" + [[package]] name = "bech32" version = "0.11.0" @@ -768,7 +774,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ - "bitcoin_hashes", + "bitcoin_hashes 0.11.0", "serde", "unicode-normalization", "zeroize", @@ -789,6 +795,20 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bitcoin" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" +dependencies = [ + "bech32 0.10.0-beta", + "bitcoin-internals", + "bitcoin_hashes 0.13.0", + "hex-conservative", + "hex_lit", + "secp256k1 0.28.2", +] + [[package]] name = "bitcoin-bech32" version = "0.13.0" @@ -798,12 +818,28 @@ dependencies = [ "bech32 0.9.1", ] +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + [[package]] name = "bitcoin_hashes" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -1570,7 +1606,7 @@ dependencies = [ "serde_json", "serde_test", "serde_with", - "serial_test", + "serial_test 3.1.1", "serialization", "static_assertions", "strum", @@ -1878,7 +1914,7 @@ dependencies = [ "rpc-description", "rstest", "schnorrkel", - "secp256k1", + "secp256k1 0.29.0", "serde", "serialization", "sha-1 0.10.1", @@ -2026,6 +2062,19 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core 0.9.10", +] + [[package]] name = "data-encoding" version = "2.6.0" @@ -3074,12 +3123,24 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + [[package]] name = "hex-literal" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hex_lit" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" + [[package]] name = "hexf-parse" version = "0.2.1" @@ -4118,6 +4179,18 @@ dependencies = [ "escape8259", ] +[[package]] +name = "libusb1-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da050ade7ac4ff1ba5379af847a10a10a8e284181e060105bf8d86960ce9ce0f" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -5902,6 +5975,26 @@ dependencies = [ "unarray", ] +[[package]] +name = "protobuf" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] + +[[package]] +name = "protobuf-support" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" +dependencies = [ + "thiserror", +] + [[package]] name = "psl" version = "2.1.55" @@ -6513,6 +6606,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "rusb" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab9f9ff05b63a786553a4c02943b74b34a988448671001e9a27e2f0565cc05a4" +dependencies = [ + "libc", + "libusb1-sys", +] + [[package]] name = "rusqlite" version = "0.32.1" @@ -6833,6 +6936,16 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "bitcoin_hashes 0.13.0", + "secp256k1-sys 0.9.2", +] + [[package]] name = "secp256k1" version = "0.29.0" @@ -6840,7 +6953,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ "rand 0.8.5", - "secp256k1-sys", + "secp256k1-sys 0.10.0", +] + +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", ] [[package]] @@ -7009,6 +7131,20 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "serial_test" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" +dependencies = [ + "dashmap", + "futures", + "lazy_static", + "log", + "parking_lot 0.12.3", + "serial_test_derive 2.0.0", +] + [[package]] name = "serial_test" version = "3.1.1" @@ -7020,7 +7156,18 @@ dependencies = [ "once_cell", "parking_lot 0.12.3", "scc", - "serial_test_derive", + "serial_test_derive 3.1.1", +] + +[[package]] +name = "serial_test_derive" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] @@ -8264,15 +8411,17 @@ dependencies = [ [[package]] name = "trezor-client" -version = "0.1.4" +version = "0.1.3" dependencies = [ "bitcoin", "byteorder", "hex", "protobuf", "rusb", + "serial_test 2.0.0", "thiserror", "tracing", + "tracing-subscriber", "unicode-normalization", ] @@ -8646,6 +8795,7 @@ dependencies = [ "tempfile", "test-utils", "thiserror", + "trezor-client", "tx-verifier", "utils", "utils-networking", diff --git a/Cargo.toml b/Cargo.toml index 30d658dcd6..0ac231f3fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,6 +77,7 @@ members = [ "wallet/wallet-rpc-daemon", # Wallet RPC daemon binary. "wallet/wallet-rpc-lib", # Wallet RPC definitions library. "wallet/wallet-test-node", # Node for wallet testing as a library. + "wallet/trezor-client", # Auto generated trezor client library from trezor firmware repo "wasm-wrappers", # WASM wrappers for various components. "wasm-wrappers/wasm-doc-gen", # WASM wrappers documentation generator. ] diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index ba1d97addb..ead6bc6780 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -26,6 +26,7 @@ utils-networking = { path = "../utils/networking" } utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } +trezor-client = { path = "./trezor-client", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } hex.workspace = true diff --git a/wallet/src/key_chain/mod.rs b/wallet/src/key_chain/mod.rs index 777c9b5faa..a3e0dc4df0 100644 --- a/wallet/src/key_chain/mod.rs +++ b/wallet/src/key_chain/mod.rs @@ -35,6 +35,7 @@ mod with_purpose; pub use account_key_chain::AccountKeyChainImpl; use common::chain::classic_multisig::ClassicMultisigChallenge; use crypto::key::hdkd::u31::U31; +use crypto::key::PublicKey; use crypto::vrf::VRFKeyKind; pub use master_key_chain::MasterKeyChain; @@ -112,6 +113,15 @@ pub enum FoundPubKey { Standalone(AccountPublicKey), } +impl FoundPubKey { + pub fn into_public_key(self) -> PublicKey { + match self { + Self::Hierarchy(xpub) => xpub.into_public_key(), + Self::Standalone(acc_pk) => acc_pk.into_item_id(), + } + } +} + pub trait AccountKeyChains { fn find_public_key(&self, destination: &Destination) -> Option; diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index f56bf9baed..be518e7414 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -19,10 +19,12 @@ use common::{ address::Address, chain::{ output_value::OutputValue, + partially_signed_transaction::PartiallySignedTransaction, signature::{ inputsig::{ arbitrary_message::ArbitraryMessageSignature, authorize_pubkey_spend::AuthorizedPublicKeySpend, + authorize_pubkeyhash_spend::AuthorizedPublicKeyHashSpend, standard_signature::StandardInputSignature, InputWitness, }, sighash::{sighashtype::SigHashType, signature_hash}, @@ -30,7 +32,6 @@ use common::{ ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, TxOutput, }, - partially_signed_transaction::PartiallySignedTransaction, }; use crypto::key::{ extended::{ExtendedPrivateKey, ExtendedPublicKey}, @@ -40,6 +41,7 @@ use crypto::key::{ use itertools::Itertools; use randomness::make_true_rng; use serialization::Encode; +#[allow(clippy::all)] use trezor_client::{ protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, Trezor, @@ -111,8 +113,32 @@ impl TrezorSigner { Some(InputWitness::NoSignature(None)), SignatureStatus::FullySigned, )), - Destination::PublicKey(_) | Destination::PublicKeyHash(_) => { + Destination::PublicKeyHash(_) => { if let Some(signature) = signature { + eprintln!("some signature pkh"); + let pk = + key_chain.find_public_key(destination).expect("found").into_public_key(); + eprintln!("pk {:?}", pk.encode()); + let mut signature = signature.clone(); + signature.insert(0, 0); + let sig = Signature::from_data(signature)?; + let sig = AuthorizedPublicKeyHashSpend::new(pk, sig); + let sig = InputWitness::Standard(StandardInputSignature::new( + sighash_type, + sig.encode(), + )); + + Ok((Some(sig), SignatureStatus::FullySigned)) + } else { + eprintln!("empty signature"); + Ok((None, SignatureStatus::NotSigned)) + } + } + Destination::PublicKey(_) => { + if let Some(signature) = signature { + eprintln!("some signature pk"); + let mut signature = signature.clone(); + signature.insert(0, 0); let sig = Signature::from_data(signature)?; let sig = AuthorizedPublicKeySpend::new(sig); let sig = InputWitness::Standard(StandardInputSignature::new( @@ -122,6 +148,7 @@ impl TrezorSigner { Ok((Some(sig), SignatureStatus::FullySigned)) } else { + eprintln!("empty signature"); Ok((None, SignatureStatus::NotSigned)) } } @@ -144,26 +171,21 @@ impl TrezorSigner { .tx() .outputs() .iter() - .map(|out| { - match out { - TxOutput::Transfer(value, dest) => { - match value { - OutputValue::Coin(amount) => { - let mut out_req = MintlayerTransferTxOutput::new(); - // TODO: change to u128 in trezor - out_req.set_amount(amount.into_atoms() as u64); - out_req.set_address( - Address::new(&self.chain_config, dest.clone()) - .expect("addressable") - .into_string(), - ); - out_req - } - _ => unimplemented!("support transfer of tokens in trezor"), - } + .map(|out| match out { + TxOutput::Transfer(value, dest) => match value { + OutputValue::Coin(amount) => { + let mut out_req = MintlayerTransferTxOutput::new(); + out_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + out_req.set_address( + Address::new(&self.chain_config, dest.clone()) + .expect("addressable") + .into_string(), + ); + out_req } - _ => unimplemented!("support other output types in trezor"), - } + _ => unimplemented!("support transfer of tokens in trezor"), + }, + _ => unimplemented!("support other output types in trezor"), }) .collect(); outputs @@ -237,11 +259,13 @@ impl Signer for TrezorSigner { (Some(destination), Some(sig)) => { let sighash_type = SigHashType::try_from(SigHashType::ALL).expect("Should not fail"); + eprintln!("making sig for {i}"); let (sig, status) = self.make_signature(sig, destination, sighash_type, key_chain)?; Ok((sig, SignatureStatus::NotSigned, status)) } (Some(_) | None, None) | (None, Some(_)) => { + eprintln!("no signature!"); Ok((None, SignatureStatus::NotSigned, SignatureStatus::NotSigned)) } }, @@ -303,8 +327,7 @@ fn to_trezor_input_msgs(ptx: &PartiallySignedTransaction) -> Vec { - // TODO: - inp_req.set_amount(amount.into_atoms() as u64); + inp_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); } OutputValue::TokenV1(_, _) | OutputValue::TokenV0(_) => { unimplemented!("support for tokens") @@ -338,8 +361,7 @@ fn to_trezor_utxo_msgs( let mut out_req = MintlayerTransferTxOutput::new(); match value { OutputValue::Coin(amount) => { - // TODO: change to u128 in trezor - out_req.set_amount(amount.into_atoms() as u64); + out_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); } OutputValue::TokenV0(_) | OutputValue::TokenV1(_, _) => { unimplemented!("support tokens in trezor") diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 2769a23b17..bafdddb26b 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -17,15 +17,14 @@ use std::ops::{Add, Div, Mul, Sub}; use std::{cell::RefCell, rc::Rc}; use super::*; +use crate::destination_getters::get_tx_output_destination; use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::output_value::OutputValue; use common::chain::signature::verify_signature; -use common::chain::{GenBlock, Transaction, TxInput}; -use common::primitives::amount::UnsignedIntType; +use common::chain::{Transaction, TxInput}; use common::primitives::{Amount, Id, H256}; -use crypto::key::KeyKind; use randomness::{Rng, RngCore}; use rstest::rstest; use test_utils::random::{make_seedable_rng, Seed}; @@ -44,12 +43,12 @@ const MNEMONIC: &str = fn sign_transaction(#[case] seed: Seed) { let mut rng = make_seedable_rng(seed); - let config = Arc::new(create_regtest()); + let chain_config = Arc::new(create_regtest()); let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); let master_key_chain = MasterKeyChain::new_from_mnemonic( - config.clone(), + chain_config.clone(), &mut db_tx, MNEMONIC, None, @@ -60,10 +59,11 @@ fn sign_transaction(#[case] seed: Seed) { let key_chain = master_key_chain .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) .unwrap(); - let mut account = Account::new(config.clone(), &mut db_tx, key_chain, None).unwrap(); + let mut account = Account::new(chain_config.clone(), &mut db_tx, key_chain, None).unwrap(); - let amounts: Vec = (0..(2 + rng.next_u32() % 5)) - .map(|_| Amount::from_atoms(rng.next_u32() as UnsignedIntType)) + let amounts: Vec = (0..1) //(0..(2 + rng.next_u32() % 5)) + // .map(|_| Amount::from_atoms(rng.next_u32() as UnsignedIntType)) + .map(|_| Amount::from_atoms(1)) .collect(); let total_amount = amounts.iter().fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); @@ -87,11 +87,11 @@ fn sign_transaction(#[case] seed: Seed) { let inputs: Vec = utxos .iter() .map(|_txo| { - let source_id = if rng.gen_bool(0.5) { - Id::::new(H256::random_using(&mut rng)).into() - } else { - Id::::new(H256::random_using(&mut rng)).into() - }; + // let source_id = if rng.gen_bool(0.5) { + let source_id = Id::::new(H256::random_using(&mut rng)).into(); + // } else { + // Id::::new(H256::random_using(&mut rng)).into() + // }; TxInput::from_utxo(source_id, rng.next_u32()) }) .collect(); @@ -105,13 +105,13 @@ fn sign_transaction(#[case] seed: Seed) { .fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); let _fee_amount = total_amount.sub(outputs_amounts_sum).unwrap(); - let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); + // let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); let outputs = vec![ - TxOutput::Transfer( - OutputValue::Coin(dest_amount), - Destination::PublicKey(dest_pub), - ), + // TxOutput::Transfer( + // OutputValue::Coin(dest_amount), + // Destination::PublicKey(dest_pub), + // ), // TxOutput::LockThenTransfer( // OutputValue::Coin(lock_amount), // Destination::AnyoneCanSpend, @@ -119,12 +119,12 @@ fn sign_transaction(#[case] seed: Seed) { // ), // TxOutput::Burn(OutputValue::Coin(burn_amount)), TxOutput::Transfer( - OutputValue::Coin(Amount::from_atoms(100)), + OutputValue::Coin(Amount::from_atoms(100_000_000_000)), account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), ), ]; - let tx = Transaction::new(0, inputs, outputs).unwrap(); + let tx = Transaction::new(0, inputs.clone(), outputs).unwrap(); let req = SendRequest::from_transaction(tx, utxos.clone(), &|_| None).unwrap(); let ptx = req.into_partially_signed_tx().unwrap(); @@ -134,21 +134,21 @@ fn sign_transaction(#[case] seed: Seed) { let client = devices.pop().unwrap().connect().unwrap(); let mut signer = TrezorSigner::new( - config.clone(), + chain_config.clone(), DEFAULT_ACCOUNT_INDEX, Rc::new(RefCell::new(client)), ); let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); - assert!(ptx.is_fully_signed(&config)); + eprintln!("num inputs in tx: {}", inputs.len()); + assert!(ptx.is_fully_signed(&chain_config)); - let sig_tx = ptx.into_signed_tx(&config).unwrap(); + let sig_tx = ptx.into_signed_tx(&chain_config).unwrap(); let utxos_ref = utxos.iter().map(Some).collect::>(); for i in 0..sig_tx.inputs().len() { - let destination = - crate::get_tx_output_destination(utxos_ref[i].unwrap(), &|_| None).unwrap(); - verify_signature(&config, &destination, &sig_tx, &utxos_ref, i).unwrap(); + let destination = get_tx_output_destination(utxos_ref[i].unwrap(), &|_| None).unwrap(); + verify_signature(&chain_config, &destination, &sig_tx, &utxos_ref, i).unwrap(); } } diff --git a/wallet/trezor-client/.gitignore b/wallet/trezor-client/.gitignore new file mode 100644 index 0000000000..2f7896d1d1 --- /dev/null +++ b/wallet/trezor-client/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/wallet/trezor-client/Cargo.toml b/wallet/trezor-client/Cargo.toml new file mode 100644 index 0000000000..cf93e75d6f --- /dev/null +++ b/wallet/trezor-client/Cargo.toml @@ -0,0 +1,77 @@ +[package] +name = "trezor-client" +# license.workspace = true +# version.workspace = true +# edition.workspace = true +# rust-version.workspace = true +version = "0.1.3" +authors = [ + "Piyush Kumar ", + "joshieDo ", + "DaniPopes <57450786+DaniPopes@users.noreply.github.com>", + "Roman Zeyde ", + "Steven Roose ", +] +license = "CC0-1.0" +homepage = "https://github.com/trezor/trezor-firmware/tree/master/rust/trezor-client" +repository = "https://github.com/trezor/trezor-firmware" +description = "Client library for interfacing with Trezor hardware wallet devices" +keywords = ["ethereum", "bitcoin", "trezor", "wallet"] +categories = ["api-bindings", "cryptography::cryptocurrencies"] +readme = "README.md" +exclude = [".github/", "examples/", "scripts/", ".clippy.toml", ".gitignore", "rustfmt.toml"] +edition = "2021" +rust-version = "1.60" + +# [package.metadata.docs.rs] +# all-features = true +# rustdoc-args = ["--cfg", "docsrs"] + +# [workspace] +# members = ["build", "."] + +# [workspace.dependencies] +# # important: keep in sync +# protobuf = "=3.3.0" +# protobuf-codegen = "=3.3.0" + +[dependencies] +# important: keep in sync +protobuf = "=3.3.0" +# protobuf-codegen = "=3.3.0" +byteorder = "1.4" +rusb = "0.9" + +hex = { version = "0.4", default-features = false, features = ["std"] } +thiserror = "1.0" +tracing = "0.1" + +# bitcoin +bitcoin = { version = "0.31", optional = true } +unicode-normalization = { version = "0.1.22", optional = true } + +[dev-dependencies] +tracing-subscriber = "0.3" +serial_test = "2.0.0" + +[features] +default = ["bitcoin", "ethereum", "solana", "mintlayer"] +no_clippy = [] + + +# Client implementations +bitcoin = ["dep:bitcoin", "unicode-normalization"] +ethereum = [] + +# Just bindings to the Trezor protobufs +binance = [] +cardano = [] +eos = [] +monero = [] +nem = [] +ripple = [] +solana = [] +stellar = [] +tezos = [] +webauthn = [] +mintlayer = [] diff --git a/wallet/trezor-client/LICENSE b/wallet/trezor-client/LICENSE new file mode 100644 index 0000000000..6ca207ef00 --- /dev/null +++ b/wallet/trezor-client/LICENSE @@ -0,0 +1,122 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. + diff --git a/wallet/trezor-client/README.md b/wallet/trezor-client/README.md new file mode 100644 index 0000000000..0dc9820ade --- /dev/null +++ b/wallet/trezor-client/README.md @@ -0,0 +1,40 @@ +# trezor-client + +[![Downloads][downloads-badge]][crates-io] +[![License][license-badge]][license-url] +[![CI Status][actions-badge]][actions-url] + +A fork of a [fork](https://github.com/romanz/rust-trezor-api) of a [library](https://github.com/stevenroose/rust-trezor-api) that provides a way to communicate with a Trezor T device from a Rust project. + +Previous iterations provided implementations for Bitcoin only. **This crate also provides an Ethereum interface**, mainly for use in [ethers-rs](https://github.com/gakonst/ethers-rs/). + +## Requirements + +**MSRV: 1.60** + +See the [Trezor guide](https://trezor.io/learn/a/os-requirements-for-trezor) on how to install and use the Trezor Suite app. + +Last tested with firmware v2.4.2. + +## Examples / Tests + +`cargo run --example features` + +## Features + +- `bitcoin` and `ethereum`: client implementation and full support; +- `cardano`, `monero`, `nem`, `ripple`, `stellar` and `tezos`: only protobuf bindings. + +## Credits + +- [Trezor](https://github.com/trezor/trezor-firmware) +- [joshieDo](https://github.com/joshieDo) +- [Piyush Kumar](https://github.com/wszdexdrf) +- [stevenroose](https://github.com/stevenroose) +- [romanz](https://github.com/romanz) +- [DaniPopes](https://github.com/DaniPopes) + +[downloads-badge]: https://img.shields.io/crates/d/trezor-client?style=for-the-badge&logo=rust +[crates-io]: https://crates.io/crates/trezor-client +[license-badge]: https://img.shields.io/badge/license-CC0--1.0-blue.svg?style=for-the-badge +[license-url]: https://github.com/trezor/trezor-firmware/blob/master/rust/trezor-client/LICENSE diff --git a/wallet/trezor-client/build/Cargo.toml b/wallet/trezor-client/build/Cargo.toml new file mode 100644 index 0000000000..384591b7bd --- /dev/null +++ b/wallet/trezor-client/build/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "trezor-client-build" +version = "0.0.0" +description = "Builds Trezor protobuf bindings for trezor-client" +publish = false + +[dependencies] +protobuf-codegen.workspace = true diff --git a/wallet/trezor-client/build/README.md b/wallet/trezor-client/build/README.md new file mode 100644 index 0000000000..d78f14296e --- /dev/null +++ b/wallet/trezor-client/build/README.md @@ -0,0 +1,7 @@ +# trezor-client-build + +Simple build script for [`trezor-client`](../). +Builds the Rust bindings for the [Trezor protobufs](../../../common/protob/). + +This crate is separate from the main crate to avoid dependencies on the +protobuf compiler (`protoc`) and the `protobuf-codegen` crate in `trezor-client`. diff --git a/wallet/trezor-client/build/src/main.rs b/wallet/trezor-client/build/src/main.rs new file mode 100644 index 0000000000..752edf14e6 --- /dev/null +++ b/wallet/trezor-client/build/src/main.rs @@ -0,0 +1,34 @@ +use std::{ + fs, + path::{Path, PathBuf}, +}; + +fn main() { + let proto_path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../../common/protob"); + let proto_dir = Path::new(proto_path).canonicalize().unwrap(); + let protos: Vec = fs::read_dir(&proto_dir) + .unwrap() + .filter_map(|entry| { + let entry = entry.unwrap(); + let path = entry.path(); + if path.is_file() && path.extension().map_or(false, |ext| ext == "proto") { + Some(path) + } else { + None + } + }) + .collect(); + + let out_path = std::env::args().skip(1).next().expect("No output directory given"); + let out_dir = PathBuf::from(out_path); + fs::create_dir_all(&out_dir).expect("Failed to create output directory"); + protobuf_codegen::Codegen::new() + .protoc() + .includes(&[proto_dir]) + .inputs(protos) + .out_dir(&out_dir) + .run_from_script(); + + // Remove mod.rs because we want to feature-gate some modules manually + fs::remove_file(out_dir.join("mod.rs")).expect("Failed to remove mod.rs"); +} diff --git a/wallet/trezor-client/examples/change_pin.rs b/wallet/trezor-client/examples/change_pin.rs new file mode 100644 index 0000000000..59ed37257c --- /dev/null +++ b/wallet/trezor-client/examples/change_pin.rs @@ -0,0 +1,31 @@ +use std::io; + +fn read_pin() -> String { + println!("Enter PIN"); + let mut pin = String::new(); + if io::stdin().read_line(&mut pin).unwrap() != 5 { + println!("must enter pin, received: {}", pin); + } + // trim newline + pin[..4].to_owned() +} + +fn do_main() -> Result<(), trezor_client::Error> { + // init with debugging + let mut trezor = trezor_client::unique(true)?; + trezor.init_device(None)?; + + let old_pin = trezor.change_pin(false)?.button_request()?.ack()?.pin_matrix_request()?; + + let new_pin1 = old_pin.ack_pin(read_pin())?.pin_matrix_request()?; + + let new_pin2 = new_pin1.ack_pin(read_pin())?.pin_matrix_request()?; + + new_pin2.ack_pin(read_pin())?.ok()?; + + Ok(()) +} + +fn main() { + do_main().unwrap() +} diff --git a/wallet/trezor-client/examples/features.rs b/wallet/trezor-client/examples/features.rs new file mode 100644 index 0000000000..00bc185cc6 --- /dev/null +++ b/wallet/trezor-client/examples/features.rs @@ -0,0 +1,101 @@ +use std::io; + +fn convert_path_from_str(derivation: &str) -> Vec { + let derivation = derivation.to_string(); + let elements = derivation.split('/').skip(1).collect::>(); + + let mut path = vec![]; + for derivation_index in elements { + let hardened = derivation_index.contains('\''); + let mut index = derivation_index.replace('\'', "").parse::().unwrap(); + if hardened { + index |= 0x80000000; + } + path.push(index); + } + + path +} + +fn device_selector() -> trezor_client::Trezor { + let mut devices = trezor_client::find_devices(false); + + if devices.is_empty() { + panic!("No devices connected"); + } else if devices.len() == 1 { + devices.remove(0).connect().expect("connection error") + } else { + println!("Choose device:"); + for (i, dev) in devices.iter().enumerate() { + println!("{}: {}", i + 1, dev); + } + println!("Enter device number: "); + let mut inp = String::new(); + io::stdin().read_line(&mut inp).expect("stdin error"); + let idx: usize = inp[..inp.len() - 1].parse().expect("invalid number"); + assert!(idx < devices.len(), "Index out of range"); + devices.remove(idx).connect().unwrap() + } +} + +fn do_main() -> Result<(), trezor_client::Error> { + // init with debugging + tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); + + let mut trezor = device_selector(); + trezor.init_device(None)?; + let f = trezor.features().expect("no features").clone(); + + println!("Features:"); + println!("vendor: {}", f.vendor()); + println!( + "version: {}.{}.{}", + f.major_version(), + f.minor_version(), + f.patch_version() + ); + println!("device id: {}", f.device_id()); + println!("label: {}", f.label()); + println!("is initialized: {}", f.initialized()); + println!("pin protection: {}", f.pin_protection()); + println!("passphrase protection: {}", f.passphrase_protection()); + println!( + "{:?}", + trezor.ethereum_get_address(convert_path_from_str("m/44'/60'/1'/0/0")).unwrap() + ); + drop(trezor); + + let mut trezor2 = device_selector(); + + trezor2.init_device(Some(f.session_id().to_vec()))?; + + println!( + "{:?}", + trezor2.ethereum_get_address(convert_path_from_str("m/44'/60'/1'/0/0")).unwrap() + ); + //optional bool bootloader_mode = 5; // is device in bootloader mode? + //optional string language = 9; // device language + //optional bytes revision = 13; // SCM revision of firmware + //optional bytes bootloader_hash = 14; // hash of the bootloader + //optional bool imported = 15; // was storage imported from an external source? + //optional bool pin_cached = 16; // is PIN already cached in session? + //optional bool passphrase_cached = 17; // is passphrase already cached in session? + //optional bool firmware_present = 18; // is valid firmware loaded? + //optional bool needs_backup = 19; // does storage need backup? (equals to + // Storage.needs_backup) optional uint32 flags = 20; // device flags (equals + // to Storage.flags) optional string model = 21; // device hardware model + //optional uint32 fw_major = 22; // reported firmware version if in bootloader + // mode optional uint32 fw_minor = 23; // reported firmware version if in + // bootloader mode optional uint32 fw_patch = 24; // reported firmware version + // if in bootloader mode optional string fw_vendor = 25; // reported firmware + // vendor if in bootloader mode optional bytes fw_vendor_keys = 26; // reported + // firmware vendor keys (their hash) optional bool unfinished_backup = 27; // report + // unfinished backup (equals to Storage.unfinished_backup) optional bool no_backup = 28; + // // report no backup (equals to Storage.no_backup) + + Ok(()) +} + +fn main() { + do_main().unwrap() +} diff --git a/wallet/trezor-client/examples/find.rs b/wallet/trezor-client/examples/find.rs new file mode 100644 index 0000000000..b538fa95da --- /dev/null +++ b/wallet/trezor-client/examples/find.rs @@ -0,0 +1,11 @@ +fn main() { + let trezors = trezor_client::find_devices(false); + println!("Found {} devices: ", trezors.len()); + for t in trezors.into_iter() { + println!("- {}", t); + { + let mut client = t.connect().unwrap(); + println!("{:?}", client.initialize(None).unwrap()); + } + } +} diff --git a/wallet/trezor-client/examples/interaction.rs b/wallet/trezor-client/examples/interaction.rs new file mode 100644 index 0000000000..9931ecc7d7 --- /dev/null +++ b/wallet/trezor-client/examples/interaction.rs @@ -0,0 +1,57 @@ +use std::io; + +use bitcoin::{bip32, network::Network, Address}; +use trezor_client::{Error, TrezorMessage, TrezorResponse}; + +fn handle_interaction(resp: TrezorResponse) -> Result { + match resp { + TrezorResponse::Ok(res) => Ok(res), + TrezorResponse::Failure(_) => resp.ok(), // assering ok() returns the failure error + TrezorResponse::ButtonRequest(req) => handle_interaction(req.ack()?), + TrezorResponse::PinMatrixRequest(req) => { + println!("Enter PIN"); + let mut pin = String::new(); + if io::stdin().read_line(&mut pin).unwrap() != 5 { + println!("must enter pin, received: {}", pin); + } + // trim newline + handle_interaction(req.ack_pin(pin[..4].to_owned())?) + } + TrezorResponse::PassphraseRequest(req) => { + println!("Enter passphrase"); + let mut pass = String::new(); + io::stdin().read_line(&mut pass).unwrap(); + // trim newline + handle_interaction(req.ack_passphrase(pass[..pass.len() - 1].to_owned())?) + } + } +} + +fn do_main() -> Result<(), trezor_client::Error> { + // init with debugging + let mut trezor = trezor_client::unique(true)?; + trezor.init_device(None)?; + + let xpub = handle_interaction( + trezor.get_public_key( + &vec![ + bip32::ChildNumber::from_hardened_idx(0).unwrap(), + bip32::ChildNumber::from_hardened_idx(0).unwrap(), + bip32::ChildNumber::from_hardened_idx(0).unwrap(), + ] + .into(), + trezor_client::protos::InputScriptType::SPENDADDRESS, + Network::Testnet, + true, + )?, + )?; + println!("{}", xpub); + println!("{:?}", xpub); + println!("{}", Address::p2pkh(&xpub.to_pub(), Network::Testnet)); + + Ok(()) +} + +fn main() { + do_main().unwrap() +} diff --git a/wallet/trezor-client/examples/sign_message.rs b/wallet/trezor-client/examples/sign_message.rs new file mode 100644 index 0000000000..8e373685b3 --- /dev/null +++ b/wallet/trezor-client/examples/sign_message.rs @@ -0,0 +1,40 @@ +use std::str::FromStr; + +use bitcoin::{bip32::DerivationPath, network::Network, Address}; +use trezor_client::{client::common::handle_interaction, InputScriptType}; + +fn main() { + tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); + + // init with debugging + let mut trezor = trezor_client::unique(false).unwrap(); + trezor.init_device(None).unwrap(); + + let pubkey = handle_interaction( + trezor + .get_public_key( + &DerivationPath::from_str("m/44h/1h/0h/0/0").unwrap(), + trezor_client::protos::InputScriptType::SPENDADDRESS, + Network::Testnet, + true, + ) + .unwrap(), + ) + .unwrap(); + let addr = Address::p2pkh(&pubkey.to_pub(), Network::Testnet); + println!("address: {}", addr); + + let (addr, signature) = handle_interaction( + trezor + .sign_message( + "regel het".to_owned(), + &DerivationPath::from_str("m/44h/1h/0h/0/0").unwrap(), + InputScriptType::SPENDADDRESS, + Network::Testnet, + ) + .unwrap(), + ) + .unwrap(); + println!("Addr from device: {}", addr); + println!("Signature: {:?}", signature); +} diff --git a/wallet/trezor-client/examples/sign_tx.rs b/wallet/trezor-client/examples/sign_tx.rs new file mode 100644 index 0000000000..69aa3ed3e7 --- /dev/null +++ b/wallet/trezor-client/examples/sign_tx.rs @@ -0,0 +1,119 @@ +use std::io::{self, Write}; + +use bitcoin::{ + bip32, blockdata::script::Builder, consensus::encode::Decodable, network::Network, psbt, + transaction::Version, Address, Amount, Sequence, Transaction, TxIn, TxOut, +}; + +use trezor_client::{Error, SignTxProgress, TrezorMessage, TrezorResponse}; + +fn handle_interaction(resp: TrezorResponse) -> T { + match resp { + TrezorResponse::Ok(res) => res, + // assering ok() returns the failure error + TrezorResponse::Failure(_) => resp.ok().unwrap(), + TrezorResponse::ButtonRequest(req) => handle_interaction(req.ack().unwrap()), + TrezorResponse::PinMatrixRequest(req) => { + println!("Enter PIN"); + let mut pin = String::new(); + if io::stdin().read_line(&mut pin).unwrap() != 5 { + println!("must enter pin, received: {}", pin); + } + // trim newline + handle_interaction(req.ack_pin(pin[..4].to_owned()).unwrap()) + } + TrezorResponse::PassphraseRequest(req) => { + println!("Enter passphrase"); + let mut pass = String::new(); + io::stdin().read_line(&mut pass).unwrap(); + // trim newline + handle_interaction(req.ack_passphrase(pass[..pass.len() - 1].to_owned()).unwrap()) + } + } +} + +fn tx_progress( + psbt: &mut psbt::Psbt, + progress: SignTxProgress, + raw_tx: &mut Vec, +) -> Result<(), Error> { + if let Some(part) = progress.get_serialized_tx_part() { + raw_tx.write_all(part).unwrap(); + } + + if !progress.finished() { + let progress = handle_interaction(progress.ack_psbt(psbt, Network::Testnet).unwrap()); + tx_progress(psbt, progress, raw_tx) + } else { + Ok(()) + } +} + +fn main() { + tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); + + // init with debugging + let mut trezor = trezor_client::unique(false).unwrap(); + trezor.init_device(None).unwrap(); + + let pubkey = handle_interaction( + trezor + .get_public_key( + &vec![ + bip32::ChildNumber::from_hardened_idx(0).unwrap(), + bip32::ChildNumber::from_hardened_idx(0).unwrap(), + bip32::ChildNumber::from_hardened_idx(1).unwrap(), + ] + .into(), + trezor_client::protos::InputScriptType::SPENDADDRESS, + Network::Testnet, + true, + ) + .unwrap(), + ); + let addr = Address::p2pkh(&pubkey.to_pub(), Network::Testnet); + println!("address: {}", addr); + + let mut psbt = psbt::Psbt { + unsigned_tx: Transaction { + version: Version::ONE, + lock_time: bitcoin::absolute::LockTime::from_consensus(0), + input: vec![TxIn { + previous_output: "c5bdb27907b78ce03f94e4bf2e94f7a39697b9074b79470019e3dbc76a10ecb6:0".parse().unwrap(), + sequence: Sequence(0xffffffff), + script_sig: Builder::new().into_script(), + witness: Default::default(), + }], + output: vec![TxOut { + value: Amount::from_sat(14245301), + script_pubkey: addr.script_pubkey(), + }], + }, + inputs: vec![psbt::Input { + non_witness_utxo: Some(Transaction::consensus_decode(&mut &hex::decode("020000000001011eb5a3e65946f88b00d67b321e5fd980b32a2316fb1fc9b712baa6a1033a04e30100000017160014f0f81ee77d552b4c81497451d1abf5c22ce8e352feffffff02b55dd900000000001976a9142c3cf5686f47c1de9cc90b4255cc2a1ef8c01b3188acfb0391ae6800000017a914a3a79e37ad366d9bf9471b28a9a8f64b50de0c968702483045022100c0aa7b262967fc2803c8a9f38f26682edba7cafb7d4870ebdc116040ad5338b502205dfebd08e993af2e6aa3118a438ad70ed9f6e09bc6abfd21f8f2957af936bc070121031f4e69fcf110bb31f019321834c0948b5487f2782489f370f66dc20f7ac767ca8bf81500").unwrap()[..]).unwrap()), + ..Default::default() + }], + outputs: vec![ + psbt::Output { + ..Default::default() + }, + ], + proprietary: Default::default(), + unknown: Default::default(), + version: 0, + xpub: Default::default(), + }; + + println!("psbt before: {:?}", psbt); + println!("unsigned txid: {}", psbt.unsigned_tx.txid()); + println!( + "unsigned tx: {}", + hex::encode(bitcoin::consensus::encode::serialize(&psbt.unsigned_tx)) + ); + + let mut raw_tx = Vec::new(); + let progress = handle_interaction(trezor.sign_tx(&psbt, Network::Testnet).unwrap()); + tx_progress(&mut psbt, progress, &mut raw_tx).unwrap(); + + println!("signed tx: {}", hex::encode(raw_tx)); +} diff --git a/wallet/trezor-client/examples/solana.rs b/wallet/trezor-client/examples/solana.rs new file mode 100644 index 0000000000..9f943c082b --- /dev/null +++ b/wallet/trezor-client/examples/solana.rs @@ -0,0 +1,17 @@ +use std::str::FromStr; + +use bitcoin::bip32::DerivationPath; +use trezor_client::utils::convert_path; + +fn do_main() -> Result<(), trezor_client::Error> { + let mut trezor = trezor_client::unique(false)?; + trezor.init_device(None)?; + let path = DerivationPath::from_str("m/44'/501'/0'/0'").expect("Hardended Derivation Path"); + let solana_address = trezor.solana_get_address(convert_path(&path))?; + println!("solana address: {:?}", solana_address); + Ok(()) +} + +fn main() { + do_main().unwrap() +} diff --git a/wallet/trezor-client/scripts/build_messages b/wallet/trezor-client/scripts/build_messages new file mode 100755 index 0000000000..8e0da67d66 --- /dev/null +++ b/wallet/trezor-client/scripts/build_messages @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 + +# Generates the `trezor_message_impl!` macro calls for the `src/messages/mod.rs` file. + +from os import path + +# Path to the `messages.proto` file +PATH = path.abspath(path.join(__file__, "../../../../common/protob/messages.proto")) +# Prefix of the enum variants +PREFIX = "MessageType_" +# Mapping of block name to feature name +FEATURES = { + # no features + "Management": "default", + "Bootloader": "default", + "Crypto": "default", + "Debug": "default", + # + "Bitcoin": "bitcoin", + "Ethereum": "ethereum", + # + "Binance": "binance", + "Cardano": "cardano", + "EOS": "eos", + "Monero": "monero", + "NEM": "nem", + "Ripple": "ripple", + "Solana": "solana", + "Stellar": "stellar", + "Tezos": "tezos", + "WebAuthn": "webauthn", + "Mintlayer": "mintlayer", +} +MACRO = "trezor_message_impl" +INDENT = " " + + +def main(): + blocks = get_blocks() + features = {} + defaults = [] + for block, variants in blocks.items(): + f = FEATURES.get(block) + if not f or f == "default": + defaults.extend(variants) + else: + vs = features.get(f) + if vs: + vs.extend(variants) + else: + features[f] = variants + + items = list(features.items()) + items.sort() + + out = write_block(defaults) + for feature, variants in items: + if variants and feature: + out += "\n" + out += write_block(variants, feature) + print(out.strip()) + + +# Parse feature blocks based on comments in the `messages.proto` file +def get_blocks() -> dict[str, list[str]]: + blocks = {} + current_block = "" + with open(PATH, "r") as file: + in_enum = False + in_block_comment = False + for line in file: + line = line.strip() + + if "/*" in line: + in_block_comment = True + if "*/" in line: + in_block_comment = False + if in_block_comment: + continue + + if line.startswith("enum MessageType {"): + in_enum = True + continue + if in_enum: + if line == "}": + break + if line.startswith("//"): + comment = line.removeprefix("//").strip() + if comment[0].isupper() and len(comment.split(" ")) == 1: + current_block = comment + blocks[current_block] = [] + elif line.startswith(PREFIX): + blocks[current_block].append(line.split(" ")[0]) + return blocks + + +# Writes a macro block +def write_block(variants: list[str], feature: str = "") -> str: + s = "" + if feature: + s += f'#[cfg(feature = "{feature}")]\n' + s += f"{MACRO}! {{\n" + for variant in variants: + s += f"{INDENT}{variant.removeprefix(PREFIX)} => {variant},\n" + s += "}\n" + return s + + +if __name__ == "__main__": + main() diff --git a/wallet/trezor-client/scripts/build_protos b/wallet/trezor-client/scripts/build_protos new file mode 100755 index 0000000000..b7a4a97a79 --- /dev/null +++ b/wallet/trezor-client/scripts/build_protos @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Generates src/protos/generated and src/messages/generated.rs + +crate_root="$(dirname "$(dirname "$(realpath "$0")")")" + +protos="$crate_root/src/protos/generated" +messages="$crate_root/src/messages/generated.rs" + +if [ "$1" = "--check" ]; then + protos_out=$(mktemp -d) + messages_out=$(mktemp) +else + protos_out=$protos + messages_out=$messages +fi + +cargo run --manifest-path "$crate_root/build/Cargo.toml" -- "$protos_out" + +"$crate_root/scripts/build_messages" > "$messages_out" +rustfmt "$messages_out" + +if [ "$1" = "--check" ]; then + set -e + diff -ur "$protos_out" "$protos" + diff -ur "$messages_out" "$messages" +fi diff --git a/wallet/trezor-client/src/client/bitcoin.rs b/wallet/trezor-client/src/client/bitcoin.rs new file mode 100644 index 0000000000..ed3b204a30 --- /dev/null +++ b/wallet/trezor-client/src/client/bitcoin.rs @@ -0,0 +1,95 @@ +use super::{Trezor, TrezorResponse}; +use crate::{error::Result, flows::sign_tx::SignTxProgress, protos, utils}; +use bitcoin::{ + address::NetworkUnchecked, bip32, network::Network, psbt, + secp256k1::ecdsa::RecoverableSignature, Address, +}; + +pub use crate::protos::InputScriptType; + +impl Trezor { + pub fn get_public_key( + &mut self, + path: &bip32::DerivationPath, + script_type: InputScriptType, + network: Network, + show_display: bool, + ) -> Result> { + let mut req = protos::GetPublicKey::new(); + req.address_n = utils::convert_path(path); + req.set_show_display(show_display); + req.set_coin_name(utils::coin_name(network)?); + req.set_script_type(script_type); + self.call(req, Box::new(|_, m| Ok(m.xpub().parse()?))) + } + + //TODO(stevenroose) multisig + pub fn get_address( + &mut self, + path: &bip32::DerivationPath, + script_type: InputScriptType, + network: Network, + show_display: bool, + ) -> Result> { + let mut req = protos::GetAddress::new(); + req.address_n = utils::convert_path(path); + req.set_coin_name(utils::coin_name(network)?); + req.set_show_display(show_display); + req.set_script_type(script_type); + self.call(req, Box::new(|_, m| parse_address(m.address()))) + } + + pub fn sign_tx( + &mut self, + psbt: &psbt::Psbt, + network: Network, + ) -> Result, protos::TxRequest>> { + let tx = &psbt.unsigned_tx; + let mut req = protos::SignTx::new(); + req.set_inputs_count(tx.input.len() as u32); + req.set_outputs_count(tx.output.len() as u32); + req.set_coin_name(utils::coin_name(network)?); + req.set_version(tx.version.0 as u32); + req.set_lock_time(tx.lock_time.to_consensus_u32()); + self.call(req, Box::new(|c, m| Ok(SignTxProgress::new(c, m)))) + } + + pub fn sign_message( + &mut self, + message: String, + path: &bip32::DerivationPath, + script_type: InputScriptType, + network: Network, + ) -> Result> { + let mut req = protos::SignMessage::new(); + req.address_n = utils::convert_path(path); + // Normalize to Unicode NFC. + let msg_bytes = nfc_normalize(&message).into_bytes(); + req.set_message(msg_bytes); + req.set_coin_name(utils::coin_name(network)?); + req.set_script_type(script_type); + self.call( + req, + Box::new(|_, m| { + let address = parse_address(m.address())?; + let signature = utils::parse_recoverable_signature(m.signature())?; + Ok((address, signature)) + }), + ) + } +} + +fn parse_address(s: &str) -> Result
{ + let address = s.parse::>()?; + Ok(address.assume_checked()) +} + +// Modified from: +// https://github.com/rust-lang/rust/blob/2a8221dbdfd180a2d56d4b0089f4f3952d8c2bcd/compiler/rustc_parse/src/lexer/mod.rs#LL754C5-L754C5 +fn nfc_normalize(string: &str) -> String { + use unicode_normalization::{is_nfc_quick, IsNormalized, UnicodeNormalization}; + match is_nfc_quick(string.chars()) { + IsNormalized::Yes => string.to_string(), + _ => string.chars().nfc().collect::(), + } +} diff --git a/wallet/trezor-client/src/client/common.rs b/wallet/trezor-client/src/client/common.rs new file mode 100644 index 0000000000..9da4eb4025 --- /dev/null +++ b/wallet/trezor-client/src/client/common.rs @@ -0,0 +1,247 @@ +use crate::{ + error::{Error, Result}, + messages::TrezorMessage, + protos, Trezor, +}; +use std::fmt; + +// Some types with raw protos that we use in the public interface so they have to be exported. +pub use protos::{ + button_request::ButtonRequestType, pin_matrix_request::PinMatrixRequestType, Features, +}; + +#[cfg(feature = "bitcoin")] +pub use protos::InputScriptType; + +/// The different options for the number of words in a seed phrase. +pub enum WordCount { + W12 = 12, + W18 = 18, + W24 = 24, +} + +/// The different types of user interactions the Trezor device can request. +#[derive(PartialEq, Eq, Clone, Debug)] +pub enum InteractionType { + Button, + PinMatrix, + Passphrase, + PassphraseState, +} + +//TODO(stevenroose) should this be FnOnce and put in an FnBox? +/// Function to be passed to the `Trezor.call` method to process the Trezor response message into a +/// general-purpose type. +pub type ResultHandler<'a, T, R> = dyn Fn(&'a mut Trezor, R) -> Result; + +/// A button request message sent by the device. +pub struct ButtonRequest<'a, T, R: TrezorMessage> { + pub message: protos::ButtonRequest, + pub client: &'a mut Trezor, + pub result_handler: Box>, +} + +impl<'a, T, R: TrezorMessage> fmt::Debug for ButtonRequest<'a, T, R> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&self.message, f) + } +} + +impl<'a, T, R: TrezorMessage> ButtonRequest<'a, T, R> { + /// The type of button request. + pub fn request_type(&self) -> ButtonRequestType { + self.message.code() + } + + /// Ack the request and get the next message from the device. + pub fn ack(self) -> Result> { + let req = protos::ButtonAck::new(); + self.client.call(req, self.result_handler) + } +} + +/// A PIN matrix request message sent by the device. +pub struct PinMatrixRequest<'a, T, R: TrezorMessage> { + pub message: protos::PinMatrixRequest, + pub client: &'a mut Trezor, + pub result_handler: Box>, +} + +impl<'a, T, R: TrezorMessage> fmt::Debug for PinMatrixRequest<'a, T, R> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&self.message, f) + } +} + +impl<'a, T, R: TrezorMessage> PinMatrixRequest<'a, T, R> { + /// The type of PIN matrix request. + pub fn request_type(&self) -> PinMatrixRequestType { + self.message.type_() + } + + /// Ack the request with a PIN and get the next message from the device. + pub fn ack_pin(self, pin: String) -> Result> { + let mut req = protos::PinMatrixAck::new(); + req.set_pin(pin); + self.client.call(req, self.result_handler) + } +} + +/// A passphrase request message sent by the device. +pub struct PassphraseRequest<'a, T, R: TrezorMessage> { + pub message: protos::PassphraseRequest, + pub client: &'a mut Trezor, + pub result_handler: Box>, +} + +impl<'a, T, R: TrezorMessage> fmt::Debug for PassphraseRequest<'a, T, R> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&self.message, f) + } +} + +impl<'a, T, R: TrezorMessage> PassphraseRequest<'a, T, R> { + /// Check whether the use is supposed to enter the passphrase on the device or not. + pub fn on_device(&self) -> bool { + self.message._on_device() + } + + /// Ack the request with a passphrase and get the next message from the device. + pub fn ack_passphrase(self, passphrase: String) -> Result> { + let mut req = protos::PassphraseAck::new(); + req.set_passphrase(passphrase); + self.client.call(req, self.result_handler) + } + + /// Ack the request without a passphrase to let the user enter it on the device + /// and get the next message from the device. + pub fn ack(self, on_device: bool) -> Result> { + let mut req = protos::PassphraseAck::new(); + if on_device { + req.set_on_device(on_device); + } + self.client.call(req, self.result_handler) + } +} + +/// A response from a Trezor device. On every message exchange, instead of the expected/desired +/// response, the Trezor can ask for some user interaction, or can send a failure. +#[derive(Debug)] +pub enum TrezorResponse<'a, T, R: TrezorMessage> { + Ok(T), + Failure(protos::Failure), + ButtonRequest(ButtonRequest<'a, T, R>), + PinMatrixRequest(PinMatrixRequest<'a, T, R>), + PassphraseRequest(PassphraseRequest<'a, T, R>), + //TODO(stevenroose) This should be taken out of this enum and intrinsically attached to the + // PassphraseRequest variant. However, it's currently impossible to do this. It might be + // possible to do with FnBox (currently nightly) or when Box becomes possible. +} + +impl<'a, T, R: TrezorMessage> fmt::Display for TrezorResponse<'a, T, R> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + // TODO(stevenroose) should we make T: Debug? + TrezorResponse::Ok(ref _m) => f.write_str("Ok"), + TrezorResponse::Failure(ref m) => write!(f, "Failure: {:?}", m), + TrezorResponse::ButtonRequest(ref r) => write!(f, "ButtonRequest: {:?}", r), + TrezorResponse::PinMatrixRequest(ref r) => write!(f, "PinMatrixRequest: {:?}", r), + TrezorResponse::PassphraseRequest(ref r) => write!(f, "PassphraseRequest: {:?}", r), + } + } +} + +impl<'a, T, R: TrezorMessage> TrezorResponse<'a, T, R> { + /// Get the actual `Ok` response value or an error if not `Ok`. + pub fn ok(self) -> Result { + match self { + TrezorResponse::Ok(m) => Ok(m), + TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), + TrezorResponse::ButtonRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) + } + TrezorResponse::PinMatrixRequest(_) => Err(Error::UnexpectedInteractionRequest( + InteractionType::PinMatrix, + )), + TrezorResponse::PassphraseRequest(_) => Err(Error::UnexpectedInteractionRequest( + InteractionType::Passphrase, + )), + } + } + + /// Get the button request object or an error if not `ButtonRequest`. + pub fn button_request(self) -> Result> { + match self { + TrezorResponse::ButtonRequest(r) => Ok(r), + TrezorResponse::Ok(_) => Err(Error::UnexpectedMessageType(R::MESSAGE_TYPE)), + TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), + TrezorResponse::PinMatrixRequest(_) => Err(Error::UnexpectedInteractionRequest( + InteractionType::PinMatrix, + )), + TrezorResponse::PassphraseRequest(_) => Err(Error::UnexpectedInteractionRequest( + InteractionType::Passphrase, + )), + } + } + + /// Get the PIN matrix request object or an error if not `PinMatrixRequest`. + pub fn pin_matrix_request(self) -> Result> { + match self { + TrezorResponse::PinMatrixRequest(r) => Ok(r), + TrezorResponse::Ok(_) => Err(Error::UnexpectedMessageType(R::MESSAGE_TYPE)), + TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), + TrezorResponse::ButtonRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) + } + TrezorResponse::PassphraseRequest(_) => Err(Error::UnexpectedInteractionRequest( + InteractionType::Passphrase, + )), + } + } + + /// Get the passphrase request object or an error if not `PassphraseRequest`. + pub fn passphrase_request(self) -> Result> { + match self { + TrezorResponse::PassphraseRequest(r) => Ok(r), + TrezorResponse::Ok(_) => Err(Error::UnexpectedMessageType(R::MESSAGE_TYPE)), + TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), + TrezorResponse::ButtonRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) + } + TrezorResponse::PinMatrixRequest(_) => Err(Error::UnexpectedInteractionRequest( + InteractionType::PinMatrix, + )), + } + } +} + +pub fn handle_interaction(resp: TrezorResponse<'_, T, R>) -> Result { + match resp { + TrezorResponse::Ok(res) => Ok(res), + TrezorResponse::Failure(_) => resp.ok(), // assering ok() returns the failure error + TrezorResponse::ButtonRequest(req) => handle_interaction(req.ack()?), + TrezorResponse::PinMatrixRequest(_) => Err(Error::UnsupportedNetwork), + TrezorResponse::PassphraseRequest(req) => handle_interaction({ + let on_device = req.on_device(); + req.ack(!on_device)? + }), + } +} + +/// When resetting the device, it will ask for entropy to aid key generation. +pub struct EntropyRequest<'a> { + pub client: &'a mut Trezor, +} + +impl<'a> EntropyRequest<'a> { + /// Provide exactly 32 bytes or entropy. + pub fn ack_entropy(self, entropy: Vec) -> Result> { + if entropy.len() != 32 { + return Err(Error::InvalidEntropy); + } + + let mut req = protos::EntropyAck::new(); + req.set_entropy(entropy); + self.client.call(req, Box::new(|_, _| Ok(()))) + } +} diff --git a/wallet/trezor-client/src/client/ethereum.rs b/wallet/trezor-client/src/client/ethereum.rs new file mode 100644 index 0000000000..548a0ae505 --- /dev/null +++ b/wallet/trezor-client/src/client/ethereum.rs @@ -0,0 +1,168 @@ +use super::{handle_interaction, Trezor}; +use crate::{ + error::Result, + protos::{self, ethereum_sign_tx_eip1559::EthereumAccessList, EthereumTxRequest}, + Error, +}; + +/// Access list item. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct AccessListItem { + /// Accessed address + pub address: String, + /// Accessed storage keys + pub storage_keys: Vec>, +} + +/// An ECDSA signature. +#[derive(Debug, Clone, PartialEq, Eq, Copy)] +pub struct Signature { + /// R value + pub r: [u8; 32], + /// S Value + pub s: [u8; 32], + /// V value in 'Electrum' notation. + pub v: u64, +} + +impl Trezor { + // ETHEREUM + pub fn ethereum_get_address(&mut self, path: Vec) -> Result { + let mut req = protos::EthereumGetAddress::new(); + req.address_n = path; + let address = handle_interaction(self.call( + req, + Box::new(|_, m: protos::EthereumAddress| Ok(m.address().into())), + )?)?; + Ok(address) + } + + pub fn ethereum_sign_message(&mut self, message: Vec, path: Vec) -> Result { + let mut req = protos::EthereumSignMessage::new(); + req.address_n = path; + req.set_message(message); + let signature = handle_interaction(self.call( + req, + Box::new(|_, m: protos::EthereumMessageSignature| { + let signature = m.signature(); + if signature.len() != 65 { + return Err(Error::MalformedSignature); + } + let r = signature[0..32].try_into().unwrap(); + let s = signature[32..64].try_into().unwrap(); + let v = signature[64] as u64; + Ok(Signature { r, s, v }) + }), + )?)?; + + Ok(signature) + } + + #[allow(clippy::too_many_arguments)] + pub fn ethereum_sign_tx( + &mut self, + path: Vec, + nonce: Vec, + gas_price: Vec, + gas_limit: Vec, + to: String, + value: Vec, + data: Vec, + chain_id: Option, + ) -> Result { + let mut req = protos::EthereumSignTx::new(); + let mut data = data; + + req.address_n = path; + req.set_nonce(nonce); + req.set_gas_price(gas_price); + req.set_gas_limit(gas_limit); + req.set_value(value); + if let Some(chain_id) = chain_id { + req.set_chain_id(chain_id); + } + req.set_to(to); + + req.set_data_length(data.len() as u32); + req.set_data_initial_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); + + let mut resp = + handle_interaction(self.call(req, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?)?; + + while resp.data_length() > 0 { + let mut ack = protos::EthereumTxAck::new(); + ack.set_data_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); + + resp = self.call(ack, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?.ok()?; + } + + convert_signature(&resp, chain_id) + } + + #[allow(clippy::too_many_arguments)] + pub fn ethereum_sign_eip1559_tx( + &mut self, + path: Vec, + nonce: Vec, + gas_limit: Vec, + to: String, + value: Vec, + data: Vec, + chain_id: Option, + max_gas_fee: Vec, + max_priority_fee: Vec, + access_list: Vec, + ) -> Result { + let mut req = protos::EthereumSignTxEIP1559::new(); + let mut data = data; + + req.address_n = path; + req.set_nonce(nonce); + req.set_max_gas_fee(max_gas_fee); + req.set_max_priority_fee(max_priority_fee); + req.set_gas_limit(gas_limit); + req.set_value(value); + if let Some(chain_id) = chain_id { + req.set_chain_id(chain_id); + } + req.set_to(to); + + if !access_list.is_empty() { + req.access_list = access_list + .into_iter() + .map(|item| EthereumAccessList { + address: Some(item.address), + storage_keys: item.storage_keys, + ..Default::default() + }) + .collect(); + } + + req.set_data_length(data.len() as u32); + req.set_data_initial_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); + + let mut resp = + handle_interaction(self.call(req, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?)?; + + while resp.data_length() > 0 { + let mut ack = protos::EthereumTxAck::new(); + ack.set_data_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); + + resp = self.call(ack, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?.ok()? + } + + convert_signature(&resp, chain_id) + } +} + +fn convert_signature(resp: &EthereumTxRequest, chain_id: Option) -> Result { + let mut v = resp.signature_v() as u64; + if let Some(chain_id) = chain_id { + if v <= 1 { + v = v + 2 * chain_id + 35; + } + } + let r = resp.signature_r().try_into().map_err(|_| Error::MalformedSignature)?; + let s = resp.signature_r().try_into().map_err(|_| Error::MalformedSignature)?; + Ok(Signature { r, s, v }) +} diff --git a/wallet/trezor-client/src/client/mintlayer.rs b/wallet/trezor-client/src/client/mintlayer.rs new file mode 100644 index 0000000000..95e413a9ee --- /dev/null +++ b/wallet/trezor-client/src/client/mintlayer.rs @@ -0,0 +1,130 @@ +use std::collections::BTreeMap; + +use bitcoin::secp256k1; +use protobuf::MessageField; + +use super::Trezor; +use crate::{ + error::Result, + protos::{ + self, mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper, + mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper, + mintlayer_tx_request::MintlayerRequestType, MintlayerTransferTxOutput, + MintlayerTxAckOutput, MintlayerTxAckUtxoInput, MintlayerUtxoTxInput, + }, + Error, TrezorResponse, +}; + +/// A chain code +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct ChainCode([u8; 32]); +// impl_array_newtype!(ChainCode, u8, 32); +// impl_bytes_newtype!(ChainCode, 32); + +pub struct XPub { + /// Public key + pub public_key: secp256k1::PublicKey, + /// Chain code + pub chain_code: ChainCode, +} + +impl Trezor { + // Mintlayer + pub fn mintlayer_get_public_key( + &mut self, + path: Vec, + ) -> Result> { + let mut req = protos::MintlayerGetPublicKey::new(); + req.address_n = path; + self.call( + req, + Box::new(|_, m| { + Ok(XPub { + public_key: secp256k1::PublicKey::from_slice(m.public_key())?, + chain_code: ChainCode( + m.chain_code().try_into().map_err(|_| Error::InvalidChaincodeFromDevice)?, + ), + }) + }), + ) + } + + pub fn mintlayer_sign_tx( + &mut self, + inputs: Vec, + outputs: Vec, + utxos: BTreeMap<[u8; 32], BTreeMap>, + ) -> Result>>> { + let mut req = protos::MintlayerSignTx::new(); + req.set_version(1); + req.set_inputs_count(inputs.len() as u32); + req.set_outputs_count(outputs.len() as u32); + + eprintln!("sending tx request"); + let mut msg = self.call::<_, _, protos::MintlayerTxRequest>(req, Box::new(|_, m| Ok(m)))?; + let mut should_ack_button = 0; + loop { + if should_ack_button > 0 { + eprintln!("waiting for button to sending button ack"); + msg = msg.button_request()?.ack()?; + should_ack_button -= 1; + continue; + } + + eprintln!("waiting for ok msg"); + let response = msg.ok()?; + match response.request_type() { + MintlayerRequestType::TXINPUT => { + let mut req = MintlayerTxAckInputWrapper::new(); + req.input = MessageField::from_option( + inputs.get(response.details.request_index() as usize).cloned(), + ); + let mut req2 = MintlayerTxAckUtxoInput::new(); + req2.tx = MessageField::some(req); + eprintln!("sending tx input ack {req2:?}"); + msg = self + .call::<_, _, protos::MintlayerTxRequest>(req2, Box::new(|_, m| Ok(m)))?; + } + MintlayerRequestType::TXOUTPUT => { + let mut req = MintlayerTxAckOutputWrapper::new(); + if response.details.has_tx_hash() { + let tx_id: [u8; 32] = response + .details + .tx_hash() + .try_into() + .map_err(|_| Error::InvalidChaincodeFromDevice)?; + let out = utxos + .get(&tx_id) + .and_then(|tx| tx.get(&response.details.request_index())); + req.output = MessageField::from_option(out.cloned()); + eprintln!("sending tx input output utxo"); + } else { + req.output = MessageField::from_option( + outputs.get(response.details.request_index() as usize).cloned(), + ); + eprintln!("sending tx output"); + should_ack_button += 2; + if response.details.request_index() as usize == outputs.len() - 1 { + eprintln!("last output will wait for one more ack"); + should_ack_button += 1; + } + } + let mut req2 = MintlayerTxAckOutput::new(); + req2.tx = MessageField::some(req); + msg = self + .call::<_, _, protos::MintlayerTxRequest>(req2, Box::new(|_, m| Ok(m)))?; + } + MintlayerRequestType::TXMETA => { + return Err(Error::MalformedMintlayerTxRequest(response)) + } + MintlayerRequestType::TXFINISHED => { + return Ok(response + .serialized + .iter() + .map(|s| Some(s.signature().to_vec())) + .collect()) + } + } + } + } +} diff --git a/wallet/trezor-client/src/client/mod.rs b/wallet/trezor-client/src/client/mod.rs new file mode 100644 index 0000000000..d36fa372ca --- /dev/null +++ b/wallet/trezor-client/src/client/mod.rs @@ -0,0 +1,266 @@ +#[cfg(feature = "bitcoin")] +mod bitcoin; +#[cfg(feature = "bitcoin")] +pub use self::bitcoin::*; + +#[cfg(feature = "ethereum")] +mod ethereum; +#[cfg(feature = "ethereum")] +pub use ethereum::*; + +#[cfg(feature = "solana")] +mod solana; +// #[cfg(feature = "solana")] +// pub use solana::*; + +pub mod common; +pub use common::*; + +pub mod mintlayer; +pub use mintlayer::*; + +use crate::{ + error::{Error, Result}, + messages::TrezorMessage, + protos, + protos::MessageType::*, + transport::{ProtoMessage, Transport}, + Model, +}; +use protobuf::MessageField; +use tracing::{debug, trace}; + +/// A Trezor client. +pub struct Trezor { + model: Model, + // Cached features for later inspection. + features: Option, + transport: Box, +} + +/// Create a new Trezor instance with the given transport. +pub fn trezor_with_transport(model: Model, transport: Box) -> Trezor { + Trezor { + model, + transport, + features: None, + } +} + +impl Trezor { + /// Get the model of the Trezor device. + pub fn model(&self) -> Model { + self.model + } + + /// Get the features of the Trezor device. + pub fn features(&self) -> Option<&protos::Features> { + self.features.as_ref() + } + + /// Sends a message and returns the raw ProtoMessage struct that was responded by the device. + /// This method is only exported for users that want to expand the features of this library + /// f.e. for supporting additional coins etc. + pub fn call_raw(&mut self, message: S) -> Result { + let proto_msg = ProtoMessage(S::MESSAGE_TYPE, message.write_to_bytes()?); + self.transport.write_message(proto_msg).map_err(Error::TransportSendMessage)?; + self.transport.read_message().map_err(Error::TransportReceiveMessage) + } + + /// Sends a message and returns a TrezorResponse with either the expected response message, + /// a failure or an interaction request. + /// This method is only exported for users that want to expand the features of this library + /// f.e. for supporting additional coins etc. + pub fn call<'a, T, S: TrezorMessage, R: TrezorMessage>( + &'a mut self, + message: S, + result_handler: Box>, + ) -> Result> { + trace!("Sending {:?} msg: {:?}", S::MESSAGE_TYPE, message); + let resp = self.call_raw(message)?; + if resp.message_type() == R::MESSAGE_TYPE { + let resp_msg = resp.into_message()?; + trace!("Received {:?} msg: {:?}", R::MESSAGE_TYPE, resp_msg); + Ok(TrezorResponse::Ok(result_handler(self, resp_msg)?)) + } else { + match resp.message_type() { + MessageType_Failure => { + let fail_msg = resp.into_message()?; + debug!("Received failure: {:?}", fail_msg); + Ok(TrezorResponse::Failure(fail_msg)) + } + MessageType_ButtonRequest => { + let req_msg = resp.into_message()?; + trace!("Received ButtonRequest: {:?}", req_msg); + Ok(TrezorResponse::ButtonRequest(ButtonRequest { + message: req_msg, + client: self, + result_handler, + })) + } + MessageType_PinMatrixRequest => { + let req_msg = resp.into_message()?; + trace!("Received PinMatrixRequest: {:?}", req_msg); + Ok(TrezorResponse::PinMatrixRequest(PinMatrixRequest { + message: req_msg, + client: self, + result_handler, + })) + } + MessageType_PassphraseRequest => { + let req_msg = resp.into_message()?; + trace!("Received PassphraseRequest: {:?}", req_msg); + Ok(TrezorResponse::PassphraseRequest(PassphraseRequest { + message: req_msg, + client: self, + result_handler, + })) + } + mtype => { + debug!( + "Received unexpected msg type: {:?}; raw msg: {}", + mtype, + hex::encode(resp.into_payload()) + ); + Err(Error::UnexpectedMessageType(mtype)) + } + } + } + } + + pub fn init_device(&mut self, session_id: Option>) -> Result<()> { + let features = self.initialize(session_id)?.ok()?; + self.features = Some(features); + Ok(()) + } + + pub fn initialize( + &mut self, + session_id: Option>, + ) -> Result> { + let mut req = protos::Initialize::new(); + if let Some(session_id) = session_id { + req.set_session_id(session_id); + } + self.call(req, Box::new(|_, m| Ok(m))) + } + + pub fn ping(&mut self, message: &str) -> Result> { + let mut req = protos::Ping::new(); + req.set_message(message.to_owned()); + self.call(req, Box::new(|_, _| Ok(()))) + } + + pub fn change_pin(&mut self, remove: bool) -> Result> { + let mut req = protos::ChangePin::new(); + req.set_remove(remove); + self.call(req, Box::new(|_, _| Ok(()))) + } + + pub fn wipe_device(&mut self) -> Result> { + let req = protos::WipeDevice::new(); + self.call(req, Box::new(|_, _| Ok(()))) + } + + pub fn recover_device( + &mut self, + word_count: WordCount, + passphrase_protection: bool, + pin_protection: bool, + label: String, + dry_run: bool, + ) -> Result> { + let mut req = protos::RecoveryDevice::new(); + req.set_word_count(word_count as u32); + req.set_passphrase_protection(passphrase_protection); + req.set_pin_protection(pin_protection); + req.set_label(label); + req.set_enforce_wordlist(true); + req.set_dry_run(dry_run); + req.set_type( + protos::recovery_device::RecoveryDeviceType::RecoveryDeviceType_ScrambledWords, + ); + //TODO(stevenroose) support languages + req.set_language("english".to_owned()); + self.call(req, Box::new(|_, _| Ok(()))) + } + + #[allow(clippy::too_many_arguments)] + pub fn reset_device( + &mut self, + display_random: bool, + strength: usize, + passphrase_protection: bool, + pin_protection: bool, + label: String, + skip_backup: bool, + no_backup: bool, + ) -> Result, protos::EntropyRequest>> { + let mut req = protos::ResetDevice::new(); + req.set_display_random(display_random); + req.set_strength(strength as u32); + req.set_passphrase_protection(passphrase_protection); + req.set_pin_protection(pin_protection); + req.set_label(label); + req.set_skip_backup(skip_backup); + req.set_no_backup(no_backup); + self.call(req, Box::new(|c, _| Ok(EntropyRequest { client: c }))) + } + + pub fn backup(&mut self) -> Result> { + let req = protos::BackupDevice::new(); + self.call(req, Box::new(|_, _| Ok(()))) + } + + //TODO(stevenroose) support U2F stuff? currently ignored all + + pub fn apply_settings( + &mut self, + label: Option, + use_passphrase: Option, + homescreen: Option>, + auto_lock_delay_ms: Option, + ) -> Result> { + let mut req = protos::ApplySettings::new(); + if let Some(label) = label { + req.set_label(label); + } + if let Some(use_passphrase) = use_passphrase { + req.set_use_passphrase(use_passphrase); + } + if let Some(homescreen) = homescreen { + req.set_homescreen(homescreen); + } + if let Some(auto_lock_delay_ms) = auto_lock_delay_ms { + req.set_auto_lock_delay_ms(auto_lock_delay_ms as u32); + } + self.call(req, Box::new(|_, _| Ok(()))) + } + + pub fn sign_identity( + &mut self, + identity: protos::IdentityType, + digest: Vec, + curve: String, + ) -> Result, protos::SignedIdentity>> { + let mut req = protos::SignIdentity::new(); + req.identity = MessageField::some(identity); + req.set_challenge_hidden(digest); + req.set_challenge_visual("".to_owned()); + req.set_ecdsa_curve_name(curve); + self.call(req, Box::new(|_, m| Ok(m.signature().to_owned()))) + } + + pub fn get_ecdh_session_key( + &mut self, + identity: protos::IdentityType, + peer_public_key: Vec, + curve: String, + ) -> Result> { + let mut req = protos::GetECDHSessionKey::new(); + req.identity = MessageField::some(identity); + req.set_peer_public_key(peer_public_key); + req.set_ecdsa_curve_name(curve); + self.call(req, Box::new(|_, m| Ok(m))) + } +} diff --git a/wallet/trezor-client/src/client/solana.rs b/wallet/trezor-client/src/client/solana.rs new file mode 100644 index 0000000000..483ae259d8 --- /dev/null +++ b/wallet/trezor-client/src/client/solana.rs @@ -0,0 +1,16 @@ +use super::{handle_interaction, Trezor}; +use crate::{error::Result, protos}; + +impl Trezor { + // SOLANA + pub fn solana_get_address(&mut self, path: Vec) -> Result { + let mut req = protos::SolanaGetAddress::new(); + req.address_n = path; + req.show_display = Some(true); + let address = handle_interaction(self.call( + req, + Box::new(|_, m: protos::SolanaAddress| Ok(m.address().into())), + )?)?; + Ok(address) + } +} diff --git a/wallet/trezor-client/src/error.rs b/wallet/trezor-client/src/error.rs new file mode 100644 index 0000000000..777e9bfc6e --- /dev/null +++ b/wallet/trezor-client/src/error.rs @@ -0,0 +1,105 @@ +//! # Error Handling + +use crate::{client::InteractionType, protos, transport::error::Error as TransportError}; + +/// Trezor result type. Aliased to [`std::result::Result`] with the error type +/// set to [`Error`]. +pub type Result = std::result::Result; + +/// Trezor error. +#[derive(Debug, thiserror::Error)] +pub enum Error { + /// Less than one device was plugged in. + #[error("Trezor device not found")] + NoDeviceFound, + /// More than one device was plugged in. + #[error("multiple Trezor devices found")] + DeviceNotUnique, + /// The device returned an invalid signature. + #[error("device returned invalid signature")] + MalformedSignature, + /// Transport error connecting to device. + #[error("transport connect: {0}")] + TransportConnect(#[source] TransportError), + /// Transport error while beginning a session. + #[error("transport beginning session: {0}")] + TransportBeginSession(#[source] TransportError), + /// Transport error while ending a session. + #[error("transport ending session: {0}")] + TransportEndSession(#[source] TransportError), + /// Transport error while sending a message. + #[error("transport sending message: {0}")] + TransportSendMessage(#[source] TransportError), + /// Transport error while receiving a message. + #[error("transport receiving message: {0}")] + TransportReceiveMessage(#[source] TransportError), + /// Received an unexpected message type from the device. + #[error("received unexpected message type: {0:?}")] + UnexpectedMessageType(protos::MessageType), //TODO(stevenroose) type alias + /// Error reading or writing protobuf messages. + #[error(transparent)] + Protobuf(#[from] protobuf::Error), + /// A failure message was returned by the device. + #[error("failure received: code={:?} message=\"{}\"", .0.code(), .0.message())] + FailureResponse(protos::Failure), + /// An unexpected interaction request was returned by the device. + #[error("unexpected interaction request: {0:?}")] + UnexpectedInteractionRequest(InteractionType), + /// The given Bitcoin network is not supported. + #[error("given network is not supported")] + UnsupportedNetwork, + /// Provided entropy is not 32 bytes. + #[error("provided entropy is not 32 bytes")] + InvalidEntropy, + /// The device erenced a non-existing input or output index. + #[error("device referenced non-existing input or output index: {0}")] + TxRequestInvalidIndex(usize), + + /// User provided invalid PSBT. + #[error("PSBT missing input tx: {0}")] + InvalidPsbt(String), + + // bitcoin + /// Error in Base58 decoding + #[cfg(feature = "bitcoin")] + #[error(transparent)] + Base58(#[from] bitcoin::base58::Error), + /// The device erenced an unknown TXID. + #[cfg(feature = "bitcoin")] + #[error("device referenced unknown TXID: {0}")] + TxRequestUnknownTxid(bitcoin::hashes::sha256d::Hash), + /// The PSBT is missing the full tx for given input. + #[cfg(feature = "bitcoin")] + #[error("PSBT missing input tx: {0}")] + PsbtMissingInputTx(bitcoin::hashes::sha256d::Hash), + /// Device produced invalid TxRequest message. + #[cfg(feature = "bitcoin")] + #[error("malformed TxRequest: {0:?}")] + MalformedTxRequest(protos::TxRequest), + /// Error encoding/decoding a Bitcoin data structure. + #[cfg(feature = "bitcoin")] + #[error(transparent)] + BitcoinEncode(#[from] bitcoin::consensus::encode::Error), + /// Elliptic curve crypto error. + #[cfg(feature = "bitcoin")] + #[error(transparent)] + Secp256k1(#[from] bitcoin::secp256k1::Error), + /// Bip32 error. + #[cfg(feature = "bitcoin")] + #[error(transparent)] + Bip32(#[from] bitcoin::bip32::Error), + /// Address error. + #[cfg(feature = "bitcoin")] + #[error(transparent)] + Address(#[from] bitcoin::address::ParseError), + + // bintlayer + /// Chaincode error. + #[cfg(feature = "mintlayer")] + #[error("Invalid chaincode length returned from device")] + InvalidChaincodeFromDevice, + /// Device produced invalid TxRequest message. + #[cfg(feature = "mintlayer")] + #[error("malformed MintlayerTxRequest: {0:?}")] + MalformedMintlayerTxRequest(protos::MintlayerTxRequest), +} diff --git a/wallet/trezor-client/src/flows/sign_tx.rs b/wallet/trezor-client/src/flows/sign_tx.rs new file mode 100644 index 0000000000..e02972a9fb --- /dev/null +++ b/wallet/trezor-client/src/flows/sign_tx.rs @@ -0,0 +1,332 @@ +//! Logic to handle the sign_tx command flow. + +#![allow(clippy::all)] + +use crate::{ + client::*, + error::{Error, Result}, + protos::{ + self, + tx_ack::{ + transaction_type::{TxOutputBinType, TxOutputType}, + TransactionType, + }, + }, + utils, +}; +use bitcoin::{hashes::sha256d, psbt, Network, Transaction}; +use protos::{ + tx_ack::transaction_type::TxInputType, tx_request::RequestType as TxRequestType, + InputScriptType, OutputScriptType, +}; +use tracing::trace; + +/// Fulfill a TxRequest for TXINPUT. +fn ack_input_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { + if req.details.is_none() || !req.details.has_request_index() { + return Err(Error::MalformedTxRequest(req.clone())); + } + + // Choose either the tx we are signing or a dependent tx. + let input_index = req.details.request_index() as usize; + let input = if req.details.has_tx_hash() { + let req_hash: sha256d::Hash = utils::from_rev_bytes(req.details.tx_hash()) + .ok_or_else(|| Error::MalformedTxRequest(req.clone()))?; + trace!("Preparing ack for input {}:{}", req_hash, input_index); + let inp = utils::psbt_find_input(psbt, req_hash)?; + let tx = inp.non_witness_utxo.as_ref().ok_or(Error::PsbtMissingInputTx(req_hash))?; + let opt = &tx.input.get(input_index); + opt.ok_or_else(|| Error::TxRequestInvalidIndex(input_index))? + } else { + trace!("Preparing ack for tx input #{}", input_index); + let opt = &psbt.unsigned_tx.input.get(input_index); + opt.ok_or(Error::TxRequestInvalidIndex(input_index))? + }; + + let mut data_input = TxInputType::new(); + data_input + .set_prev_hash(utils::to_rev_bytes(input.previous_output.txid.as_raw_hash()).to_vec()); + data_input.set_prev_index(input.previous_output.vout); + data_input.set_script_sig(input.script_sig.to_bytes()); + data_input.set_sequence(input.sequence.to_consensus_u32()); + + // Extra data only for currently signing tx. + if !req.details.has_tx_hash() { + let psbt_input = psbt + .inputs + .get(input_index) + .ok_or_else(|| Error::InvalidPsbt("not enough psbt inputs".to_owned()))?; + + // Get the output we are spending from the PSBT input. + let txout = if let Some(ref txout) = psbt_input.witness_utxo { + txout + } else if let Some(ref tx) = psbt_input.non_witness_utxo { + tx.output.get(input.previous_output.vout as usize).ok_or_else(|| { + Error::InvalidPsbt(format!("invalid utxo for PSBT input {}", input_index)) + })? + } else { + return Err(Error::InvalidPsbt(format!( + "no utxo for PSBT input {}", + input_index + ))); + }; + + // If there is exactly 1 HD keypath known, we can provide it. If more it's multisig. + if psbt_input.bip32_derivation.len() == 1 { + let (_, (_, path)) = psbt_input.bip32_derivation.iter().next().unwrap(); + data_input.address_n = path.as_ref().iter().map(|i| (*i).into()).collect(); + } + + // Since we know the keypath, we probably have to sign it. So update script_type. + let script_type = { + let script_pubkey = &txout.script_pubkey; + + if script_pubkey.is_p2pkh() { + InputScriptType::SPENDADDRESS + } else if script_pubkey.is_p2wpkh() || script_pubkey.is_p2wsh() { + InputScriptType::SPENDWITNESS + } else if script_pubkey.is_p2sh() && psbt_input.witness_script.is_some() { + InputScriptType::SPENDP2SHWITNESS + } else { + //TODO(stevenroose) normal p2sh is probably multisig + InputScriptType::EXTERNAL + } + }; + data_input.set_script_type(script_type); + //TODO(stevenroose) multisig + + data_input.set_amount(txout.value.to_sat()); + } + + trace!("Prepared input to ack: {:?}", data_input); + let mut txdata = TransactionType::new(); + txdata.inputs.push(data_input); + let mut msg = protos::TxAck::new(); + msg.tx = protobuf::MessageField::some(txdata); + Ok(msg) +} + +/// Fulfill a TxRequest for TXOUTPUT. +fn ack_output_request( + req: &protos::TxRequest, + psbt: &psbt::Psbt, + network: Network, +) -> Result { + if req.details.is_none() || !req.details.has_request_index() { + return Err(Error::MalformedTxRequest(req.clone())); + } + + // For outputs, the Trezor only needs bin_outputs to be set for dependent txs and full outputs + // for the signing tx. + let mut txdata = TransactionType::new(); + if req.details.has_tx_hash() { + // Dependent tx, take the output from the PSBT and just create bin_output. + let output_index = req.details.request_index() as usize; + let req_hash: sha256d::Hash = utils::from_rev_bytes(req.details.tx_hash()) + .ok_or_else(|| Error::MalformedTxRequest(req.clone()))?; + trace!("Preparing ack for output {}:{}", req_hash, output_index); + let inp = utils::psbt_find_input(psbt, req_hash)?; + let output = if let Some(ref tx) = inp.non_witness_utxo { + let opt = &tx.output.get(output_index); + opt.ok_or_else(|| Error::TxRequestInvalidIndex(output_index))? + } else if let Some(ref utxo) = inp.witness_utxo { + utxo + } else { + return Err(Error::InvalidPsbt( + "not all inputs have utxo data".to_owned(), + )); + }; + + let mut bin_output = TxOutputBinType::new(); + bin_output.set_amount(output.value.to_sat()); + bin_output.set_script_pubkey(output.script_pubkey.to_bytes()); + + trace!("Prepared bin_output to ack: {:?}", bin_output); + txdata.bin_outputs.push(bin_output); + } else { + // Signing tx, we need to fill the full output meta object. + let output_index = req.details.request_index() as usize; + trace!("Preparing ack for tx output #{}", output_index); + let opt = &psbt.unsigned_tx.output.get(output_index); + let output = opt.ok_or(Error::TxRequestInvalidIndex(output_index))?; + + let mut data_output = TxOutputType::new(); + data_output.set_amount(output.value.to_sat()); + // Set script type to PAYTOADDRESS unless we find out otherwise from the PSBT. + data_output.set_script_type(OutputScriptType::PAYTOADDRESS); + if let Some(addr) = utils::address_from_script(&output.script_pubkey, network) { + data_output.set_address(addr.to_string()); + } + + let psbt_output = psbt + .outputs + .get(output_index) + .ok_or_else(|| Error::InvalidPsbt("output indices don't match".to_owned()))?; + if psbt_output.bip32_derivation.len() == 1 { + let (_, (_, path)) = psbt_output.bip32_derivation.iter().next().unwrap(); + data_output.address_n = path.as_ref().iter().map(|i| (*i).into()).collect(); + + // Since we know the keypath, it's probably a change output. So update script_type. + let script_pubkey = &psbt.unsigned_tx.output[output_index].script_pubkey; + if script_pubkey.is_op_return() { + data_output.set_script_type(OutputScriptType::PAYTOOPRETURN); + data_output.set_op_return_data(script_pubkey.as_bytes()[1..].to_vec()); + } else if psbt_output.witness_script.is_some() { + if psbt_output.redeem_script.is_some() { + data_output.set_script_type(OutputScriptType::PAYTOP2SHWITNESS); + } else { + data_output.set_script_type(OutputScriptType::PAYTOWITNESS); + } + } else { + data_output.set_script_type(OutputScriptType::PAYTOADDRESS); + } + } + + trace!("Prepared output to ack: {:?}", data_output); + txdata.outputs.push(data_output); + }; + + let mut msg = protos::TxAck::new(); + msg.tx = protobuf::MessageField::some(txdata); + Ok(msg) +} + +/// Fulfill a TxRequest for TXMETA. +fn ack_meta_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { + if req.details.is_none() { + return Err(Error::MalformedTxRequest(req.clone())); + } + + // Choose either the tx we are signing or a dependent tx. + let tx: &Transaction = if req.details.has_tx_hash() { + // dependeny tx, look for it in PSBT inputs + let req_hash: sha256d::Hash = utils::from_rev_bytes(req.details.tx_hash()) + .ok_or_else(|| Error::MalformedTxRequest(req.clone()))?; + trace!("Preparing ack for tx meta of {}", req_hash); + let inp = utils::psbt_find_input(psbt, req_hash)?; + inp.non_witness_utxo.as_ref().ok_or(Error::PsbtMissingInputTx(req_hash))? + } else { + // currently signing tx + trace!("Preparing ack for tx meta of tx being signed"); + &psbt.unsigned_tx + }; + + let mut txdata = TransactionType::new(); + txdata.set_version(tx.version.0 as u32); + txdata.set_lock_time(tx.lock_time.to_consensus_u32()); + txdata.set_inputs_cnt(tx.input.len() as u32); + txdata.set_outputs_cnt(tx.output.len() as u32); + //TODO(stevenroose) python does something with extra data? + + trace!("Prepared tx meta to ack: {:?}", txdata); + let mut msg = protos::TxAck::new(); + msg.tx = protobuf::MessageField::some(txdata); + Ok(msg) +} + +/// Object to track the progress in the transaction signing flow. The device will ask for various +/// parts of the transaction and dependent transactions and can at any point also ask for user +/// interaction. The information asked for by the device is provided based on a PSBT object and the +/// resulting extra signatures are also added to the PSBT file. +/// +/// It's important to always first check with the `finished()` method if more data is requested by +/// the device. If you're not yet finished you must call the `ack_psbt()` method to send more +/// information to the device. +pub struct SignTxProgress<'a> { + client: &'a mut Trezor, + req: protos::TxRequest, +} + +impl<'a> SignTxProgress<'a> { + /// Only intended for internal usage. + pub fn new(client: &mut Trezor, req: protos::TxRequest) -> SignTxProgress<'_> { + SignTxProgress { client, req } + } + + /// Inspector to the request message received from the device. + pub fn tx_request(&self) -> &protos::TxRequest { + &self.req + } + + /// Check whether or not the signing process is finished. + pub fn finished(&self) -> bool { + self.req.request_type() == TxRequestType::TXFINISHED + } + + /// Check if a signature is provided by the device. + pub fn has_signature(&self) -> bool { + let serialized = &self.req.serialized; + serialized.is_some() && serialized.has_signature_index() && serialized.has_signature() + } + + /// Get the signature provided from the device along with the input index of the signature. + pub fn get_signature(&self) -> Option<(usize, &[u8])> { + if self.has_signature() { + let serialized = &self.req.serialized; + Some(( + serialized.signature_index() as usize, + serialized.signature(), + )) + } else { + None + } + } + + //TODO(stevenroose) We used to have a method here `apply_signature(&mut psbt)` that would put + // the received signature in the correct PSBT input. However, since the signature is just a raw + // signature instead of a scriptSig, this is harder. It can be done, but then we'd have to have + // the pubkey provided in the PSBT (possible thought HD path) and we'd have to do some Script + // inspection to see if we should put it as a p2pkh sciptSig or witness data. + + /// Check if a part of the serialized signed tx is provided by the device. + pub fn has_serialized_tx_part(&self) -> bool { + let serialized = &self.req.serialized; + serialized.is_some() && serialized.has_serialized_tx() + } + + /// Get the part of the serialized signed tx from the device. + pub fn get_serialized_tx_part(&self) -> Option<&[u8]> { + if self.has_serialized_tx_part() { + Some(self.req.serialized.serialized_tx()) + } else { + None + } + } + + /// Manually provide a TxAck message to the device. + /// + /// This method will panic if `finished()` returned true, + /// so it should always be checked in advance. + pub fn ack_msg( + self, + ack: protos::TxAck, + ) -> Result, protos::TxRequest>> { + assert!(!self.finished()); + + self.client.call(ack, Box::new(|c, m| Ok(SignTxProgress::new(c, m)))) + } + + /// Provide additional PSBT information to the device. + /// + /// This method will panic if `apply()` returned true, + /// so it should always be checked in advance. + pub fn ack_psbt( + self, + psbt: &psbt::Psbt, + network: Network, + ) -> Result, protos::TxRequest>> { + assert!(self.req.request_type() != TxRequestType::TXFINISHED); + + let ack = match self.req.request_type() { + TxRequestType::TXINPUT => ack_input_request(&self.req, psbt), + TxRequestType::TXOUTPUT => ack_output_request(&self.req, psbt, network), + TxRequestType::TXMETA => ack_meta_request(&self.req, psbt), + TxRequestType::TXEXTRADATA => unimplemented!(), //TODO(stevenroose) implement + TxRequestType::TXORIGINPUT + | TxRequestType::TXORIGOUTPUT + | TxRequestType::TXPAYMENTREQ => unimplemented!(), + TxRequestType::TXFINISHED => unreachable!(), + }?; + self.ack_msg(ack) + } +} diff --git a/wallet/trezor-client/src/lib.rs b/wallet/trezor-client/src/lib.rs new file mode 100644 index 0000000000..d69445e641 --- /dev/null +++ b/wallet/trezor-client/src/lib.rs @@ -0,0 +1,247 @@ +//! # Trezor API library +//! +//! ## Connecting +//! +//! Use the public top-level methods `find_devices()` and `unique()` to find devices. When using +//! `find_devices()`, a list of different available devices is returned. To connect to one or more +//! of them, use their `connect()` method. +//! +//! ## Logging +//! +//! We use the log package interface, so any logger that supports log can be attached. +//! Please be aware that `trace` logging can contain sensitive data. + +#![allow(clippy::all)] +#![warn(unreachable_pub, rustdoc::all)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] +#![deny(unused_must_use, rust_2018_idioms)] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + +#[allow(clippy::all)] +mod messages; + +pub mod client; +pub mod error; +pub mod protos; +pub mod transport; +#[cfg(feature = "bitcoin")] +pub mod utils; + +#[allow(clippy::all)] +mod flows { + #[cfg(feature = "bitcoin")] + pub(crate) mod sign_tx; +} + +pub use client::{ + ButtonRequest, ButtonRequestType, EntropyRequest, Features, PassphraseRequest, + PinMatrixRequest, PinMatrixRequestType, Trezor, TrezorResponse, WordCount, +}; +pub use error::{Error, Result}; +pub use messages::TrezorMessage; + +#[cfg(feature = "bitcoin")] +pub use flows::sign_tx::SignTxProgress; +#[cfg(feature = "bitcoin")] +pub use protos::InputScriptType; + +use std::fmt; +use tracing::{debug, warn}; +use transport::{udp::UdpTransport, webusb::WebUsbTransport}; + +/// The different kind of Trezor device models. +#[derive(PartialEq, Eq, Clone, Debug, Copy)] +pub enum Model { + TrezorLegacy, + Trezor, + TrezorBootloader, + TrezorEmulator, +} + +impl fmt::Display for Model { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.as_str()) + } +} + +impl Model { + pub const fn as_str(&self) -> &'static str { + match self { + Model::TrezorLegacy => "Trezor (legacy)", + Model::Trezor => "Trezor", + Model::TrezorBootloader => "Trezor (bootloader)", + Model::TrezorEmulator => "Trezor Emulator", + } + } +} + +/// A device found by the `find_devices()` method. It can be connected to using the `connect()` +/// method. +#[derive(Debug)] +pub struct AvailableDevice { + pub model: Model, + pub debug: bool, + transport: transport::AvailableDeviceTransport, +} + +impl fmt::Display for AvailableDevice { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "{} (transport: {}) (debug: {})", + self.model, &self.transport, self.debug + ) + } +} + +impl AvailableDevice { + /// Connect to the device. + pub fn connect(self) -> Result { + let transport = transport::connect(&self).map_err(Error::TransportConnect)?; + Ok(client::trezor_with_transport(self.model, transport)) + } +} + +/// Search for all available devices. +/// Most devices will show up twice both either debugging enables or disabled. +pub fn find_devices(debug: bool) -> Vec { + let mut devices = vec![]; + + match WebUsbTransport::find_devices(debug) { + Ok(usb) => devices.extend(usb), + Err(err) => { + warn!("{}", Error::TransportConnect(err)) + } + }; + + match UdpTransport::find_devices(debug, None) { + Ok(udp) => devices.extend(udp), + Err(err) => { + warn!("{}", Error::TransportConnect(err)) + } + }; + + devices +} + +/// Try to get a single device. Optionally specify whether debug should be enabled or not. +/// Can error if there are multiple or no devices available. +/// For more fine-grained device selection, use `find_devices()`. +/// When using USB mode, the device will show up both with debug and without debug, so it's +/// necessary to specify the debug option in order to find a unique one. +pub fn unique(debug: bool) -> Result { + let mut devices = find_devices(debug); + match devices.len() { + 0 => Err(Error::NoDeviceFound), + 1 => Ok(devices.remove(0).connect()?), + _ => { + debug!("Trezor devices found: {:?}", devices); + Err(Error::DeviceNotUnique) + } + } +} + +#[cfg(test)] +mod tests { + use serial_test::serial; + use std::str::FromStr; + + use crate::{client::handle_interaction, protos::IdentityType}; + use bitcoin::{bip32::DerivationPath, hex::FromHex}; + + use super::*; + + fn init_emulator() -> Trezor { + let mut emulator = find_devices(false) + .into_iter() + .find(|t| t.model == Model::TrezorEmulator) + .expect("No emulator found") + .connect() + .expect("Failed to connect to emulator"); + emulator.init_device(None).expect("Failed to intialize device"); + emulator + } + + #[test] + #[serial] + fn test_emulator_find() { + let trezors = find_devices(false); + assert!(!trezors.is_empty()); + assert!(trezors.iter().any(|t| t.model == Model::TrezorEmulator)); + } + + #[test] + #[serial] + fn test_emulator_features() { + let emulator = init_emulator(); + let features = emulator.features().expect("Failed to get features"); + assert_eq!(features.vendor(), "trezor.io"); + assert!(features.initialized()); + assert!(!features.firmware_present()); + assert!(features.initialized()); + assert!(!features.pin_protection()); + assert!(!features.passphrase_protection()); + assert!(["T", "Safe 3"].contains(&features.model())); + } + + #[test] + #[serial] + fn test_bitcoin_address() { + let mut emulator = init_emulator(); + assert_eq!( + emulator.features().expect("Failed to get features").label(), + "SLIP-0014" + ); + let path = DerivationPath::from_str("m/44'/1'/0'/0/0").expect("Failed to parse path"); + let address = emulator + .get_address( + &path, + InputScriptType::SPENDADDRESS, + bitcoin::Network::Testnet, + false, + ) + .expect("Failed to get address"); + assert_eq!( + address.ok().unwrap().to_string(), + "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q" + ); + } + + #[ignore] + #[test] + #[serial] + fn test_ecdh_shared_secret() { + tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); + + let mut emulator = init_emulator(); + assert_eq!( + emulator.features().expect("Failed to get features").label(), + "SLIP-0014" + ); + + let mut ident = IdentityType::new(); + ident.set_proto("gpg".to_owned()); + ident.set_user("".to_owned()); + ident.set_host("Satoshi Nakamoto ".to_owned()); + ident.set_port("".to_owned()); + ident.set_path("".to_owned()); + ident.set_index(0); + + let peer_public_key = Vec::from_hex("0407f2c6e5becf3213c1d07df0cfbe8e39f70a8c643df7575e5c56859ec52c45ca950499c019719dae0fda04248d851e52cf9d66eeb211d89a77be40de22b6c89d").unwrap(); + let curve_name = "secp256k1".to_owned(); + let response = handle_interaction( + emulator + .get_ecdh_session_key(ident, peer_public_key, curve_name) + .expect("Failed to get ECDH shared secret"), + ) + .unwrap(); + + let expected_session_key = Vec::from_hex("048125883b086746244b0d2c548860ecc723346e14c87e51dc7ba32791bc780d132dbd814fbee77134f318afac6ad6db3c5334efe6a8798628a1038195b96e82e2").unwrap(); + assert_eq!(response.session_key(), &expected_session_key); + + let expected_public_key = + Vec::from_hex("032726ba71aa066b47fc0f90b389f8c3e02fe20b94c858395d71f260e9944e3c65") + .unwrap(); + assert_eq!(response.public_key(), &expected_public_key); + } +} diff --git a/wallet/trezor-client/src/messages/generated.rs b/wallet/trezor-client/src/messages/generated.rs new file mode 100644 index 0000000000..83b12bf65f --- /dev/null +++ b/wallet/trezor-client/src/messages/generated.rs @@ -0,0 +1,306 @@ +trezor_message_impl! { + Initialize => MessageType_Initialize, + Ping => MessageType_Ping, + Success => MessageType_Success, + Failure => MessageType_Failure, + ChangePin => MessageType_ChangePin, + WipeDevice => MessageType_WipeDevice, + GetEntropy => MessageType_GetEntropy, + Entropy => MessageType_Entropy, + LoadDevice => MessageType_LoadDevice, + ResetDevice => MessageType_ResetDevice, + SetBusy => MessageType_SetBusy, + Features => MessageType_Features, + PinMatrixRequest => MessageType_PinMatrixRequest, + PinMatrixAck => MessageType_PinMatrixAck, + Cancel => MessageType_Cancel, + LockDevice => MessageType_LockDevice, + ApplySettings => MessageType_ApplySettings, + ButtonRequest => MessageType_ButtonRequest, + ButtonAck => MessageType_ButtonAck, + ApplyFlags => MessageType_ApplyFlags, + GetNonce => MessageType_GetNonce, + Nonce => MessageType_Nonce, + BackupDevice => MessageType_BackupDevice, + EntropyRequest => MessageType_EntropyRequest, + EntropyAck => MessageType_EntropyAck, + PassphraseRequest => MessageType_PassphraseRequest, + PassphraseAck => MessageType_PassphraseAck, + RecoveryDevice => MessageType_RecoveryDevice, + WordRequest => MessageType_WordRequest, + WordAck => MessageType_WordAck, + GetFeatures => MessageType_GetFeatures, + SdProtect => MessageType_SdProtect, + ChangeWipeCode => MessageType_ChangeWipeCode, + EndSession => MessageType_EndSession, + DoPreauthorized => MessageType_DoPreauthorized, + PreauthorizedRequest => MessageType_PreauthorizedRequest, + CancelAuthorization => MessageType_CancelAuthorization, + RebootToBootloader => MessageType_RebootToBootloader, + GetFirmwareHash => MessageType_GetFirmwareHash, + FirmwareHash => MessageType_FirmwareHash, + UnlockPath => MessageType_UnlockPath, + UnlockedPathRequest => MessageType_UnlockedPathRequest, + ShowDeviceTutorial => MessageType_ShowDeviceTutorial, + UnlockBootloader => MessageType_UnlockBootloader, + AuthenticateDevice => MessageType_AuthenticateDevice, + AuthenticityProof => MessageType_AuthenticityProof, + ChangeLanguage => MessageType_ChangeLanguage, + TranslationDataRequest => MessageType_TranslationDataRequest, + TranslationDataAck => MessageType_TranslationDataAck, + SetU2FCounter => MessageType_SetU2FCounter, + GetNextU2FCounter => MessageType_GetNextU2FCounter, + NextU2FCounter => MessageType_NextU2FCounter, + Deprecated_PassphraseStateRequest => MessageType_Deprecated_PassphraseStateRequest, + Deprecated_PassphraseStateAck => MessageType_Deprecated_PassphraseStateAck, + FirmwareErase => MessageType_FirmwareErase, + FirmwareUpload => MessageType_FirmwareUpload, + FirmwareRequest => MessageType_FirmwareRequest, + ProdTestT1 => MessageType_ProdTestT1, + CipherKeyValue => MessageType_CipherKeyValue, + CipheredKeyValue => MessageType_CipheredKeyValue, + SignIdentity => MessageType_SignIdentity, + SignedIdentity => MessageType_SignedIdentity, + GetECDHSessionKey => MessageType_GetECDHSessionKey, + ECDHSessionKey => MessageType_ECDHSessionKey, + CosiCommit => MessageType_CosiCommit, + CosiCommitment => MessageType_CosiCommitment, + CosiSign => MessageType_CosiSign, + CosiSignature => MessageType_CosiSignature, + DebugLinkDecision => MessageType_DebugLinkDecision, + DebugLinkGetState => MessageType_DebugLinkGetState, + DebugLinkState => MessageType_DebugLinkState, + DebugLinkStop => MessageType_DebugLinkStop, + DebugLinkLog => MessageType_DebugLinkLog, + DebugLinkMemoryRead => MessageType_DebugLinkMemoryRead, + DebugLinkMemory => MessageType_DebugLinkMemory, + DebugLinkMemoryWrite => MessageType_DebugLinkMemoryWrite, + DebugLinkFlashErase => MessageType_DebugLinkFlashErase, + DebugLinkLayout => MessageType_DebugLinkLayout, + DebugLinkReseedRandom => MessageType_DebugLinkReseedRandom, + DebugLinkRecordScreen => MessageType_DebugLinkRecordScreen, + DebugLinkEraseSdCard => MessageType_DebugLinkEraseSdCard, + DebugLinkWatchLayout => MessageType_DebugLinkWatchLayout, + DebugLinkResetDebugEvents => MessageType_DebugLinkResetDebugEvents, +} + +#[cfg(feature = "binance")] +trezor_message_impl! { + BinanceGetAddress => MessageType_BinanceGetAddress, + BinanceAddress => MessageType_BinanceAddress, + BinanceGetPublicKey => MessageType_BinanceGetPublicKey, + BinancePublicKey => MessageType_BinancePublicKey, + BinanceSignTx => MessageType_BinanceSignTx, + BinanceTxRequest => MessageType_BinanceTxRequest, + BinanceTransferMsg => MessageType_BinanceTransferMsg, + BinanceOrderMsg => MessageType_BinanceOrderMsg, + BinanceCancelMsg => MessageType_BinanceCancelMsg, + BinanceSignedTx => MessageType_BinanceSignedTx, +} + +#[cfg(feature = "bitcoin")] +trezor_message_impl! { + GetPublicKey => MessageType_GetPublicKey, + PublicKey => MessageType_PublicKey, + SignTx => MessageType_SignTx, + TxRequest => MessageType_TxRequest, + TxAck => MessageType_TxAck, + GetAddress => MessageType_GetAddress, + Address => MessageType_Address, + TxAckPaymentRequest => MessageType_TxAckPaymentRequest, + SignMessage => MessageType_SignMessage, + VerifyMessage => MessageType_VerifyMessage, + MessageSignature => MessageType_MessageSignature, + GetOwnershipId => MessageType_GetOwnershipId, + OwnershipId => MessageType_OwnershipId, + GetOwnershipProof => MessageType_GetOwnershipProof, + OwnershipProof => MessageType_OwnershipProof, + AuthorizeCoinJoin => MessageType_AuthorizeCoinJoin, +} + +#[cfg(feature = "cardano")] +trezor_message_impl! { + CardanoGetPublicKey => MessageType_CardanoGetPublicKey, + CardanoPublicKey => MessageType_CardanoPublicKey, + CardanoGetAddress => MessageType_CardanoGetAddress, + CardanoAddress => MessageType_CardanoAddress, + CardanoTxItemAck => MessageType_CardanoTxItemAck, + CardanoTxAuxiliaryDataSupplement => MessageType_CardanoTxAuxiliaryDataSupplement, + CardanoTxWitnessRequest => MessageType_CardanoTxWitnessRequest, + CardanoTxWitnessResponse => MessageType_CardanoTxWitnessResponse, + CardanoTxHostAck => MessageType_CardanoTxHostAck, + CardanoTxBodyHash => MessageType_CardanoTxBodyHash, + CardanoSignTxFinished => MessageType_CardanoSignTxFinished, + CardanoSignTxInit => MessageType_CardanoSignTxInit, + CardanoTxInput => MessageType_CardanoTxInput, + CardanoTxOutput => MessageType_CardanoTxOutput, + CardanoAssetGroup => MessageType_CardanoAssetGroup, + CardanoToken => MessageType_CardanoToken, + CardanoTxCertificate => MessageType_CardanoTxCertificate, + CardanoTxWithdrawal => MessageType_CardanoTxWithdrawal, + CardanoTxAuxiliaryData => MessageType_CardanoTxAuxiliaryData, + CardanoPoolOwner => MessageType_CardanoPoolOwner, + CardanoPoolRelayParameters => MessageType_CardanoPoolRelayParameters, + CardanoGetNativeScriptHash => MessageType_CardanoGetNativeScriptHash, + CardanoNativeScriptHash => MessageType_CardanoNativeScriptHash, + CardanoTxMint => MessageType_CardanoTxMint, + CardanoTxCollateralInput => MessageType_CardanoTxCollateralInput, + CardanoTxRequiredSigner => MessageType_CardanoTxRequiredSigner, + CardanoTxInlineDatumChunk => MessageType_CardanoTxInlineDatumChunk, + CardanoTxReferenceScriptChunk => MessageType_CardanoTxReferenceScriptChunk, + CardanoTxReferenceInput => MessageType_CardanoTxReferenceInput, +} + +#[cfg(feature = "eos")] +trezor_message_impl! { + EosGetPublicKey => MessageType_EosGetPublicKey, + EosPublicKey => MessageType_EosPublicKey, + EosSignTx => MessageType_EosSignTx, + EosTxActionRequest => MessageType_EosTxActionRequest, + EosTxActionAck => MessageType_EosTxActionAck, + EosSignedTx => MessageType_EosSignedTx, +} + +#[cfg(feature = "ethereum")] +trezor_message_impl! { + EthereumGetPublicKey => MessageType_EthereumGetPublicKey, + EthereumPublicKey => MessageType_EthereumPublicKey, + EthereumGetAddress => MessageType_EthereumGetAddress, + EthereumAddress => MessageType_EthereumAddress, + EthereumSignTx => MessageType_EthereumSignTx, + EthereumSignTxEIP1559 => MessageType_EthereumSignTxEIP1559, + EthereumTxRequest => MessageType_EthereumTxRequest, + EthereumTxAck => MessageType_EthereumTxAck, + EthereumSignMessage => MessageType_EthereumSignMessage, + EthereumVerifyMessage => MessageType_EthereumVerifyMessage, + EthereumMessageSignature => MessageType_EthereumMessageSignature, + EthereumSignTypedData => MessageType_EthereumSignTypedData, + EthereumTypedDataStructRequest => MessageType_EthereumTypedDataStructRequest, + EthereumTypedDataStructAck => MessageType_EthereumTypedDataStructAck, + EthereumTypedDataValueRequest => MessageType_EthereumTypedDataValueRequest, + EthereumTypedDataValueAck => MessageType_EthereumTypedDataValueAck, + EthereumTypedDataSignature => MessageType_EthereumTypedDataSignature, + EthereumSignTypedHash => MessageType_EthereumSignTypedHash, +} + +#[cfg(feature = "mintlayer")] +trezor_message_impl! { + MintlayerGetAddress => MessageType_MintlayerGetAddress, + MintlayerAddress => MessageType_MintlayerAddress, + MintlayerGetPublicKey => MessageType_MintlayerGetPublicKey, + MintlayerPublicKey => MessageType_MintlayerPublicKey, + MintlayerVerifySig => MessageType_MintlayerVerifySig, + MintlayerSignTx => MessageType_MintlayerSignTx, + MintlayerTxRequest => MessageType_MintlayerTxRequest, + MintlayerTxAckUtxoInput => MessageType_MintlayerTxAckUtxoInput, + MintlayerTxAckOutput => MessageType_MintlayerTxAckOutput, +} + +#[cfg(feature = "monero")] +trezor_message_impl! { + MoneroTransactionInitRequest => MessageType_MoneroTransactionInitRequest, + MoneroTransactionInitAck => MessageType_MoneroTransactionInitAck, + MoneroTransactionSetInputRequest => MessageType_MoneroTransactionSetInputRequest, + MoneroTransactionSetInputAck => MessageType_MoneroTransactionSetInputAck, + MoneroTransactionInputViniRequest => MessageType_MoneroTransactionInputViniRequest, + MoneroTransactionInputViniAck => MessageType_MoneroTransactionInputViniAck, + MoneroTransactionAllInputsSetRequest => MessageType_MoneroTransactionAllInputsSetRequest, + MoneroTransactionAllInputsSetAck => MessageType_MoneroTransactionAllInputsSetAck, + MoneroTransactionSetOutputRequest => MessageType_MoneroTransactionSetOutputRequest, + MoneroTransactionSetOutputAck => MessageType_MoneroTransactionSetOutputAck, + MoneroTransactionAllOutSetRequest => MessageType_MoneroTransactionAllOutSetRequest, + MoneroTransactionAllOutSetAck => MessageType_MoneroTransactionAllOutSetAck, + MoneroTransactionSignInputRequest => MessageType_MoneroTransactionSignInputRequest, + MoneroTransactionSignInputAck => MessageType_MoneroTransactionSignInputAck, + MoneroTransactionFinalRequest => MessageType_MoneroTransactionFinalRequest, + MoneroTransactionFinalAck => MessageType_MoneroTransactionFinalAck, + MoneroKeyImageExportInitRequest => MessageType_MoneroKeyImageExportInitRequest, + MoneroKeyImageExportInitAck => MessageType_MoneroKeyImageExportInitAck, + MoneroKeyImageSyncStepRequest => MessageType_MoneroKeyImageSyncStepRequest, + MoneroKeyImageSyncStepAck => MessageType_MoneroKeyImageSyncStepAck, + MoneroKeyImageSyncFinalRequest => MessageType_MoneroKeyImageSyncFinalRequest, + MoneroKeyImageSyncFinalAck => MessageType_MoneroKeyImageSyncFinalAck, + MoneroGetAddress => MessageType_MoneroGetAddress, + MoneroAddress => MessageType_MoneroAddress, + MoneroGetWatchKey => MessageType_MoneroGetWatchKey, + MoneroWatchKey => MessageType_MoneroWatchKey, + DebugMoneroDiagRequest => MessageType_DebugMoneroDiagRequest, + DebugMoneroDiagAck => MessageType_DebugMoneroDiagAck, + MoneroGetTxKeyRequest => MessageType_MoneroGetTxKeyRequest, + MoneroGetTxKeyAck => MessageType_MoneroGetTxKeyAck, + MoneroLiveRefreshStartRequest => MessageType_MoneroLiveRefreshStartRequest, + MoneroLiveRefreshStartAck => MessageType_MoneroLiveRefreshStartAck, + MoneroLiveRefreshStepRequest => MessageType_MoneroLiveRefreshStepRequest, + MoneroLiveRefreshStepAck => MessageType_MoneroLiveRefreshStepAck, + MoneroLiveRefreshFinalRequest => MessageType_MoneroLiveRefreshFinalRequest, + MoneroLiveRefreshFinalAck => MessageType_MoneroLiveRefreshFinalAck, +} + +#[cfg(feature = "nem")] +trezor_message_impl! { + NEMGetAddress => MessageType_NEMGetAddress, + NEMAddress => MessageType_NEMAddress, + NEMSignTx => MessageType_NEMSignTx, + NEMSignedTx => MessageType_NEMSignedTx, + NEMDecryptMessage => MessageType_NEMDecryptMessage, + NEMDecryptedMessage => MessageType_NEMDecryptedMessage, +} + +#[cfg(feature = "ripple")] +trezor_message_impl! { + RippleGetAddress => MessageType_RippleGetAddress, + RippleAddress => MessageType_RippleAddress, + RippleSignTx => MessageType_RippleSignTx, + RippleSignedTx => MessageType_RippleSignedTx, +} + +#[cfg(feature = "solana")] +trezor_message_impl! { + SolanaGetPublicKey => MessageType_SolanaGetPublicKey, + SolanaPublicKey => MessageType_SolanaPublicKey, + SolanaGetAddress => MessageType_SolanaGetAddress, + SolanaAddress => MessageType_SolanaAddress, + SolanaSignTx => MessageType_SolanaSignTx, + SolanaTxSignature => MessageType_SolanaTxSignature, +} + +#[cfg(feature = "stellar")] +trezor_message_impl! { + StellarSignTx => MessageType_StellarSignTx, + StellarTxOpRequest => MessageType_StellarTxOpRequest, + StellarGetAddress => MessageType_StellarGetAddress, + StellarAddress => MessageType_StellarAddress, + StellarCreateAccountOp => MessageType_StellarCreateAccountOp, + StellarPaymentOp => MessageType_StellarPaymentOp, + StellarPathPaymentStrictReceiveOp => MessageType_StellarPathPaymentStrictReceiveOp, + StellarManageSellOfferOp => MessageType_StellarManageSellOfferOp, + StellarCreatePassiveSellOfferOp => MessageType_StellarCreatePassiveSellOfferOp, + StellarSetOptionsOp => MessageType_StellarSetOptionsOp, + StellarChangeTrustOp => MessageType_StellarChangeTrustOp, + StellarAllowTrustOp => MessageType_StellarAllowTrustOp, + StellarAccountMergeOp => MessageType_StellarAccountMergeOp, + StellarManageDataOp => MessageType_StellarManageDataOp, + StellarBumpSequenceOp => MessageType_StellarBumpSequenceOp, + StellarManageBuyOfferOp => MessageType_StellarManageBuyOfferOp, + StellarPathPaymentStrictSendOp => MessageType_StellarPathPaymentStrictSendOp, + StellarClaimClaimableBalanceOp => MessageType_StellarClaimClaimableBalanceOp, + StellarSignedTx => MessageType_StellarSignedTx, +} + +#[cfg(feature = "tezos")] +trezor_message_impl! { + TezosGetAddress => MessageType_TezosGetAddress, + TezosAddress => MessageType_TezosAddress, + TezosSignTx => MessageType_TezosSignTx, + TezosSignedTx => MessageType_TezosSignedTx, + TezosGetPublicKey => MessageType_TezosGetPublicKey, + TezosPublicKey => MessageType_TezosPublicKey, +} + +#[cfg(feature = "webauthn")] +trezor_message_impl! { + WebAuthnListResidentCredentials => MessageType_WebAuthnListResidentCredentials, + WebAuthnCredentials => MessageType_WebAuthnCredentials, + WebAuthnAddResidentCredential => MessageType_WebAuthnAddResidentCredential, + WebAuthnRemoveResidentCredential => MessageType_WebAuthnRemoveResidentCredential, +} diff --git a/wallet/trezor-client/src/messages/mod.rs b/wallet/trezor-client/src/messages/mod.rs new file mode 100644 index 0000000000..f558259bc8 --- /dev/null +++ b/wallet/trezor-client/src/messages/mod.rs @@ -0,0 +1,26 @@ +//! This module implements the `message_type` getter for all protobuf message types. + +use crate::protos::{MessageType::*, *}; + +/// Extends the protobuf Message trait to also have a static getter for the message +/// type code. +pub trait TrezorMessage: protobuf::Message + std::fmt::Debug { + const MESSAGE_TYPE: MessageType; + + #[inline] + #[deprecated(note = "Use `MESSAGE_TYPE` instead")] + fn message_type() -> MessageType { + Self::MESSAGE_TYPE + } +} + +/// This macro provides the TrezorMessage trait for a protobuf message. +macro_rules! trezor_message_impl { + ($($struct:ident => $mtype:expr),+ $(,)?) => {$( + impl TrezorMessage for $struct { + const MESSAGE_TYPE: MessageType = $mtype; + } + )+}; +} + +include!("./generated.rs"); diff --git a/wallet/trezor-client/src/protos/generated/messages.rs b/wallet/trezor-client/src/protos/generated/messages.rs new file mode 100644 index 0000000000..4ce75c2df3 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages.rs @@ -0,0 +1,1963 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.MessageType) +pub enum MessageType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Initialize) + MessageType_Initialize = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Ping) + MessageType_Ping = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Success) + MessageType_Success = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Failure) + MessageType_Failure = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ChangePin) + MessageType_ChangePin = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WipeDevice) + MessageType_WipeDevice = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetEntropy) + MessageType_GetEntropy = 9, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Entropy) + MessageType_Entropy = 10, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_LoadDevice) + MessageType_LoadDevice = 13, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ResetDevice) + MessageType_ResetDevice = 14, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SetBusy) + MessageType_SetBusy = 16, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Features) + MessageType_Features = 17, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PinMatrixRequest) + MessageType_PinMatrixRequest = 18, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PinMatrixAck) + MessageType_PinMatrixAck = 19, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Cancel) + MessageType_Cancel = 20, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_LockDevice) + MessageType_LockDevice = 24, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ApplySettings) + MessageType_ApplySettings = 25, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ButtonRequest) + MessageType_ButtonRequest = 26, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ButtonAck) + MessageType_ButtonAck = 27, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ApplyFlags) + MessageType_ApplyFlags = 28, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetNonce) + MessageType_GetNonce = 31, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Nonce) + MessageType_Nonce = 33, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BackupDevice) + MessageType_BackupDevice = 34, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EntropyRequest) + MessageType_EntropyRequest = 35, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EntropyAck) + MessageType_EntropyAck = 36, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PassphraseRequest) + MessageType_PassphraseRequest = 41, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PassphraseAck) + MessageType_PassphraseAck = 42, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RecoveryDevice) + MessageType_RecoveryDevice = 45, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WordRequest) + MessageType_WordRequest = 46, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WordAck) + MessageType_WordAck = 47, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetFeatures) + MessageType_GetFeatures = 55, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SdProtect) + MessageType_SdProtect = 79, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ChangeWipeCode) + MessageType_ChangeWipeCode = 82, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EndSession) + MessageType_EndSession = 83, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DoPreauthorized) + MessageType_DoPreauthorized = 84, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PreauthorizedRequest) + MessageType_PreauthorizedRequest = 85, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CancelAuthorization) + MessageType_CancelAuthorization = 86, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RebootToBootloader) + MessageType_RebootToBootloader = 87, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetFirmwareHash) + MessageType_GetFirmwareHash = 88, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareHash) + MessageType_FirmwareHash = 89, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_UnlockPath) + MessageType_UnlockPath = 93, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_UnlockedPathRequest) + MessageType_UnlockedPathRequest = 94, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ShowDeviceTutorial) + MessageType_ShowDeviceTutorial = 95, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_UnlockBootloader) + MessageType_UnlockBootloader = 96, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_AuthenticateDevice) + MessageType_AuthenticateDevice = 97, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_AuthenticityProof) + MessageType_AuthenticityProof = 98, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ChangeLanguage) + MessageType_ChangeLanguage = 990, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TranslationDataRequest) + MessageType_TranslationDataRequest = 991, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TranslationDataAck) + MessageType_TranslationDataAck = 992, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SetU2FCounter) + MessageType_SetU2FCounter = 63, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetNextU2FCounter) + MessageType_GetNextU2FCounter = 80, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NextU2FCounter) + MessageType_NextU2FCounter = 81, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Deprecated_PassphraseStateRequest) + MessageType_Deprecated_PassphraseStateRequest = 77, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Deprecated_PassphraseStateAck) + MessageType_Deprecated_PassphraseStateAck = 78, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareErase) + MessageType_FirmwareErase = 6, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareUpload) + MessageType_FirmwareUpload = 7, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareRequest) + MessageType_FirmwareRequest = 8, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ProdTestT1) + MessageType_ProdTestT1 = 32, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetPublicKey) + MessageType_GetPublicKey = 11, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PublicKey) + MessageType_PublicKey = 12, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignTx) + MessageType_SignTx = 15, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TxRequest) + MessageType_TxRequest = 21, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TxAck) + MessageType_TxAck = 22, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetAddress) + MessageType_GetAddress = 29, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Address) + MessageType_Address = 30, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TxAckPaymentRequest) + MessageType_TxAckPaymentRequest = 37, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignMessage) + MessageType_SignMessage = 38, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_VerifyMessage) + MessageType_VerifyMessage = 39, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MessageSignature) + MessageType_MessageSignature = 40, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetOwnershipId) + MessageType_GetOwnershipId = 43, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_OwnershipId) + MessageType_OwnershipId = 44, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetOwnershipProof) + MessageType_GetOwnershipProof = 49, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_OwnershipProof) + MessageType_OwnershipProof = 50, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_AuthorizeCoinJoin) + MessageType_AuthorizeCoinJoin = 51, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CipherKeyValue) + MessageType_CipherKeyValue = 23, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CipheredKeyValue) + MessageType_CipheredKeyValue = 48, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignIdentity) + MessageType_SignIdentity = 53, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignedIdentity) + MessageType_SignedIdentity = 54, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetECDHSessionKey) + MessageType_GetECDHSessionKey = 61, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ECDHSessionKey) + MessageType_ECDHSessionKey = 62, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiCommit) + MessageType_CosiCommit = 71, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiCommitment) + MessageType_CosiCommitment = 72, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiSign) + MessageType_CosiSign = 73, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiSignature) + MessageType_CosiSignature = 74, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkDecision) + MessageType_DebugLinkDecision = 100, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkGetState) + MessageType_DebugLinkGetState = 101, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkState) + MessageType_DebugLinkState = 102, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkStop) + MessageType_DebugLinkStop = 103, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkLog) + MessageType_DebugLinkLog = 104, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkMemoryRead) + MessageType_DebugLinkMemoryRead = 110, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkMemory) + MessageType_DebugLinkMemory = 111, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkMemoryWrite) + MessageType_DebugLinkMemoryWrite = 112, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkFlashErase) + MessageType_DebugLinkFlashErase = 113, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkLayout) + MessageType_DebugLinkLayout = 9001, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkReseedRandom) + MessageType_DebugLinkReseedRandom = 9002, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkRecordScreen) + MessageType_DebugLinkRecordScreen = 9003, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkEraseSdCard) + MessageType_DebugLinkEraseSdCard = 9005, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkWatchLayout) + MessageType_DebugLinkWatchLayout = 9006, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkResetDebugEvents) + MessageType_DebugLinkResetDebugEvents = 9007, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumGetPublicKey) + MessageType_EthereumGetPublicKey = 450, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumPublicKey) + MessageType_EthereumPublicKey = 451, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumGetAddress) + MessageType_EthereumGetAddress = 56, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumAddress) + MessageType_EthereumAddress = 57, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTx) + MessageType_EthereumSignTx = 58, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTxEIP1559) + MessageType_EthereumSignTxEIP1559 = 452, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTxRequest) + MessageType_EthereumTxRequest = 59, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTxAck) + MessageType_EthereumTxAck = 60, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignMessage) + MessageType_EthereumSignMessage = 64, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumVerifyMessage) + MessageType_EthereumVerifyMessage = 65, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumMessageSignature) + MessageType_EthereumMessageSignature = 66, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTypedData) + MessageType_EthereumSignTypedData = 464, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataStructRequest) + MessageType_EthereumTypedDataStructRequest = 465, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataStructAck) + MessageType_EthereumTypedDataStructAck = 466, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataValueRequest) + MessageType_EthereumTypedDataValueRequest = 467, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataValueAck) + MessageType_EthereumTypedDataValueAck = 468, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataSignature) + MessageType_EthereumTypedDataSignature = 469, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTypedHash) + MessageType_EthereumSignTypedHash = 470, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMGetAddress) + MessageType_NEMGetAddress = 67, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMAddress) + MessageType_NEMAddress = 68, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMSignTx) + MessageType_NEMSignTx = 69, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMSignedTx) + MessageType_NEMSignedTx = 70, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMDecryptMessage) + MessageType_NEMDecryptMessage = 75, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMDecryptedMessage) + MessageType_NEMDecryptedMessage = 76, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosGetAddress) + MessageType_TezosGetAddress = 150, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosAddress) + MessageType_TezosAddress = 151, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosSignTx) + MessageType_TezosSignTx = 152, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosSignedTx) + MessageType_TezosSignedTx = 153, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosGetPublicKey) + MessageType_TezosGetPublicKey = 154, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosPublicKey) + MessageType_TezosPublicKey = 155, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarSignTx) + MessageType_StellarSignTx = 202, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarTxOpRequest) + MessageType_StellarTxOpRequest = 203, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarGetAddress) + MessageType_StellarGetAddress = 207, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarAddress) + MessageType_StellarAddress = 208, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarCreateAccountOp) + MessageType_StellarCreateAccountOp = 210, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarPaymentOp) + MessageType_StellarPaymentOp = 211, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarPathPaymentStrictReceiveOp) + MessageType_StellarPathPaymentStrictReceiveOp = 212, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarManageSellOfferOp) + MessageType_StellarManageSellOfferOp = 213, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarCreatePassiveSellOfferOp) + MessageType_StellarCreatePassiveSellOfferOp = 214, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarSetOptionsOp) + MessageType_StellarSetOptionsOp = 215, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarChangeTrustOp) + MessageType_StellarChangeTrustOp = 216, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarAllowTrustOp) + MessageType_StellarAllowTrustOp = 217, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarAccountMergeOp) + MessageType_StellarAccountMergeOp = 218, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarManageDataOp) + MessageType_StellarManageDataOp = 220, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarBumpSequenceOp) + MessageType_StellarBumpSequenceOp = 221, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarManageBuyOfferOp) + MessageType_StellarManageBuyOfferOp = 222, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarPathPaymentStrictSendOp) + MessageType_StellarPathPaymentStrictSendOp = 223, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarClaimClaimableBalanceOp) + MessageType_StellarClaimClaimableBalanceOp = 225, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarSignedTx) + MessageType_StellarSignedTx = 230, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoGetPublicKey) + MessageType_CardanoGetPublicKey = 305, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoPublicKey) + MessageType_CardanoPublicKey = 306, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoGetAddress) + MessageType_CardanoGetAddress = 307, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoAddress) + MessageType_CardanoAddress = 308, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxItemAck) + MessageType_CardanoTxItemAck = 313, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxAuxiliaryDataSupplement) + MessageType_CardanoTxAuxiliaryDataSupplement = 314, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxWitnessRequest) + MessageType_CardanoTxWitnessRequest = 315, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxWitnessResponse) + MessageType_CardanoTxWitnessResponse = 316, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxHostAck) + MessageType_CardanoTxHostAck = 317, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxBodyHash) + MessageType_CardanoTxBodyHash = 318, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoSignTxFinished) + MessageType_CardanoSignTxFinished = 319, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoSignTxInit) + MessageType_CardanoSignTxInit = 320, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxInput) + MessageType_CardanoTxInput = 321, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxOutput) + MessageType_CardanoTxOutput = 322, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoAssetGroup) + MessageType_CardanoAssetGroup = 323, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoToken) + MessageType_CardanoToken = 324, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxCertificate) + MessageType_CardanoTxCertificate = 325, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxWithdrawal) + MessageType_CardanoTxWithdrawal = 326, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxAuxiliaryData) + MessageType_CardanoTxAuxiliaryData = 327, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoPoolOwner) + MessageType_CardanoPoolOwner = 328, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoPoolRelayParameters) + MessageType_CardanoPoolRelayParameters = 329, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoGetNativeScriptHash) + MessageType_CardanoGetNativeScriptHash = 330, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoNativeScriptHash) + MessageType_CardanoNativeScriptHash = 331, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxMint) + MessageType_CardanoTxMint = 332, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxCollateralInput) + MessageType_CardanoTxCollateralInput = 333, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxRequiredSigner) + MessageType_CardanoTxRequiredSigner = 334, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxInlineDatumChunk) + MessageType_CardanoTxInlineDatumChunk = 335, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxReferenceScriptChunk) + MessageType_CardanoTxReferenceScriptChunk = 336, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxReferenceInput) + MessageType_CardanoTxReferenceInput = 337, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleGetAddress) + MessageType_RippleGetAddress = 400, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleAddress) + MessageType_RippleAddress = 401, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleSignTx) + MessageType_RippleSignTx = 402, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleSignedTx) + MessageType_RippleSignedTx = 403, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInitRequest) + MessageType_MoneroTransactionInitRequest = 501, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInitAck) + MessageType_MoneroTransactionInitAck = 502, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetInputRequest) + MessageType_MoneroTransactionSetInputRequest = 503, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetInputAck) + MessageType_MoneroTransactionSetInputAck = 504, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInputViniRequest) + MessageType_MoneroTransactionInputViniRequest = 507, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInputViniAck) + MessageType_MoneroTransactionInputViniAck = 508, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllInputsSetRequest) + MessageType_MoneroTransactionAllInputsSetRequest = 509, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllInputsSetAck) + MessageType_MoneroTransactionAllInputsSetAck = 510, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetOutputRequest) + MessageType_MoneroTransactionSetOutputRequest = 511, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetOutputAck) + MessageType_MoneroTransactionSetOutputAck = 512, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllOutSetRequest) + MessageType_MoneroTransactionAllOutSetRequest = 513, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllOutSetAck) + MessageType_MoneroTransactionAllOutSetAck = 514, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSignInputRequest) + MessageType_MoneroTransactionSignInputRequest = 515, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSignInputAck) + MessageType_MoneroTransactionSignInputAck = 516, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionFinalRequest) + MessageType_MoneroTransactionFinalRequest = 517, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionFinalAck) + MessageType_MoneroTransactionFinalAck = 518, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageExportInitRequest) + MessageType_MoneroKeyImageExportInitRequest = 530, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageExportInitAck) + MessageType_MoneroKeyImageExportInitAck = 531, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncStepRequest) + MessageType_MoneroKeyImageSyncStepRequest = 532, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncStepAck) + MessageType_MoneroKeyImageSyncStepAck = 533, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncFinalRequest) + MessageType_MoneroKeyImageSyncFinalRequest = 534, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncFinalAck) + MessageType_MoneroKeyImageSyncFinalAck = 535, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetAddress) + MessageType_MoneroGetAddress = 540, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroAddress) + MessageType_MoneroAddress = 541, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetWatchKey) + MessageType_MoneroGetWatchKey = 542, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroWatchKey) + MessageType_MoneroWatchKey = 543, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugMoneroDiagRequest) + MessageType_DebugMoneroDiagRequest = 546, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugMoneroDiagAck) + MessageType_DebugMoneroDiagAck = 547, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetTxKeyRequest) + MessageType_MoneroGetTxKeyRequest = 550, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetTxKeyAck) + MessageType_MoneroGetTxKeyAck = 551, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStartRequest) + MessageType_MoneroLiveRefreshStartRequest = 552, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStartAck) + MessageType_MoneroLiveRefreshStartAck = 553, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStepRequest) + MessageType_MoneroLiveRefreshStepRequest = 554, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStepAck) + MessageType_MoneroLiveRefreshStepAck = 555, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshFinalRequest) + MessageType_MoneroLiveRefreshFinalRequest = 556, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshFinalAck) + MessageType_MoneroLiveRefreshFinalAck = 557, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosGetPublicKey) + MessageType_EosGetPublicKey = 600, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosPublicKey) + MessageType_EosPublicKey = 601, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosSignTx) + MessageType_EosSignTx = 602, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosTxActionRequest) + MessageType_EosTxActionRequest = 603, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosTxActionAck) + MessageType_EosTxActionAck = 604, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosSignedTx) + MessageType_EosSignedTx = 605, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceGetAddress) + MessageType_BinanceGetAddress = 700, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceAddress) + MessageType_BinanceAddress = 701, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceGetPublicKey) + MessageType_BinanceGetPublicKey = 702, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinancePublicKey) + MessageType_BinancePublicKey = 703, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceSignTx) + MessageType_BinanceSignTx = 704, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceTxRequest) + MessageType_BinanceTxRequest = 705, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceTransferMsg) + MessageType_BinanceTransferMsg = 706, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceOrderMsg) + MessageType_BinanceOrderMsg = 707, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceCancelMsg) + MessageType_BinanceCancelMsg = 708, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceSignedTx) + MessageType_BinanceSignedTx = 709, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnListResidentCredentials) + MessageType_WebAuthnListResidentCredentials = 800, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnCredentials) + MessageType_WebAuthnCredentials = 801, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnAddResidentCredential) + MessageType_WebAuthnAddResidentCredential = 802, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnRemoveResidentCredential) + MessageType_WebAuthnRemoveResidentCredential = 803, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaGetPublicKey) + MessageType_SolanaGetPublicKey = 900, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaPublicKey) + MessageType_SolanaPublicKey = 901, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaGetAddress) + MessageType_SolanaGetAddress = 902, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaAddress) + MessageType_SolanaAddress = 903, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaSignTx) + MessageType_SolanaSignTx = 904, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaTxSignature) + MessageType_SolanaTxSignature = 905, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerGetAddress) + MessageType_MintlayerGetAddress = 1000, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerAddress) + MessageType_MintlayerAddress = 1001, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerGetPublicKey) + MessageType_MintlayerGetPublicKey = 1002, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerPublicKey) + MessageType_MintlayerPublicKey = 1003, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerVerifySig) + MessageType_MintlayerVerifySig = 1004, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerSignTx) + MessageType_MintlayerSignTx = 1005, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerTxRequest) + MessageType_MintlayerTxRequest = 1006, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerTxAckUtxoInput) + MessageType_MintlayerTxAckUtxoInput = 1007, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerTxAckOutput) + MessageType_MintlayerTxAckOutput = 1008, +} + +impl ::protobuf::Enum for MessageType { + const NAME: &'static str = "MessageType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(MessageType::MessageType_Initialize), + 1 => ::std::option::Option::Some(MessageType::MessageType_Ping), + 2 => ::std::option::Option::Some(MessageType::MessageType_Success), + 3 => ::std::option::Option::Some(MessageType::MessageType_Failure), + 4 => ::std::option::Option::Some(MessageType::MessageType_ChangePin), + 5 => ::std::option::Option::Some(MessageType::MessageType_WipeDevice), + 9 => ::std::option::Option::Some(MessageType::MessageType_GetEntropy), + 10 => ::std::option::Option::Some(MessageType::MessageType_Entropy), + 13 => ::std::option::Option::Some(MessageType::MessageType_LoadDevice), + 14 => ::std::option::Option::Some(MessageType::MessageType_ResetDevice), + 16 => ::std::option::Option::Some(MessageType::MessageType_SetBusy), + 17 => ::std::option::Option::Some(MessageType::MessageType_Features), + 18 => ::std::option::Option::Some(MessageType::MessageType_PinMatrixRequest), + 19 => ::std::option::Option::Some(MessageType::MessageType_PinMatrixAck), + 20 => ::std::option::Option::Some(MessageType::MessageType_Cancel), + 24 => ::std::option::Option::Some(MessageType::MessageType_LockDevice), + 25 => ::std::option::Option::Some(MessageType::MessageType_ApplySettings), + 26 => ::std::option::Option::Some(MessageType::MessageType_ButtonRequest), + 27 => ::std::option::Option::Some(MessageType::MessageType_ButtonAck), + 28 => ::std::option::Option::Some(MessageType::MessageType_ApplyFlags), + 31 => ::std::option::Option::Some(MessageType::MessageType_GetNonce), + 33 => ::std::option::Option::Some(MessageType::MessageType_Nonce), + 34 => ::std::option::Option::Some(MessageType::MessageType_BackupDevice), + 35 => ::std::option::Option::Some(MessageType::MessageType_EntropyRequest), + 36 => ::std::option::Option::Some(MessageType::MessageType_EntropyAck), + 41 => ::std::option::Option::Some(MessageType::MessageType_PassphraseRequest), + 42 => ::std::option::Option::Some(MessageType::MessageType_PassphraseAck), + 45 => ::std::option::Option::Some(MessageType::MessageType_RecoveryDevice), + 46 => ::std::option::Option::Some(MessageType::MessageType_WordRequest), + 47 => ::std::option::Option::Some(MessageType::MessageType_WordAck), + 55 => ::std::option::Option::Some(MessageType::MessageType_GetFeatures), + 79 => ::std::option::Option::Some(MessageType::MessageType_SdProtect), + 82 => ::std::option::Option::Some(MessageType::MessageType_ChangeWipeCode), + 83 => ::std::option::Option::Some(MessageType::MessageType_EndSession), + 84 => ::std::option::Option::Some(MessageType::MessageType_DoPreauthorized), + 85 => ::std::option::Option::Some(MessageType::MessageType_PreauthorizedRequest), + 86 => ::std::option::Option::Some(MessageType::MessageType_CancelAuthorization), + 87 => ::std::option::Option::Some(MessageType::MessageType_RebootToBootloader), + 88 => ::std::option::Option::Some(MessageType::MessageType_GetFirmwareHash), + 89 => ::std::option::Option::Some(MessageType::MessageType_FirmwareHash), + 93 => ::std::option::Option::Some(MessageType::MessageType_UnlockPath), + 94 => ::std::option::Option::Some(MessageType::MessageType_UnlockedPathRequest), + 95 => ::std::option::Option::Some(MessageType::MessageType_ShowDeviceTutorial), + 96 => ::std::option::Option::Some(MessageType::MessageType_UnlockBootloader), + 97 => ::std::option::Option::Some(MessageType::MessageType_AuthenticateDevice), + 98 => ::std::option::Option::Some(MessageType::MessageType_AuthenticityProof), + 990 => ::std::option::Option::Some(MessageType::MessageType_ChangeLanguage), + 991 => ::std::option::Option::Some(MessageType::MessageType_TranslationDataRequest), + 992 => ::std::option::Option::Some(MessageType::MessageType_TranslationDataAck), + 63 => ::std::option::Option::Some(MessageType::MessageType_SetU2FCounter), + 80 => ::std::option::Option::Some(MessageType::MessageType_GetNextU2FCounter), + 81 => ::std::option::Option::Some(MessageType::MessageType_NextU2FCounter), + 77 => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateRequest), + 78 => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateAck), + 6 => ::std::option::Option::Some(MessageType::MessageType_FirmwareErase), + 7 => ::std::option::Option::Some(MessageType::MessageType_FirmwareUpload), + 8 => ::std::option::Option::Some(MessageType::MessageType_FirmwareRequest), + 32 => ::std::option::Option::Some(MessageType::MessageType_ProdTestT1), + 11 => ::std::option::Option::Some(MessageType::MessageType_GetPublicKey), + 12 => ::std::option::Option::Some(MessageType::MessageType_PublicKey), + 15 => ::std::option::Option::Some(MessageType::MessageType_SignTx), + 21 => ::std::option::Option::Some(MessageType::MessageType_TxRequest), + 22 => ::std::option::Option::Some(MessageType::MessageType_TxAck), + 29 => ::std::option::Option::Some(MessageType::MessageType_GetAddress), + 30 => ::std::option::Option::Some(MessageType::MessageType_Address), + 37 => ::std::option::Option::Some(MessageType::MessageType_TxAckPaymentRequest), + 38 => ::std::option::Option::Some(MessageType::MessageType_SignMessage), + 39 => ::std::option::Option::Some(MessageType::MessageType_VerifyMessage), + 40 => ::std::option::Option::Some(MessageType::MessageType_MessageSignature), + 43 => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipId), + 44 => ::std::option::Option::Some(MessageType::MessageType_OwnershipId), + 49 => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipProof), + 50 => ::std::option::Option::Some(MessageType::MessageType_OwnershipProof), + 51 => ::std::option::Option::Some(MessageType::MessageType_AuthorizeCoinJoin), + 23 => ::std::option::Option::Some(MessageType::MessageType_CipherKeyValue), + 48 => ::std::option::Option::Some(MessageType::MessageType_CipheredKeyValue), + 53 => ::std::option::Option::Some(MessageType::MessageType_SignIdentity), + 54 => ::std::option::Option::Some(MessageType::MessageType_SignedIdentity), + 61 => ::std::option::Option::Some(MessageType::MessageType_GetECDHSessionKey), + 62 => ::std::option::Option::Some(MessageType::MessageType_ECDHSessionKey), + 71 => ::std::option::Option::Some(MessageType::MessageType_CosiCommit), + 72 => ::std::option::Option::Some(MessageType::MessageType_CosiCommitment), + 73 => ::std::option::Option::Some(MessageType::MessageType_CosiSign), + 74 => ::std::option::Option::Some(MessageType::MessageType_CosiSignature), + 100 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkDecision), + 101 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkGetState), + 102 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkState), + 103 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkStop), + 104 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLog), + 110 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryRead), + 111 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemory), + 112 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryWrite), + 113 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkFlashErase), + 9001 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLayout), + 9002 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkReseedRandom), + 9003 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkRecordScreen), + 9005 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkEraseSdCard), + 9006 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkWatchLayout), + 9007 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkResetDebugEvents), + 450 => ::std::option::Option::Some(MessageType::MessageType_EthereumGetPublicKey), + 451 => ::std::option::Option::Some(MessageType::MessageType_EthereumPublicKey), + 56 => ::std::option::Option::Some(MessageType::MessageType_EthereumGetAddress), + 57 => ::std::option::Option::Some(MessageType::MessageType_EthereumAddress), + 58 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTx), + 452 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTxEIP1559), + 59 => ::std::option::Option::Some(MessageType::MessageType_EthereumTxRequest), + 60 => ::std::option::Option::Some(MessageType::MessageType_EthereumTxAck), + 64 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignMessage), + 65 => ::std::option::Option::Some(MessageType::MessageType_EthereumVerifyMessage), + 66 => ::std::option::Option::Some(MessageType::MessageType_EthereumMessageSignature), + 464 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedData), + 465 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructRequest), + 466 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructAck), + 467 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueRequest), + 468 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueAck), + 469 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataSignature), + 470 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedHash), + 67 => ::std::option::Option::Some(MessageType::MessageType_NEMGetAddress), + 68 => ::std::option::Option::Some(MessageType::MessageType_NEMAddress), + 69 => ::std::option::Option::Some(MessageType::MessageType_NEMSignTx), + 70 => ::std::option::Option::Some(MessageType::MessageType_NEMSignedTx), + 75 => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptMessage), + 76 => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptedMessage), + 150 => ::std::option::Option::Some(MessageType::MessageType_TezosGetAddress), + 151 => ::std::option::Option::Some(MessageType::MessageType_TezosAddress), + 152 => ::std::option::Option::Some(MessageType::MessageType_TezosSignTx), + 153 => ::std::option::Option::Some(MessageType::MessageType_TezosSignedTx), + 154 => ::std::option::Option::Some(MessageType::MessageType_TezosGetPublicKey), + 155 => ::std::option::Option::Some(MessageType::MessageType_TezosPublicKey), + 202 => ::std::option::Option::Some(MessageType::MessageType_StellarSignTx), + 203 => ::std::option::Option::Some(MessageType::MessageType_StellarTxOpRequest), + 207 => ::std::option::Option::Some(MessageType::MessageType_StellarGetAddress), + 208 => ::std::option::Option::Some(MessageType::MessageType_StellarAddress), + 210 => ::std::option::Option::Some(MessageType::MessageType_StellarCreateAccountOp), + 211 => ::std::option::Option::Some(MessageType::MessageType_StellarPaymentOp), + 212 => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictReceiveOp), + 213 => ::std::option::Option::Some(MessageType::MessageType_StellarManageSellOfferOp), + 214 => ::std::option::Option::Some(MessageType::MessageType_StellarCreatePassiveSellOfferOp), + 215 => ::std::option::Option::Some(MessageType::MessageType_StellarSetOptionsOp), + 216 => ::std::option::Option::Some(MessageType::MessageType_StellarChangeTrustOp), + 217 => ::std::option::Option::Some(MessageType::MessageType_StellarAllowTrustOp), + 218 => ::std::option::Option::Some(MessageType::MessageType_StellarAccountMergeOp), + 220 => ::std::option::Option::Some(MessageType::MessageType_StellarManageDataOp), + 221 => ::std::option::Option::Some(MessageType::MessageType_StellarBumpSequenceOp), + 222 => ::std::option::Option::Some(MessageType::MessageType_StellarManageBuyOfferOp), + 223 => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictSendOp), + 225 => ::std::option::Option::Some(MessageType::MessageType_StellarClaimClaimableBalanceOp), + 230 => ::std::option::Option::Some(MessageType::MessageType_StellarSignedTx), + 305 => ::std::option::Option::Some(MessageType::MessageType_CardanoGetPublicKey), + 306 => ::std::option::Option::Some(MessageType::MessageType_CardanoPublicKey), + 307 => ::std::option::Option::Some(MessageType::MessageType_CardanoGetAddress), + 308 => ::std::option::Option::Some(MessageType::MessageType_CardanoAddress), + 313 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxItemAck), + 314 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryDataSupplement), + 315 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessRequest), + 316 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessResponse), + 317 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxHostAck), + 318 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxBodyHash), + 319 => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxFinished), + 320 => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxInit), + 321 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInput), + 322 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxOutput), + 323 => ::std::option::Option::Some(MessageType::MessageType_CardanoAssetGroup), + 324 => ::std::option::Option::Some(MessageType::MessageType_CardanoToken), + 325 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCertificate), + 326 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWithdrawal), + 327 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryData), + 328 => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolOwner), + 329 => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolRelayParameters), + 330 => ::std::option::Option::Some(MessageType::MessageType_CardanoGetNativeScriptHash), + 331 => ::std::option::Option::Some(MessageType::MessageType_CardanoNativeScriptHash), + 332 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxMint), + 333 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCollateralInput), + 334 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxRequiredSigner), + 335 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInlineDatumChunk), + 336 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceScriptChunk), + 337 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceInput), + 400 => ::std::option::Option::Some(MessageType::MessageType_RippleGetAddress), + 401 => ::std::option::Option::Some(MessageType::MessageType_RippleAddress), + 402 => ::std::option::Option::Some(MessageType::MessageType_RippleSignTx), + 403 => ::std::option::Option::Some(MessageType::MessageType_RippleSignedTx), + 501 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitRequest), + 502 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitAck), + 503 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputRequest), + 504 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputAck), + 507 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniRequest), + 508 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniAck), + 509 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetRequest), + 510 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetAck), + 511 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputRequest), + 512 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputAck), + 513 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetRequest), + 514 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetAck), + 515 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputRequest), + 516 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputAck), + 517 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalRequest), + 518 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalAck), + 530 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitRequest), + 531 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitAck), + 532 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepRequest), + 533 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepAck), + 534 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalRequest), + 535 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalAck), + 540 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetAddress), + 541 => ::std::option::Option::Some(MessageType::MessageType_MoneroAddress), + 542 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetWatchKey), + 543 => ::std::option::Option::Some(MessageType::MessageType_MoneroWatchKey), + 546 => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagRequest), + 547 => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagAck), + 550 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyRequest), + 551 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyAck), + 552 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartRequest), + 553 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartAck), + 554 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepRequest), + 555 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepAck), + 556 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalRequest), + 557 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalAck), + 600 => ::std::option::Option::Some(MessageType::MessageType_EosGetPublicKey), + 601 => ::std::option::Option::Some(MessageType::MessageType_EosPublicKey), + 602 => ::std::option::Option::Some(MessageType::MessageType_EosSignTx), + 603 => ::std::option::Option::Some(MessageType::MessageType_EosTxActionRequest), + 604 => ::std::option::Option::Some(MessageType::MessageType_EosTxActionAck), + 605 => ::std::option::Option::Some(MessageType::MessageType_EosSignedTx), + 700 => ::std::option::Option::Some(MessageType::MessageType_BinanceGetAddress), + 701 => ::std::option::Option::Some(MessageType::MessageType_BinanceAddress), + 702 => ::std::option::Option::Some(MessageType::MessageType_BinanceGetPublicKey), + 703 => ::std::option::Option::Some(MessageType::MessageType_BinancePublicKey), + 704 => ::std::option::Option::Some(MessageType::MessageType_BinanceSignTx), + 705 => ::std::option::Option::Some(MessageType::MessageType_BinanceTxRequest), + 706 => ::std::option::Option::Some(MessageType::MessageType_BinanceTransferMsg), + 707 => ::std::option::Option::Some(MessageType::MessageType_BinanceOrderMsg), + 708 => ::std::option::Option::Some(MessageType::MessageType_BinanceCancelMsg), + 709 => ::std::option::Option::Some(MessageType::MessageType_BinanceSignedTx), + 800 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnListResidentCredentials), + 801 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnCredentials), + 802 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnAddResidentCredential), + 803 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnRemoveResidentCredential), + 900 => ::std::option::Option::Some(MessageType::MessageType_SolanaGetPublicKey), + 901 => ::std::option::Option::Some(MessageType::MessageType_SolanaPublicKey), + 902 => ::std::option::Option::Some(MessageType::MessageType_SolanaGetAddress), + 903 => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress), + 904 => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx), + 905 => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature), + 1000 => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetAddress), + 1001 => ::std::option::Option::Some(MessageType::MessageType_MintlayerAddress), + 1002 => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetPublicKey), + 1003 => ::std::option::Option::Some(MessageType::MessageType_MintlayerPublicKey), + 1004 => ::std::option::Option::Some(MessageType::MessageType_MintlayerVerifySig), + 1005 => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignTx), + 1006 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxRequest), + 1007 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckUtxoInput), + 1008 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckOutput), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "MessageType_Initialize" => ::std::option::Option::Some(MessageType::MessageType_Initialize), + "MessageType_Ping" => ::std::option::Option::Some(MessageType::MessageType_Ping), + "MessageType_Success" => ::std::option::Option::Some(MessageType::MessageType_Success), + "MessageType_Failure" => ::std::option::Option::Some(MessageType::MessageType_Failure), + "MessageType_ChangePin" => ::std::option::Option::Some(MessageType::MessageType_ChangePin), + "MessageType_WipeDevice" => ::std::option::Option::Some(MessageType::MessageType_WipeDevice), + "MessageType_GetEntropy" => ::std::option::Option::Some(MessageType::MessageType_GetEntropy), + "MessageType_Entropy" => ::std::option::Option::Some(MessageType::MessageType_Entropy), + "MessageType_LoadDevice" => ::std::option::Option::Some(MessageType::MessageType_LoadDevice), + "MessageType_ResetDevice" => ::std::option::Option::Some(MessageType::MessageType_ResetDevice), + "MessageType_SetBusy" => ::std::option::Option::Some(MessageType::MessageType_SetBusy), + "MessageType_Features" => ::std::option::Option::Some(MessageType::MessageType_Features), + "MessageType_PinMatrixRequest" => ::std::option::Option::Some(MessageType::MessageType_PinMatrixRequest), + "MessageType_PinMatrixAck" => ::std::option::Option::Some(MessageType::MessageType_PinMatrixAck), + "MessageType_Cancel" => ::std::option::Option::Some(MessageType::MessageType_Cancel), + "MessageType_LockDevice" => ::std::option::Option::Some(MessageType::MessageType_LockDevice), + "MessageType_ApplySettings" => ::std::option::Option::Some(MessageType::MessageType_ApplySettings), + "MessageType_ButtonRequest" => ::std::option::Option::Some(MessageType::MessageType_ButtonRequest), + "MessageType_ButtonAck" => ::std::option::Option::Some(MessageType::MessageType_ButtonAck), + "MessageType_ApplyFlags" => ::std::option::Option::Some(MessageType::MessageType_ApplyFlags), + "MessageType_GetNonce" => ::std::option::Option::Some(MessageType::MessageType_GetNonce), + "MessageType_Nonce" => ::std::option::Option::Some(MessageType::MessageType_Nonce), + "MessageType_BackupDevice" => ::std::option::Option::Some(MessageType::MessageType_BackupDevice), + "MessageType_EntropyRequest" => ::std::option::Option::Some(MessageType::MessageType_EntropyRequest), + "MessageType_EntropyAck" => ::std::option::Option::Some(MessageType::MessageType_EntropyAck), + "MessageType_PassphraseRequest" => ::std::option::Option::Some(MessageType::MessageType_PassphraseRequest), + "MessageType_PassphraseAck" => ::std::option::Option::Some(MessageType::MessageType_PassphraseAck), + "MessageType_RecoveryDevice" => ::std::option::Option::Some(MessageType::MessageType_RecoveryDevice), + "MessageType_WordRequest" => ::std::option::Option::Some(MessageType::MessageType_WordRequest), + "MessageType_WordAck" => ::std::option::Option::Some(MessageType::MessageType_WordAck), + "MessageType_GetFeatures" => ::std::option::Option::Some(MessageType::MessageType_GetFeatures), + "MessageType_SdProtect" => ::std::option::Option::Some(MessageType::MessageType_SdProtect), + "MessageType_ChangeWipeCode" => ::std::option::Option::Some(MessageType::MessageType_ChangeWipeCode), + "MessageType_EndSession" => ::std::option::Option::Some(MessageType::MessageType_EndSession), + "MessageType_DoPreauthorized" => ::std::option::Option::Some(MessageType::MessageType_DoPreauthorized), + "MessageType_PreauthorizedRequest" => ::std::option::Option::Some(MessageType::MessageType_PreauthorizedRequest), + "MessageType_CancelAuthorization" => ::std::option::Option::Some(MessageType::MessageType_CancelAuthorization), + "MessageType_RebootToBootloader" => ::std::option::Option::Some(MessageType::MessageType_RebootToBootloader), + "MessageType_GetFirmwareHash" => ::std::option::Option::Some(MessageType::MessageType_GetFirmwareHash), + "MessageType_FirmwareHash" => ::std::option::Option::Some(MessageType::MessageType_FirmwareHash), + "MessageType_UnlockPath" => ::std::option::Option::Some(MessageType::MessageType_UnlockPath), + "MessageType_UnlockedPathRequest" => ::std::option::Option::Some(MessageType::MessageType_UnlockedPathRequest), + "MessageType_ShowDeviceTutorial" => ::std::option::Option::Some(MessageType::MessageType_ShowDeviceTutorial), + "MessageType_UnlockBootloader" => ::std::option::Option::Some(MessageType::MessageType_UnlockBootloader), + "MessageType_AuthenticateDevice" => ::std::option::Option::Some(MessageType::MessageType_AuthenticateDevice), + "MessageType_AuthenticityProof" => ::std::option::Option::Some(MessageType::MessageType_AuthenticityProof), + "MessageType_ChangeLanguage" => ::std::option::Option::Some(MessageType::MessageType_ChangeLanguage), + "MessageType_TranslationDataRequest" => ::std::option::Option::Some(MessageType::MessageType_TranslationDataRequest), + "MessageType_TranslationDataAck" => ::std::option::Option::Some(MessageType::MessageType_TranslationDataAck), + "MessageType_SetU2FCounter" => ::std::option::Option::Some(MessageType::MessageType_SetU2FCounter), + "MessageType_GetNextU2FCounter" => ::std::option::Option::Some(MessageType::MessageType_GetNextU2FCounter), + "MessageType_NextU2FCounter" => ::std::option::Option::Some(MessageType::MessageType_NextU2FCounter), + "MessageType_Deprecated_PassphraseStateRequest" => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateRequest), + "MessageType_Deprecated_PassphraseStateAck" => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateAck), + "MessageType_FirmwareErase" => ::std::option::Option::Some(MessageType::MessageType_FirmwareErase), + "MessageType_FirmwareUpload" => ::std::option::Option::Some(MessageType::MessageType_FirmwareUpload), + "MessageType_FirmwareRequest" => ::std::option::Option::Some(MessageType::MessageType_FirmwareRequest), + "MessageType_ProdTestT1" => ::std::option::Option::Some(MessageType::MessageType_ProdTestT1), + "MessageType_GetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_GetPublicKey), + "MessageType_PublicKey" => ::std::option::Option::Some(MessageType::MessageType_PublicKey), + "MessageType_SignTx" => ::std::option::Option::Some(MessageType::MessageType_SignTx), + "MessageType_TxRequest" => ::std::option::Option::Some(MessageType::MessageType_TxRequest), + "MessageType_TxAck" => ::std::option::Option::Some(MessageType::MessageType_TxAck), + "MessageType_GetAddress" => ::std::option::Option::Some(MessageType::MessageType_GetAddress), + "MessageType_Address" => ::std::option::Option::Some(MessageType::MessageType_Address), + "MessageType_TxAckPaymentRequest" => ::std::option::Option::Some(MessageType::MessageType_TxAckPaymentRequest), + "MessageType_SignMessage" => ::std::option::Option::Some(MessageType::MessageType_SignMessage), + "MessageType_VerifyMessage" => ::std::option::Option::Some(MessageType::MessageType_VerifyMessage), + "MessageType_MessageSignature" => ::std::option::Option::Some(MessageType::MessageType_MessageSignature), + "MessageType_GetOwnershipId" => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipId), + "MessageType_OwnershipId" => ::std::option::Option::Some(MessageType::MessageType_OwnershipId), + "MessageType_GetOwnershipProof" => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipProof), + "MessageType_OwnershipProof" => ::std::option::Option::Some(MessageType::MessageType_OwnershipProof), + "MessageType_AuthorizeCoinJoin" => ::std::option::Option::Some(MessageType::MessageType_AuthorizeCoinJoin), + "MessageType_CipherKeyValue" => ::std::option::Option::Some(MessageType::MessageType_CipherKeyValue), + "MessageType_CipheredKeyValue" => ::std::option::Option::Some(MessageType::MessageType_CipheredKeyValue), + "MessageType_SignIdentity" => ::std::option::Option::Some(MessageType::MessageType_SignIdentity), + "MessageType_SignedIdentity" => ::std::option::Option::Some(MessageType::MessageType_SignedIdentity), + "MessageType_GetECDHSessionKey" => ::std::option::Option::Some(MessageType::MessageType_GetECDHSessionKey), + "MessageType_ECDHSessionKey" => ::std::option::Option::Some(MessageType::MessageType_ECDHSessionKey), + "MessageType_CosiCommit" => ::std::option::Option::Some(MessageType::MessageType_CosiCommit), + "MessageType_CosiCommitment" => ::std::option::Option::Some(MessageType::MessageType_CosiCommitment), + "MessageType_CosiSign" => ::std::option::Option::Some(MessageType::MessageType_CosiSign), + "MessageType_CosiSignature" => ::std::option::Option::Some(MessageType::MessageType_CosiSignature), + "MessageType_DebugLinkDecision" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkDecision), + "MessageType_DebugLinkGetState" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkGetState), + "MessageType_DebugLinkState" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkState), + "MessageType_DebugLinkStop" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkStop), + "MessageType_DebugLinkLog" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLog), + "MessageType_DebugLinkMemoryRead" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryRead), + "MessageType_DebugLinkMemory" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemory), + "MessageType_DebugLinkMemoryWrite" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryWrite), + "MessageType_DebugLinkFlashErase" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkFlashErase), + "MessageType_DebugLinkLayout" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLayout), + "MessageType_DebugLinkReseedRandom" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkReseedRandom), + "MessageType_DebugLinkRecordScreen" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkRecordScreen), + "MessageType_DebugLinkEraseSdCard" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkEraseSdCard), + "MessageType_DebugLinkWatchLayout" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkWatchLayout), + "MessageType_DebugLinkResetDebugEvents" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkResetDebugEvents), + "MessageType_EthereumGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EthereumGetPublicKey), + "MessageType_EthereumPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EthereumPublicKey), + "MessageType_EthereumGetAddress" => ::std::option::Option::Some(MessageType::MessageType_EthereumGetAddress), + "MessageType_EthereumAddress" => ::std::option::Option::Some(MessageType::MessageType_EthereumAddress), + "MessageType_EthereumSignTx" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTx), + "MessageType_EthereumSignTxEIP1559" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTxEIP1559), + "MessageType_EthereumTxRequest" => ::std::option::Option::Some(MessageType::MessageType_EthereumTxRequest), + "MessageType_EthereumTxAck" => ::std::option::Option::Some(MessageType::MessageType_EthereumTxAck), + "MessageType_EthereumSignMessage" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignMessage), + "MessageType_EthereumVerifyMessage" => ::std::option::Option::Some(MessageType::MessageType_EthereumVerifyMessage), + "MessageType_EthereumMessageSignature" => ::std::option::Option::Some(MessageType::MessageType_EthereumMessageSignature), + "MessageType_EthereumSignTypedData" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedData), + "MessageType_EthereumTypedDataStructRequest" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructRequest), + "MessageType_EthereumTypedDataStructAck" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructAck), + "MessageType_EthereumTypedDataValueRequest" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueRequest), + "MessageType_EthereumTypedDataValueAck" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueAck), + "MessageType_EthereumTypedDataSignature" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataSignature), + "MessageType_EthereumSignTypedHash" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedHash), + "MessageType_NEMGetAddress" => ::std::option::Option::Some(MessageType::MessageType_NEMGetAddress), + "MessageType_NEMAddress" => ::std::option::Option::Some(MessageType::MessageType_NEMAddress), + "MessageType_NEMSignTx" => ::std::option::Option::Some(MessageType::MessageType_NEMSignTx), + "MessageType_NEMSignedTx" => ::std::option::Option::Some(MessageType::MessageType_NEMSignedTx), + "MessageType_NEMDecryptMessage" => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptMessage), + "MessageType_NEMDecryptedMessage" => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptedMessage), + "MessageType_TezosGetAddress" => ::std::option::Option::Some(MessageType::MessageType_TezosGetAddress), + "MessageType_TezosAddress" => ::std::option::Option::Some(MessageType::MessageType_TezosAddress), + "MessageType_TezosSignTx" => ::std::option::Option::Some(MessageType::MessageType_TezosSignTx), + "MessageType_TezosSignedTx" => ::std::option::Option::Some(MessageType::MessageType_TezosSignedTx), + "MessageType_TezosGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_TezosGetPublicKey), + "MessageType_TezosPublicKey" => ::std::option::Option::Some(MessageType::MessageType_TezosPublicKey), + "MessageType_StellarSignTx" => ::std::option::Option::Some(MessageType::MessageType_StellarSignTx), + "MessageType_StellarTxOpRequest" => ::std::option::Option::Some(MessageType::MessageType_StellarTxOpRequest), + "MessageType_StellarGetAddress" => ::std::option::Option::Some(MessageType::MessageType_StellarGetAddress), + "MessageType_StellarAddress" => ::std::option::Option::Some(MessageType::MessageType_StellarAddress), + "MessageType_StellarCreateAccountOp" => ::std::option::Option::Some(MessageType::MessageType_StellarCreateAccountOp), + "MessageType_StellarPaymentOp" => ::std::option::Option::Some(MessageType::MessageType_StellarPaymentOp), + "MessageType_StellarPathPaymentStrictReceiveOp" => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictReceiveOp), + "MessageType_StellarManageSellOfferOp" => ::std::option::Option::Some(MessageType::MessageType_StellarManageSellOfferOp), + "MessageType_StellarCreatePassiveSellOfferOp" => ::std::option::Option::Some(MessageType::MessageType_StellarCreatePassiveSellOfferOp), + "MessageType_StellarSetOptionsOp" => ::std::option::Option::Some(MessageType::MessageType_StellarSetOptionsOp), + "MessageType_StellarChangeTrustOp" => ::std::option::Option::Some(MessageType::MessageType_StellarChangeTrustOp), + "MessageType_StellarAllowTrustOp" => ::std::option::Option::Some(MessageType::MessageType_StellarAllowTrustOp), + "MessageType_StellarAccountMergeOp" => ::std::option::Option::Some(MessageType::MessageType_StellarAccountMergeOp), + "MessageType_StellarManageDataOp" => ::std::option::Option::Some(MessageType::MessageType_StellarManageDataOp), + "MessageType_StellarBumpSequenceOp" => ::std::option::Option::Some(MessageType::MessageType_StellarBumpSequenceOp), + "MessageType_StellarManageBuyOfferOp" => ::std::option::Option::Some(MessageType::MessageType_StellarManageBuyOfferOp), + "MessageType_StellarPathPaymentStrictSendOp" => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictSendOp), + "MessageType_StellarClaimClaimableBalanceOp" => ::std::option::Option::Some(MessageType::MessageType_StellarClaimClaimableBalanceOp), + "MessageType_StellarSignedTx" => ::std::option::Option::Some(MessageType::MessageType_StellarSignedTx), + "MessageType_CardanoGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_CardanoGetPublicKey), + "MessageType_CardanoPublicKey" => ::std::option::Option::Some(MessageType::MessageType_CardanoPublicKey), + "MessageType_CardanoGetAddress" => ::std::option::Option::Some(MessageType::MessageType_CardanoGetAddress), + "MessageType_CardanoAddress" => ::std::option::Option::Some(MessageType::MessageType_CardanoAddress), + "MessageType_CardanoTxItemAck" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxItemAck), + "MessageType_CardanoTxAuxiliaryDataSupplement" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryDataSupplement), + "MessageType_CardanoTxWitnessRequest" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessRequest), + "MessageType_CardanoTxWitnessResponse" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessResponse), + "MessageType_CardanoTxHostAck" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxHostAck), + "MessageType_CardanoTxBodyHash" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxBodyHash), + "MessageType_CardanoSignTxFinished" => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxFinished), + "MessageType_CardanoSignTxInit" => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxInit), + "MessageType_CardanoTxInput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInput), + "MessageType_CardanoTxOutput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxOutput), + "MessageType_CardanoAssetGroup" => ::std::option::Option::Some(MessageType::MessageType_CardanoAssetGroup), + "MessageType_CardanoToken" => ::std::option::Option::Some(MessageType::MessageType_CardanoToken), + "MessageType_CardanoTxCertificate" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCertificate), + "MessageType_CardanoTxWithdrawal" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWithdrawal), + "MessageType_CardanoTxAuxiliaryData" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryData), + "MessageType_CardanoPoolOwner" => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolOwner), + "MessageType_CardanoPoolRelayParameters" => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolRelayParameters), + "MessageType_CardanoGetNativeScriptHash" => ::std::option::Option::Some(MessageType::MessageType_CardanoGetNativeScriptHash), + "MessageType_CardanoNativeScriptHash" => ::std::option::Option::Some(MessageType::MessageType_CardanoNativeScriptHash), + "MessageType_CardanoTxMint" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxMint), + "MessageType_CardanoTxCollateralInput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCollateralInput), + "MessageType_CardanoTxRequiredSigner" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxRequiredSigner), + "MessageType_CardanoTxInlineDatumChunk" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInlineDatumChunk), + "MessageType_CardanoTxReferenceScriptChunk" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceScriptChunk), + "MessageType_CardanoTxReferenceInput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceInput), + "MessageType_RippleGetAddress" => ::std::option::Option::Some(MessageType::MessageType_RippleGetAddress), + "MessageType_RippleAddress" => ::std::option::Option::Some(MessageType::MessageType_RippleAddress), + "MessageType_RippleSignTx" => ::std::option::Option::Some(MessageType::MessageType_RippleSignTx), + "MessageType_RippleSignedTx" => ::std::option::Option::Some(MessageType::MessageType_RippleSignedTx), + "MessageType_MoneroTransactionInitRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitRequest), + "MessageType_MoneroTransactionInitAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitAck), + "MessageType_MoneroTransactionSetInputRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputRequest), + "MessageType_MoneroTransactionSetInputAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputAck), + "MessageType_MoneroTransactionInputViniRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniRequest), + "MessageType_MoneroTransactionInputViniAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniAck), + "MessageType_MoneroTransactionAllInputsSetRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetRequest), + "MessageType_MoneroTransactionAllInputsSetAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetAck), + "MessageType_MoneroTransactionSetOutputRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputRequest), + "MessageType_MoneroTransactionSetOutputAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputAck), + "MessageType_MoneroTransactionAllOutSetRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetRequest), + "MessageType_MoneroTransactionAllOutSetAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetAck), + "MessageType_MoneroTransactionSignInputRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputRequest), + "MessageType_MoneroTransactionSignInputAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputAck), + "MessageType_MoneroTransactionFinalRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalRequest), + "MessageType_MoneroTransactionFinalAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalAck), + "MessageType_MoneroKeyImageExportInitRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitRequest), + "MessageType_MoneroKeyImageExportInitAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitAck), + "MessageType_MoneroKeyImageSyncStepRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepRequest), + "MessageType_MoneroKeyImageSyncStepAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepAck), + "MessageType_MoneroKeyImageSyncFinalRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalRequest), + "MessageType_MoneroKeyImageSyncFinalAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalAck), + "MessageType_MoneroGetAddress" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetAddress), + "MessageType_MoneroAddress" => ::std::option::Option::Some(MessageType::MessageType_MoneroAddress), + "MessageType_MoneroGetWatchKey" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetWatchKey), + "MessageType_MoneroWatchKey" => ::std::option::Option::Some(MessageType::MessageType_MoneroWatchKey), + "MessageType_DebugMoneroDiagRequest" => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagRequest), + "MessageType_DebugMoneroDiagAck" => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagAck), + "MessageType_MoneroGetTxKeyRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyRequest), + "MessageType_MoneroGetTxKeyAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyAck), + "MessageType_MoneroLiveRefreshStartRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartRequest), + "MessageType_MoneroLiveRefreshStartAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartAck), + "MessageType_MoneroLiveRefreshStepRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepRequest), + "MessageType_MoneroLiveRefreshStepAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepAck), + "MessageType_MoneroLiveRefreshFinalRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalRequest), + "MessageType_MoneroLiveRefreshFinalAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalAck), + "MessageType_EosGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EosGetPublicKey), + "MessageType_EosPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EosPublicKey), + "MessageType_EosSignTx" => ::std::option::Option::Some(MessageType::MessageType_EosSignTx), + "MessageType_EosTxActionRequest" => ::std::option::Option::Some(MessageType::MessageType_EosTxActionRequest), + "MessageType_EosTxActionAck" => ::std::option::Option::Some(MessageType::MessageType_EosTxActionAck), + "MessageType_EosSignedTx" => ::std::option::Option::Some(MessageType::MessageType_EosSignedTx), + "MessageType_BinanceGetAddress" => ::std::option::Option::Some(MessageType::MessageType_BinanceGetAddress), + "MessageType_BinanceAddress" => ::std::option::Option::Some(MessageType::MessageType_BinanceAddress), + "MessageType_BinanceGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_BinanceGetPublicKey), + "MessageType_BinancePublicKey" => ::std::option::Option::Some(MessageType::MessageType_BinancePublicKey), + "MessageType_BinanceSignTx" => ::std::option::Option::Some(MessageType::MessageType_BinanceSignTx), + "MessageType_BinanceTxRequest" => ::std::option::Option::Some(MessageType::MessageType_BinanceTxRequest), + "MessageType_BinanceTransferMsg" => ::std::option::Option::Some(MessageType::MessageType_BinanceTransferMsg), + "MessageType_BinanceOrderMsg" => ::std::option::Option::Some(MessageType::MessageType_BinanceOrderMsg), + "MessageType_BinanceCancelMsg" => ::std::option::Option::Some(MessageType::MessageType_BinanceCancelMsg), + "MessageType_BinanceSignedTx" => ::std::option::Option::Some(MessageType::MessageType_BinanceSignedTx), + "MessageType_WebAuthnListResidentCredentials" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnListResidentCredentials), + "MessageType_WebAuthnCredentials" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnCredentials), + "MessageType_WebAuthnAddResidentCredential" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnAddResidentCredential), + "MessageType_WebAuthnRemoveResidentCredential" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnRemoveResidentCredential), + "MessageType_SolanaGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_SolanaGetPublicKey), + "MessageType_SolanaPublicKey" => ::std::option::Option::Some(MessageType::MessageType_SolanaPublicKey), + "MessageType_SolanaGetAddress" => ::std::option::Option::Some(MessageType::MessageType_SolanaGetAddress), + "MessageType_SolanaAddress" => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress), + "MessageType_SolanaSignTx" => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx), + "MessageType_SolanaTxSignature" => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature), + "MessageType_MintlayerGetAddress" => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetAddress), + "MessageType_MintlayerAddress" => ::std::option::Option::Some(MessageType::MessageType_MintlayerAddress), + "MessageType_MintlayerGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetPublicKey), + "MessageType_MintlayerPublicKey" => ::std::option::Option::Some(MessageType::MessageType_MintlayerPublicKey), + "MessageType_MintlayerVerifySig" => ::std::option::Option::Some(MessageType::MessageType_MintlayerVerifySig), + "MessageType_MintlayerSignTx" => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignTx), + "MessageType_MintlayerTxRequest" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxRequest), + "MessageType_MintlayerTxAckUtxoInput" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckUtxoInput), + "MessageType_MintlayerTxAckOutput" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckOutput), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [MessageType] = &[ + MessageType::MessageType_Initialize, + MessageType::MessageType_Ping, + MessageType::MessageType_Success, + MessageType::MessageType_Failure, + MessageType::MessageType_ChangePin, + MessageType::MessageType_WipeDevice, + MessageType::MessageType_GetEntropy, + MessageType::MessageType_Entropy, + MessageType::MessageType_LoadDevice, + MessageType::MessageType_ResetDevice, + MessageType::MessageType_SetBusy, + MessageType::MessageType_Features, + MessageType::MessageType_PinMatrixRequest, + MessageType::MessageType_PinMatrixAck, + MessageType::MessageType_Cancel, + MessageType::MessageType_LockDevice, + MessageType::MessageType_ApplySettings, + MessageType::MessageType_ButtonRequest, + MessageType::MessageType_ButtonAck, + MessageType::MessageType_ApplyFlags, + MessageType::MessageType_GetNonce, + MessageType::MessageType_Nonce, + MessageType::MessageType_BackupDevice, + MessageType::MessageType_EntropyRequest, + MessageType::MessageType_EntropyAck, + MessageType::MessageType_PassphraseRequest, + MessageType::MessageType_PassphraseAck, + MessageType::MessageType_RecoveryDevice, + MessageType::MessageType_WordRequest, + MessageType::MessageType_WordAck, + MessageType::MessageType_GetFeatures, + MessageType::MessageType_SdProtect, + MessageType::MessageType_ChangeWipeCode, + MessageType::MessageType_EndSession, + MessageType::MessageType_DoPreauthorized, + MessageType::MessageType_PreauthorizedRequest, + MessageType::MessageType_CancelAuthorization, + MessageType::MessageType_RebootToBootloader, + MessageType::MessageType_GetFirmwareHash, + MessageType::MessageType_FirmwareHash, + MessageType::MessageType_UnlockPath, + MessageType::MessageType_UnlockedPathRequest, + MessageType::MessageType_ShowDeviceTutorial, + MessageType::MessageType_UnlockBootloader, + MessageType::MessageType_AuthenticateDevice, + MessageType::MessageType_AuthenticityProof, + MessageType::MessageType_ChangeLanguage, + MessageType::MessageType_TranslationDataRequest, + MessageType::MessageType_TranslationDataAck, + MessageType::MessageType_SetU2FCounter, + MessageType::MessageType_GetNextU2FCounter, + MessageType::MessageType_NextU2FCounter, + MessageType::MessageType_Deprecated_PassphraseStateRequest, + MessageType::MessageType_Deprecated_PassphraseStateAck, + MessageType::MessageType_FirmwareErase, + MessageType::MessageType_FirmwareUpload, + MessageType::MessageType_FirmwareRequest, + MessageType::MessageType_ProdTestT1, + MessageType::MessageType_GetPublicKey, + MessageType::MessageType_PublicKey, + MessageType::MessageType_SignTx, + MessageType::MessageType_TxRequest, + MessageType::MessageType_TxAck, + MessageType::MessageType_GetAddress, + MessageType::MessageType_Address, + MessageType::MessageType_TxAckPaymentRequest, + MessageType::MessageType_SignMessage, + MessageType::MessageType_VerifyMessage, + MessageType::MessageType_MessageSignature, + MessageType::MessageType_GetOwnershipId, + MessageType::MessageType_OwnershipId, + MessageType::MessageType_GetOwnershipProof, + MessageType::MessageType_OwnershipProof, + MessageType::MessageType_AuthorizeCoinJoin, + MessageType::MessageType_CipherKeyValue, + MessageType::MessageType_CipheredKeyValue, + MessageType::MessageType_SignIdentity, + MessageType::MessageType_SignedIdentity, + MessageType::MessageType_GetECDHSessionKey, + MessageType::MessageType_ECDHSessionKey, + MessageType::MessageType_CosiCommit, + MessageType::MessageType_CosiCommitment, + MessageType::MessageType_CosiSign, + MessageType::MessageType_CosiSignature, + MessageType::MessageType_DebugLinkDecision, + MessageType::MessageType_DebugLinkGetState, + MessageType::MessageType_DebugLinkState, + MessageType::MessageType_DebugLinkStop, + MessageType::MessageType_DebugLinkLog, + MessageType::MessageType_DebugLinkMemoryRead, + MessageType::MessageType_DebugLinkMemory, + MessageType::MessageType_DebugLinkMemoryWrite, + MessageType::MessageType_DebugLinkFlashErase, + MessageType::MessageType_DebugLinkLayout, + MessageType::MessageType_DebugLinkReseedRandom, + MessageType::MessageType_DebugLinkRecordScreen, + MessageType::MessageType_DebugLinkEraseSdCard, + MessageType::MessageType_DebugLinkWatchLayout, + MessageType::MessageType_DebugLinkResetDebugEvents, + MessageType::MessageType_EthereumGetPublicKey, + MessageType::MessageType_EthereumPublicKey, + MessageType::MessageType_EthereumGetAddress, + MessageType::MessageType_EthereumAddress, + MessageType::MessageType_EthereumSignTx, + MessageType::MessageType_EthereumSignTxEIP1559, + MessageType::MessageType_EthereumTxRequest, + MessageType::MessageType_EthereumTxAck, + MessageType::MessageType_EthereumSignMessage, + MessageType::MessageType_EthereumVerifyMessage, + MessageType::MessageType_EthereumMessageSignature, + MessageType::MessageType_EthereumSignTypedData, + MessageType::MessageType_EthereumTypedDataStructRequest, + MessageType::MessageType_EthereumTypedDataStructAck, + MessageType::MessageType_EthereumTypedDataValueRequest, + MessageType::MessageType_EthereumTypedDataValueAck, + MessageType::MessageType_EthereumTypedDataSignature, + MessageType::MessageType_EthereumSignTypedHash, + MessageType::MessageType_NEMGetAddress, + MessageType::MessageType_NEMAddress, + MessageType::MessageType_NEMSignTx, + MessageType::MessageType_NEMSignedTx, + MessageType::MessageType_NEMDecryptMessage, + MessageType::MessageType_NEMDecryptedMessage, + MessageType::MessageType_TezosGetAddress, + MessageType::MessageType_TezosAddress, + MessageType::MessageType_TezosSignTx, + MessageType::MessageType_TezosSignedTx, + MessageType::MessageType_TezosGetPublicKey, + MessageType::MessageType_TezosPublicKey, + MessageType::MessageType_StellarSignTx, + MessageType::MessageType_StellarTxOpRequest, + MessageType::MessageType_StellarGetAddress, + MessageType::MessageType_StellarAddress, + MessageType::MessageType_StellarCreateAccountOp, + MessageType::MessageType_StellarPaymentOp, + MessageType::MessageType_StellarPathPaymentStrictReceiveOp, + MessageType::MessageType_StellarManageSellOfferOp, + MessageType::MessageType_StellarCreatePassiveSellOfferOp, + MessageType::MessageType_StellarSetOptionsOp, + MessageType::MessageType_StellarChangeTrustOp, + MessageType::MessageType_StellarAllowTrustOp, + MessageType::MessageType_StellarAccountMergeOp, + MessageType::MessageType_StellarManageDataOp, + MessageType::MessageType_StellarBumpSequenceOp, + MessageType::MessageType_StellarManageBuyOfferOp, + MessageType::MessageType_StellarPathPaymentStrictSendOp, + MessageType::MessageType_StellarClaimClaimableBalanceOp, + MessageType::MessageType_StellarSignedTx, + MessageType::MessageType_CardanoGetPublicKey, + MessageType::MessageType_CardanoPublicKey, + MessageType::MessageType_CardanoGetAddress, + MessageType::MessageType_CardanoAddress, + MessageType::MessageType_CardanoTxItemAck, + MessageType::MessageType_CardanoTxAuxiliaryDataSupplement, + MessageType::MessageType_CardanoTxWitnessRequest, + MessageType::MessageType_CardanoTxWitnessResponse, + MessageType::MessageType_CardanoTxHostAck, + MessageType::MessageType_CardanoTxBodyHash, + MessageType::MessageType_CardanoSignTxFinished, + MessageType::MessageType_CardanoSignTxInit, + MessageType::MessageType_CardanoTxInput, + MessageType::MessageType_CardanoTxOutput, + MessageType::MessageType_CardanoAssetGroup, + MessageType::MessageType_CardanoToken, + MessageType::MessageType_CardanoTxCertificate, + MessageType::MessageType_CardanoTxWithdrawal, + MessageType::MessageType_CardanoTxAuxiliaryData, + MessageType::MessageType_CardanoPoolOwner, + MessageType::MessageType_CardanoPoolRelayParameters, + MessageType::MessageType_CardanoGetNativeScriptHash, + MessageType::MessageType_CardanoNativeScriptHash, + MessageType::MessageType_CardanoTxMint, + MessageType::MessageType_CardanoTxCollateralInput, + MessageType::MessageType_CardanoTxRequiredSigner, + MessageType::MessageType_CardanoTxInlineDatumChunk, + MessageType::MessageType_CardanoTxReferenceScriptChunk, + MessageType::MessageType_CardanoTxReferenceInput, + MessageType::MessageType_RippleGetAddress, + MessageType::MessageType_RippleAddress, + MessageType::MessageType_RippleSignTx, + MessageType::MessageType_RippleSignedTx, + MessageType::MessageType_MoneroTransactionInitRequest, + MessageType::MessageType_MoneroTransactionInitAck, + MessageType::MessageType_MoneroTransactionSetInputRequest, + MessageType::MessageType_MoneroTransactionSetInputAck, + MessageType::MessageType_MoneroTransactionInputViniRequest, + MessageType::MessageType_MoneroTransactionInputViniAck, + MessageType::MessageType_MoneroTransactionAllInputsSetRequest, + MessageType::MessageType_MoneroTransactionAllInputsSetAck, + MessageType::MessageType_MoneroTransactionSetOutputRequest, + MessageType::MessageType_MoneroTransactionSetOutputAck, + MessageType::MessageType_MoneroTransactionAllOutSetRequest, + MessageType::MessageType_MoneroTransactionAllOutSetAck, + MessageType::MessageType_MoneroTransactionSignInputRequest, + MessageType::MessageType_MoneroTransactionSignInputAck, + MessageType::MessageType_MoneroTransactionFinalRequest, + MessageType::MessageType_MoneroTransactionFinalAck, + MessageType::MessageType_MoneroKeyImageExportInitRequest, + MessageType::MessageType_MoneroKeyImageExportInitAck, + MessageType::MessageType_MoneroKeyImageSyncStepRequest, + MessageType::MessageType_MoneroKeyImageSyncStepAck, + MessageType::MessageType_MoneroKeyImageSyncFinalRequest, + MessageType::MessageType_MoneroKeyImageSyncFinalAck, + MessageType::MessageType_MoneroGetAddress, + MessageType::MessageType_MoneroAddress, + MessageType::MessageType_MoneroGetWatchKey, + MessageType::MessageType_MoneroWatchKey, + MessageType::MessageType_DebugMoneroDiagRequest, + MessageType::MessageType_DebugMoneroDiagAck, + MessageType::MessageType_MoneroGetTxKeyRequest, + MessageType::MessageType_MoneroGetTxKeyAck, + MessageType::MessageType_MoneroLiveRefreshStartRequest, + MessageType::MessageType_MoneroLiveRefreshStartAck, + MessageType::MessageType_MoneroLiveRefreshStepRequest, + MessageType::MessageType_MoneroLiveRefreshStepAck, + MessageType::MessageType_MoneroLiveRefreshFinalRequest, + MessageType::MessageType_MoneroLiveRefreshFinalAck, + MessageType::MessageType_EosGetPublicKey, + MessageType::MessageType_EosPublicKey, + MessageType::MessageType_EosSignTx, + MessageType::MessageType_EosTxActionRequest, + MessageType::MessageType_EosTxActionAck, + MessageType::MessageType_EosSignedTx, + MessageType::MessageType_BinanceGetAddress, + MessageType::MessageType_BinanceAddress, + MessageType::MessageType_BinanceGetPublicKey, + MessageType::MessageType_BinancePublicKey, + MessageType::MessageType_BinanceSignTx, + MessageType::MessageType_BinanceTxRequest, + MessageType::MessageType_BinanceTransferMsg, + MessageType::MessageType_BinanceOrderMsg, + MessageType::MessageType_BinanceCancelMsg, + MessageType::MessageType_BinanceSignedTx, + MessageType::MessageType_WebAuthnListResidentCredentials, + MessageType::MessageType_WebAuthnCredentials, + MessageType::MessageType_WebAuthnAddResidentCredential, + MessageType::MessageType_WebAuthnRemoveResidentCredential, + MessageType::MessageType_SolanaGetPublicKey, + MessageType::MessageType_SolanaPublicKey, + MessageType::MessageType_SolanaGetAddress, + MessageType::MessageType_SolanaAddress, + MessageType::MessageType_SolanaSignTx, + MessageType::MessageType_SolanaTxSignature, + MessageType::MessageType_MintlayerGetAddress, + MessageType::MessageType_MintlayerAddress, + MessageType::MessageType_MintlayerGetPublicKey, + MessageType::MessageType_MintlayerPublicKey, + MessageType::MessageType_MintlayerVerifySig, + MessageType::MessageType_MintlayerSignTx, + MessageType::MessageType_MintlayerTxRequest, + MessageType::MessageType_MintlayerTxAckUtxoInput, + MessageType::MessageType_MintlayerTxAckOutput, + ]; +} + +impl ::protobuf::EnumFull for MessageType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("MessageType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + MessageType::MessageType_Initialize => 0, + MessageType::MessageType_Ping => 1, + MessageType::MessageType_Success => 2, + MessageType::MessageType_Failure => 3, + MessageType::MessageType_ChangePin => 4, + MessageType::MessageType_WipeDevice => 5, + MessageType::MessageType_GetEntropy => 6, + MessageType::MessageType_Entropy => 7, + MessageType::MessageType_LoadDevice => 8, + MessageType::MessageType_ResetDevice => 9, + MessageType::MessageType_SetBusy => 10, + MessageType::MessageType_Features => 11, + MessageType::MessageType_PinMatrixRequest => 12, + MessageType::MessageType_PinMatrixAck => 13, + MessageType::MessageType_Cancel => 14, + MessageType::MessageType_LockDevice => 15, + MessageType::MessageType_ApplySettings => 16, + MessageType::MessageType_ButtonRequest => 17, + MessageType::MessageType_ButtonAck => 18, + MessageType::MessageType_ApplyFlags => 19, + MessageType::MessageType_GetNonce => 20, + MessageType::MessageType_Nonce => 21, + MessageType::MessageType_BackupDevice => 22, + MessageType::MessageType_EntropyRequest => 23, + MessageType::MessageType_EntropyAck => 24, + MessageType::MessageType_PassphraseRequest => 25, + MessageType::MessageType_PassphraseAck => 26, + MessageType::MessageType_RecoveryDevice => 27, + MessageType::MessageType_WordRequest => 28, + MessageType::MessageType_WordAck => 29, + MessageType::MessageType_GetFeatures => 30, + MessageType::MessageType_SdProtect => 31, + MessageType::MessageType_ChangeWipeCode => 32, + MessageType::MessageType_EndSession => 33, + MessageType::MessageType_DoPreauthorized => 34, + MessageType::MessageType_PreauthorizedRequest => 35, + MessageType::MessageType_CancelAuthorization => 36, + MessageType::MessageType_RebootToBootloader => 37, + MessageType::MessageType_GetFirmwareHash => 38, + MessageType::MessageType_FirmwareHash => 39, + MessageType::MessageType_UnlockPath => 40, + MessageType::MessageType_UnlockedPathRequest => 41, + MessageType::MessageType_ShowDeviceTutorial => 42, + MessageType::MessageType_UnlockBootloader => 43, + MessageType::MessageType_AuthenticateDevice => 44, + MessageType::MessageType_AuthenticityProof => 45, + MessageType::MessageType_ChangeLanguage => 46, + MessageType::MessageType_TranslationDataRequest => 47, + MessageType::MessageType_TranslationDataAck => 48, + MessageType::MessageType_SetU2FCounter => 49, + MessageType::MessageType_GetNextU2FCounter => 50, + MessageType::MessageType_NextU2FCounter => 51, + MessageType::MessageType_Deprecated_PassphraseStateRequest => 52, + MessageType::MessageType_Deprecated_PassphraseStateAck => 53, + MessageType::MessageType_FirmwareErase => 54, + MessageType::MessageType_FirmwareUpload => 55, + MessageType::MessageType_FirmwareRequest => 56, + MessageType::MessageType_ProdTestT1 => 57, + MessageType::MessageType_GetPublicKey => 58, + MessageType::MessageType_PublicKey => 59, + MessageType::MessageType_SignTx => 60, + MessageType::MessageType_TxRequest => 61, + MessageType::MessageType_TxAck => 62, + MessageType::MessageType_GetAddress => 63, + MessageType::MessageType_Address => 64, + MessageType::MessageType_TxAckPaymentRequest => 65, + MessageType::MessageType_SignMessage => 66, + MessageType::MessageType_VerifyMessage => 67, + MessageType::MessageType_MessageSignature => 68, + MessageType::MessageType_GetOwnershipId => 69, + MessageType::MessageType_OwnershipId => 70, + MessageType::MessageType_GetOwnershipProof => 71, + MessageType::MessageType_OwnershipProof => 72, + MessageType::MessageType_AuthorizeCoinJoin => 73, + MessageType::MessageType_CipherKeyValue => 74, + MessageType::MessageType_CipheredKeyValue => 75, + MessageType::MessageType_SignIdentity => 76, + MessageType::MessageType_SignedIdentity => 77, + MessageType::MessageType_GetECDHSessionKey => 78, + MessageType::MessageType_ECDHSessionKey => 79, + MessageType::MessageType_CosiCommit => 80, + MessageType::MessageType_CosiCommitment => 81, + MessageType::MessageType_CosiSign => 82, + MessageType::MessageType_CosiSignature => 83, + MessageType::MessageType_DebugLinkDecision => 84, + MessageType::MessageType_DebugLinkGetState => 85, + MessageType::MessageType_DebugLinkState => 86, + MessageType::MessageType_DebugLinkStop => 87, + MessageType::MessageType_DebugLinkLog => 88, + MessageType::MessageType_DebugLinkMemoryRead => 89, + MessageType::MessageType_DebugLinkMemory => 90, + MessageType::MessageType_DebugLinkMemoryWrite => 91, + MessageType::MessageType_DebugLinkFlashErase => 92, + MessageType::MessageType_DebugLinkLayout => 93, + MessageType::MessageType_DebugLinkReseedRandom => 94, + MessageType::MessageType_DebugLinkRecordScreen => 95, + MessageType::MessageType_DebugLinkEraseSdCard => 96, + MessageType::MessageType_DebugLinkWatchLayout => 97, + MessageType::MessageType_DebugLinkResetDebugEvents => 98, + MessageType::MessageType_EthereumGetPublicKey => 99, + MessageType::MessageType_EthereumPublicKey => 100, + MessageType::MessageType_EthereumGetAddress => 101, + MessageType::MessageType_EthereumAddress => 102, + MessageType::MessageType_EthereumSignTx => 103, + MessageType::MessageType_EthereumSignTxEIP1559 => 104, + MessageType::MessageType_EthereumTxRequest => 105, + MessageType::MessageType_EthereumTxAck => 106, + MessageType::MessageType_EthereumSignMessage => 107, + MessageType::MessageType_EthereumVerifyMessage => 108, + MessageType::MessageType_EthereumMessageSignature => 109, + MessageType::MessageType_EthereumSignTypedData => 110, + MessageType::MessageType_EthereumTypedDataStructRequest => 111, + MessageType::MessageType_EthereumTypedDataStructAck => 112, + MessageType::MessageType_EthereumTypedDataValueRequest => 113, + MessageType::MessageType_EthereumTypedDataValueAck => 114, + MessageType::MessageType_EthereumTypedDataSignature => 115, + MessageType::MessageType_EthereumSignTypedHash => 116, + MessageType::MessageType_NEMGetAddress => 117, + MessageType::MessageType_NEMAddress => 118, + MessageType::MessageType_NEMSignTx => 119, + MessageType::MessageType_NEMSignedTx => 120, + MessageType::MessageType_NEMDecryptMessage => 121, + MessageType::MessageType_NEMDecryptedMessage => 122, + MessageType::MessageType_TezosGetAddress => 123, + MessageType::MessageType_TezosAddress => 124, + MessageType::MessageType_TezosSignTx => 125, + MessageType::MessageType_TezosSignedTx => 126, + MessageType::MessageType_TezosGetPublicKey => 127, + MessageType::MessageType_TezosPublicKey => 128, + MessageType::MessageType_StellarSignTx => 129, + MessageType::MessageType_StellarTxOpRequest => 130, + MessageType::MessageType_StellarGetAddress => 131, + MessageType::MessageType_StellarAddress => 132, + MessageType::MessageType_StellarCreateAccountOp => 133, + MessageType::MessageType_StellarPaymentOp => 134, + MessageType::MessageType_StellarPathPaymentStrictReceiveOp => 135, + MessageType::MessageType_StellarManageSellOfferOp => 136, + MessageType::MessageType_StellarCreatePassiveSellOfferOp => 137, + MessageType::MessageType_StellarSetOptionsOp => 138, + MessageType::MessageType_StellarChangeTrustOp => 139, + MessageType::MessageType_StellarAllowTrustOp => 140, + MessageType::MessageType_StellarAccountMergeOp => 141, + MessageType::MessageType_StellarManageDataOp => 142, + MessageType::MessageType_StellarBumpSequenceOp => 143, + MessageType::MessageType_StellarManageBuyOfferOp => 144, + MessageType::MessageType_StellarPathPaymentStrictSendOp => 145, + MessageType::MessageType_StellarClaimClaimableBalanceOp => 146, + MessageType::MessageType_StellarSignedTx => 147, + MessageType::MessageType_CardanoGetPublicKey => 148, + MessageType::MessageType_CardanoPublicKey => 149, + MessageType::MessageType_CardanoGetAddress => 150, + MessageType::MessageType_CardanoAddress => 151, + MessageType::MessageType_CardanoTxItemAck => 152, + MessageType::MessageType_CardanoTxAuxiliaryDataSupplement => 153, + MessageType::MessageType_CardanoTxWitnessRequest => 154, + MessageType::MessageType_CardanoTxWitnessResponse => 155, + MessageType::MessageType_CardanoTxHostAck => 156, + MessageType::MessageType_CardanoTxBodyHash => 157, + MessageType::MessageType_CardanoSignTxFinished => 158, + MessageType::MessageType_CardanoSignTxInit => 159, + MessageType::MessageType_CardanoTxInput => 160, + MessageType::MessageType_CardanoTxOutput => 161, + MessageType::MessageType_CardanoAssetGroup => 162, + MessageType::MessageType_CardanoToken => 163, + MessageType::MessageType_CardanoTxCertificate => 164, + MessageType::MessageType_CardanoTxWithdrawal => 165, + MessageType::MessageType_CardanoTxAuxiliaryData => 166, + MessageType::MessageType_CardanoPoolOwner => 167, + MessageType::MessageType_CardanoPoolRelayParameters => 168, + MessageType::MessageType_CardanoGetNativeScriptHash => 169, + MessageType::MessageType_CardanoNativeScriptHash => 170, + MessageType::MessageType_CardanoTxMint => 171, + MessageType::MessageType_CardanoTxCollateralInput => 172, + MessageType::MessageType_CardanoTxRequiredSigner => 173, + MessageType::MessageType_CardanoTxInlineDatumChunk => 174, + MessageType::MessageType_CardanoTxReferenceScriptChunk => 175, + MessageType::MessageType_CardanoTxReferenceInput => 176, + MessageType::MessageType_RippleGetAddress => 177, + MessageType::MessageType_RippleAddress => 178, + MessageType::MessageType_RippleSignTx => 179, + MessageType::MessageType_RippleSignedTx => 180, + MessageType::MessageType_MoneroTransactionInitRequest => 181, + MessageType::MessageType_MoneroTransactionInitAck => 182, + MessageType::MessageType_MoneroTransactionSetInputRequest => 183, + MessageType::MessageType_MoneroTransactionSetInputAck => 184, + MessageType::MessageType_MoneroTransactionInputViniRequest => 185, + MessageType::MessageType_MoneroTransactionInputViniAck => 186, + MessageType::MessageType_MoneroTransactionAllInputsSetRequest => 187, + MessageType::MessageType_MoneroTransactionAllInputsSetAck => 188, + MessageType::MessageType_MoneroTransactionSetOutputRequest => 189, + MessageType::MessageType_MoneroTransactionSetOutputAck => 190, + MessageType::MessageType_MoneroTransactionAllOutSetRequest => 191, + MessageType::MessageType_MoneroTransactionAllOutSetAck => 192, + MessageType::MessageType_MoneroTransactionSignInputRequest => 193, + MessageType::MessageType_MoneroTransactionSignInputAck => 194, + MessageType::MessageType_MoneroTransactionFinalRequest => 195, + MessageType::MessageType_MoneroTransactionFinalAck => 196, + MessageType::MessageType_MoneroKeyImageExportInitRequest => 197, + MessageType::MessageType_MoneroKeyImageExportInitAck => 198, + MessageType::MessageType_MoneroKeyImageSyncStepRequest => 199, + MessageType::MessageType_MoneroKeyImageSyncStepAck => 200, + MessageType::MessageType_MoneroKeyImageSyncFinalRequest => 201, + MessageType::MessageType_MoneroKeyImageSyncFinalAck => 202, + MessageType::MessageType_MoneroGetAddress => 203, + MessageType::MessageType_MoneroAddress => 204, + MessageType::MessageType_MoneroGetWatchKey => 205, + MessageType::MessageType_MoneroWatchKey => 206, + MessageType::MessageType_DebugMoneroDiagRequest => 207, + MessageType::MessageType_DebugMoneroDiagAck => 208, + MessageType::MessageType_MoneroGetTxKeyRequest => 209, + MessageType::MessageType_MoneroGetTxKeyAck => 210, + MessageType::MessageType_MoneroLiveRefreshStartRequest => 211, + MessageType::MessageType_MoneroLiveRefreshStartAck => 212, + MessageType::MessageType_MoneroLiveRefreshStepRequest => 213, + MessageType::MessageType_MoneroLiveRefreshStepAck => 214, + MessageType::MessageType_MoneroLiveRefreshFinalRequest => 215, + MessageType::MessageType_MoneroLiveRefreshFinalAck => 216, + MessageType::MessageType_EosGetPublicKey => 217, + MessageType::MessageType_EosPublicKey => 218, + MessageType::MessageType_EosSignTx => 219, + MessageType::MessageType_EosTxActionRequest => 220, + MessageType::MessageType_EosTxActionAck => 221, + MessageType::MessageType_EosSignedTx => 222, + MessageType::MessageType_BinanceGetAddress => 223, + MessageType::MessageType_BinanceAddress => 224, + MessageType::MessageType_BinanceGetPublicKey => 225, + MessageType::MessageType_BinancePublicKey => 226, + MessageType::MessageType_BinanceSignTx => 227, + MessageType::MessageType_BinanceTxRequest => 228, + MessageType::MessageType_BinanceTransferMsg => 229, + MessageType::MessageType_BinanceOrderMsg => 230, + MessageType::MessageType_BinanceCancelMsg => 231, + MessageType::MessageType_BinanceSignedTx => 232, + MessageType::MessageType_WebAuthnListResidentCredentials => 233, + MessageType::MessageType_WebAuthnCredentials => 234, + MessageType::MessageType_WebAuthnAddResidentCredential => 235, + MessageType::MessageType_WebAuthnRemoveResidentCredential => 236, + MessageType::MessageType_SolanaGetPublicKey => 237, + MessageType::MessageType_SolanaPublicKey => 238, + MessageType::MessageType_SolanaGetAddress => 239, + MessageType::MessageType_SolanaAddress => 240, + MessageType::MessageType_SolanaSignTx => 241, + MessageType::MessageType_SolanaTxSignature => 242, + MessageType::MessageType_MintlayerGetAddress => 243, + MessageType::MessageType_MintlayerAddress => 244, + MessageType::MessageType_MintlayerGetPublicKey => 245, + MessageType::MessageType_MintlayerPublicKey => 246, + MessageType::MessageType_MintlayerVerifySig => 247, + MessageType::MessageType_MintlayerSignTx => 248, + MessageType::MessageType_MintlayerTxRequest => 249, + MessageType::MessageType_MintlayerTxAckUtxoInput => 250, + MessageType::MessageType_MintlayerTxAckOutput => 251, + }; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for MessageType { + fn default() -> Self { + MessageType::MessageType_Initialize + } +} + +impl MessageType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MessageType") + } +} + +/// Extension fields +pub mod exts { + + pub const wire_in: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50002, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const wire_out: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50003, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const wire_debug_in: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50004, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const wire_debug_out: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50005, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const wire_tiny: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50006, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const wire_bootloader: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50007, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const wire_no_fsm: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50008, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const bitcoin_only: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(60000, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const has_bitcoin_only_values: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(51001, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const experimental_message: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(52001, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const wire_type: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, u32> = ::protobuf::ext::ExtFieldOptional::new(52002, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_UINT32); + + pub const experimental_field: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FieldOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(53001, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); + + pub const include_in_bitcoin_only: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(60000, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\x20google/protobuf/de\ + scriptor.proto*\xa3W\n\x0bMessageType\x12(\n\x16MessageType_Initialize\ + \x10\0\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12\x1e\n\ + \x10MessageType_Ping\x10\x01\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\ + %\n\x13MessageType_Success\x10\x02\x1a\x0c\x80\xa6\x1d\x01\xa8\xb5\x18\ + \x01\x98\xb5\x18\x01\x12%\n\x13MessageType_Failure\x10\x03\x1a\x0c\x80\ + \xa6\x1d\x01\xa8\xb5\x18\x01\x98\xb5\x18\x01\x12#\n\x15MessageType_Chang\ + ePin\x10\x04\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16MessageTy\ + pe_WipeDevice\x10\x05\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16\ + MessageType_GetEntropy\x10\t\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\ + !\n\x13MessageType_Entropy\x10\n\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\ + \x12$\n\x16MessageType_LoadDevice\x10\r\x1a\x08\x80\xa6\x1d\x01\x90\xb5\ + \x18\x01\x12%\n\x17MessageType_ResetDevice\x10\x0e\x1a\x08\x80\xa6\x1d\ + \x01\x90\xb5\x18\x01\x12!\n\x13MessageType_SetBusy\x10\x10\x1a\x08\x80\ + \xa6\x1d\x01\x90\xb5\x18\x01\x12\"\n\x14MessageType_Features\x10\x11\x1a\ + \x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12*\n\x1cMessageType_PinMatrixRequ\ + est\x10\x12\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12.\n\x18MessageTyp\ + e_PinMatrixAck\x10\x13\x1a\x10\xc0\xb5\x18\x01\xb0\xb5\x18\x01\x80\xa6\ + \x1d\x01\x90\xb5\x18\x01\x12$\n\x12MessageType_Cancel\x10\x14\x1a\x0c\ + \x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12$\n\x16MessageType_L\ + ockDevice\x10\x18\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12'\n\x19Mess\ + ageType_ApplySettings\x10\x19\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ + \x12'\n\x19MessageType_ButtonRequest\x10\x1a\x1a\x08\x80\xa6\x1d\x01\x98\ + \xb5\x18\x01\x12+\n\x15MessageType_ButtonAck\x10\x1b\x1a\x10\xc0\xb5\x18\ + \x01\xb0\xb5\x18\x01\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16MessageTy\ + pe_ApplyFlags\x10\x1c\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\"\n\ + \x14MessageType_GetNonce\x10\x1f\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ + \x12\x1f\n\x11MessageType_Nonce\x10!\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\ + \x01\x12&\n\x18MessageType_BackupDevice\x10\"\x1a\x08\x80\xa6\x1d\x01\ + \x90\xb5\x18\x01\x12(\n\x1aMessageType_EntropyRequest\x10#\x1a\x08\x80\ + \xa6\x1d\x01\x98\xb5\x18\x01\x12$\n\x16MessageType_EntropyAck\x10$\x1a\ + \x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12+\n\x1dMessageType_PassphraseReq\ + uest\x10)\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12/\n\x19MessageType_\ + PassphraseAck\x10*\x1a\x10\xc0\xb5\x18\x01\xb0\xb5\x18\x01\x80\xa6\x1d\ + \x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_RecoveryDevice\x10-\x1a\x08\ + \x80\xa6\x1d\x01\x90\xb5\x18\x01\x12%\n\x17MessageType_WordRequest\x10.\ + \x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12!\n\x13MessageType_WordAck\ + \x10/\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12%\n\x17MessageType_GetF\ + eatures\x107\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12#\n\x15MessageTy\ + pe_SdProtect\x10O\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMess\ + ageType_ChangeWipeCode\x10R\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\ + \n\x16MessageType_EndSession\x10S\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\ + \x01\x12)\n\x1bMessageType_DoPreauthorized\x10T\x1a\x08\x80\xa6\x1d\x01\ + \x90\xb5\x18\x01\x12.\n\x20MessageType_PreauthorizedRequest\x10U\x1a\x08\ + \x80\xa6\x1d\x01\x98\xb5\x18\x01\x12-\n\x1fMessageType_CancelAuthorizati\ + on\x10V\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12,\n\x1eMessageType_Re\ + bootToBootloader\x10W\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12)\n\x1b\ + MessageType_GetFirmwareHash\x10X\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ + \x12&\n\x18MessageType_FirmwareHash\x10Y\x1a\x08\x80\xa6\x1d\x01\x98\xb5\ + \x18\x01\x12$\n\x16MessageType_UnlockPath\x10]\x1a\x08\x80\xa6\x1d\x01\ + \x90\xb5\x18\x01\x12-\n\x1fMessageType_UnlockedPathRequest\x10^\x1a\x08\ + \x80\xa6\x1d\x01\x98\xb5\x18\x01\x12,\n\x1eMessageType_ShowDeviceTutoria\ + l\x10_\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12*\n\x1cMessageType_Unl\ + ockBootloader\x10`\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12,\n\x1eMes\ + sageType_AuthenticateDevice\x10a\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\ + \x12+\n\x1dMessageType_AuthenticityProof\x10b\x1a\x08\x80\xa6\x1d\x01\ + \x90\xb5\x18\x01\x12)\n\x1aMessageType_ChangeLanguage\x10\xde\x07\x1a\ + \x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x121\n\"MessageType_TranslationData\ + Request\x10\xdf\x07\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12-\n\x1eMe\ + ssageType_TranslationDataAck\x10\xe0\x07\x1a\x08\x80\xa6\x1d\x01\x90\xb5\ + \x18\x01\x12#\n\x19MessageType_SetU2FCounter\x10?\x1a\x04\x90\xb5\x18\ + \x01\x12'\n\x1dMessageType_GetNextU2FCounter\x10P\x1a\x04\x90\xb5\x18\ + \x01\x12$\n\x1aMessageType_NextU2FCounter\x10Q\x1a\x04\x98\xb5\x18\x01\ + \x125\n-MessageType_Deprecated_PassphraseStateRequest\x10M\x1a\x02\x08\ + \x01\x121\n)MessageType_Deprecated_PassphraseStateAck\x10N\x1a\x02\x08\ + \x01\x12+\n\x19MessageType_FirmwareErase\x10\x06\x1a\x0c\xb8\xb5\x18\x01\ + \x80\xa6\x1d\x01\x90\xb5\x18\x01\x12,\n\x1aMessageType_FirmwareUpload\ + \x10\x07\x1a\x0c\xb8\xb5\x18\x01\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12-\n\ + \x1bMessageType_FirmwareRequest\x10\x08\x1a\x0c\xb8\xb5\x18\x01\x80\xa6\ + \x1d\x01\x98\xb5\x18\x01\x12(\n\x16MessageType_ProdTestT1\x10\x20\x1a\ + \x0c\xb8\xb5\x18\x01\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12&\n\x18MessageTy\ + pe_GetPublicKey\x10\x0b\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12#\n\ + \x15MessageType_PublicKey\x10\x0c\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\ + \x01\x12\x20\n\x12MessageType_SignTx\x10\x0f\x1a\x08\x80\xa6\x1d\x01\x90\ + \xb5\x18\x01\x12#\n\x15MessageType_TxRequest\x10\x15\x1a\x08\x80\xa6\x1d\ + \x01\x98\xb5\x18\x01\x12\x1f\n\x11MessageType_TxAck\x10\x16\x1a\x08\x80\ + \xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16MessageType_GetAddress\x10\x1d\ + \x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12!\n\x13MessageType_Address\ + \x10\x1e\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12)\n\x1fMessageType_T\ + xAckPaymentRequest\x10%\x1a\x04\x90\xb5\x18\x01\x12%\n\x17MessageType_Si\ + gnMessage\x10&\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12'\n\x19Message\ + Type_VerifyMessage\x10'\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12*\n\ + \x1cMessageType_MessageSignature\x10(\x1a\x08\x80\xa6\x1d\x01\x98\xb5\ + \x18\x01\x12(\n\x1aMessageType_GetOwnershipId\x10+\x1a\x08\x80\xa6\x1d\ + \x01\x90\xb5\x18\x01\x12%\n\x17MessageType_OwnershipId\x10,\x1a\x08\x80\ + \xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageType_GetOwnershipProof\x10\ + 1\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_Ownershi\ + pProof\x102\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageTyp\ + e_AuthorizeCoinJoin\x103\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\ + \x1aMessageType_CipherKeyValue\x10\x17\x1a\x08\x80\xa6\x1d\x01\x90\xb5\ + \x18\x01\x12*\n\x1cMessageType_CipheredKeyValue\x100\x1a\x08\x80\xa6\x1d\ + \x01\x98\xb5\x18\x01\x12&\n\x18MessageType_SignIdentity\x105\x1a\x08\x80\ + \xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_SignedIdentity\x106\ + \x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageType_GetECDHSe\ + ssionKey\x10=\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageT\ + ype_ECDHSessionKey\x10>\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12$\n\ + \x16MessageType_CosiCommit\x10G\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ + \x12(\n\x1aMessageType_CosiCommitment\x10H\x1a\x08\x80\xa6\x1d\x01\x98\ + \xb5\x18\x01\x12\"\n\x14MessageType_CosiSign\x10I\x1a\x08\x80\xa6\x1d\ + \x01\x90\xb5\x18\x01\x12'\n\x19MessageType_CosiSignature\x10J\x1a\x08\ + \x80\xa6\x1d\x01\x98\xb5\x18\x01\x123\n\x1dMessageType_DebugLinkDecision\ + \x10d\x1a\x10\xc0\xb5\x18\x01\xb0\xb5\x18\x01\x80\xa6\x1d\x01\xa0\xb5\ + \x18\x01\x12/\n\x1dMessageType_DebugLinkGetState\x10e\x1a\x0c\x80\xa6\ + \x1d\x01\xb0\xb5\x18\x01\xa0\xb5\x18\x01\x12(\n\x1aMessageType_DebugLink\ + State\x10f\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12'\n\x19MessageType\ + _DebugLinkStop\x10g\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12&\n\x18Me\ + ssageType_DebugLinkLog\x10h\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12-\ + \n\x1fMessageType_DebugLinkMemoryRead\x10n\x1a\x08\x80\xa6\x1d\x01\xa0\ + \xb5\x18\x01\x12)\n\x1bMessageType_DebugLinkMemory\x10o\x1a\x08\x80\xa6\ + \x1d\x01\xa8\xb5\x18\x01\x12.\n\x20MessageType_DebugLinkMemoryWrite\x10p\ + \x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12-\n\x1fMessageType_DebugLink\ + FlashErase\x10q\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12*\n\x1bMessag\ + eType_DebugLinkLayout\x10\xa9F\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\ + \x120\n!MessageType_DebugLinkReseedRandom\x10\xaaF\x1a\x08\x80\xa6\x1d\ + \x01\xa0\xb5\x18\x01\x120\n!MessageType_DebugLinkRecordScreen\x10\xabF\ + \x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12/\n\x20MessageType_DebugLink\ + EraseSdCard\x10\xadF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12/\n\x20M\ + essageType_DebugLinkWatchLayout\x10\xaeF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\ + \x18\x01\x124\n%MessageType_DebugLinkResetDebugEvents\x10\xafF\x1a\x08\ + \x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12+\n\x20MessageType_EthereumGetPublic\ + Key\x10\xc2\x03\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_EthereumPu\ + blicKey\x10\xc3\x03\x1a\x04\x98\xb5\x18\x01\x12(\n\x1eMessageType_Ethere\ + umGetAddress\x108\x1a\x04\x90\xb5\x18\x01\x12%\n\x1bMessageType_Ethereum\ + Address\x109\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_EthereumSignT\ + x\x10:\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_EthereumSignTxEIP1559\ + \x10\xc4\x03\x1a\x04\x90\xb5\x18\x01\x12'\n\x1dMessageType_EthereumTxReq\ + uest\x10;\x1a\x04\x98\xb5\x18\x01\x12#\n\x19MessageType_EthereumTxAck\ + \x10<\x1a\x04\x90\xb5\x18\x01\x12)\n\x1fMessageType_EthereumSignMessage\ + \x10@\x1a\x04\x90\xb5\x18\x01\x12+\n!MessageType_EthereumVerifyMessage\ + \x10A\x1a\x04\x90\xb5\x18\x01\x12.\n$MessageType_EthereumMessageSignatur\ + e\x10B\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedData\ + \x10\xd0\x03\x1a\x04\x90\xb5\x18\x01\x125\n*MessageType_EthereumTypedDat\ + aStructRequest\x10\xd1\x03\x1a\x04\x98\xb5\x18\x01\x121\n&MessageType_Et\ + hereumTypedDataStructAck\x10\xd2\x03\x1a\x04\x90\xb5\x18\x01\x124\n)Mess\ + ageType_EthereumTypedDataValueRequest\x10\xd3\x03\x1a\x04\x98\xb5\x18\ + \x01\x120\n%MessageType_EthereumTypedDataValueAck\x10\xd4\x03\x1a\x04\ + \x90\xb5\x18\x01\x121\n&MessageType_EthereumTypedDataSignature\x10\xd5\ + \x03\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedHash\ + \x10\xd6\x03\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_NEMGetAddress\ + \x10C\x1a\x04\x90\xb5\x18\x01\x12\x20\n\x16MessageType_NEMAddress\x10D\ + \x1a\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_NEMSignTx\x10E\x1a\x04\ + \x90\xb5\x18\x01\x12!\n\x17MessageType_NEMSignedTx\x10F\x1a\x04\x98\xb5\ + \x18\x01\x12'\n\x1dMessageType_NEMDecryptMessage\x10K\x1a\x04\x90\xb5\ + \x18\x01\x12)\n\x1fMessageType_NEMDecryptedMessage\x10L\x1a\x04\x98\xb5\ + \x18\x01\x12&\n\x1bMessageType_TezosGetAddress\x10\x96\x01\x1a\x04\x90\ + \xb5\x18\x01\x12#\n\x18MessageType_TezosAddress\x10\x97\x01\x1a\x04\x98\ + \xb5\x18\x01\x12\"\n\x17MessageType_TezosSignTx\x10\x98\x01\x1a\x04\x90\ + \xb5\x18\x01\x12$\n\x19MessageType_TezosSignedTx\x10\x99\x01\x1a\x04\x98\ + \xb5\x18\x01\x12(\n\x1dMessageType_TezosGetPublicKey\x10\x9a\x01\x1a\x04\ + \x90\xb5\x18\x01\x12%\n\x1aMessageType_TezosPublicKey\x10\x9b\x01\x1a\ + \x04\x98\xb5\x18\x01\x12$\n\x19MessageType_StellarSignTx\x10\xca\x01\x1a\ + \x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_StellarTxOpRequest\x10\xcb\ + \x01\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_StellarGetAddress\x10\ + \xcf\x01\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_StellarAddress\ + \x10\xd0\x01\x1a\x04\x98\xb5\x18\x01\x12-\n\"MessageType_StellarCreateAc\ + countOp\x10\xd2\x01\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_Stella\ + rPaymentOp\x10\xd3\x01\x1a\x04\x90\xb5\x18\x01\x128\n-MessageType_Stella\ + rPathPaymentStrictReceiveOp\x10\xd4\x01\x1a\x04\x90\xb5\x18\x01\x12/\n$M\ + essageType_StellarManageSellOfferOp\x10\xd5\x01\x1a\x04\x90\xb5\x18\x01\ + \x126\n+MessageType_StellarCreatePassiveSellOfferOp\x10\xd6\x01\x1a\x04\ + \x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarSetOptionsOp\x10\xd7\x01\ + \x1a\x04\x90\xb5\x18\x01\x12+\n\x20MessageType_StellarChangeTrustOp\x10\ + \xd8\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarAllowTrust\ + Op\x10\xd9\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_StellarAccount\ + MergeOp\x10\xda\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_Stella\ + rManageDataOp\x10\xdc\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_Ste\ + llarBumpSequenceOp\x10\xdd\x01\x1a\x04\x90\xb5\x18\x01\x12.\n#MessageTyp\ + e_StellarManageBuyOfferOp\x10\xde\x01\x1a\x04\x90\xb5\x18\x01\x125\n*Mes\ + sageType_StellarPathPaymentStrictSendOp\x10\xdf\x01\x1a\x04\x90\xb5\x18\ + \x01\x125\n*MessageType_StellarClaimClaimableBalanceOp\x10\xe1\x01\x1a\ + \x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_StellarSignedTx\x10\xe6\x01\ + \x1a\x04\x98\xb5\x18\x01\x12*\n\x1fMessageType_CardanoGetPublicKey\x10\ + \xb1\x02\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_CardanoPublicKey\ + \x10\xb2\x02\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_CardanoGetAdd\ + ress\x10\xb3\x02\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_CardanoAd\ + dress\x10\xb4\x02\x1a\x04\x98\xb5\x18\x01\x12'\n\x1cMessageType_CardanoT\ + xItemAck\x10\xb9\x02\x1a\x04\x98\xb5\x18\x01\x127\n,MessageType_CardanoT\ + xAuxiliaryDataSupplement\x10\xba\x02\x1a\x04\x98\xb5\x18\x01\x12.\n#Mess\ + ageType_CardanoTxWitnessRequest\x10\xbb\x02\x1a\x04\x90\xb5\x18\x01\x12/\ + \n$MessageType_CardanoTxWitnessResponse\x10\xbc\x02\x1a\x04\x98\xb5\x18\ + \x01\x12'\n\x1cMessageType_CardanoTxHostAck\x10\xbd\x02\x1a\x04\x90\xb5\ + \x18\x01\x12(\n\x1dMessageType_CardanoTxBodyHash\x10\xbe\x02\x1a\x04\x98\ + \xb5\x18\x01\x12,\n!MessageType_CardanoSignTxFinished\x10\xbf\x02\x1a\ + \x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_CardanoSignTxInit\x10\xc0\x02\ + \x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_CardanoTxInput\x10\xc1\ + \x02\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_CardanoTxOutput\x10\ + \xc2\x02\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_CardanoAssetGroup\ + \x10\xc3\x02\x1a\x04\x90\xb5\x18\x01\x12#\n\x18MessageType_CardanoToken\ + \x10\xc4\x02\x1a\x04\x90\xb5\x18\x01\x12+\n\x20MessageType_CardanoTxCert\ + ificate\x10\xc5\x02\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_Cardan\ + oTxWithdrawal\x10\xc6\x02\x1a\x04\x90\xb5\x18\x01\x12-\n\"MessageType_Ca\ + rdanoTxAuxiliaryData\x10\xc7\x02\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessa\ + geType_CardanoPoolOwner\x10\xc8\x02\x1a\x04\x90\xb5\x18\x01\x121\n&Messa\ + geType_CardanoPoolRelayParameters\x10\xc9\x02\x1a\x04\x90\xb5\x18\x01\ + \x121\n&MessageType_CardanoGetNativeScriptHash\x10\xca\x02\x1a\x04\x90\ + \xb5\x18\x01\x12.\n#MessageType_CardanoNativeScriptHash\x10\xcb\x02\x1a\ + \x04\x98\xb5\x18\x01\x12$\n\x19MessageType_CardanoTxMint\x10\xcc\x02\x1a\ + \x04\x90\xb5\x18\x01\x12/\n$MessageType_CardanoTxCollateralInput\x10\xcd\ + \x02\x1a\x04\x90\xb5\x18\x01\x12.\n#MessageType_CardanoTxRequiredSigner\ + \x10\xce\x02\x1a\x04\x90\xb5\x18\x01\x120\n%MessageType_CardanoTxInlineD\ + atumChunk\x10\xcf\x02\x1a\x04\x90\xb5\x18\x01\x124\n)MessageType_Cardano\ + TxReferenceScriptChunk\x10\xd0\x02\x1a\x04\x90\xb5\x18\x01\x12.\n#Messag\ + eType_CardanoTxReferenceInput\x10\xd1\x02\x1a\x04\x90\xb5\x18\x01\x12'\n\ + \x1cMessageType_RippleGetAddress\x10\x90\x03\x1a\x04\x90\xb5\x18\x01\x12\ + $\n\x19MessageType_RippleAddress\x10\x91\x03\x1a\x04\x98\xb5\x18\x01\x12\ + #\n\x18MessageType_RippleSignTx\x10\x92\x03\x1a\x04\x90\xb5\x18\x01\x12%\ + \n\x1aMessageType_RippleSignedTx\x10\x93\x03\x1a\x04\x90\xb5\x18\x01\x12\ + 3\n(MessageType_MoneroTransactionInitRequest\x10\xf5\x03\x1a\x04\x98\xb5\ + \x18\x01\x12/\n$MessageType_MoneroTransactionInitAck\x10\xf6\x03\x1a\x04\ + \x98\xb5\x18\x01\x127\n,MessageType_MoneroTransactionSetInputRequest\x10\ + \xf7\x03\x1a\x04\x98\xb5\x18\x01\x123\n(MessageType_MoneroTransactionSet\ + InputAck\x10\xf8\x03\x1a\x04\x98\xb5\x18\x01\x128\n-MessageType_MoneroTr\ + ansactionInputViniRequest\x10\xfb\x03\x1a\x04\x98\xb5\x18\x01\x124\n)Mes\ + sageType_MoneroTransactionInputViniAck\x10\xfc\x03\x1a\x04\x98\xb5\x18\ + \x01\x12;\n0MessageType_MoneroTransactionAllInputsSetRequest\x10\xfd\x03\ + \x1a\x04\x98\xb5\x18\x01\x127\n,MessageType_MoneroTransactionAllInputsSe\ + tAck\x10\xfe\x03\x1a\x04\x98\xb5\x18\x01\x128\n-MessageType_MoneroTransa\ + ctionSetOutputRequest\x10\xff\x03\x1a\x04\x98\xb5\x18\x01\x124\n)Message\ + Type_MoneroTransactionSetOutputAck\x10\x80\x04\x1a\x04\x98\xb5\x18\x01\ + \x128\n-MessageType_MoneroTransactionAllOutSetRequest\x10\x81\x04\x1a\ + \x04\x98\xb5\x18\x01\x124\n)MessageType_MoneroTransactionAllOutSetAck\ + \x10\x82\x04\x1a\x04\x98\xb5\x18\x01\x128\n-MessageType_MoneroTransactio\ + nSignInputRequest\x10\x83\x04\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType\ + _MoneroTransactionSignInputAck\x10\x84\x04\x1a\x04\x98\xb5\x18\x01\x124\ + \n)MessageType_MoneroTransactionFinalRequest\x10\x85\x04\x1a\x04\x98\xb5\ + \x18\x01\x120\n%MessageType_MoneroTransactionFinalAck\x10\x86\x04\x1a\ + \x04\x98\xb5\x18\x01\x126\n+MessageType_MoneroKeyImageExportInitRequest\ + \x10\x92\x04\x1a\x04\x98\xb5\x18\x01\x122\n'MessageType_MoneroKeyImageEx\ + portInitAck\x10\x93\x04\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType_Moner\ + oKeyImageSyncStepRequest\x10\x94\x04\x1a\x04\x98\xb5\x18\x01\x120\n%Mess\ + ageType_MoneroKeyImageSyncStepAck\x10\x95\x04\x1a\x04\x98\xb5\x18\x01\ + \x125\n*MessageType_MoneroKeyImageSyncFinalRequest\x10\x96\x04\x1a\x04\ + \x98\xb5\x18\x01\x121\n&MessageType_MoneroKeyImageSyncFinalAck\x10\x97\ + \x04\x1a\x04\x98\xb5\x18\x01\x12'\n\x1cMessageType_MoneroGetAddress\x10\ + \x9c\x04\x1a\x04\x90\xb5\x18\x01\x12$\n\x19MessageType_MoneroAddress\x10\ + \x9d\x04\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_MoneroGetWatchKey\ + \x10\x9e\x04\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_MoneroWatchKe\ + y\x10\x9f\x04\x1a\x04\x98\xb5\x18\x01\x12-\n\"MessageType_DebugMoneroDia\ + gRequest\x10\xa2\x04\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_Debug\ + MoneroDiagAck\x10\xa3\x04\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_Mon\ + eroGetTxKeyRequest\x10\xa6\x04\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessage\ + Type_MoneroGetTxKeyAck\x10\xa7\x04\x1a\x04\x98\xb5\x18\x01\x124\n)Messag\ + eType_MoneroLiveRefreshStartRequest\x10\xa8\x04\x1a\x04\x90\xb5\x18\x01\ + \x120\n%MessageType_MoneroLiveRefreshStartAck\x10\xa9\x04\x1a\x04\x98\ + \xb5\x18\x01\x123\n(MessageType_MoneroLiveRefreshStepRequest\x10\xaa\x04\ + \x1a\x04\x90\xb5\x18\x01\x12/\n$MessageType_MoneroLiveRefreshStepAck\x10\ + \xab\x04\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType_MoneroLiveRefreshFin\ + alRequest\x10\xac\x04\x1a\x04\x90\xb5\x18\x01\x120\n%MessageType_MoneroL\ + iveRefreshFinalAck\x10\xad\x04\x1a\x04\x98\xb5\x18\x01\x12&\n\x1bMessage\ + Type_EosGetPublicKey\x10\xd8\x04\x1a\x04\x90\xb5\x18\x01\x12#\n\x18Messa\ + geType_EosPublicKey\x10\xd9\x04\x1a\x04\x98\xb5\x18\x01\x12\x20\n\x15Mes\ + sageType_EosSignTx\x10\xda\x04\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMessage\ + Type_EosTxActionRequest\x10\xdb\x04\x1a\x04\x98\xb5\x18\x01\x12%\n\x1aMe\ + ssageType_EosTxActionAck\x10\xdc\x04\x1a\x04\x90\xb5\x18\x01\x12\"\n\x17\ + MessageType_EosSignedTx\x10\xdd\x04\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMe\ + ssageType_BinanceGetAddress\x10\xbc\x05\x1a\x04\x90\xb5\x18\x01\x12%\n\ + \x1aMessageType_BinanceAddress\x10\xbd\x05\x1a\x04\x98\xb5\x18\x01\x12*\ + \n\x1fMessageType_BinanceGetPublicKey\x10\xbe\x05\x1a\x04\x90\xb5\x18\ + \x01\x12'\n\x1cMessageType_BinancePublicKey\x10\xbf\x05\x1a\x04\x98\xb5\ + \x18\x01\x12$\n\x19MessageType_BinanceSignTx\x10\xc0\x05\x1a\x04\x90\xb5\ + \x18\x01\x12'\n\x1cMessageType_BinanceTxRequest\x10\xc1\x05\x1a\x04\x98\ + \xb5\x18\x01\x12)\n\x1eMessageType_BinanceTransferMsg\x10\xc2\x05\x1a\ + \x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_BinanceOrderMsg\x10\xc3\x05\ + \x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_BinanceCancelMsg\x10\xc4\ + \x05\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_BinanceSignedTx\x10\ + \xc5\x05\x1a\x04\x98\xb5\x18\x01\x126\n+MessageType_WebAuthnListResident\ + Credentials\x10\xa0\x06\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_We\ + bAuthnCredentials\x10\xa1\x06\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType\ + _WebAuthnAddResidentCredential\x10\xa2\x06\x1a\x04\x90\xb5\x18\x01\x127\ + \n,MessageType_WebAuthnRemoveResidentCredential\x10\xa3\x06\x1a\x04\x90\ + \xb5\x18\x01\x12)\n\x1eMessageType_SolanaGetPublicKey\x10\x84\x07\x1a\ + \x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_SolanaPublicKey\x10\x85\x07\ + \x1a\x04\x98\xb5\x18\x01\x12'\n\x1cMessageType_SolanaGetAddress\x10\x86\ + \x07\x1a\x04\x90\xb5\x18\x01\x12$\n\x19MessageType_SolanaAddress\x10\x87\ + \x07\x1a\x04\x98\xb5\x18\x01\x12#\n\x18MessageType_SolanaSignTx\x10\x88\ + \x07\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_SolanaTxSignature\x10\ + \x89\x07\x1a\x04\x98\xb5\x18\x01\x12*\n\x1fMessageType_MintlayerGetAddre\ + ss\x10\xe8\x07\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_MintlayerAd\ + dress\x10\xe9\x07\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_MintlayerGe\ + tPublicKey\x10\xea\x07\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_Min\ + tlayerPublicKey\x10\xeb\x07\x1a\x04\x98\xb5\x18\x01\x12)\n\x1eMessageTyp\ + e_MintlayerVerifySig\x10\xec\x07\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMessa\ + geType_MintlayerSignTx\x10\xed\x07\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMes\ + sageType_MintlayerTxRequest\x10\xee\x07\x1a\x04\x98\xb5\x18\x01\x12.\n#M\ + essageType_MintlayerTxAckUtxoInput\x10\xef\x07\x1a\x04\x90\xb5\x18\x01\ + \x12+\n\x20MessageType_MintlayerTxAckOutput\x10\xf0\x07\x1a\x04\x90\xb5\ + \x18\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\\\"\x04\x08r\x10z\"\x06\ + \x08\xdb\x01\x10\xdb\x01\"\x06\x08\xe0\x01\x10\xe0\x01\"\x06\x08\xac\x02\ + \x10\xb0\x02\"\x06\x08\xb5\x02\x10\xb8\x02:<\n\x07wire_in\x18\xd2\x86\ + \x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x06wireIn:>\n\ + \x08wire_out\x18\xd3\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValue\ + OptionsR\x07wireOut:G\n\rwire_debug_in\x18\xd4\x86\x03\x20\x01(\x08\x12!\ + .google.protobuf.EnumValueOptionsR\x0bwireDebugIn:I\n\x0ewire_debug_out\ + \x18\xd5\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0c\ + wireDebugOut:@\n\twire_tiny\x18\xd6\x86\x03\x20\x01(\x08\x12!.google.pro\ + tobuf.EnumValueOptionsR\x08wireTiny:L\n\x0fwire_bootloader\x18\xd7\x86\ + \x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0ewireBootload\ + er:C\n\x0bwire_no_fsm\x18\xd8\x86\x03\x20\x01(\x08\x12!.google.protobuf.\ + EnumValueOptionsR\twireNoFsm:F\n\x0cbitcoin_only\x18\xe0\xd4\x03\x20\x01\ + (\x08\x12!.google.protobuf.EnumValueOptionsR\x0bbitcoinOnly:U\n\x17has_b\ + itcoin_only_values\x18\xb9\x8e\x03\x20\x01(\x08\x12\x1c.google.protobuf.\ + EnumOptionsR\x14hasBitcoinOnlyValues:T\n\x14experimental_message\x18\xa1\ + \x96\x03\x20\x01(\x08\x12\x1f.google.protobuf.MessageOptionsR\x13experim\ + entalMessage:>\n\twire_type\x18\xa2\x96\x03\x20\x01(\r\x12\x1f.google.pr\ + otobuf.MessageOptionsR\x08wireType:N\n\x12experimental_field\x18\x89\x9e\ + \x03\x20\x01(\x08\x12\x1d.google.protobuf.FieldOptionsR\x11experimentalF\ + ield:U\n\x17include_in_bitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12\x1c\ + .google.protobuf.FileOptionsR\x14includeInBitcoinOnlyB8\n#com.satoshilab\ + s.trezor.lib.protobufB\rTrezorMessage\x80\xa6\x1d\x01\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(::protobuf::descriptor::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(0); + let mut enums = ::std::vec::Vec::with_capacity(1); + enums.push(MessageType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_binance.rs b/wallet/trezor-client/src/protos/generated/messages_binance.rs new file mode 100644 index 0000000000..4612b354f7 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_binance.rs @@ -0,0 +1,3083 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-binance.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceGetAddress { + fn default() -> &'a BinanceGetAddress { + ::default_instance() + } +} + +impl BinanceGetAddress { + pub fn new() -> BinanceGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &BinanceGetAddress| { &m.address_n }, + |m: &mut BinanceGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &BinanceGetAddress| { &m.show_display }, + |m: &mut BinanceGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &BinanceGetAddress| { &m.chunkify }, + |m: &mut BinanceGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceGetAddress { + const NAME: &'static str = "BinanceGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceGetAddress { + BinanceGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceGetAddress { + static instance: BinanceGetAddress = BinanceGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceAddress { + fn default() -> &'a BinanceAddress { + ::default_instance() + } +} + +impl BinanceAddress { + pub fn new() -> BinanceAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &BinanceAddress| { &m.address }, + |m: &mut BinanceAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceAddress { + const NAME: &'static str = "BinanceAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceAddress { + BinanceAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceAddress { + static instance: BinanceAddress = BinanceAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceGetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceGetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetPublicKey.show_display) + pub show_display: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceGetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceGetPublicKey { + fn default() -> &'a BinanceGetPublicKey { + ::default_instance() + } +} + +impl BinanceGetPublicKey { + pub fn new() -> BinanceGetPublicKey { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &BinanceGetPublicKey| { &m.address_n }, + |m: &mut BinanceGetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &BinanceGetPublicKey| { &m.show_display }, + |m: &mut BinanceGetPublicKey| { &mut m.show_display }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceGetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceGetPublicKey { + const NAME: &'static str = "BinanceGetPublicKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceGetPublicKey { + BinanceGetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceGetPublicKey { + static instance: BinanceGetPublicKey = BinanceGetPublicKey { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceGetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceGetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceGetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceGetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinancePublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinancePublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinancePublicKey.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinancePublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinancePublicKey { + fn default() -> &'a BinancePublicKey { + ::default_instance() + } +} + +impl BinancePublicKey { + pub fn new() -> BinancePublicKey { + ::std::default::Default::default() + } + + // required bytes public_key = 1; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &BinancePublicKey| { &m.public_key }, + |m: &mut BinancePublicKey| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinancePublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinancePublicKey { + const NAME: &'static str = "BinancePublicKey"; + + fn is_initialized(&self) -> bool { + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinancePublicKey { + BinancePublicKey::new() + } + + fn clear(&mut self) { + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinancePublicKey { + static instance: BinancePublicKey = BinancePublicKey { + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinancePublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinancePublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinancePublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinancePublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.msg_count) + pub msg_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.account_number) + pub account_number: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.chain_id) + pub chain_id: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.memo) + pub memo: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.source) + pub source: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceSignTx { + fn default() -> &'a BinanceSignTx { + ::default_instance() + } +} + +impl BinanceSignTx { + pub fn new() -> BinanceSignTx { + ::std::default::Default::default() + } + + // required uint32 msg_count = 2; + + pub fn msg_count(&self) -> u32 { + self.msg_count.unwrap_or(0) + } + + pub fn clear_msg_count(&mut self) { + self.msg_count = ::std::option::Option::None; + } + + pub fn has_msg_count(&self) -> bool { + self.msg_count.is_some() + } + + // Param is passed by value, moved + pub fn set_msg_count(&mut self, v: u32) { + self.msg_count = ::std::option::Option::Some(v); + } + + // required sint64 account_number = 3; + + pub fn account_number(&self) -> i64 { + self.account_number.unwrap_or(0) + } + + pub fn clear_account_number(&mut self) { + self.account_number = ::std::option::Option::None; + } + + pub fn has_account_number(&self) -> bool { + self.account_number.is_some() + } + + // Param is passed by value, moved + pub fn set_account_number(&mut self, v: i64) { + self.account_number = ::std::option::Option::Some(v); + } + + // optional string chain_id = 4; + + pub fn chain_id(&self) -> &str { + match self.chain_id.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_chain_id(&mut self) { + self.chain_id = ::std::option::Option::None; + } + + pub fn has_chain_id(&self) -> bool { + self.chain_id.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_id(&mut self, v: ::std::string::String) { + self.chain_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_chain_id(&mut self) -> &mut ::std::string::String { + if self.chain_id.is_none() { + self.chain_id = ::std::option::Option::Some(::std::string::String::new()); + } + self.chain_id.as_mut().unwrap() + } + + // Take field + pub fn take_chain_id(&mut self) -> ::std::string::String { + self.chain_id.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string memo = 5; + + pub fn memo(&self) -> &str { + match self.memo.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_memo(&mut self) { + self.memo = ::std::option::Option::None; + } + + pub fn has_memo(&self) -> bool { + self.memo.is_some() + } + + // Param is passed by value, moved + pub fn set_memo(&mut self, v: ::std::string::String) { + self.memo = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_memo(&mut self) -> &mut ::std::string::String { + if self.memo.is_none() { + self.memo = ::std::option::Option::Some(::std::string::String::new()); + } + self.memo.as_mut().unwrap() + } + + // Take field + pub fn take_memo(&mut self) -> ::std::string::String { + self.memo.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 sequence = 6; + + pub fn sequence(&self) -> i64 { + self.sequence.unwrap_or(0) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: i64) { + self.sequence = ::std::option::Option::Some(v); + } + + // required sint64 source = 7; + + pub fn source(&self) -> i64 { + self.source.unwrap_or(0) + } + + pub fn clear_source(&mut self) { + self.source = ::std::option::Option::None; + } + + pub fn has_source(&self) -> bool { + self.source.is_some() + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: i64) { + self.source = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 8; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &BinanceSignTx| { &m.address_n }, + |m: &mut BinanceSignTx| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "msg_count", + |m: &BinanceSignTx| { &m.msg_count }, + |m: &mut BinanceSignTx| { &mut m.msg_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account_number", + |m: &BinanceSignTx| { &m.account_number }, + |m: &mut BinanceSignTx| { &mut m.account_number }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_id", + |m: &BinanceSignTx| { &m.chain_id }, + |m: &mut BinanceSignTx| { &mut m.chain_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memo", + |m: &BinanceSignTx| { &m.memo }, + |m: &mut BinanceSignTx| { &mut m.memo }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &BinanceSignTx| { &m.sequence }, + |m: &mut BinanceSignTx| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source", + |m: &BinanceSignTx| { &m.source }, + |m: &mut BinanceSignTx| { &mut m.source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &BinanceSignTx| { &m.chunkify }, + |m: &mut BinanceSignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceSignTx { + const NAME: &'static str = "BinanceSignTx"; + + fn is_initialized(&self) -> bool { + if self.msg_count.is_none() { + return false; + } + if self.account_number.is_none() { + return false; + } + if self.sequence.is_none() { + return false; + } + if self.source.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.msg_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.account_number = ::std::option::Option::Some(is.read_sint64()?); + }, + 34 => { + self.chain_id = ::std::option::Option::Some(is.read_string()?); + }, + 42 => { + self.memo = ::std::option::Option::Some(is.read_string()?); + }, + 48 => { + self.sequence = ::std::option::Option::Some(is.read_sint64()?); + }, + 56 => { + self.source = ::std::option::Option::Some(is.read_sint64()?); + }, + 64 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.msg_count { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.account_number { + my_size += ::protobuf::rt::sint64_size(3, v); + } + if let Some(v) = self.chain_id.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.memo.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::sint64_size(6, v); + } + if let Some(v) = self.source { + my_size += ::protobuf::rt::sint64_size(7, v); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.msg_count { + os.write_uint32(2, v)?; + } + if let Some(v) = self.account_number { + os.write_sint64(3, v)?; + } + if let Some(v) = self.chain_id.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.memo.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.sequence { + os.write_sint64(6, v)?; + } + if let Some(v) = self.source { + os.write_sint64(7, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(8, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceSignTx { + BinanceSignTx::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.msg_count = ::std::option::Option::None; + self.account_number = ::std::option::Option::None; + self.chain_id = ::std::option::Option::None; + self.memo = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.source = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceSignTx { + static instance: BinanceSignTx = BinanceSignTx { + address_n: ::std::vec::Vec::new(), + msg_count: ::std::option::Option::None, + account_number: ::std::option::Option::None, + chain_id: ::std::option::Option::None, + memo: ::std::option::Option::None, + sequence: ::std::option::Option::None, + source: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTxRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceTxRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTxRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceTxRequest { + fn default() -> &'a BinanceTxRequest { + ::default_instance() + } +} + +impl BinanceTxRequest { + pub fn new() -> BinanceTxRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceTxRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceTxRequest { + const NAME: &'static str = "BinanceTxRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceTxRequest { + BinanceTxRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceTxRequest { + static instance: BinanceTxRequest = BinanceTxRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceTxRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceTxRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceTxRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceTxRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTransferMsg) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceTransferMsg { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.inputs) + pub inputs: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.outputs) + pub outputs: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTransferMsg.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceTransferMsg { + fn default() -> &'a BinanceTransferMsg { + ::default_instance() + } +} + +impl BinanceTransferMsg { + pub fn new() -> BinanceTransferMsg { + ::std::default::Default::default() + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "inputs", + |m: &BinanceTransferMsg| { &m.inputs }, + |m: &mut BinanceTransferMsg| { &mut m.inputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "outputs", + |m: &BinanceTransferMsg| { &m.outputs }, + |m: &mut BinanceTransferMsg| { &mut m.outputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &BinanceTransferMsg| { &m.chunkify }, + |m: &mut BinanceTransferMsg| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceTransferMsg", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceTransferMsg { + const NAME: &'static str = "BinanceTransferMsg"; + + fn is_initialized(&self) -> bool { + for v in &self.inputs { + if !v.is_initialized() { + return false; + } + }; + for v in &self.outputs { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.inputs.push(is.read_message()?); + }, + 18 => { + self.outputs.push(is.read_message()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.inputs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.outputs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.inputs { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + for v in &self.outputs { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + }; + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceTransferMsg { + BinanceTransferMsg::new() + } + + fn clear(&mut self) { + self.inputs.clear(); + self.outputs.clear(); + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceTransferMsg { + static instance: BinanceTransferMsg = BinanceTransferMsg { + inputs: ::std::vec::Vec::new(), + outputs: ::std::vec::Vec::new(), + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceTransferMsg { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceTransferMsg").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceTransferMsg { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceTransferMsg { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `BinanceTransferMsg` +pub mod binance_transfer_msg { + // @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct BinanceInputOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput.coins) + pub coins: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a BinanceInputOutput { + fn default() -> &'a BinanceInputOutput { + ::default_instance() + } + } + + impl BinanceInputOutput { + pub fn new() -> BinanceInputOutput { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &BinanceInputOutput| { &m.address }, + |m: &mut BinanceInputOutput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "coins", + |m: &BinanceInputOutput| { &m.coins }, + |m: &mut BinanceInputOutput| { &mut m.coins }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceTransferMsg.BinanceInputOutput", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for BinanceInputOutput { + const NAME: &'static str = "BinanceInputOutput"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + for v in &self.coins { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.coins.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + for value in &self.coins { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + for v in &self.coins { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceInputOutput { + BinanceInputOutput::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.coins.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceInputOutput { + static instance: BinanceInputOutput = BinanceInputOutput { + address: ::std::option::Option::None, + coins: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for BinanceInputOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BinanceTransferMsg.BinanceInputOutput").unwrap()).clone() + } + } + + impl ::std::fmt::Display for BinanceInputOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for BinanceInputOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct BinanceCoin { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin.denom) + pub denom: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a BinanceCoin { + fn default() -> &'a BinanceCoin { + ::default_instance() + } + } + + impl BinanceCoin { + pub fn new() -> BinanceCoin { + ::std::default::Default::default() + } + + // required sint64 amount = 1; + + pub fn amount(&self) -> i64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: i64) { + self.amount = ::std::option::Option::Some(v); + } + + // required string denom = 2; + + pub fn denom(&self) -> &str { + match self.denom.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_denom(&mut self) { + self.denom = ::std::option::Option::None; + } + + pub fn has_denom(&self) -> bool { + self.denom.is_some() + } + + // Param is passed by value, moved + pub fn set_denom(&mut self, v: ::std::string::String) { + self.denom = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_denom(&mut self) -> &mut ::std::string::String { + if self.denom.is_none() { + self.denom = ::std::option::Option::Some(::std::string::String::new()); + } + self.denom.as_mut().unwrap() + } + + // Take field + pub fn take_denom(&mut self) -> ::std::string::String { + self.denom.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &BinanceCoin| { &m.amount }, + |m: &mut BinanceCoin| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "denom", + |m: &BinanceCoin| { &m.denom }, + |m: &mut BinanceCoin| { &mut m.denom }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceTransferMsg.BinanceCoin", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for BinanceCoin { + const NAME: &'static str = "BinanceCoin"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + if self.denom.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.amount = ::std::option::Option::Some(is.read_sint64()?); + }, + 18 => { + self.denom = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::sint64_size(1, v); + } + if let Some(v) = self.denom.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount { + os.write_sint64(1, v)?; + } + if let Some(v) = self.denom.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceCoin { + BinanceCoin::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.denom = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceCoin { + static instance: BinanceCoin = BinanceCoin { + amount: ::std::option::Option::None, + denom: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for BinanceCoin { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BinanceTransferMsg.BinanceCoin").unwrap()).clone() + } + } + + impl ::std::fmt::Display for BinanceCoin { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for BinanceCoin { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceOrderMsg) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceOrderMsg { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.id) + pub id: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.ordertype) + pub ordertype: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.price) + pub price: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.quantity) + pub quantity: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.sender) + pub sender: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.side) + pub side: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.symbol) + pub symbol: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.timeinforce) + pub timeinforce: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceOrderMsg.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceOrderMsg { + fn default() -> &'a BinanceOrderMsg { + ::default_instance() + } +} + +impl BinanceOrderMsg { + pub fn new() -> BinanceOrderMsg { + ::std::default::Default::default() + } + + // optional string id = 1; + + pub fn id(&self) -> &str { + match self.id.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::string::String) { + self.id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::string::String { + if self.id.is_none() { + self.id = ::std::option::Option::Some(::std::string::String::new()); + } + self.id.as_mut().unwrap() + } + + // Take field + pub fn take_id(&mut self) -> ::std::string::String { + self.id.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required .hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType ordertype = 2; + + pub fn ordertype(&self) -> binance_order_msg::BinanceOrderType { + match self.ordertype { + Some(e) => e.enum_value_or(binance_order_msg::BinanceOrderType::OT_UNKNOWN), + None => binance_order_msg::BinanceOrderType::OT_UNKNOWN, + } + } + + pub fn clear_ordertype(&mut self) { + self.ordertype = ::std::option::Option::None; + } + + pub fn has_ordertype(&self) -> bool { + self.ordertype.is_some() + } + + // Param is passed by value, moved + pub fn set_ordertype(&mut self, v: binance_order_msg::BinanceOrderType) { + self.ordertype = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required sint64 price = 3; + + pub fn price(&self) -> i64 { + self.price.unwrap_or(0) + } + + pub fn clear_price(&mut self) { + self.price = ::std::option::Option::None; + } + + pub fn has_price(&self) -> bool { + self.price.is_some() + } + + // Param is passed by value, moved + pub fn set_price(&mut self, v: i64) { + self.price = ::std::option::Option::Some(v); + } + + // required sint64 quantity = 4; + + pub fn quantity(&self) -> i64 { + self.quantity.unwrap_or(0) + } + + pub fn clear_quantity(&mut self) { + self.quantity = ::std::option::Option::None; + } + + pub fn has_quantity(&self) -> bool { + self.quantity.is_some() + } + + // Param is passed by value, moved + pub fn set_quantity(&mut self, v: i64) { + self.quantity = ::std::option::Option::Some(v); + } + + // optional string sender = 5; + + pub fn sender(&self) -> &str { + match self.sender.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_sender(&mut self) { + self.sender = ::std::option::Option::None; + } + + pub fn has_sender(&self) -> bool { + self.sender.is_some() + } + + // Param is passed by value, moved + pub fn set_sender(&mut self, v: ::std::string::String) { + self.sender = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sender(&mut self) -> &mut ::std::string::String { + if self.sender.is_none() { + self.sender = ::std::option::Option::Some(::std::string::String::new()); + } + self.sender.as_mut().unwrap() + } + + // Take field + pub fn take_sender(&mut self) -> ::std::string::String { + self.sender.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required .hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide side = 6; + + pub fn side(&self) -> binance_order_msg::BinanceOrderSide { + match self.side { + Some(e) => e.enum_value_or(binance_order_msg::BinanceOrderSide::SIDE_UNKNOWN), + None => binance_order_msg::BinanceOrderSide::SIDE_UNKNOWN, + } + } + + pub fn clear_side(&mut self) { + self.side = ::std::option::Option::None; + } + + pub fn has_side(&self) -> bool { + self.side.is_some() + } + + // Param is passed by value, moved + pub fn set_side(&mut self, v: binance_order_msg::BinanceOrderSide) { + self.side = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional string symbol = 7; + + pub fn symbol(&self) -> &str { + match self.symbol.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_symbol(&mut self) { + self.symbol = ::std::option::Option::None; + } + + pub fn has_symbol(&self) -> bool { + self.symbol.is_some() + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + if self.symbol.is_none() { + self.symbol = ::std::option::Option::Some(::std::string::String::new()); + } + self.symbol.as_mut().unwrap() + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required .hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce timeinforce = 8; + + pub fn timeinforce(&self) -> binance_order_msg::BinanceTimeInForce { + match self.timeinforce { + Some(e) => e.enum_value_or(binance_order_msg::BinanceTimeInForce::TIF_UNKNOWN), + None => binance_order_msg::BinanceTimeInForce::TIF_UNKNOWN, + } + } + + pub fn clear_timeinforce(&mut self) { + self.timeinforce = ::std::option::Option::None; + } + + pub fn has_timeinforce(&self) -> bool { + self.timeinforce.is_some() + } + + // Param is passed by value, moved + pub fn set_timeinforce(&mut self, v: binance_order_msg::BinanceTimeInForce) { + self.timeinforce = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "id", + |m: &BinanceOrderMsg| { &m.id }, + |m: &mut BinanceOrderMsg| { &mut m.id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ordertype", + |m: &BinanceOrderMsg| { &m.ordertype }, + |m: &mut BinanceOrderMsg| { &mut m.ordertype }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "price", + |m: &BinanceOrderMsg| { &m.price }, + |m: &mut BinanceOrderMsg| { &mut m.price }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "quantity", + |m: &BinanceOrderMsg| { &m.quantity }, + |m: &mut BinanceOrderMsg| { &mut m.quantity }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sender", + |m: &BinanceOrderMsg| { &m.sender }, + |m: &mut BinanceOrderMsg| { &mut m.sender }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "side", + |m: &BinanceOrderMsg| { &m.side }, + |m: &mut BinanceOrderMsg| { &mut m.side }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "symbol", + |m: &BinanceOrderMsg| { &m.symbol }, + |m: &mut BinanceOrderMsg| { &mut m.symbol }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "timeinforce", + |m: &BinanceOrderMsg| { &m.timeinforce }, + |m: &mut BinanceOrderMsg| { &mut m.timeinforce }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceOrderMsg", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceOrderMsg { + const NAME: &'static str = "BinanceOrderMsg"; + + fn is_initialized(&self) -> bool { + if self.ordertype.is_none() { + return false; + } + if self.price.is_none() { + return false; + } + if self.quantity.is_none() { + return false; + } + if self.side.is_none() { + return false; + } + if self.timeinforce.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.id = ::std::option::Option::Some(is.read_string()?); + }, + 16 => { + self.ordertype = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 24 => { + self.price = ::std::option::Option::Some(is.read_sint64()?); + }, + 32 => { + self.quantity = ::std::option::Option::Some(is.read_sint64()?); + }, + 42 => { + self.sender = ::std::option::Option::Some(is.read_string()?); + }, + 48 => { + self.side = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 58 => { + self.symbol = ::std::option::Option::Some(is.read_string()?); + }, + 64 => { + self.timeinforce = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.id.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.ordertype { + my_size += ::protobuf::rt::int32_size(2, v.value()); + } + if let Some(v) = self.price { + my_size += ::protobuf::rt::sint64_size(3, v); + } + if let Some(v) = self.quantity { + my_size += ::protobuf::rt::sint64_size(4, v); + } + if let Some(v) = self.sender.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.side { + my_size += ::protobuf::rt::int32_size(6, v.value()); + } + if let Some(v) = self.symbol.as_ref() { + my_size += ::protobuf::rt::string_size(7, &v); + } + if let Some(v) = self.timeinforce { + my_size += ::protobuf::rt::int32_size(8, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.id.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.ordertype { + os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.price { + os.write_sint64(3, v)?; + } + if let Some(v) = self.quantity { + os.write_sint64(4, v)?; + } + if let Some(v) = self.sender.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.side { + os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.symbol.as_ref() { + os.write_string(7, v)?; + } + if let Some(v) = self.timeinforce { + os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceOrderMsg { + BinanceOrderMsg::new() + } + + fn clear(&mut self) { + self.id = ::std::option::Option::None; + self.ordertype = ::std::option::Option::None; + self.price = ::std::option::Option::None; + self.quantity = ::std::option::Option::None; + self.sender = ::std::option::Option::None; + self.side = ::std::option::Option::None; + self.symbol = ::std::option::Option::None; + self.timeinforce = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceOrderMsg { + static instance: BinanceOrderMsg = BinanceOrderMsg { + id: ::std::option::Option::None, + ordertype: ::std::option::Option::None, + price: ::std::option::Option::None, + quantity: ::std::option::Option::None, + sender: ::std::option::Option::None, + side: ::std::option::Option::None, + symbol: ::std::option::Option::None, + timeinforce: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceOrderMsg { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceOrderMsg").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceOrderMsg { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceOrderMsg { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `BinanceOrderMsg` +pub mod binance_order_msg { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType) + pub enum BinanceOrderType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.OT_UNKNOWN) + OT_UNKNOWN = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.MARKET) + MARKET = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.LIMIT) + LIMIT = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.OT_RESERVED) + OT_RESERVED = 3, + } + + impl ::protobuf::Enum for BinanceOrderType { + const NAME: &'static str = "BinanceOrderType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(BinanceOrderType::OT_UNKNOWN), + 1 => ::std::option::Option::Some(BinanceOrderType::MARKET), + 2 => ::std::option::Option::Some(BinanceOrderType::LIMIT), + 3 => ::std::option::Option::Some(BinanceOrderType::OT_RESERVED), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "OT_UNKNOWN" => ::std::option::Option::Some(BinanceOrderType::OT_UNKNOWN), + "MARKET" => ::std::option::Option::Some(BinanceOrderType::MARKET), + "LIMIT" => ::std::option::Option::Some(BinanceOrderType::LIMIT), + "OT_RESERVED" => ::std::option::Option::Some(BinanceOrderType::OT_RESERVED), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [BinanceOrderType] = &[ + BinanceOrderType::OT_UNKNOWN, + BinanceOrderType::MARKET, + BinanceOrderType::LIMIT, + BinanceOrderType::OT_RESERVED, + ]; + } + + impl ::protobuf::EnumFull for BinanceOrderType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("BinanceOrderMsg.BinanceOrderType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for BinanceOrderType { + fn default() -> Self { + BinanceOrderType::OT_UNKNOWN + } + } + + impl BinanceOrderType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BinanceOrderMsg.BinanceOrderType") + } + } + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide) + pub enum BinanceOrderSide { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide.SIDE_UNKNOWN) + SIDE_UNKNOWN = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide.BUY) + BUY = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide.SELL) + SELL = 2, + } + + impl ::protobuf::Enum for BinanceOrderSide { + const NAME: &'static str = "BinanceOrderSide"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(BinanceOrderSide::SIDE_UNKNOWN), + 1 => ::std::option::Option::Some(BinanceOrderSide::BUY), + 2 => ::std::option::Option::Some(BinanceOrderSide::SELL), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SIDE_UNKNOWN" => ::std::option::Option::Some(BinanceOrderSide::SIDE_UNKNOWN), + "BUY" => ::std::option::Option::Some(BinanceOrderSide::BUY), + "SELL" => ::std::option::Option::Some(BinanceOrderSide::SELL), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [BinanceOrderSide] = &[ + BinanceOrderSide::SIDE_UNKNOWN, + BinanceOrderSide::BUY, + BinanceOrderSide::SELL, + ]; + } + + impl ::protobuf::EnumFull for BinanceOrderSide { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("BinanceOrderMsg.BinanceOrderSide").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for BinanceOrderSide { + fn default() -> Self { + BinanceOrderSide::SIDE_UNKNOWN + } + } + + impl BinanceOrderSide { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BinanceOrderMsg.BinanceOrderSide") + } + } + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce) + pub enum BinanceTimeInForce { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.TIF_UNKNOWN) + TIF_UNKNOWN = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.GTE) + GTE = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.TIF_RESERVED) + TIF_RESERVED = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.IOC) + IOC = 3, + } + + impl ::protobuf::Enum for BinanceTimeInForce { + const NAME: &'static str = "BinanceTimeInForce"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(BinanceTimeInForce::TIF_UNKNOWN), + 1 => ::std::option::Option::Some(BinanceTimeInForce::GTE), + 2 => ::std::option::Option::Some(BinanceTimeInForce::TIF_RESERVED), + 3 => ::std::option::Option::Some(BinanceTimeInForce::IOC), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "TIF_UNKNOWN" => ::std::option::Option::Some(BinanceTimeInForce::TIF_UNKNOWN), + "GTE" => ::std::option::Option::Some(BinanceTimeInForce::GTE), + "TIF_RESERVED" => ::std::option::Option::Some(BinanceTimeInForce::TIF_RESERVED), + "IOC" => ::std::option::Option::Some(BinanceTimeInForce::IOC), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [BinanceTimeInForce] = &[ + BinanceTimeInForce::TIF_UNKNOWN, + BinanceTimeInForce::GTE, + BinanceTimeInForce::TIF_RESERVED, + BinanceTimeInForce::IOC, + ]; + } + + impl ::protobuf::EnumFull for BinanceTimeInForce { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("BinanceOrderMsg.BinanceTimeInForce").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for BinanceTimeInForce { + fn default() -> Self { + BinanceTimeInForce::TIF_UNKNOWN + } + } + + impl BinanceTimeInForce { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BinanceOrderMsg.BinanceTimeInForce") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceCancelMsg) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceCancelMsg { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceCancelMsg.refid) + pub refid: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceCancelMsg.sender) + pub sender: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceCancelMsg.symbol) + pub symbol: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceCancelMsg.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceCancelMsg { + fn default() -> &'a BinanceCancelMsg { + ::default_instance() + } +} + +impl BinanceCancelMsg { + pub fn new() -> BinanceCancelMsg { + ::std::default::Default::default() + } + + // optional string refid = 1; + + pub fn refid(&self) -> &str { + match self.refid.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_refid(&mut self) { + self.refid = ::std::option::Option::None; + } + + pub fn has_refid(&self) -> bool { + self.refid.is_some() + } + + // Param is passed by value, moved + pub fn set_refid(&mut self, v: ::std::string::String) { + self.refid = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_refid(&mut self) -> &mut ::std::string::String { + if self.refid.is_none() { + self.refid = ::std::option::Option::Some(::std::string::String::new()); + } + self.refid.as_mut().unwrap() + } + + // Take field + pub fn take_refid(&mut self) -> ::std::string::String { + self.refid.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string sender = 2; + + pub fn sender(&self) -> &str { + match self.sender.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_sender(&mut self) { + self.sender = ::std::option::Option::None; + } + + pub fn has_sender(&self) -> bool { + self.sender.is_some() + } + + // Param is passed by value, moved + pub fn set_sender(&mut self, v: ::std::string::String) { + self.sender = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sender(&mut self) -> &mut ::std::string::String { + if self.sender.is_none() { + self.sender = ::std::option::Option::Some(::std::string::String::new()); + } + self.sender.as_mut().unwrap() + } + + // Take field + pub fn take_sender(&mut self) -> ::std::string::String { + self.sender.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string symbol = 3; + + pub fn symbol(&self) -> &str { + match self.symbol.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_symbol(&mut self) { + self.symbol = ::std::option::Option::None; + } + + pub fn has_symbol(&self) -> bool { + self.symbol.is_some() + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + if self.symbol.is_none() { + self.symbol = ::std::option::Option::Some(::std::string::String::new()); + } + self.symbol.as_mut().unwrap() + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "refid", + |m: &BinanceCancelMsg| { &m.refid }, + |m: &mut BinanceCancelMsg| { &mut m.refid }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sender", + |m: &BinanceCancelMsg| { &m.sender }, + |m: &mut BinanceCancelMsg| { &mut m.sender }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "symbol", + |m: &BinanceCancelMsg| { &m.symbol }, + |m: &mut BinanceCancelMsg| { &mut m.symbol }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceCancelMsg", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceCancelMsg { + const NAME: &'static str = "BinanceCancelMsg"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.refid = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.sender = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.symbol = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.refid.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.sender.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.symbol.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.refid.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.sender.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.symbol.as_ref() { + os.write_string(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceCancelMsg { + BinanceCancelMsg::new() + } + + fn clear(&mut self) { + self.refid = ::std::option::Option::None; + self.sender = ::std::option::Option::None; + self.symbol = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceCancelMsg { + static instance: BinanceCancelMsg = BinanceCancelMsg { + refid: ::std::option::Option::None, + sender: ::std::option::Option::None, + symbol: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceCancelMsg { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceCancelMsg").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceCancelMsg { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceCancelMsg { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceSignedTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BinanceSignedTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignedTx.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignedTx.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceSignedTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BinanceSignedTx { + fn default() -> &'a BinanceSignedTx { + ::default_instance() + } +} + +impl BinanceSignedTx { + pub fn new() -> BinanceSignedTx { + ::std::default::Default::default() + } + + // required bytes signature = 1; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes public_key = 2; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &BinanceSignedTx| { &m.signature }, + |m: &mut BinanceSignedTx| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &BinanceSignedTx| { &m.public_key }, + |m: &mut BinanceSignedTx| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BinanceSignedTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BinanceSignedTx { + const NAME: &'static str = "BinanceSignedTx"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BinanceSignedTx { + BinanceSignedTx::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BinanceSignedTx { + static instance: BinanceSignedTx = BinanceSignedTx { + signature: ::std::option::Option::None, + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BinanceSignedTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceSignedTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BinanceSignedTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BinanceSignedTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x16messages-binance.proto\x12\x1ahw.trezor.messages.binance\"o\n\x11B\ + inanceGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ + \x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\ + \x08chunkify\x18\x03\x20\x01(\x08R\x08chunkify\"*\n\x0eBinanceAddress\ + \x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"U\n\x13BinanceGetP\ + ublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0c\ + show_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"1\n\x10BinancePublicK\ + ey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\"\xef\x01\n\rB\ + inanceSignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\ + \x1b\n\tmsg_count\x18\x02\x20\x02(\rR\x08msgCount\x12%\n\x0eaccount_numb\ + er\x18\x03\x20\x02(\x12R\raccountNumber\x12\x19\n\x08chain_id\x18\x04\ + \x20\x01(\tR\x07chainId\x12\x12\n\x04memo\x18\x05\x20\x01(\tR\x04memo\ + \x12\x1a\n\x08sequence\x18\x06\x20\x02(\x12R\x08sequence\x12\x16\n\x06so\ + urce\x18\x07\x20\x02(\x12R\x06source\x12\x1a\n\x08chunkify\x18\x08\x20\ + \x01(\x08R\x08chunkify\"\x12\n\x10BinanceTxRequest\"\xa8\x03\n\x12Binanc\ + eTransferMsg\x12Y\n\x06inputs\x18\x01\x20\x03(\x0b2A.hw.trezor.messages.\ + binance.BinanceTransferMsg.BinanceInputOutputR\x06inputs\x12[\n\x07outpu\ + ts\x18\x02\x20\x03(\x0b2A.hw.trezor.messages.binance.BinanceTransferMsg.\ + BinanceInputOutputR\x07outputs\x12\x1a\n\x08chunkify\x18\x03\x20\x01(\ + \x08R\x08chunkify\x1a\x80\x01\n\x12BinanceInputOutput\x12\x18\n\x07addre\ + ss\x18\x01\x20\x02(\tR\x07address\x12P\n\x05coins\x18\x02\x20\x03(\x0b2:\ + .hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoinR\x05coins\x1a\ + ;\n\x0bBinanceCoin\x12\x16\n\x06amount\x18\x01\x20\x02(\x12R\x06amount\ + \x12\x14\n\x05denom\x18\x02\x20\x02(\tR\x05denom\"\xe3\x04\n\x0fBinanceO\ + rderMsg\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12Z\n\tordertype\x18\ + \x02\x20\x02(\x0e2<.hw.trezor.messages.binance.BinanceOrderMsg.BinanceOr\ + derTypeR\tordertype\x12\x14\n\x05price\x18\x03\x20\x02(\x12R\x05price\ + \x12\x1a\n\x08quantity\x18\x04\x20\x02(\x12R\x08quantity\x12\x16\n\x06se\ + nder\x18\x05\x20\x01(\tR\x06sender\x12P\n\x04side\x18\x06\x20\x02(\x0e2<\ + .hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSideR\x04side\ + \x12\x16\n\x06symbol\x18\x07\x20\x01(\tR\x06symbol\x12`\n\x0btimeinforce\ + \x18\x08\x20\x02(\x0e2>.hw.trezor.messages.binance.BinanceOrderMsg.Binan\ + ceTimeInForceR\x0btimeinforce\"J\n\x10BinanceOrderType\x12\x0e\n\nOT_UNK\ + NOWN\x10\0\x12\n\n\x06MARKET\x10\x01\x12\t\n\x05LIMIT\x10\x02\x12\x0f\n\ + \x0bOT_RESERVED\x10\x03\"7\n\x10BinanceOrderSide\x12\x10\n\x0cSIDE_UNKNO\ + WN\x10\0\x12\x07\n\x03BUY\x10\x01\x12\x08\n\x04SELL\x10\x02\"I\n\x12Bina\ + nceTimeInForce\x12\x0f\n\x0bTIF_UNKNOWN\x10\0\x12\x07\n\x03GTE\x10\x01\ + \x12\x10\n\x0cTIF_RESERVED\x10\x02\x12\x07\n\x03IOC\x10\x03\"X\n\x10Bina\ + nceCancelMsg\x12\x14\n\x05refid\x18\x01\x20\x01(\tR\x05refid\x12\x16\n\ + \x06sender\x18\x02\x20\x01(\tR\x06sender\x12\x16\n\x06symbol\x18\x03\x20\ + \x01(\tR\x06symbol\"N\n\x0fBinanceSignedTx\x12\x1c\n\tsignature\x18\x01\ + \x20\x02(\x0cR\tsignature\x12\x1d\n\npublic_key\x18\x02\x20\x02(\x0cR\tp\ + ublicKeyB;\n#com.satoshilabs.trezor.lib.protobufB\x14TrezorMessageBinanc\ + e\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(12); + messages.push(BinanceGetAddress::generated_message_descriptor_data()); + messages.push(BinanceAddress::generated_message_descriptor_data()); + messages.push(BinanceGetPublicKey::generated_message_descriptor_data()); + messages.push(BinancePublicKey::generated_message_descriptor_data()); + messages.push(BinanceSignTx::generated_message_descriptor_data()); + messages.push(BinanceTxRequest::generated_message_descriptor_data()); + messages.push(BinanceTransferMsg::generated_message_descriptor_data()); + messages.push(BinanceOrderMsg::generated_message_descriptor_data()); + messages.push(BinanceCancelMsg::generated_message_descriptor_data()); + messages.push(BinanceSignedTx::generated_message_descriptor_data()); + messages.push(binance_transfer_msg::BinanceInputOutput::generated_message_descriptor_data()); + messages.push(binance_transfer_msg::BinanceCoin::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(3); + enums.push(binance_order_msg::BinanceOrderType::generated_enum_descriptor_data()); + enums.push(binance_order_msg::BinanceOrderSide::generated_enum_descriptor_data()); + enums.push(binance_order_msg::BinanceTimeInForce::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs b/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs new file mode 100644 index 0000000000..59422c58bb --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs @@ -0,0 +1,13682 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-bitcoin.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.MultisigRedeemScriptType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MultisigRedeemScriptType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.pubkeys) + pub pubkeys: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.signatures) + pub signatures: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.m) + pub m: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.nodes) + pub nodes: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.address_n) + pub address_n: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MultisigRedeemScriptType { + fn default() -> &'a MultisigRedeemScriptType { + ::default_instance() + } +} + +impl MultisigRedeemScriptType { + pub fn new() -> MultisigRedeemScriptType { + ::std::default::Default::default() + } + + // required uint32 m = 3; + + pub fn m(&self) -> u32 { + self.m.unwrap_or(0) + } + + pub fn clear_m(&mut self) { + self.m = ::std::option::Option::None; + } + + pub fn has_m(&self) -> bool { + self.m.is_some() + } + + // Param is passed by value, moved + pub fn set_m(&mut self, v: u32) { + self.m = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "pubkeys", + |m: &MultisigRedeemScriptType| { &m.pubkeys }, + |m: &mut MultisigRedeemScriptType| { &mut m.pubkeys }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "signatures", + |m: &MultisigRedeemScriptType| { &m.signatures }, + |m: &mut MultisigRedeemScriptType| { &mut m.signatures }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "m", + |m: &MultisigRedeemScriptType| { &m.m }, + |m: &mut MultisigRedeemScriptType| { &mut m.m }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "nodes", + |m: &MultisigRedeemScriptType| { &m.nodes }, + |m: &mut MultisigRedeemScriptType| { &mut m.nodes }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MultisigRedeemScriptType| { &m.address_n }, + |m: &mut MultisigRedeemScriptType| { &mut m.address_n }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MultisigRedeemScriptType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MultisigRedeemScriptType { + const NAME: &'static str = "MultisigRedeemScriptType"; + + fn is_initialized(&self) -> bool { + if self.m.is_none() { + return false; + } + for v in &self.pubkeys { + if !v.is_initialized() { + return false; + } + }; + for v in &self.nodes { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.pubkeys.push(is.read_message()?); + }, + 18 => { + self.signatures.push(is.read_bytes()?); + }, + 24 => { + self.m = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.nodes.push(is.read_message()?); + }, + 42 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 40 => { + self.address_n.push(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.pubkeys { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.signatures { + my_size += ::protobuf::rt::bytes_size(2, &value); + }; + if let Some(v) = self.m { + my_size += ::protobuf::rt::uint32_size(3, v); + } + for value in &self.nodes { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(5, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.pubkeys { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + for v in &self.signatures { + os.write_bytes(2, &v)?; + }; + if let Some(v) = self.m { + os.write_uint32(3, v)?; + } + for v in &self.nodes { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + }; + for v in &self.address_n { + os.write_uint32(5, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MultisigRedeemScriptType { + MultisigRedeemScriptType::new() + } + + fn clear(&mut self) { + self.pubkeys.clear(); + self.signatures.clear(); + self.m = ::std::option::Option::None; + self.nodes.clear(); + self.address_n.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MultisigRedeemScriptType { + static instance: MultisigRedeemScriptType = MultisigRedeemScriptType { + pubkeys: ::std::vec::Vec::new(), + signatures: ::std::vec::Vec::new(), + m: ::std::option::Option::None, + nodes: ::std::vec::Vec::new(), + address_n: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MultisigRedeemScriptType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MultisigRedeemScriptType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MultisigRedeemScriptType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MultisigRedeemScriptType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MultisigRedeemScriptType` +pub mod multisig_redeem_script_type { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct HDNodePathType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType.node) + pub node: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType.address_n) + pub address_n: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a HDNodePathType { + fn default() -> &'a HDNodePathType { + ::default_instance() + } + } + + impl HDNodePathType { + pub fn new() -> HDNodePathType { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::messages_common::HDNodeType>( + "node", + |m: &HDNodePathType| { &m.node }, + |m: &mut HDNodePathType| { &mut m.node }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &HDNodePathType| { &m.address_n }, + |m: &mut HDNodePathType| { &mut m.address_n }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MultisigRedeemScriptType.HDNodePathType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for HDNodePathType { + const NAME: &'static str = "HDNodePathType"; + + fn is_initialized(&self) -> bool { + if self.node.is_none() { + return false; + } + for v in &self.node { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.node.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.node.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> HDNodePathType { + HDNodePathType::new() + } + + fn clear(&mut self) { + self.node.clear(); + self.address_n.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static HDNodePathType { + static instance: HDNodePathType = HDNodePathType { + node: ::protobuf::MessageField::none(), + address_n: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for HDNodePathType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MultisigRedeemScriptType.HDNodePathType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for HDNodePathType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for HDNodePathType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.ecdsa_curve_name) + pub ecdsa_curve_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.ignore_xpub_magic) + pub ignore_xpub_magic: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetPublicKey { + fn default() -> &'a GetPublicKey { + ::default_instance() + } +} + +impl GetPublicKey { + pub fn new() -> GetPublicKey { + ::std::default::Default::default() + } + + // optional string ecdsa_curve_name = 2; + + pub fn ecdsa_curve_name(&self) -> &str { + match self.ecdsa_curve_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_ecdsa_curve_name(&mut self) { + self.ecdsa_curve_name = ::std::option::Option::None; + } + + pub fn has_ecdsa_curve_name(&self) -> bool { + self.ecdsa_curve_name.is_some() + } + + // Param is passed by value, moved + pub fn set_ecdsa_curve_name(&mut self, v: ::std::string::String) { + self.ecdsa_curve_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ecdsa_curve_name(&mut self) -> &mut ::std::string::String { + if self.ecdsa_curve_name.is_none() { + self.ecdsa_curve_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.ecdsa_curve_name.as_mut().unwrap() + } + + // Take field + pub fn take_ecdsa_curve_name(&mut self) -> ::std::string::String { + self.ecdsa_curve_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool show_display = 3; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional string coin_name = 4; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 5; + + pub fn script_type(&self) -> InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), + None => InputScriptType::SPENDADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool ignore_xpub_magic = 6; + + pub fn ignore_xpub_magic(&self) -> bool { + self.ignore_xpub_magic.unwrap_or(false) + } + + pub fn clear_ignore_xpub_magic(&mut self) { + self.ignore_xpub_magic = ::std::option::Option::None; + } + + pub fn has_ignore_xpub_magic(&self) -> bool { + self.ignore_xpub_magic.is_some() + } + + // Param is passed by value, moved + pub fn set_ignore_xpub_magic(&mut self, v: bool) { + self.ignore_xpub_magic = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &GetPublicKey| { &m.address_n }, + |m: &mut GetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ecdsa_curve_name", + |m: &GetPublicKey| { &m.ecdsa_curve_name }, + |m: &mut GetPublicKey| { &mut m.ecdsa_curve_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &GetPublicKey| { &m.show_display }, + |m: &mut GetPublicKey| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &GetPublicKey| { &m.coin_name }, + |m: &mut GetPublicKey| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &GetPublicKey| { &m.script_type }, + |m: &mut GetPublicKey| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ignore_xpub_magic", + |m: &GetPublicKey| { &m.ignore_xpub_magic }, + |m: &mut GetPublicKey| { &mut m.ignore_xpub_magic }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetPublicKey { + const NAME: &'static str = "GetPublicKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.ecdsa_curve_name = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 34 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 40 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 48 => { + self.ignore_xpub_magic = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.ecdsa_curve_name.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(5, v.value()); + } + if let Some(v) = self.ignore_xpub_magic { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.ecdsa_curve_name.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.show_display { + os.write_bool(3, v)?; + } + if let Some(v) = self.coin_name.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.ignore_xpub_magic { + os.write_bool(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetPublicKey { + GetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.ecdsa_curve_name = ::std::option::Option::None; + self.show_display = ::std::option::Option::None; + self.coin_name = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.ignore_xpub_magic = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetPublicKey { + static instance: GetPublicKey = GetPublicKey { + address_n: ::std::vec::Vec::new(), + ecdsa_curve_name: ::std::option::Option::None, + show_display: ::std::option::Option::None, + coin_name: ::std::option::Option::None, + script_type: ::std::option::Option::None, + ignore_xpub_magic: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.node) + pub node: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.xpub) + pub xpub: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.root_fingerprint) + pub root_fingerprint: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.descriptor) + pub descriptor: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PublicKey { + fn default() -> &'a PublicKey { + ::default_instance() + } +} + +impl PublicKey { + pub fn new() -> PublicKey { + ::std::default::Default::default() + } + + // required string xpub = 2; + + pub fn xpub(&self) -> &str { + match self.xpub.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_xpub(&mut self) { + self.xpub = ::std::option::Option::None; + } + + pub fn has_xpub(&self) -> bool { + self.xpub.is_some() + } + + // Param is passed by value, moved + pub fn set_xpub(&mut self, v: ::std::string::String) { + self.xpub = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_xpub(&mut self) -> &mut ::std::string::String { + if self.xpub.is_none() { + self.xpub = ::std::option::Option::Some(::std::string::String::new()); + } + self.xpub.as_mut().unwrap() + } + + // Take field + pub fn take_xpub(&mut self) -> ::std::string::String { + self.xpub.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 root_fingerprint = 3; + + pub fn root_fingerprint(&self) -> u32 { + self.root_fingerprint.unwrap_or(0) + } + + pub fn clear_root_fingerprint(&mut self) { + self.root_fingerprint = ::std::option::Option::None; + } + + pub fn has_root_fingerprint(&self) -> bool { + self.root_fingerprint.is_some() + } + + // Param is passed by value, moved + pub fn set_root_fingerprint(&mut self, v: u32) { + self.root_fingerprint = ::std::option::Option::Some(v); + } + + // optional string descriptor = 4; + + pub fn descriptor(&self) -> &str { + match self.descriptor.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_descriptor(&mut self) { + self.descriptor = ::std::option::Option::None; + } + + pub fn has_descriptor(&self) -> bool { + self.descriptor.is_some() + } + + // Param is passed by value, moved + pub fn set_descriptor(&mut self, v: ::std::string::String) { + self.descriptor = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_descriptor(&mut self) -> &mut ::std::string::String { + if self.descriptor.is_none() { + self.descriptor = ::std::option::Option::Some(::std::string::String::new()); + } + self.descriptor.as_mut().unwrap() + } + + // Take field + pub fn take_descriptor(&mut self) -> ::std::string::String { + self.descriptor.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( + "node", + |m: &PublicKey| { &m.node }, + |m: &mut PublicKey| { &mut m.node }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "xpub", + |m: &PublicKey| { &m.xpub }, + |m: &mut PublicKey| { &mut m.xpub }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "root_fingerprint", + |m: &PublicKey| { &m.root_fingerprint }, + |m: &mut PublicKey| { &mut m.root_fingerprint }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "descriptor", + |m: &PublicKey| { &m.descriptor }, + |m: &mut PublicKey| { &mut m.descriptor }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PublicKey { + const NAME: &'static str = "PublicKey"; + + fn is_initialized(&self) -> bool { + if self.node.is_none() { + return false; + } + if self.xpub.is_none() { + return false; + } + for v in &self.node { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; + }, + 18 => { + self.xpub = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.root_fingerprint = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.descriptor = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.node.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.xpub.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.root_fingerprint { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.descriptor.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.node.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.xpub.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.root_fingerprint { + os.write_uint32(3, v)?; + } + if let Some(v) = self.descriptor.as_ref() { + os.write_string(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PublicKey { + PublicKey::new() + } + + fn clear(&mut self) { + self.node.clear(); + self.xpub = ::std::option::Option::None; + self.root_fingerprint = ::std::option::Option::None; + self.descriptor = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PublicKey { + static instance: PublicKey = PublicKey { + node: ::protobuf::MessageField::none(), + xpub: ::std::option::Option::None, + root_fingerprint: ::std::option::Option::None, + descriptor: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.ignore_xpub_magic) + pub ignore_xpub_magic: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetAddress { + fn default() -> &'a GetAddress { + ::default_instance() + } +} + +impl GetAddress { + pub fn new() -> GetAddress { + ::std::default::Default::default() + } + + // optional string coin_name = 2; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool show_display = 3; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 5; + + pub fn script_type(&self) -> InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), + None => InputScriptType::SPENDADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool ignore_xpub_magic = 6; + + pub fn ignore_xpub_magic(&self) -> bool { + self.ignore_xpub_magic.unwrap_or(false) + } + + pub fn clear_ignore_xpub_magic(&mut self) { + self.ignore_xpub_magic = ::std::option::Option::None; + } + + pub fn has_ignore_xpub_magic(&self) -> bool { + self.ignore_xpub_magic.is_some() + } + + // Param is passed by value, moved + pub fn set_ignore_xpub_magic(&mut self, v: bool) { + self.ignore_xpub_magic = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 7; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &GetAddress| { &m.address_n }, + |m: &mut GetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &GetAddress| { &m.coin_name }, + |m: &mut GetAddress| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &GetAddress| { &m.show_display }, + |m: &mut GetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( + "multisig", + |m: &GetAddress| { &m.multisig }, + |m: &mut GetAddress| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &GetAddress| { &m.script_type }, + |m: &mut GetAddress| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ignore_xpub_magic", + |m: &GetAddress| { &m.ignore_xpub_magic }, + |m: &mut GetAddress| { &mut m.ignore_xpub_magic }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &GetAddress| { &m.chunkify }, + |m: &mut GetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetAddress { + const NAME: &'static str = "GetAddress"; + + fn is_initialized(&self) -> bool { + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 40 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 48 => { + self.ignore_xpub_magic = ::std::option::Option::Some(is.read_bool()?); + }, + 56 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(5, v.value()); + } + if let Some(v) = self.ignore_xpub_magic { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.coin_name.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.show_display { + os.write_bool(3, v)?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.script_type { + os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.ignore_xpub_magic { + os.write_bool(6, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetAddress { + GetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.coin_name = ::std::option::Option::None; + self.show_display = ::std::option::Option::None; + self.multisig.clear(); + self.script_type = ::std::option::Option::None; + self.ignore_xpub_magic = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetAddress { + static instance: GetAddress = GetAddress { + address_n: ::std::vec::Vec::new(), + coin_name: ::std::option::Option::None, + show_display: ::std::option::Option::None, + multisig: ::protobuf::MessageField::none(), + script_type: ::std::option::Option::None, + ignore_xpub_magic: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.Address) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Address { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.Address.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.Address.mac) + pub mac: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.Address.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Address { + fn default() -> &'a Address { +
::default_instance() + } +} + +impl Address { + pub fn new() -> Address { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes mac = 2; + + pub fn mac(&self) -> &[u8] { + match self.mac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mac(&mut self) { + self.mac = ::std::option::Option::None; + } + + pub fn has_mac(&self) -> bool { + self.mac.is_some() + } + + // Param is passed by value, moved + pub fn set_mac(&mut self, v: ::std::vec::Vec) { + self.mac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { + if self.mac.is_none() { + self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mac.as_mut().unwrap() + } + + // Take field + pub fn take_mac(&mut self) -> ::std::vec::Vec { + self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &Address| { &m.address }, + |m: &mut Address| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mac", + |m: &Address| { &m.mac }, + |m: &mut Address| { &mut m.mac }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::
( + "Address", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Address { + const NAME: &'static str = "Address"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.mac = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.mac.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.mac.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Address { + Address::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.mac = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Address { + static instance: Address = Address { + address: ::std::option::Option::None, + mac: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Address { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Address").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Address { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Address { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetOwnershipId) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetOwnershipId { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetOwnershipId.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetOwnershipId { + fn default() -> &'a GetOwnershipId { + ::default_instance() + } +} + +impl GetOwnershipId { + pub fn new() -> GetOwnershipId { + ::std::default::Default::default() + } + + // optional string coin_name = 2; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 4; + + pub fn script_type(&self) -> InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), + None => InputScriptType::SPENDADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &GetOwnershipId| { &m.address_n }, + |m: &mut GetOwnershipId| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &GetOwnershipId| { &m.coin_name }, + |m: &mut GetOwnershipId| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( + "multisig", + |m: &GetOwnershipId| { &m.multisig }, + |m: &mut GetOwnershipId| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &GetOwnershipId| { &m.script_type }, + |m: &mut GetOwnershipId| { &mut m.script_type }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetOwnershipId", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetOwnershipId { + const NAME: &'static str = "GetOwnershipId"; + + fn is_initialized(&self) -> bool { + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 32 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(4, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.coin_name.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.script_type { + os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetOwnershipId { + GetOwnershipId::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.coin_name = ::std::option::Option::None; + self.multisig.clear(); + self.script_type = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetOwnershipId { + static instance: GetOwnershipId = GetOwnershipId { + address_n: ::std::vec::Vec::new(), + coin_name: ::std::option::Option::None, + multisig: ::protobuf::MessageField::none(), + script_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetOwnershipId { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetOwnershipId").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetOwnershipId { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetOwnershipId { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.OwnershipId) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct OwnershipId { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.OwnershipId.ownership_id) + pub ownership_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.OwnershipId.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a OwnershipId { + fn default() -> &'a OwnershipId { + ::default_instance() + } +} + +impl OwnershipId { + pub fn new() -> OwnershipId { + ::std::default::Default::default() + } + + // required bytes ownership_id = 1; + + pub fn ownership_id(&self) -> &[u8] { + match self.ownership_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ownership_id(&mut self) { + self.ownership_id = ::std::option::Option::None; + } + + pub fn has_ownership_id(&self) -> bool { + self.ownership_id.is_some() + } + + // Param is passed by value, moved + pub fn set_ownership_id(&mut self, v: ::std::vec::Vec) { + self.ownership_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ownership_id(&mut self) -> &mut ::std::vec::Vec { + if self.ownership_id.is_none() { + self.ownership_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ownership_id.as_mut().unwrap() + } + + // Take field + pub fn take_ownership_id(&mut self) -> ::std::vec::Vec { + self.ownership_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ownership_id", + |m: &OwnershipId| { &m.ownership_id }, + |m: &mut OwnershipId| { &mut m.ownership_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "OwnershipId", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for OwnershipId { + const NAME: &'static str = "OwnershipId"; + + fn is_initialized(&self) -> bool { + if self.ownership_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.ownership_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.ownership_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.ownership_id.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> OwnershipId { + OwnershipId::new() + } + + fn clear(&mut self) { + self.ownership_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static OwnershipId { + static instance: OwnershipId = OwnershipId { + ownership_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for OwnershipId { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("OwnershipId").unwrap()).clone() + } +} + +impl ::std::fmt::Display for OwnershipId { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OwnershipId { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.SignMessage) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SignMessage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.message) + pub message: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.no_script_type) + pub no_script_type: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.SignMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SignMessage { + fn default() -> &'a SignMessage { + ::default_instance() + } +} + +impl SignMessage { + pub fn new() -> SignMessage { + ::std::default::Default::default() + } + + // required bytes message = 2; + + pub fn message(&self) -> &[u8] { + match self.message.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::vec::Vec) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::vec::Vec { + self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string coin_name = 3; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 4; + + pub fn script_type(&self) -> InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), + None => InputScriptType::SPENDADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool no_script_type = 5; + + pub fn no_script_type(&self) -> bool { + self.no_script_type.unwrap_or(false) + } + + pub fn clear_no_script_type(&mut self) { + self.no_script_type = ::std::option::Option::None; + } + + pub fn has_no_script_type(&self) -> bool { + self.no_script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_no_script_type(&mut self, v: bool) { + self.no_script_type = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 6; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &SignMessage| { &m.address_n }, + |m: &mut SignMessage| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &SignMessage| { &m.message }, + |m: &mut SignMessage| { &mut m.message }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &SignMessage| { &m.coin_name }, + |m: &mut SignMessage| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &SignMessage| { &m.script_type }, + |m: &mut SignMessage| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "no_script_type", + |m: &SignMessage| { &m.no_script_type }, + |m: &mut SignMessage| { &mut m.no_script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &SignMessage| { &m.chunkify }, + |m: &mut SignMessage| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SignMessage", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SignMessage { + const NAME: &'static str = "SignMessage"; + + fn is_initialized(&self) -> bool { + if self.message.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.message = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 32 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 40 => { + self.no_script_type = ::std::option::Option::Some(is.read_bool()?); + }, + 48 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(4, v.value()); + } + if let Some(v) = self.no_script_type { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.message.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.coin_name.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.no_script_type { + os.write_bool(5, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SignMessage { + SignMessage::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.message = ::std::option::Option::None; + self.coin_name = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.no_script_type = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SignMessage { + static instance: SignMessage = SignMessage { + address_n: ::std::vec::Vec::new(), + message: ::std::option::Option::None, + coin_name: ::std::option::Option::None, + script_type: ::std::option::Option::None, + no_script_type: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SignMessage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SignMessage").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SignMessage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SignMessage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.MessageSignature) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MessageSignature { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MessageSignature.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MessageSignature.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.MessageSignature.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MessageSignature { + fn default() -> &'a MessageSignature { + ::default_instance() + } +} + +impl MessageSignature { + pub fn new() -> MessageSignature { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MessageSignature| { &m.address }, + |m: &mut MessageSignature| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &MessageSignature| { &m.signature }, + |m: &mut MessageSignature| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MessageSignature", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MessageSignature { + const NAME: &'static str = "MessageSignature"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MessageSignature { + MessageSignature::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MessageSignature { + static instance: MessageSignature = MessageSignature { + address: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MessageSignature { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MessageSignature").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MessageSignature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MessageSignature { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.VerifyMessage) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct VerifyMessage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.message) + pub message: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.VerifyMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a VerifyMessage { + fn default() -> &'a VerifyMessage { + ::default_instance() + } +} + +impl VerifyMessage { + pub fn new() -> VerifyMessage { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes message = 3; + + pub fn message(&self) -> &[u8] { + match self.message.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::vec::Vec) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::vec::Vec { + self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string coin_name = 4; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool chunkify = 5; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &VerifyMessage| { &m.address }, + |m: &mut VerifyMessage| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &VerifyMessage| { &m.signature }, + |m: &mut VerifyMessage| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &VerifyMessage| { &m.message }, + |m: &mut VerifyMessage| { &mut m.message }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &VerifyMessage| { &m.coin_name }, + |m: &mut VerifyMessage| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &VerifyMessage| { &m.chunkify }, + |m: &mut VerifyMessage| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "VerifyMessage", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for VerifyMessage { + const NAME: &'static str = "VerifyMessage"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + if self.message.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.message = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 40 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.message.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.coin_name.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> VerifyMessage { + VerifyMessage::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.message = ::std::option::Option::None; + self.coin_name = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static VerifyMessage { + static instance: VerifyMessage = VerifyMessage { + address: ::std::option::Option::None, + signature: ::std::option::Option::None, + message: ::std::option::Option::None, + coin_name: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for VerifyMessage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("VerifyMessage").unwrap()).clone() + } +} + +impl ::std::fmt::Display for VerifyMessage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for VerifyMessage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.SignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.outputs_count) + pub outputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.inputs_count) + pub inputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.version) + pub version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.lock_time) + pub lock_time: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.expiry) + pub expiry: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.overwintered) + pub overwintered: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.version_group_id) + pub version_group_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.timestamp) + pub timestamp: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.branch_id) + pub branch_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.amount_unit) + pub amount_unit: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.decred_staking_ticket) + pub decred_staking_ticket: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.serialize) + pub serialize: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.coinjoin_request) + pub coinjoin_request: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.SignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SignTx { + fn default() -> &'a SignTx { + ::default_instance() + } +} + +impl SignTx { + pub fn new() -> SignTx { + ::std::default::Default::default() + } + + // required uint32 outputs_count = 1; + + pub fn outputs_count(&self) -> u32 { + self.outputs_count.unwrap_or(0) + } + + pub fn clear_outputs_count(&mut self) { + self.outputs_count = ::std::option::Option::None; + } + + pub fn has_outputs_count(&self) -> bool { + self.outputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_outputs_count(&mut self, v: u32) { + self.outputs_count = ::std::option::Option::Some(v); + } + + // required uint32 inputs_count = 2; + + pub fn inputs_count(&self) -> u32 { + self.inputs_count.unwrap_or(0) + } + + pub fn clear_inputs_count(&mut self) { + self.inputs_count = ::std::option::Option::None; + } + + pub fn has_inputs_count(&self) -> bool { + self.inputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_inputs_count(&mut self, v: u32) { + self.inputs_count = ::std::option::Option::Some(v); + } + + // optional string coin_name = 3; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 version = 4; + + pub fn version(&self) -> u32 { + self.version.unwrap_or(1u32) + } + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u32) { + self.version = ::std::option::Option::Some(v); + } + + // optional uint32 lock_time = 5; + + pub fn lock_time(&self) -> u32 { + self.lock_time.unwrap_or(0u32) + } + + pub fn clear_lock_time(&mut self) { + self.lock_time = ::std::option::Option::None; + } + + pub fn has_lock_time(&self) -> bool { + self.lock_time.is_some() + } + + // Param is passed by value, moved + pub fn set_lock_time(&mut self, v: u32) { + self.lock_time = ::std::option::Option::Some(v); + } + + // optional uint32 expiry = 6; + + pub fn expiry(&self) -> u32 { + self.expiry.unwrap_or(0) + } + + pub fn clear_expiry(&mut self) { + self.expiry = ::std::option::Option::None; + } + + pub fn has_expiry(&self) -> bool { + self.expiry.is_some() + } + + // Param is passed by value, moved + pub fn set_expiry(&mut self, v: u32) { + self.expiry = ::std::option::Option::Some(v); + } + + // optional bool overwintered = 7; + + pub fn overwintered(&self) -> bool { + self.overwintered.unwrap_or(false) + } + + pub fn clear_overwintered(&mut self) { + self.overwintered = ::std::option::Option::None; + } + + pub fn has_overwintered(&self) -> bool { + self.overwintered.is_some() + } + + // Param is passed by value, moved + pub fn set_overwintered(&mut self, v: bool) { + self.overwintered = ::std::option::Option::Some(v); + } + + // optional uint32 version_group_id = 8; + + pub fn version_group_id(&self) -> u32 { + self.version_group_id.unwrap_or(0) + } + + pub fn clear_version_group_id(&mut self) { + self.version_group_id = ::std::option::Option::None; + } + + pub fn has_version_group_id(&self) -> bool { + self.version_group_id.is_some() + } + + // Param is passed by value, moved + pub fn set_version_group_id(&mut self, v: u32) { + self.version_group_id = ::std::option::Option::Some(v); + } + + // optional uint32 timestamp = 9; + + pub fn timestamp(&self) -> u32 { + self.timestamp.unwrap_or(0) + } + + pub fn clear_timestamp(&mut self) { + self.timestamp = ::std::option::Option::None; + } + + pub fn has_timestamp(&self) -> bool { + self.timestamp.is_some() + } + + // Param is passed by value, moved + pub fn set_timestamp(&mut self, v: u32) { + self.timestamp = ::std::option::Option::Some(v); + } + + // optional uint32 branch_id = 10; + + pub fn branch_id(&self) -> u32 { + self.branch_id.unwrap_or(0) + } + + pub fn clear_branch_id(&mut self) { + self.branch_id = ::std::option::Option::None; + } + + pub fn has_branch_id(&self) -> bool { + self.branch_id.is_some() + } + + // Param is passed by value, moved + pub fn set_branch_id(&mut self, v: u32) { + self.branch_id = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.AmountUnit amount_unit = 11; + + pub fn amount_unit(&self) -> AmountUnit { + match self.amount_unit { + Some(e) => e.enum_value_or(AmountUnit::BITCOIN), + None => AmountUnit::BITCOIN, + } + } + + pub fn clear_amount_unit(&mut self) { + self.amount_unit = ::std::option::Option::None; + } + + pub fn has_amount_unit(&self) -> bool { + self.amount_unit.is_some() + } + + // Param is passed by value, moved + pub fn set_amount_unit(&mut self, v: AmountUnit) { + self.amount_unit = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool decred_staking_ticket = 12; + + pub fn decred_staking_ticket(&self) -> bool { + self.decred_staking_ticket.unwrap_or(false) + } + + pub fn clear_decred_staking_ticket(&mut self) { + self.decred_staking_ticket = ::std::option::Option::None; + } + + pub fn has_decred_staking_ticket(&self) -> bool { + self.decred_staking_ticket.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_staking_ticket(&mut self, v: bool) { + self.decred_staking_ticket = ::std::option::Option::Some(v); + } + + // optional bool serialize = 13; + + pub fn serialize(&self) -> bool { + self.serialize.unwrap_or(true) + } + + pub fn clear_serialize(&mut self) { + self.serialize = ::std::option::Option::None; + } + + pub fn has_serialize(&self) -> bool { + self.serialize.is_some() + } + + // Param is passed by value, moved + pub fn set_serialize(&mut self, v: bool) { + self.serialize = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 15; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(15); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "outputs_count", + |m: &SignTx| { &m.outputs_count }, + |m: &mut SignTx| { &mut m.outputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inputs_count", + |m: &SignTx| { &m.inputs_count }, + |m: &mut SignTx| { &mut m.inputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &SignTx| { &m.coin_name }, + |m: &mut SignTx| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version", + |m: &SignTx| { &m.version }, + |m: &mut SignTx| { &mut m.version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "lock_time", + |m: &SignTx| { &m.lock_time }, + |m: &mut SignTx| { &mut m.lock_time }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "expiry", + |m: &SignTx| { &m.expiry }, + |m: &mut SignTx| { &mut m.expiry }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "overwintered", + |m: &SignTx| { &m.overwintered }, + |m: &mut SignTx| { &mut m.overwintered }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version_group_id", + |m: &SignTx| { &m.version_group_id }, + |m: &mut SignTx| { &mut m.version_group_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "timestamp", + |m: &SignTx| { &m.timestamp }, + |m: &mut SignTx| { &mut m.timestamp }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "branch_id", + |m: &SignTx| { &m.branch_id }, + |m: &mut SignTx| { &mut m.branch_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount_unit", + |m: &SignTx| { &m.amount_unit }, + |m: &mut SignTx| { &mut m.amount_unit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_staking_ticket", + |m: &SignTx| { &m.decred_staking_ticket }, + |m: &mut SignTx| { &mut m.decred_staking_ticket }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "serialize", + |m: &SignTx| { &m.serialize }, + |m: &mut SignTx| { &mut m.serialize }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, sign_tx::CoinJoinRequest>( + "coinjoin_request", + |m: &SignTx| { &m.coinjoin_request }, + |m: &mut SignTx| { &mut m.coinjoin_request }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &SignTx| { &m.chunkify }, + |m: &mut SignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SignTx { + const NAME: &'static str = "SignTx"; + + fn is_initialized(&self) -> bool { + if self.outputs_count.is_none() { + return false; + } + if self.inputs_count.is_none() { + return false; + } + for v in &self.coinjoin_request { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 26 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 32 => { + self.version = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.lock_time = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.expiry = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.overwintered = ::std::option::Option::Some(is.read_bool()?); + }, + 64 => { + self.version_group_id = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.timestamp = ::std::option::Option::Some(is.read_uint32()?); + }, + 80 => { + self.branch_id = ::std::option::Option::Some(is.read_uint32()?); + }, + 88 => { + self.amount_unit = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 96 => { + self.decred_staking_ticket = ::std::option::Option::Some(is.read_bool()?); + }, + 104 => { + self.serialize = ::std::option::Option::Some(is.read_bool()?); + }, + 114 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.coinjoin_request)?; + }, + 120 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.outputs_count { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.inputs_count { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.version { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.lock_time { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.expiry { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.overwintered { + my_size += 1 + 1; + } + if let Some(v) = self.version_group_id { + my_size += ::protobuf::rt::uint32_size(8, v); + } + if let Some(v) = self.timestamp { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.branch_id { + my_size += ::protobuf::rt::uint32_size(10, v); + } + if let Some(v) = self.amount_unit { + my_size += ::protobuf::rt::int32_size(11, v.value()); + } + if let Some(v) = self.decred_staking_ticket { + my_size += 1 + 1; + } + if let Some(v) = self.serialize { + my_size += 1 + 1; + } + if let Some(v) = self.coinjoin_request.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.outputs_count { + os.write_uint32(1, v)?; + } + if let Some(v) = self.inputs_count { + os.write_uint32(2, v)?; + } + if let Some(v) = self.coin_name.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.version { + os.write_uint32(4, v)?; + } + if let Some(v) = self.lock_time { + os.write_uint32(5, v)?; + } + if let Some(v) = self.expiry { + os.write_uint32(6, v)?; + } + if let Some(v) = self.overwintered { + os.write_bool(7, v)?; + } + if let Some(v) = self.version_group_id { + os.write_uint32(8, v)?; + } + if let Some(v) = self.timestamp { + os.write_uint32(9, v)?; + } + if let Some(v) = self.branch_id { + os.write_uint32(10, v)?; + } + if let Some(v) = self.amount_unit { + os.write_enum(11, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.decred_staking_ticket { + os.write_bool(12, v)?; + } + if let Some(v) = self.serialize { + os.write_bool(13, v)?; + } + if let Some(v) = self.coinjoin_request.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(14, v, os)?; + } + if let Some(v) = self.chunkify { + os.write_bool(15, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SignTx { + SignTx::new() + } + + fn clear(&mut self) { + self.outputs_count = ::std::option::Option::None; + self.inputs_count = ::std::option::Option::None; + self.coin_name = ::std::option::Option::None; + self.version = ::std::option::Option::None; + self.lock_time = ::std::option::Option::None; + self.expiry = ::std::option::Option::None; + self.overwintered = ::std::option::Option::None; + self.version_group_id = ::std::option::Option::None; + self.timestamp = ::std::option::Option::None; + self.branch_id = ::std::option::Option::None; + self.amount_unit = ::std::option::Option::None; + self.decred_staking_ticket = ::std::option::Option::None; + self.serialize = ::std::option::Option::None; + self.coinjoin_request.clear(); + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SignTx { + static instance: SignTx = SignTx { + outputs_count: ::std::option::Option::None, + inputs_count: ::std::option::Option::None, + coin_name: ::std::option::Option::None, + version: ::std::option::Option::None, + lock_time: ::std::option::Option::None, + expiry: ::std::option::Option::None, + overwintered: ::std::option::Option::None, + version_group_id: ::std::option::Option::None, + timestamp: ::std::option::Option::None, + branch_id: ::std::option::Option::None, + amount_unit: ::std::option::Option::None, + decred_staking_ticket: ::std::option::Option::None, + serialize: ::std::option::Option::None, + coinjoin_request: ::protobuf::MessageField::none(), + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `SignTx` +pub mod sign_tx { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct CoinJoinRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.fee_rate) + pub fee_rate: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.no_fee_threshold) + pub no_fee_threshold: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.min_registrable_amount) + pub min_registrable_amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.mask_public_key) + pub mask_public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a CoinJoinRequest { + fn default() -> &'a CoinJoinRequest { + ::default_instance() + } + } + + impl CoinJoinRequest { + pub fn new() -> CoinJoinRequest { + ::std::default::Default::default() + } + + // required uint32 fee_rate = 1; + + pub fn fee_rate(&self) -> u32 { + self.fee_rate.unwrap_or(0) + } + + pub fn clear_fee_rate(&mut self) { + self.fee_rate = ::std::option::Option::None; + } + + pub fn has_fee_rate(&self) -> bool { + self.fee_rate.is_some() + } + + // Param is passed by value, moved + pub fn set_fee_rate(&mut self, v: u32) { + self.fee_rate = ::std::option::Option::Some(v); + } + + // required uint64 no_fee_threshold = 2; + + pub fn no_fee_threshold(&self) -> u64 { + self.no_fee_threshold.unwrap_or(0) + } + + pub fn clear_no_fee_threshold(&mut self) { + self.no_fee_threshold = ::std::option::Option::None; + } + + pub fn has_no_fee_threshold(&self) -> bool { + self.no_fee_threshold.is_some() + } + + // Param is passed by value, moved + pub fn set_no_fee_threshold(&mut self, v: u64) { + self.no_fee_threshold = ::std::option::Option::Some(v); + } + + // required uint64 min_registrable_amount = 3; + + pub fn min_registrable_amount(&self) -> u64 { + self.min_registrable_amount.unwrap_or(0) + } + + pub fn clear_min_registrable_amount(&mut self) { + self.min_registrable_amount = ::std::option::Option::None; + } + + pub fn has_min_registrable_amount(&self) -> bool { + self.min_registrable_amount.is_some() + } + + // Param is passed by value, moved + pub fn set_min_registrable_amount(&mut self, v: u64) { + self.min_registrable_amount = ::std::option::Option::Some(v); + } + + // required bytes mask_public_key = 4; + + pub fn mask_public_key(&self) -> &[u8] { + match self.mask_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mask_public_key(&mut self) { + self.mask_public_key = ::std::option::Option::None; + } + + pub fn has_mask_public_key(&self) -> bool { + self.mask_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_mask_public_key(&mut self, v: ::std::vec::Vec) { + self.mask_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mask_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.mask_public_key.is_none() { + self.mask_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mask_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_mask_public_key(&mut self) -> ::std::vec::Vec { + self.mask_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes signature = 5; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee_rate", + |m: &CoinJoinRequest| { &m.fee_rate }, + |m: &mut CoinJoinRequest| { &mut m.fee_rate }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "no_fee_threshold", + |m: &CoinJoinRequest| { &m.no_fee_threshold }, + |m: &mut CoinJoinRequest| { &mut m.no_fee_threshold }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "min_registrable_amount", + |m: &CoinJoinRequest| { &m.min_registrable_amount }, + |m: &mut CoinJoinRequest| { &mut m.min_registrable_amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mask_public_key", + |m: &CoinJoinRequest| { &m.mask_public_key }, + |m: &mut CoinJoinRequest| { &mut m.mask_public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &CoinJoinRequest| { &m.signature }, + |m: &mut CoinJoinRequest| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SignTx.CoinJoinRequest", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for CoinJoinRequest { + const NAME: &'static str = "CoinJoinRequest"; + + fn is_initialized(&self) -> bool { + if self.fee_rate.is_none() { + return false; + } + if self.no_fee_threshold.is_none() { + return false; + } + if self.min_registrable_amount.is_none() { + return false; + } + if self.mask_public_key.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.fee_rate = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.no_fee_threshold = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.min_registrable_amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 34 => { + self.mask_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.fee_rate { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.no_fee_threshold { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.min_registrable_amount { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.mask_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.fee_rate { + os.write_uint32(1, v)?; + } + if let Some(v) = self.no_fee_threshold { + os.write_uint64(2, v)?; + } + if let Some(v) = self.min_registrable_amount { + os.write_uint64(3, v)?; + } + if let Some(v) = self.mask_public_key.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CoinJoinRequest { + CoinJoinRequest::new() + } + + fn clear(&mut self) { + self.fee_rate = ::std::option::Option::None; + self.no_fee_threshold = ::std::option::Option::None; + self.min_registrable_amount = ::std::option::Option::None; + self.mask_public_key = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CoinJoinRequest { + static instance: CoinJoinRequest = CoinJoinRequest { + fee_rate: ::std::option::Option::None, + no_fee_threshold: ::std::option::Option::None, + min_registrable_amount: ::std::option::Option::None, + mask_public_key: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for CoinJoinRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("SignTx.CoinJoinRequest").unwrap()).clone() + } + } + + impl ::std::fmt::Display for CoinJoinRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for CoinJoinRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.request_type) + pub request_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.details) + pub details: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.serialized) + pub serialized: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxRequest { + fn default() -> &'a TxRequest { + ::default_instance() + } +} + +impl TxRequest { + pub fn new() -> TxRequest { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.bitcoin.TxRequest.RequestType request_type = 1; + + pub fn request_type(&self) -> tx_request::RequestType { + match self.request_type { + Some(e) => e.enum_value_or(tx_request::RequestType::TXINPUT), + None => tx_request::RequestType::TXINPUT, + } + } + + pub fn clear_request_type(&mut self) { + self.request_type = ::std::option::Option::None; + } + + pub fn has_request_type(&self) -> bool { + self.request_type.is_some() + } + + // Param is passed by value, moved + pub fn set_request_type(&mut self, v: tx_request::RequestType) { + self.request_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "request_type", + |m: &TxRequest| { &m.request_type }, + |m: &mut TxRequest| { &mut m.request_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_request::TxRequestDetailsType>( + "details", + |m: &TxRequest| { &m.details }, + |m: &mut TxRequest| { &mut m.details }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_request::TxRequestSerializedType>( + "serialized", + |m: &TxRequest| { &m.serialized }, + |m: &mut TxRequest| { &mut m.serialized }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxRequest { + const NAME: &'static str = "TxRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.request_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.details)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.serialized)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.request_type { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.details.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.serialized.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.request_type { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.details.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.serialized.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxRequest { + TxRequest::new() + } + + fn clear(&mut self) { + self.request_type = ::std::option::Option::None; + self.details.clear(); + self.serialized.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxRequest { + static instance: TxRequest = TxRequest { + request_type: ::std::option::Option::None, + details: ::protobuf::MessageField::none(), + serialized: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxRequest` +pub mod tx_request { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxRequestDetailsType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.request_index) + pub request_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.tx_hash) + pub tx_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.extra_data_len) + pub extra_data_len: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.extra_data_offset) + pub extra_data_offset: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxRequestDetailsType { + fn default() -> &'a TxRequestDetailsType { + ::default_instance() + } + } + + impl TxRequestDetailsType { + pub fn new() -> TxRequestDetailsType { + ::std::default::Default::default() + } + + // optional uint32 request_index = 1; + + pub fn request_index(&self) -> u32 { + self.request_index.unwrap_or(0) + } + + pub fn clear_request_index(&mut self) { + self.request_index = ::std::option::Option::None; + } + + pub fn has_request_index(&self) -> bool { + self.request_index.is_some() + } + + // Param is passed by value, moved + pub fn set_request_index(&mut self, v: u32) { + self.request_index = ::std::option::Option::Some(v); + } + + // optional bytes tx_hash = 2; + + pub fn tx_hash(&self) -> &[u8] { + match self.tx_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_hash(&mut self) { + self.tx_hash = ::std::option::Option::None; + } + + pub fn has_tx_hash(&self) -> bool { + self.tx_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_hash(&mut self, v: ::std::vec::Vec) { + self.tx_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_hash(&mut self) -> &mut ::std::vec::Vec { + if self.tx_hash.is_none() { + self.tx_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_hash.as_mut().unwrap() + } + + // Take field + pub fn take_tx_hash(&mut self) -> ::std::vec::Vec { + self.tx_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 extra_data_len = 3; + + pub fn extra_data_len(&self) -> u32 { + self.extra_data_len.unwrap_or(0) + } + + pub fn clear_extra_data_len(&mut self) { + self.extra_data_len = ::std::option::Option::None; + } + + pub fn has_extra_data_len(&self) -> bool { + self.extra_data_len.is_some() + } + + // Param is passed by value, moved + pub fn set_extra_data_len(&mut self, v: u32) { + self.extra_data_len = ::std::option::Option::Some(v); + } + + // optional uint32 extra_data_offset = 4; + + pub fn extra_data_offset(&self) -> u32 { + self.extra_data_offset.unwrap_or(0) + } + + pub fn clear_extra_data_offset(&mut self) { + self.extra_data_offset = ::std::option::Option::None; + } + + pub fn has_extra_data_offset(&self) -> bool { + self.extra_data_offset.is_some() + } + + // Param is passed by value, moved + pub fn set_extra_data_offset(&mut self, v: u32) { + self.extra_data_offset = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "request_index", + |m: &TxRequestDetailsType| { &m.request_index }, + |m: &mut TxRequestDetailsType| { &mut m.request_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_hash", + |m: &TxRequestDetailsType| { &m.tx_hash }, + |m: &mut TxRequestDetailsType| { &mut m.tx_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "extra_data_len", + |m: &TxRequestDetailsType| { &m.extra_data_len }, + |m: &mut TxRequestDetailsType| { &mut m.extra_data_len }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "extra_data_offset", + |m: &TxRequestDetailsType| { &m.extra_data_offset }, + |m: &mut TxRequestDetailsType| { &mut m.extra_data_offset }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxRequest.TxRequestDetailsType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxRequestDetailsType { + const NAME: &'static str = "TxRequestDetailsType"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.request_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.tx_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.extra_data_len = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.extra_data_offset = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.request_index { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.tx_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.extra_data_len { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.extra_data_offset { + my_size += ::protobuf::rt::uint32_size(4, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.request_index { + os.write_uint32(1, v)?; + } + if let Some(v) = self.tx_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.extra_data_len { + os.write_uint32(3, v)?; + } + if let Some(v) = self.extra_data_offset { + os.write_uint32(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxRequestDetailsType { + TxRequestDetailsType::new() + } + + fn clear(&mut self) { + self.request_index = ::std::option::Option::None; + self.tx_hash = ::std::option::Option::None; + self.extra_data_len = ::std::option::Option::None; + self.extra_data_offset = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxRequestDetailsType { + static instance: TxRequestDetailsType = TxRequestDetailsType { + request_index: ::std::option::Option::None, + tx_hash: ::std::option::Option::None, + extra_data_len: ::std::option::Option::None, + extra_data_offset: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxRequestDetailsType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxRequest.TxRequestDetailsType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxRequestDetailsType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxRequestDetailsType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxRequestSerializedType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.signature_index) + pub signature_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.serialized_tx) + pub serialized_tx: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxRequestSerializedType { + fn default() -> &'a TxRequestSerializedType { + ::default_instance() + } + } + + impl TxRequestSerializedType { + pub fn new() -> TxRequestSerializedType { + ::std::default::Default::default() + } + + // optional uint32 signature_index = 1; + + pub fn signature_index(&self) -> u32 { + self.signature_index.unwrap_or(0) + } + + pub fn clear_signature_index(&mut self) { + self.signature_index = ::std::option::Option::None; + } + + pub fn has_signature_index(&self) -> bool { + self.signature_index.is_some() + } + + // Param is passed by value, moved + pub fn set_signature_index(&mut self, v: u32) { + self.signature_index = ::std::option::Option::Some(v); + } + + // optional bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes serialized_tx = 3; + + pub fn serialized_tx(&self) -> &[u8] { + match self.serialized_tx.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_serialized_tx(&mut self) { + self.serialized_tx = ::std::option::Option::None; + } + + pub fn has_serialized_tx(&self) -> bool { + self.serialized_tx.is_some() + } + + // Param is passed by value, moved + pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { + self.serialized_tx = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { + if self.serialized_tx.is_none() { + self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.serialized_tx.as_mut().unwrap() + } + + // Take field + pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { + self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature_index", + |m: &TxRequestSerializedType| { &m.signature_index }, + |m: &mut TxRequestSerializedType| { &mut m.signature_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &TxRequestSerializedType| { &m.signature }, + |m: &mut TxRequestSerializedType| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "serialized_tx", + |m: &TxRequestSerializedType| { &m.serialized_tx }, + |m: &mut TxRequestSerializedType| { &mut m.serialized_tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxRequest.TxRequestSerializedType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxRequestSerializedType { + const NAME: &'static str = "TxRequestSerializedType"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.signature_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature_index { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.serialized_tx.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature_index { + os.write_uint32(1, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.serialized_tx.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxRequestSerializedType { + TxRequestSerializedType::new() + } + + fn clear(&mut self) { + self.signature_index = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.serialized_tx = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxRequestSerializedType { + static instance: TxRequestSerializedType = TxRequestSerializedType { + signature_index: ::std::option::Option::None, + signature: ::std::option::Option::None, + serialized_tx: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxRequestSerializedType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxRequest.TxRequestSerializedType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxRequestSerializedType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxRequestSerializedType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.TxRequest.RequestType) + pub enum RequestType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXINPUT) + TXINPUT = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXOUTPUT) + TXOUTPUT = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXMETA) + TXMETA = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXFINISHED) + TXFINISHED = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXEXTRADATA) + TXEXTRADATA = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXORIGINPUT) + TXORIGINPUT = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXORIGOUTPUT) + TXORIGOUTPUT = 6, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXPAYMENTREQ) + TXPAYMENTREQ = 7, + } + + impl ::protobuf::Enum for RequestType { + const NAME: &'static str = "RequestType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(RequestType::TXINPUT), + 1 => ::std::option::Option::Some(RequestType::TXOUTPUT), + 2 => ::std::option::Option::Some(RequestType::TXMETA), + 3 => ::std::option::Option::Some(RequestType::TXFINISHED), + 4 => ::std::option::Option::Some(RequestType::TXEXTRADATA), + 5 => ::std::option::Option::Some(RequestType::TXORIGINPUT), + 6 => ::std::option::Option::Some(RequestType::TXORIGOUTPUT), + 7 => ::std::option::Option::Some(RequestType::TXPAYMENTREQ), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "TXINPUT" => ::std::option::Option::Some(RequestType::TXINPUT), + "TXOUTPUT" => ::std::option::Option::Some(RequestType::TXOUTPUT), + "TXMETA" => ::std::option::Option::Some(RequestType::TXMETA), + "TXFINISHED" => ::std::option::Option::Some(RequestType::TXFINISHED), + "TXEXTRADATA" => ::std::option::Option::Some(RequestType::TXEXTRADATA), + "TXORIGINPUT" => ::std::option::Option::Some(RequestType::TXORIGINPUT), + "TXORIGOUTPUT" => ::std::option::Option::Some(RequestType::TXORIGOUTPUT), + "TXPAYMENTREQ" => ::std::option::Option::Some(RequestType::TXPAYMENTREQ), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [RequestType] = &[ + RequestType::TXINPUT, + RequestType::TXOUTPUT, + RequestType::TXMETA, + RequestType::TXFINISHED, + RequestType::TXEXTRADATA, + RequestType::TXORIGINPUT, + RequestType::TXORIGOUTPUT, + RequestType::TXPAYMENTREQ, + ]; + } + + impl ::protobuf::EnumFull for RequestType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("TxRequest.RequestType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for RequestType { + fn default() -> Self { + RequestType::TXINPUT + } + } + + impl RequestType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("TxRequest.RequestType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAck { + fn default() -> &'a TxAck { + ::default_instance() + } +} + +impl TxAck { + pub fn new() -> TxAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack::TransactionType>( + "tx", + |m: &TxAck| { &m.tx }, + |m: &mut TxAck| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAck { + const NAME: &'static str = "TxAck"; + + fn is_initialized(&self) -> bool { + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAck { + TxAck::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAck { + static instance: TxAck = TxAck { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxAck` +pub mod tx_ack { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TransactionType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.version) + pub version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.inputs) + pub inputs: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.bin_outputs) + pub bin_outputs: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.lock_time) + pub lock_time: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.outputs) + pub outputs: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.inputs_cnt) + pub inputs_cnt: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.outputs_cnt) + pub outputs_cnt: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.extra_data) + pub extra_data: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.extra_data_len) + pub extra_data_len: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.expiry) + pub expiry: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.overwintered) + pub overwintered: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.version_group_id) + pub version_group_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.timestamp) + pub timestamp: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.branch_id) + pub branch_id: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TransactionType { + fn default() -> &'a TransactionType { + ::default_instance() + } + } + + impl TransactionType { + pub fn new() -> TransactionType { + ::std::default::Default::default() + } + + // optional uint32 version = 1; + + pub fn version(&self) -> u32 { + self.version.unwrap_or(0) + } + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u32) { + self.version = ::std::option::Option::Some(v); + } + + // optional uint32 lock_time = 4; + + pub fn lock_time(&self) -> u32 { + self.lock_time.unwrap_or(0) + } + + pub fn clear_lock_time(&mut self) { + self.lock_time = ::std::option::Option::None; + } + + pub fn has_lock_time(&self) -> bool { + self.lock_time.is_some() + } + + // Param is passed by value, moved + pub fn set_lock_time(&mut self, v: u32) { + self.lock_time = ::std::option::Option::Some(v); + } + + // optional uint32 inputs_cnt = 6; + + pub fn inputs_cnt(&self) -> u32 { + self.inputs_cnt.unwrap_or(0) + } + + pub fn clear_inputs_cnt(&mut self) { + self.inputs_cnt = ::std::option::Option::None; + } + + pub fn has_inputs_cnt(&self) -> bool { + self.inputs_cnt.is_some() + } + + // Param is passed by value, moved + pub fn set_inputs_cnt(&mut self, v: u32) { + self.inputs_cnt = ::std::option::Option::Some(v); + } + + // optional uint32 outputs_cnt = 7; + + pub fn outputs_cnt(&self) -> u32 { + self.outputs_cnt.unwrap_or(0) + } + + pub fn clear_outputs_cnt(&mut self) { + self.outputs_cnt = ::std::option::Option::None; + } + + pub fn has_outputs_cnt(&self) -> bool { + self.outputs_cnt.is_some() + } + + // Param is passed by value, moved + pub fn set_outputs_cnt(&mut self, v: u32) { + self.outputs_cnt = ::std::option::Option::Some(v); + } + + // optional bytes extra_data = 8; + + pub fn extra_data(&self) -> &[u8] { + match self.extra_data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_extra_data(&mut self) { + self.extra_data = ::std::option::Option::None; + } + + pub fn has_extra_data(&self) -> bool { + self.extra_data.is_some() + } + + // Param is passed by value, moved + pub fn set_extra_data(&mut self, v: ::std::vec::Vec) { + self.extra_data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_extra_data(&mut self) -> &mut ::std::vec::Vec { + if self.extra_data.is_none() { + self.extra_data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.extra_data.as_mut().unwrap() + } + + // Take field + pub fn take_extra_data(&mut self) -> ::std::vec::Vec { + self.extra_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 extra_data_len = 9; + + pub fn extra_data_len(&self) -> u32 { + self.extra_data_len.unwrap_or(0) + } + + pub fn clear_extra_data_len(&mut self) { + self.extra_data_len = ::std::option::Option::None; + } + + pub fn has_extra_data_len(&self) -> bool { + self.extra_data_len.is_some() + } + + // Param is passed by value, moved + pub fn set_extra_data_len(&mut self, v: u32) { + self.extra_data_len = ::std::option::Option::Some(v); + } + + // optional uint32 expiry = 10; + + pub fn expiry(&self) -> u32 { + self.expiry.unwrap_or(0) + } + + pub fn clear_expiry(&mut self) { + self.expiry = ::std::option::Option::None; + } + + pub fn has_expiry(&self) -> bool { + self.expiry.is_some() + } + + // Param is passed by value, moved + pub fn set_expiry(&mut self, v: u32) { + self.expiry = ::std::option::Option::Some(v); + } + + // optional bool overwintered = 11; + + pub fn overwintered(&self) -> bool { + self.overwintered.unwrap_or(false) + } + + pub fn clear_overwintered(&mut self) { + self.overwintered = ::std::option::Option::None; + } + + pub fn has_overwintered(&self) -> bool { + self.overwintered.is_some() + } + + // Param is passed by value, moved + pub fn set_overwintered(&mut self, v: bool) { + self.overwintered = ::std::option::Option::Some(v); + } + + // optional uint32 version_group_id = 12; + + pub fn version_group_id(&self) -> u32 { + self.version_group_id.unwrap_or(0) + } + + pub fn clear_version_group_id(&mut self) { + self.version_group_id = ::std::option::Option::None; + } + + pub fn has_version_group_id(&self) -> bool { + self.version_group_id.is_some() + } + + // Param is passed by value, moved + pub fn set_version_group_id(&mut self, v: u32) { + self.version_group_id = ::std::option::Option::Some(v); + } + + // optional uint32 timestamp = 13; + + pub fn timestamp(&self) -> u32 { + self.timestamp.unwrap_or(0) + } + + pub fn clear_timestamp(&mut self) { + self.timestamp = ::std::option::Option::None; + } + + pub fn has_timestamp(&self) -> bool { + self.timestamp.is_some() + } + + // Param is passed by value, moved + pub fn set_timestamp(&mut self, v: u32) { + self.timestamp = ::std::option::Option::Some(v); + } + + // optional uint32 branch_id = 14; + + pub fn branch_id(&self) -> u32 { + self.branch_id.unwrap_or(0) + } + + pub fn clear_branch_id(&mut self) { + self.branch_id = ::std::option::Option::None; + } + + pub fn has_branch_id(&self) -> bool { + self.branch_id.is_some() + } + + // Param is passed by value, moved + pub fn set_branch_id(&mut self, v: u32) { + self.branch_id = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(14); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version", + |m: &TransactionType| { &m.version }, + |m: &mut TransactionType| { &mut m.version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "inputs", + |m: &TransactionType| { &m.inputs }, + |m: &mut TransactionType| { &mut m.inputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "bin_outputs", + |m: &TransactionType| { &m.bin_outputs }, + |m: &mut TransactionType| { &mut m.bin_outputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "lock_time", + |m: &TransactionType| { &m.lock_time }, + |m: &mut TransactionType| { &mut m.lock_time }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "outputs", + |m: &TransactionType| { &m.outputs }, + |m: &mut TransactionType| { &mut m.outputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inputs_cnt", + |m: &TransactionType| { &m.inputs_cnt }, + |m: &mut TransactionType| { &mut m.inputs_cnt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "outputs_cnt", + |m: &TransactionType| { &m.outputs_cnt }, + |m: &mut TransactionType| { &mut m.outputs_cnt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "extra_data", + |m: &TransactionType| { &m.extra_data }, + |m: &mut TransactionType| { &mut m.extra_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "extra_data_len", + |m: &TransactionType| { &m.extra_data_len }, + |m: &mut TransactionType| { &mut m.extra_data_len }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "expiry", + |m: &TransactionType| { &m.expiry }, + |m: &mut TransactionType| { &mut m.expiry }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "overwintered", + |m: &TransactionType| { &m.overwintered }, + |m: &mut TransactionType| { &mut m.overwintered }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version_group_id", + |m: &TransactionType| { &m.version_group_id }, + |m: &mut TransactionType| { &mut m.version_group_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "timestamp", + |m: &TransactionType| { &m.timestamp }, + |m: &mut TransactionType| { &mut m.timestamp }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "branch_id", + |m: &TransactionType| { &m.branch_id }, + |m: &mut TransactionType| { &mut m.branch_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAck.TransactionType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TransactionType { + const NAME: &'static str = "TransactionType"; + + fn is_initialized(&self) -> bool { + for v in &self.inputs { + if !v.is_initialized() { + return false; + } + }; + for v in &self.bin_outputs { + if !v.is_initialized() { + return false; + } + }; + for v in &self.outputs { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.version = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.inputs.push(is.read_message()?); + }, + 26 => { + self.bin_outputs.push(is.read_message()?); + }, + 32 => { + self.lock_time = ::std::option::Option::Some(is.read_uint32()?); + }, + 42 => { + self.outputs.push(is.read_message()?); + }, + 48 => { + self.inputs_cnt = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.outputs_cnt = ::std::option::Option::Some(is.read_uint32()?); + }, + 66 => { + self.extra_data = ::std::option::Option::Some(is.read_bytes()?); + }, + 72 => { + self.extra_data_len = ::std::option::Option::Some(is.read_uint32()?); + }, + 80 => { + self.expiry = ::std::option::Option::Some(is.read_uint32()?); + }, + 88 => { + self.overwintered = ::std::option::Option::Some(is.read_bool()?); + }, + 96 => { + self.version_group_id = ::std::option::Option::Some(is.read_uint32()?); + }, + 104 => { + self.timestamp = ::std::option::Option::Some(is.read_uint32()?); + }, + 112 => { + self.branch_id = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.version { + my_size += ::protobuf::rt::uint32_size(1, v); + } + for value in &self.inputs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.bin_outputs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.lock_time { + my_size += ::protobuf::rt::uint32_size(4, v); + } + for value in &self.outputs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.inputs_cnt { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.outputs_cnt { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.extra_data.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + if let Some(v) = self.extra_data_len { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.expiry { + my_size += ::protobuf::rt::uint32_size(10, v); + } + if let Some(v) = self.overwintered { + my_size += 1 + 1; + } + if let Some(v) = self.version_group_id { + my_size += ::protobuf::rt::uint32_size(12, v); + } + if let Some(v) = self.timestamp { + my_size += ::protobuf::rt::uint32_size(13, v); + } + if let Some(v) = self.branch_id { + my_size += ::protobuf::rt::uint32_size(14, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.version { + os.write_uint32(1, v)?; + } + for v in &self.inputs { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + }; + for v in &self.bin_outputs { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + }; + if let Some(v) = self.lock_time { + os.write_uint32(4, v)?; + } + for v in &self.outputs { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + }; + if let Some(v) = self.inputs_cnt { + os.write_uint32(6, v)?; + } + if let Some(v) = self.outputs_cnt { + os.write_uint32(7, v)?; + } + if let Some(v) = self.extra_data.as_ref() { + os.write_bytes(8, v)?; + } + if let Some(v) = self.extra_data_len { + os.write_uint32(9, v)?; + } + if let Some(v) = self.expiry { + os.write_uint32(10, v)?; + } + if let Some(v) = self.overwintered { + os.write_bool(11, v)?; + } + if let Some(v) = self.version_group_id { + os.write_uint32(12, v)?; + } + if let Some(v) = self.timestamp { + os.write_uint32(13, v)?; + } + if let Some(v) = self.branch_id { + os.write_uint32(14, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TransactionType { + TransactionType::new() + } + + fn clear(&mut self) { + self.version = ::std::option::Option::None; + self.inputs.clear(); + self.bin_outputs.clear(); + self.lock_time = ::std::option::Option::None; + self.outputs.clear(); + self.inputs_cnt = ::std::option::Option::None; + self.outputs_cnt = ::std::option::Option::None; + self.extra_data = ::std::option::Option::None; + self.extra_data_len = ::std::option::Option::None; + self.expiry = ::std::option::Option::None; + self.overwintered = ::std::option::Option::None; + self.version_group_id = ::std::option::Option::None; + self.timestamp = ::std::option::Option::None; + self.branch_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TransactionType { + static instance: TransactionType = TransactionType { + version: ::std::option::Option::None, + inputs: ::std::vec::Vec::new(), + bin_outputs: ::std::vec::Vec::new(), + lock_time: ::std::option::Option::None, + outputs: ::std::vec::Vec::new(), + inputs_cnt: ::std::option::Option::None, + outputs_cnt: ::std::option::Option::None, + extra_data: ::std::option::Option::None, + extra_data_len: ::std::option::Option::None, + expiry: ::std::option::Option::None, + overwintered: ::std::option::Option::None, + version_group_id: ::std::option::Option::None, + timestamp: ::std::option::Option::None, + branch_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TransactionType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TransactionType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TransactionType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `TransactionType` + pub mod transaction_type { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxInputType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.prev_index) + pub prev_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.script_sig) + pub script_sig: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.decred_tree) + pub decred_tree: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.witness) + pub witness: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.ownership_proof) + pub ownership_proof: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.commitment_data) + pub commitment_data: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.orig_hash) + pub orig_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.orig_index) + pub orig_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.decred_staking_spend) + pub decred_staking_spend: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.script_pubkey) + pub script_pubkey: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.coinjoin_flags) + pub coinjoin_flags: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxInputType { + fn default() -> &'a TxInputType { + ::default_instance() + } + } + + impl TxInputType { + pub fn new() -> TxInputType { + ::std::default::Default::default() + } + + // required bytes prev_hash = 2; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 3; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + // optional bytes script_sig = 4; + + pub fn script_sig(&self) -> &[u8] { + match self.script_sig.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_sig(&mut self) { + self.script_sig = ::std::option::Option::None; + } + + pub fn has_script_sig(&self) -> bool { + self.script_sig.is_some() + } + + // Param is passed by value, moved + pub fn set_script_sig(&mut self, v: ::std::vec::Vec) { + self.script_sig = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_sig(&mut self) -> &mut ::std::vec::Vec { + if self.script_sig.is_none() { + self.script_sig = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_sig.as_mut().unwrap() + } + + // Take field + pub fn take_script_sig(&mut self) -> ::std::vec::Vec { + self.script_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 sequence = 5; + + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(4294967295u32) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 6; + + pub fn script_type(&self) -> super::super::InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(super::super::InputScriptType::SPENDADDRESS), + None => super::super::InputScriptType::SPENDADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: super::super::InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint64 amount = 8; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional uint32 decred_tree = 9; + + pub fn decred_tree(&self) -> u32 { + self.decred_tree.unwrap_or(0) + } + + pub fn clear_decred_tree(&mut self) { + self.decred_tree = ::std::option::Option::None; + } + + pub fn has_decred_tree(&self) -> bool { + self.decred_tree.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_tree(&mut self, v: u32) { + self.decred_tree = ::std::option::Option::Some(v); + } + + // optional bytes witness = 13; + + pub fn witness(&self) -> &[u8] { + match self.witness.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_witness(&mut self) { + self.witness = ::std::option::Option::None; + } + + pub fn has_witness(&self) -> bool { + self.witness.is_some() + } + + // Param is passed by value, moved + pub fn set_witness(&mut self, v: ::std::vec::Vec) { + self.witness = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_witness(&mut self) -> &mut ::std::vec::Vec { + if self.witness.is_none() { + self.witness = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.witness.as_mut().unwrap() + } + + // Take field + pub fn take_witness(&mut self) -> ::std::vec::Vec { + self.witness.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes ownership_proof = 14; + + pub fn ownership_proof(&self) -> &[u8] { + match self.ownership_proof.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ownership_proof(&mut self) { + self.ownership_proof = ::std::option::Option::None; + } + + pub fn has_ownership_proof(&self) -> bool { + self.ownership_proof.is_some() + } + + // Param is passed by value, moved + pub fn set_ownership_proof(&mut self, v: ::std::vec::Vec) { + self.ownership_proof = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ownership_proof(&mut self) -> &mut ::std::vec::Vec { + if self.ownership_proof.is_none() { + self.ownership_proof = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ownership_proof.as_mut().unwrap() + } + + // Take field + pub fn take_ownership_proof(&mut self) -> ::std::vec::Vec { + self.ownership_proof.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes commitment_data = 15; + + pub fn commitment_data(&self) -> &[u8] { + match self.commitment_data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_commitment_data(&mut self) { + self.commitment_data = ::std::option::Option::None; + } + + pub fn has_commitment_data(&self) -> bool { + self.commitment_data.is_some() + } + + // Param is passed by value, moved + pub fn set_commitment_data(&mut self, v: ::std::vec::Vec) { + self.commitment_data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_commitment_data(&mut self) -> &mut ::std::vec::Vec { + if self.commitment_data.is_none() { + self.commitment_data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.commitment_data.as_mut().unwrap() + } + + // Take field + pub fn take_commitment_data(&mut self) -> ::std::vec::Vec { + self.commitment_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes orig_hash = 16; + + pub fn orig_hash(&self) -> &[u8] { + match self.orig_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_orig_hash(&mut self) { + self.orig_hash = ::std::option::Option::None; + } + + pub fn has_orig_hash(&self) -> bool { + self.orig_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { + self.orig_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { + if self.orig_hash.is_none() { + self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.orig_hash.as_mut().unwrap() + } + + // Take field + pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { + self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 orig_index = 17; + + pub fn orig_index(&self) -> u32 { + self.orig_index.unwrap_or(0) + } + + pub fn clear_orig_index(&mut self) { + self.orig_index = ::std::option::Option::None; + } + + pub fn has_orig_index(&self) -> bool { + self.orig_index.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_index(&mut self, v: u32) { + self.orig_index = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.DecredStakingSpendType decred_staking_spend = 18; + + pub fn decred_staking_spend(&self) -> super::super::DecredStakingSpendType { + match self.decred_staking_spend { + Some(e) => e.enum_value_or(super::super::DecredStakingSpendType::SSGen), + None => super::super::DecredStakingSpendType::SSGen, + } + } + + pub fn clear_decred_staking_spend(&mut self) { + self.decred_staking_spend = ::std::option::Option::None; + } + + pub fn has_decred_staking_spend(&self) -> bool { + self.decred_staking_spend.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_staking_spend(&mut self, v: super::super::DecredStakingSpendType) { + self.decred_staking_spend = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes script_pubkey = 19; + + pub fn script_pubkey(&self) -> &[u8] { + match self.script_pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_pubkey(&mut self) { + self.script_pubkey = ::std::option::Option::None; + } + + pub fn has_script_pubkey(&self) -> bool { + self.script_pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { + self.script_pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.script_pubkey.is_none() { + self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { + self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 coinjoin_flags = 20; + + pub fn coinjoin_flags(&self) -> u32 { + self.coinjoin_flags.unwrap_or(0u32) + } + + pub fn clear_coinjoin_flags(&mut self) { + self.coinjoin_flags = ::std::option::Option::None; + } + + pub fn has_coinjoin_flags(&self) -> bool { + self.coinjoin_flags.is_some() + } + + // Param is passed by value, moved + pub fn set_coinjoin_flags(&mut self, v: u32) { + self.coinjoin_flags = ::std::option::Option::Some(v); + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(17); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &TxInputType| { &m.address_n }, + |m: &mut TxInputType| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &TxInputType| { &m.prev_hash }, + |m: &mut TxInputType| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &TxInputType| { &m.prev_index }, + |m: &mut TxInputType| { &mut m.prev_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_sig", + |m: &TxInputType| { &m.script_sig }, + |m: &mut TxInputType| { &mut m.script_sig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &TxInputType| { &m.sequence }, + |m: &mut TxInputType| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &TxInputType| { &m.script_type }, + |m: &mut TxInputType| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::MultisigRedeemScriptType>( + "multisig", + |m: &TxInputType| { &m.multisig }, + |m: &mut TxInputType| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TxInputType| { &m.amount }, + |m: &mut TxInputType| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_tree", + |m: &TxInputType| { &m.decred_tree }, + |m: &mut TxInputType| { &mut m.decred_tree }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "witness", + |m: &TxInputType| { &m.witness }, + |m: &mut TxInputType| { &mut m.witness }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ownership_proof", + |m: &TxInputType| { &m.ownership_proof }, + |m: &mut TxInputType| { &mut m.ownership_proof }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "commitment_data", + |m: &TxInputType| { &m.commitment_data }, + |m: &mut TxInputType| { &mut m.commitment_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_hash", + |m: &TxInputType| { &m.orig_hash }, + |m: &mut TxInputType| { &mut m.orig_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_index", + |m: &TxInputType| { &m.orig_index }, + |m: &mut TxInputType| { &mut m.orig_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_staking_spend", + |m: &TxInputType| { &m.decred_staking_spend }, + |m: &mut TxInputType| { &mut m.decred_staking_spend }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_pubkey", + |m: &TxInputType| { &m.script_pubkey }, + |m: &mut TxInputType| { &mut m.script_pubkey }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coinjoin_flags", + |m: &TxInputType| { &m.coinjoin_flags }, + |m: &mut TxInputType| { &mut m.coinjoin_flags }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAck.TransactionType.TxInputType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxInputType { + const NAME: &'static str = "TxInputType"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.script_sig = ::std::option::Option::Some(is.read_bytes()?); + }, + 40 => { + self.sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 64 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 72 => { + self.decred_tree = ::std::option::Option::Some(is.read_uint32()?); + }, + 106 => { + self.witness = ::std::option::Option::Some(is.read_bytes()?); + }, + 114 => { + self.ownership_proof = ::std::option::Option::Some(is.read_bytes()?); + }, + 122 => { + self.commitment_data = ::std::option::Option::Some(is.read_bytes()?); + }, + 130 => { + self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 136 => { + self.orig_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 144 => { + self.decred_staking_spend = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 154 => { + self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + 160 => { + self.coinjoin_flags = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.script_sig.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(6, v.value()); + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(8, v); + } + if let Some(v) = self.decred_tree { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.witness.as_ref() { + my_size += ::protobuf::rt::bytes_size(13, &v); + } + if let Some(v) = self.ownership_proof.as_ref() { + my_size += ::protobuf::rt::bytes_size(14, &v); + } + if let Some(v) = self.commitment_data.as_ref() { + my_size += ::protobuf::rt::bytes_size(15, &v); + } + if let Some(v) = self.orig_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(16, &v); + } + if let Some(v) = self.orig_index { + my_size += ::protobuf::rt::uint32_size(17, v); + } + if let Some(v) = self.decred_staking_spend { + my_size += ::protobuf::rt::int32_size(18, v.value()); + } + if let Some(v) = self.script_pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(19, &v); + } + if let Some(v) = self.coinjoin_flags { + my_size += ::protobuf::rt::uint32_size(20, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(3, v)?; + } + if let Some(v) = self.script_sig.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.sequence { + os.write_uint32(5, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.amount { + os.write_uint64(8, v)?; + } + if let Some(v) = self.decred_tree { + os.write_uint32(9, v)?; + } + if let Some(v) = self.witness.as_ref() { + os.write_bytes(13, v)?; + } + if let Some(v) = self.ownership_proof.as_ref() { + os.write_bytes(14, v)?; + } + if let Some(v) = self.commitment_data.as_ref() { + os.write_bytes(15, v)?; + } + if let Some(v) = self.orig_hash.as_ref() { + os.write_bytes(16, v)?; + } + if let Some(v) = self.orig_index { + os.write_uint32(17, v)?; + } + if let Some(v) = self.decred_staking_spend { + os.write_enum(18, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.script_pubkey.as_ref() { + os.write_bytes(19, v)?; + } + if let Some(v) = self.coinjoin_flags { + os.write_uint32(20, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxInputType { + TxInputType::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.script_sig = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.multisig.clear(); + self.amount = ::std::option::Option::None; + self.decred_tree = ::std::option::Option::None; + self.witness = ::std::option::Option::None; + self.ownership_proof = ::std::option::Option::None; + self.commitment_data = ::std::option::Option::None; + self.orig_hash = ::std::option::Option::None; + self.orig_index = ::std::option::Option::None; + self.decred_staking_spend = ::std::option::Option::None; + self.script_pubkey = ::std::option::Option::None; + self.coinjoin_flags = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxInputType { + static instance: TxInputType = TxInputType { + address_n: ::std::vec::Vec::new(), + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + script_sig: ::std::option::Option::None, + sequence: ::std::option::Option::None, + script_type: ::std::option::Option::None, + multisig: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + decred_tree: ::std::option::Option::None, + witness: ::std::option::Option::None, + ownership_proof: ::std::option::Option::None, + commitment_data: ::std::option::Option::None, + orig_hash: ::std::option::Option::None, + orig_index: ::std::option::Option::None, + decred_staking_spend: ::std::option::Option::None, + script_pubkey: ::std::option::Option::None, + coinjoin_flags: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxInputType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType.TxInputType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxInputType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxInputType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxOutputBinType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.script_pubkey) + pub script_pubkey: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.decred_script_version) + pub decred_script_version: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxOutputBinType { + fn default() -> &'a TxOutputBinType { + ::default_instance() + } + } + + impl TxOutputBinType { + pub fn new() -> TxOutputBinType { + ::std::default::Default::default() + } + + // required uint64 amount = 1; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // required bytes script_pubkey = 2; + + pub fn script_pubkey(&self) -> &[u8] { + match self.script_pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_pubkey(&mut self) { + self.script_pubkey = ::std::option::Option::None; + } + + pub fn has_script_pubkey(&self) -> bool { + self.script_pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { + self.script_pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.script_pubkey.is_none() { + self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { + self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 decred_script_version = 3; + + pub fn decred_script_version(&self) -> u32 { + self.decred_script_version.unwrap_or(0) + } + + pub fn clear_decred_script_version(&mut self) { + self.decred_script_version = ::std::option::Option::None; + } + + pub fn has_decred_script_version(&self) -> bool { + self.decred_script_version.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_script_version(&mut self, v: u32) { + self.decred_script_version = ::std::option::Option::Some(v); + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TxOutputBinType| { &m.amount }, + |m: &mut TxOutputBinType| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_pubkey", + |m: &TxOutputBinType| { &m.script_pubkey }, + |m: &mut TxOutputBinType| { &mut m.script_pubkey }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_script_version", + |m: &TxOutputBinType| { &m.decred_script_version }, + |m: &mut TxOutputBinType| { &mut m.decred_script_version }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAck.TransactionType.TxOutputBinType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxOutputBinType { + const NAME: &'static str = "TxOutputBinType"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + if self.script_pubkey.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.decred_script_version = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.script_pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.decred_script_version { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount { + os.write_uint64(1, v)?; + } + if let Some(v) = self.script_pubkey.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.decred_script_version { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxOutputBinType { + TxOutputBinType::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.script_pubkey = ::std::option::Option::None; + self.decred_script_version = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxOutputBinType { + static instance: TxOutputBinType = TxOutputBinType { + amount: ::std::option::Option::None, + script_pubkey: ::std::option::Option::None, + decred_script_version: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxOutputBinType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType.TxOutputBinType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxOutputBinType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxOutputBinType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxOutputType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.op_return_data) + pub op_return_data: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.orig_hash) + pub orig_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.orig_index) + pub orig_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.payment_req_index) + pub payment_req_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxOutputType { + fn default() -> &'a TxOutputType { + ::default_instance() + } + } + + impl TxOutputType { + pub fn new() -> TxOutputType { + ::std::default::Default::default() + } + + // optional string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 amount = 3; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.OutputScriptType script_type = 4; + + pub fn script_type(&self) -> super::super::OutputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(super::super::OutputScriptType::PAYTOADDRESS), + None => super::super::OutputScriptType::PAYTOADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: super::super::OutputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes op_return_data = 6; + + pub fn op_return_data(&self) -> &[u8] { + match self.op_return_data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_op_return_data(&mut self) { + self.op_return_data = ::std::option::Option::None; + } + + pub fn has_op_return_data(&self) -> bool { + self.op_return_data.is_some() + } + + // Param is passed by value, moved + pub fn set_op_return_data(&mut self, v: ::std::vec::Vec) { + self.op_return_data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_op_return_data(&mut self) -> &mut ::std::vec::Vec { + if self.op_return_data.is_none() { + self.op_return_data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.op_return_data.as_mut().unwrap() + } + + // Take field + pub fn take_op_return_data(&mut self) -> ::std::vec::Vec { + self.op_return_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes orig_hash = 10; + + pub fn orig_hash(&self) -> &[u8] { + match self.orig_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_orig_hash(&mut self) { + self.orig_hash = ::std::option::Option::None; + } + + pub fn has_orig_hash(&self) -> bool { + self.orig_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { + self.orig_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { + if self.orig_hash.is_none() { + self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.orig_hash.as_mut().unwrap() + } + + // Take field + pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { + self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 orig_index = 11; + + pub fn orig_index(&self) -> u32 { + self.orig_index.unwrap_or(0) + } + + pub fn clear_orig_index(&mut self) { + self.orig_index = ::std::option::Option::None; + } + + pub fn has_orig_index(&self) -> bool { + self.orig_index.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_index(&mut self, v: u32) { + self.orig_index = ::std::option::Option::Some(v); + } + + // optional uint32 payment_req_index = 12; + + pub fn payment_req_index(&self) -> u32 { + self.payment_req_index.unwrap_or(0) + } + + pub fn clear_payment_req_index(&mut self) { + self.payment_req_index = ::std::option::Option::None; + } + + pub fn has_payment_req_index(&self) -> bool { + self.payment_req_index.is_some() + } + + // Param is passed by value, moved + pub fn set_payment_req_index(&mut self, v: u32) { + self.payment_req_index = ::std::option::Option::Some(v); + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &TxOutputType| { &m.address }, + |m: &mut TxOutputType| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &TxOutputType| { &m.address_n }, + |m: &mut TxOutputType| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TxOutputType| { &m.amount }, + |m: &mut TxOutputType| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &TxOutputType| { &m.script_type }, + |m: &mut TxOutputType| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::MultisigRedeemScriptType>( + "multisig", + |m: &TxOutputType| { &m.multisig }, + |m: &mut TxOutputType| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "op_return_data", + |m: &TxOutputType| { &m.op_return_data }, + |m: &mut TxOutputType| { &mut m.op_return_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_hash", + |m: &TxOutputType| { &m.orig_hash }, + |m: &mut TxOutputType| { &mut m.orig_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_index", + |m: &TxOutputType| { &m.orig_index }, + |m: &mut TxOutputType| { &mut m.orig_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payment_req_index", + |m: &TxOutputType| { &m.payment_req_index }, + |m: &mut TxOutputType| { &mut m.payment_req_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAck.TransactionType.TxOutputType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxOutputType { + const NAME: &'static str = "TxOutputType"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 24 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 50 => { + self.op_return_data = ::std::option::Option::Some(is.read_bytes()?); + }, + 82 => { + self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 88 => { + self.orig_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 96 => { + self.payment_req_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(4, v.value()); + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.op_return_data.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.orig_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(10, &v); + } + if let Some(v) = self.orig_index { + my_size += ::protobuf::rt::uint32_size(11, v); + } + if let Some(v) = self.payment_req_index { + my_size += ::protobuf::rt::uint32_size(12, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.amount { + os.write_uint64(3, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.op_return_data.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.orig_hash.as_ref() { + os.write_bytes(10, v)?; + } + if let Some(v) = self.orig_index { + os.write_uint32(11, v)?; + } + if let Some(v) = self.payment_req_index { + os.write_uint32(12, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxOutputType { + TxOutputType::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.address_n.clear(); + self.amount = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.multisig.clear(); + self.op_return_data = ::std::option::Option::None; + self.orig_hash = ::std::option::Option::None; + self.orig_index = ::std::option::Option::None; + self.payment_req_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxOutputType { + static instance: TxOutputType = TxOutputType { + address: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + amount: ::std::option::Option::None, + script_type: ::std::option::Option::None, + multisig: ::protobuf::MessageField::none(), + op_return_data: ::std::option::Option::None, + orig_hash: ::std::option::Option::None, + orig_index: ::std::option::Option::None, + payment_req_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxOutputType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType.TxOutputType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxOutputType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxOutputType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.prev_index) + pub prev_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.script_sig) + pub script_sig: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.decred_tree) + pub decred_tree: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.witness) + pub witness: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.ownership_proof) + pub ownership_proof: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.commitment_data) + pub commitment_data: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.orig_hash) + pub orig_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.orig_index) + pub orig_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.decred_staking_spend) + pub decred_staking_spend: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.script_pubkey) + pub script_pubkey: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.coinjoin_flags) + pub coinjoin_flags: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxInput { + fn default() -> &'a TxInput { + ::default_instance() + } +} + +impl TxInput { + pub fn new() -> TxInput { + ::std::default::Default::default() + } + + // required bytes prev_hash = 2; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 3; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + // optional bytes script_sig = 4; + + pub fn script_sig(&self) -> &[u8] { + match self.script_sig.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_sig(&mut self) { + self.script_sig = ::std::option::Option::None; + } + + pub fn has_script_sig(&self) -> bool { + self.script_sig.is_some() + } + + // Param is passed by value, moved + pub fn set_script_sig(&mut self, v: ::std::vec::Vec) { + self.script_sig = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_sig(&mut self) -> &mut ::std::vec::Vec { + if self.script_sig.is_none() { + self.script_sig = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_sig.as_mut().unwrap() + } + + // Take field + pub fn take_script_sig(&mut self) -> ::std::vec::Vec { + self.script_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 sequence = 5; + + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(4294967295u32) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 6; + + pub fn script_type(&self) -> InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), + None => InputScriptType::SPENDADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required uint64 amount = 8; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional uint32 decred_tree = 9; + + pub fn decred_tree(&self) -> u32 { + self.decred_tree.unwrap_or(0) + } + + pub fn clear_decred_tree(&mut self) { + self.decred_tree = ::std::option::Option::None; + } + + pub fn has_decred_tree(&self) -> bool { + self.decred_tree.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_tree(&mut self, v: u32) { + self.decred_tree = ::std::option::Option::Some(v); + } + + // optional bytes witness = 13; + + pub fn witness(&self) -> &[u8] { + match self.witness.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_witness(&mut self) { + self.witness = ::std::option::Option::None; + } + + pub fn has_witness(&self) -> bool { + self.witness.is_some() + } + + // Param is passed by value, moved + pub fn set_witness(&mut self, v: ::std::vec::Vec) { + self.witness = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_witness(&mut self) -> &mut ::std::vec::Vec { + if self.witness.is_none() { + self.witness = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.witness.as_mut().unwrap() + } + + // Take field + pub fn take_witness(&mut self) -> ::std::vec::Vec { + self.witness.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes ownership_proof = 14; + + pub fn ownership_proof(&self) -> &[u8] { + match self.ownership_proof.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ownership_proof(&mut self) { + self.ownership_proof = ::std::option::Option::None; + } + + pub fn has_ownership_proof(&self) -> bool { + self.ownership_proof.is_some() + } + + // Param is passed by value, moved + pub fn set_ownership_proof(&mut self, v: ::std::vec::Vec) { + self.ownership_proof = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ownership_proof(&mut self) -> &mut ::std::vec::Vec { + if self.ownership_proof.is_none() { + self.ownership_proof = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ownership_proof.as_mut().unwrap() + } + + // Take field + pub fn take_ownership_proof(&mut self) -> ::std::vec::Vec { + self.ownership_proof.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes commitment_data = 15; + + pub fn commitment_data(&self) -> &[u8] { + match self.commitment_data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_commitment_data(&mut self) { + self.commitment_data = ::std::option::Option::None; + } + + pub fn has_commitment_data(&self) -> bool { + self.commitment_data.is_some() + } + + // Param is passed by value, moved + pub fn set_commitment_data(&mut self, v: ::std::vec::Vec) { + self.commitment_data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_commitment_data(&mut self) -> &mut ::std::vec::Vec { + if self.commitment_data.is_none() { + self.commitment_data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.commitment_data.as_mut().unwrap() + } + + // Take field + pub fn take_commitment_data(&mut self) -> ::std::vec::Vec { + self.commitment_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes orig_hash = 16; + + pub fn orig_hash(&self) -> &[u8] { + match self.orig_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_orig_hash(&mut self) { + self.orig_hash = ::std::option::Option::None; + } + + pub fn has_orig_hash(&self) -> bool { + self.orig_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { + self.orig_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { + if self.orig_hash.is_none() { + self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.orig_hash.as_mut().unwrap() + } + + // Take field + pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { + self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 orig_index = 17; + + pub fn orig_index(&self) -> u32 { + self.orig_index.unwrap_or(0) + } + + pub fn clear_orig_index(&mut self) { + self.orig_index = ::std::option::Option::None; + } + + pub fn has_orig_index(&self) -> bool { + self.orig_index.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_index(&mut self, v: u32) { + self.orig_index = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.DecredStakingSpendType decred_staking_spend = 18; + + pub fn decred_staking_spend(&self) -> DecredStakingSpendType { + match self.decred_staking_spend { + Some(e) => e.enum_value_or(DecredStakingSpendType::SSGen), + None => DecredStakingSpendType::SSGen, + } + } + + pub fn clear_decred_staking_spend(&mut self) { + self.decred_staking_spend = ::std::option::Option::None; + } + + pub fn has_decred_staking_spend(&self) -> bool { + self.decred_staking_spend.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_staking_spend(&mut self, v: DecredStakingSpendType) { + self.decred_staking_spend = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes script_pubkey = 19; + + pub fn script_pubkey(&self) -> &[u8] { + match self.script_pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_pubkey(&mut self) { + self.script_pubkey = ::std::option::Option::None; + } + + pub fn has_script_pubkey(&self) -> bool { + self.script_pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { + self.script_pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.script_pubkey.is_none() { + self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { + self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 coinjoin_flags = 20; + + pub fn coinjoin_flags(&self) -> u32 { + self.coinjoin_flags.unwrap_or(0u32) + } + + pub fn clear_coinjoin_flags(&mut self) { + self.coinjoin_flags = ::std::option::Option::None; + } + + pub fn has_coinjoin_flags(&self) -> bool { + self.coinjoin_flags.is_some() + } + + // Param is passed by value, moved + pub fn set_coinjoin_flags(&mut self, v: u32) { + self.coinjoin_flags = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(17); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &TxInput| { &m.address_n }, + |m: &mut TxInput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &TxInput| { &m.prev_hash }, + |m: &mut TxInput| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &TxInput| { &m.prev_index }, + |m: &mut TxInput| { &mut m.prev_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_sig", + |m: &TxInput| { &m.script_sig }, + |m: &mut TxInput| { &mut m.script_sig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &TxInput| { &m.sequence }, + |m: &mut TxInput| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &TxInput| { &m.script_type }, + |m: &mut TxInput| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( + "multisig", + |m: &TxInput| { &m.multisig }, + |m: &mut TxInput| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TxInput| { &m.amount }, + |m: &mut TxInput| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_tree", + |m: &TxInput| { &m.decred_tree }, + |m: &mut TxInput| { &mut m.decred_tree }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "witness", + |m: &TxInput| { &m.witness }, + |m: &mut TxInput| { &mut m.witness }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ownership_proof", + |m: &TxInput| { &m.ownership_proof }, + |m: &mut TxInput| { &mut m.ownership_proof }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "commitment_data", + |m: &TxInput| { &m.commitment_data }, + |m: &mut TxInput| { &mut m.commitment_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_hash", + |m: &TxInput| { &m.orig_hash }, + |m: &mut TxInput| { &mut m.orig_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_index", + |m: &TxInput| { &m.orig_index }, + |m: &mut TxInput| { &mut m.orig_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_staking_spend", + |m: &TxInput| { &m.decred_staking_spend }, + |m: &mut TxInput| { &mut m.decred_staking_spend }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_pubkey", + |m: &TxInput| { &m.script_pubkey }, + |m: &mut TxInput| { &mut m.script_pubkey }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coinjoin_flags", + |m: &TxInput| { &m.coinjoin_flags }, + |m: &mut TxInput| { &mut m.coinjoin_flags }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxInput { + const NAME: &'static str = "TxInput"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.script_sig = ::std::option::Option::Some(is.read_bytes()?); + }, + 40 => { + self.sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 64 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 72 => { + self.decred_tree = ::std::option::Option::Some(is.read_uint32()?); + }, + 106 => { + self.witness = ::std::option::Option::Some(is.read_bytes()?); + }, + 114 => { + self.ownership_proof = ::std::option::Option::Some(is.read_bytes()?); + }, + 122 => { + self.commitment_data = ::std::option::Option::Some(is.read_bytes()?); + }, + 130 => { + self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 136 => { + self.orig_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 144 => { + self.decred_staking_spend = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 154 => { + self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + 160 => { + self.coinjoin_flags = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.script_sig.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(6, v.value()); + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(8, v); + } + if let Some(v) = self.decred_tree { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.witness.as_ref() { + my_size += ::protobuf::rt::bytes_size(13, &v); + } + if let Some(v) = self.ownership_proof.as_ref() { + my_size += ::protobuf::rt::bytes_size(14, &v); + } + if let Some(v) = self.commitment_data.as_ref() { + my_size += ::protobuf::rt::bytes_size(15, &v); + } + if let Some(v) = self.orig_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(16, &v); + } + if let Some(v) = self.orig_index { + my_size += ::protobuf::rt::uint32_size(17, v); + } + if let Some(v) = self.decred_staking_spend { + my_size += ::protobuf::rt::int32_size(18, v.value()); + } + if let Some(v) = self.script_pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(19, &v); + } + if let Some(v) = self.coinjoin_flags { + my_size += ::protobuf::rt::uint32_size(20, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(3, v)?; + } + if let Some(v) = self.script_sig.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.sequence { + os.write_uint32(5, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.amount { + os.write_uint64(8, v)?; + } + if let Some(v) = self.decred_tree { + os.write_uint32(9, v)?; + } + if let Some(v) = self.witness.as_ref() { + os.write_bytes(13, v)?; + } + if let Some(v) = self.ownership_proof.as_ref() { + os.write_bytes(14, v)?; + } + if let Some(v) = self.commitment_data.as_ref() { + os.write_bytes(15, v)?; + } + if let Some(v) = self.orig_hash.as_ref() { + os.write_bytes(16, v)?; + } + if let Some(v) = self.orig_index { + os.write_uint32(17, v)?; + } + if let Some(v) = self.decred_staking_spend { + os.write_enum(18, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.script_pubkey.as_ref() { + os.write_bytes(19, v)?; + } + if let Some(v) = self.coinjoin_flags { + os.write_uint32(20, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxInput { + TxInput::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.script_sig = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.multisig.clear(); + self.amount = ::std::option::Option::None; + self.decred_tree = ::std::option::Option::None; + self.witness = ::std::option::Option::None; + self.ownership_proof = ::std::option::Option::None; + self.commitment_data = ::std::option::Option::None; + self.orig_hash = ::std::option::Option::None; + self.orig_index = ::std::option::Option::None; + self.decred_staking_spend = ::std::option::Option::None; + self.script_pubkey = ::std::option::Option::None; + self.coinjoin_flags = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxInput { + static instance: TxInput = TxInput { + address_n: ::std::vec::Vec::new(), + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + script_sig: ::std::option::Option::None, + sequence: ::std::option::Option::None, + script_type: ::std::option::Option::None, + multisig: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + decred_tree: ::std::option::Option::None, + witness: ::std::option::Option::None, + ownership_proof: ::std::option::Option::None, + commitment_data: ::std::option::Option::None, + orig_hash: ::std::option::Option::None, + orig_index: ::std::option::Option::None, + decred_staking_spend: ::std::option::Option::None, + script_pubkey: ::std::option::Option::None, + coinjoin_flags: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.op_return_data) + pub op_return_data: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.orig_hash) + pub orig_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.orig_index) + pub orig_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.payment_req_index) + pub payment_req_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxOutput { + fn default() -> &'a TxOutput { + ::default_instance() + } +} + +impl TxOutput { + pub fn new() -> TxOutput { + ::std::default::Default::default() + } + + // optional string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 amount = 3; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.bitcoin.OutputScriptType script_type = 4; + + pub fn script_type(&self) -> OutputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(OutputScriptType::PAYTOADDRESS), + None => OutputScriptType::PAYTOADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: OutputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes op_return_data = 6; + + pub fn op_return_data(&self) -> &[u8] { + match self.op_return_data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_op_return_data(&mut self) { + self.op_return_data = ::std::option::Option::None; + } + + pub fn has_op_return_data(&self) -> bool { + self.op_return_data.is_some() + } + + // Param is passed by value, moved + pub fn set_op_return_data(&mut self, v: ::std::vec::Vec) { + self.op_return_data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_op_return_data(&mut self) -> &mut ::std::vec::Vec { + if self.op_return_data.is_none() { + self.op_return_data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.op_return_data.as_mut().unwrap() + } + + // Take field + pub fn take_op_return_data(&mut self) -> ::std::vec::Vec { + self.op_return_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes orig_hash = 10; + + pub fn orig_hash(&self) -> &[u8] { + match self.orig_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_orig_hash(&mut self) { + self.orig_hash = ::std::option::Option::None; + } + + pub fn has_orig_hash(&self) -> bool { + self.orig_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { + self.orig_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { + if self.orig_hash.is_none() { + self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.orig_hash.as_mut().unwrap() + } + + // Take field + pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { + self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 orig_index = 11; + + pub fn orig_index(&self) -> u32 { + self.orig_index.unwrap_or(0) + } + + pub fn clear_orig_index(&mut self) { + self.orig_index = ::std::option::Option::None; + } + + pub fn has_orig_index(&self) -> bool { + self.orig_index.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_index(&mut self, v: u32) { + self.orig_index = ::std::option::Option::Some(v); + } + + // optional uint32 payment_req_index = 12; + + pub fn payment_req_index(&self) -> u32 { + self.payment_req_index.unwrap_or(0) + } + + pub fn clear_payment_req_index(&mut self) { + self.payment_req_index = ::std::option::Option::None; + } + + pub fn has_payment_req_index(&self) -> bool { + self.payment_req_index.is_some() + } + + // Param is passed by value, moved + pub fn set_payment_req_index(&mut self, v: u32) { + self.payment_req_index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &TxOutput| { &m.address }, + |m: &mut TxOutput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &TxOutput| { &m.address_n }, + |m: &mut TxOutput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TxOutput| { &m.amount }, + |m: &mut TxOutput| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &TxOutput| { &m.script_type }, + |m: &mut TxOutput| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( + "multisig", + |m: &TxOutput| { &m.multisig }, + |m: &mut TxOutput| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "op_return_data", + |m: &TxOutput| { &m.op_return_data }, + |m: &mut TxOutput| { &mut m.op_return_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_hash", + |m: &TxOutput| { &m.orig_hash }, + |m: &mut TxOutput| { &mut m.orig_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_index", + |m: &TxOutput| { &m.orig_index }, + |m: &mut TxOutput| { &mut m.orig_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payment_req_index", + |m: &TxOutput| { &m.payment_req_index }, + |m: &mut TxOutput| { &mut m.payment_req_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxOutput { + const NAME: &'static str = "TxOutput"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 24 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 50 => { + self.op_return_data = ::std::option::Option::Some(is.read_bytes()?); + }, + 82 => { + self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 88 => { + self.orig_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 96 => { + self.payment_req_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(4, v.value()); + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.op_return_data.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.orig_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(10, &v); + } + if let Some(v) = self.orig_index { + my_size += ::protobuf::rt::uint32_size(11, v); + } + if let Some(v) = self.payment_req_index { + my_size += ::protobuf::rt::uint32_size(12, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.amount { + os.write_uint64(3, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.op_return_data.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.orig_hash.as_ref() { + os.write_bytes(10, v)?; + } + if let Some(v) = self.orig_index { + os.write_uint32(11, v)?; + } + if let Some(v) = self.payment_req_index { + os.write_uint32(12, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxOutput { + TxOutput::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.address_n.clear(); + self.amount = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.multisig.clear(); + self.op_return_data = ::std::option::Option::None; + self.orig_hash = ::std::option::Option::None; + self.orig_index = ::std::option::Option::None; + self.payment_req_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxOutput { + static instance: TxOutput = TxOutput { + address: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + amount: ::std::option::Option::None, + script_type: ::std::option::Option::None, + multisig: ::protobuf::MessageField::none(), + op_return_data: ::std::option::Option::None, + orig_hash: ::std::option::Option::None, + orig_index: ::std::option::Option::None, + payment_req_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PrevTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PrevTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.version) + pub version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.lock_time) + pub lock_time: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.inputs_count) + pub inputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.outputs_count) + pub outputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.extra_data_len) + pub extra_data_len: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.expiry) + pub expiry: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.version_group_id) + pub version_group_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.timestamp) + pub timestamp: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.branch_id) + pub branch_id: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PrevTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PrevTx { + fn default() -> &'a PrevTx { + ::default_instance() + } +} + +impl PrevTx { + pub fn new() -> PrevTx { + ::std::default::Default::default() + } + + // required uint32 version = 1; + + pub fn version(&self) -> u32 { + self.version.unwrap_or(0) + } + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u32) { + self.version = ::std::option::Option::Some(v); + } + + // required uint32 lock_time = 4; + + pub fn lock_time(&self) -> u32 { + self.lock_time.unwrap_or(0) + } + + pub fn clear_lock_time(&mut self) { + self.lock_time = ::std::option::Option::None; + } + + pub fn has_lock_time(&self) -> bool { + self.lock_time.is_some() + } + + // Param is passed by value, moved + pub fn set_lock_time(&mut self, v: u32) { + self.lock_time = ::std::option::Option::Some(v); + } + + // required uint32 inputs_count = 6; + + pub fn inputs_count(&self) -> u32 { + self.inputs_count.unwrap_or(0) + } + + pub fn clear_inputs_count(&mut self) { + self.inputs_count = ::std::option::Option::None; + } + + pub fn has_inputs_count(&self) -> bool { + self.inputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_inputs_count(&mut self, v: u32) { + self.inputs_count = ::std::option::Option::Some(v); + } + + // required uint32 outputs_count = 7; + + pub fn outputs_count(&self) -> u32 { + self.outputs_count.unwrap_or(0) + } + + pub fn clear_outputs_count(&mut self) { + self.outputs_count = ::std::option::Option::None; + } + + pub fn has_outputs_count(&self) -> bool { + self.outputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_outputs_count(&mut self, v: u32) { + self.outputs_count = ::std::option::Option::Some(v); + } + + // optional uint32 extra_data_len = 9; + + pub fn extra_data_len(&self) -> u32 { + self.extra_data_len.unwrap_or(0u32) + } + + pub fn clear_extra_data_len(&mut self) { + self.extra_data_len = ::std::option::Option::None; + } + + pub fn has_extra_data_len(&self) -> bool { + self.extra_data_len.is_some() + } + + // Param is passed by value, moved + pub fn set_extra_data_len(&mut self, v: u32) { + self.extra_data_len = ::std::option::Option::Some(v); + } + + // optional uint32 expiry = 10; + + pub fn expiry(&self) -> u32 { + self.expiry.unwrap_or(0) + } + + pub fn clear_expiry(&mut self) { + self.expiry = ::std::option::Option::None; + } + + pub fn has_expiry(&self) -> bool { + self.expiry.is_some() + } + + // Param is passed by value, moved + pub fn set_expiry(&mut self, v: u32) { + self.expiry = ::std::option::Option::Some(v); + } + + // optional uint32 version_group_id = 12; + + pub fn version_group_id(&self) -> u32 { + self.version_group_id.unwrap_or(0) + } + + pub fn clear_version_group_id(&mut self) { + self.version_group_id = ::std::option::Option::None; + } + + pub fn has_version_group_id(&self) -> bool { + self.version_group_id.is_some() + } + + // Param is passed by value, moved + pub fn set_version_group_id(&mut self, v: u32) { + self.version_group_id = ::std::option::Option::Some(v); + } + + // optional uint32 timestamp = 13; + + pub fn timestamp(&self) -> u32 { + self.timestamp.unwrap_or(0) + } + + pub fn clear_timestamp(&mut self) { + self.timestamp = ::std::option::Option::None; + } + + pub fn has_timestamp(&self) -> bool { + self.timestamp.is_some() + } + + // Param is passed by value, moved + pub fn set_timestamp(&mut self, v: u32) { + self.timestamp = ::std::option::Option::Some(v); + } + + // optional uint32 branch_id = 14; + + pub fn branch_id(&self) -> u32 { + self.branch_id.unwrap_or(0) + } + + pub fn clear_branch_id(&mut self) { + self.branch_id = ::std::option::Option::None; + } + + pub fn has_branch_id(&self) -> bool { + self.branch_id.is_some() + } + + // Param is passed by value, moved + pub fn set_branch_id(&mut self, v: u32) { + self.branch_id = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version", + |m: &PrevTx| { &m.version }, + |m: &mut PrevTx| { &mut m.version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "lock_time", + |m: &PrevTx| { &m.lock_time }, + |m: &mut PrevTx| { &mut m.lock_time }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inputs_count", + |m: &PrevTx| { &m.inputs_count }, + |m: &mut PrevTx| { &mut m.inputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "outputs_count", + |m: &PrevTx| { &m.outputs_count }, + |m: &mut PrevTx| { &mut m.outputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "extra_data_len", + |m: &PrevTx| { &m.extra_data_len }, + |m: &mut PrevTx| { &mut m.extra_data_len }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "expiry", + |m: &PrevTx| { &m.expiry }, + |m: &mut PrevTx| { &mut m.expiry }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version_group_id", + |m: &PrevTx| { &m.version_group_id }, + |m: &mut PrevTx| { &mut m.version_group_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "timestamp", + |m: &PrevTx| { &m.timestamp }, + |m: &mut PrevTx| { &mut m.timestamp }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "branch_id", + |m: &PrevTx| { &m.branch_id }, + |m: &mut PrevTx| { &mut m.branch_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PrevTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PrevTx { + const NAME: &'static str = "PrevTx"; + + fn is_initialized(&self) -> bool { + if self.version.is_none() { + return false; + } + if self.lock_time.is_none() { + return false; + } + if self.inputs_count.is_none() { + return false; + } + if self.outputs_count.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.version = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.lock_time = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.extra_data_len = ::std::option::Option::Some(is.read_uint32()?); + }, + 80 => { + self.expiry = ::std::option::Option::Some(is.read_uint32()?); + }, + 96 => { + self.version_group_id = ::std::option::Option::Some(is.read_uint32()?); + }, + 104 => { + self.timestamp = ::std::option::Option::Some(is.read_uint32()?); + }, + 112 => { + self.branch_id = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.version { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.lock_time { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.inputs_count { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.outputs_count { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.extra_data_len { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.expiry { + my_size += ::protobuf::rt::uint32_size(10, v); + } + if let Some(v) = self.version_group_id { + my_size += ::protobuf::rt::uint32_size(12, v); + } + if let Some(v) = self.timestamp { + my_size += ::protobuf::rt::uint32_size(13, v); + } + if let Some(v) = self.branch_id { + my_size += ::protobuf::rt::uint32_size(14, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.version { + os.write_uint32(1, v)?; + } + if let Some(v) = self.lock_time { + os.write_uint32(4, v)?; + } + if let Some(v) = self.inputs_count { + os.write_uint32(6, v)?; + } + if let Some(v) = self.outputs_count { + os.write_uint32(7, v)?; + } + if let Some(v) = self.extra_data_len { + os.write_uint32(9, v)?; + } + if let Some(v) = self.expiry { + os.write_uint32(10, v)?; + } + if let Some(v) = self.version_group_id { + os.write_uint32(12, v)?; + } + if let Some(v) = self.timestamp { + os.write_uint32(13, v)?; + } + if let Some(v) = self.branch_id { + os.write_uint32(14, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PrevTx { + PrevTx::new() + } + + fn clear(&mut self) { + self.version = ::std::option::Option::None; + self.lock_time = ::std::option::Option::None; + self.inputs_count = ::std::option::Option::None; + self.outputs_count = ::std::option::Option::None; + self.extra_data_len = ::std::option::Option::None; + self.expiry = ::std::option::Option::None; + self.version_group_id = ::std::option::Option::None; + self.timestamp = ::std::option::Option::None; + self.branch_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PrevTx { + static instance: PrevTx = PrevTx { + version: ::std::option::Option::None, + lock_time: ::std::option::Option::None, + inputs_count: ::std::option::Option::None, + outputs_count: ::std::option::Option::None, + extra_data_len: ::std::option::Option::None, + expiry: ::std::option::Option::None, + version_group_id: ::std::option::Option::None, + timestamp: ::std::option::Option::None, + branch_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PrevTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PrevTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PrevTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PrevTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PrevInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PrevInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.prev_index) + pub prev_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.script_sig) + pub script_sig: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.decred_tree) + pub decred_tree: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PrevInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PrevInput { + fn default() -> &'a PrevInput { + ::default_instance() + } +} + +impl PrevInput { + pub fn new() -> PrevInput { + ::std::default::Default::default() + } + + // required bytes prev_hash = 2; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 3; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + // required bytes script_sig = 4; + + pub fn script_sig(&self) -> &[u8] { + match self.script_sig.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_sig(&mut self) { + self.script_sig = ::std::option::Option::None; + } + + pub fn has_script_sig(&self) -> bool { + self.script_sig.is_some() + } + + // Param is passed by value, moved + pub fn set_script_sig(&mut self, v: ::std::vec::Vec) { + self.script_sig = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_sig(&mut self) -> &mut ::std::vec::Vec { + if self.script_sig.is_none() { + self.script_sig = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_sig.as_mut().unwrap() + } + + // Take field + pub fn take_script_sig(&mut self) -> ::std::vec::Vec { + self.script_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 sequence = 5; + + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(0) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); + } + + // optional uint32 decred_tree = 9; + + pub fn decred_tree(&self) -> u32 { + self.decred_tree.unwrap_or(0) + } + + pub fn clear_decred_tree(&mut self) { + self.decred_tree = ::std::option::Option::None; + } + + pub fn has_decred_tree(&self) -> bool { + self.decred_tree.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_tree(&mut self, v: u32) { + self.decred_tree = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &PrevInput| { &m.prev_hash }, + |m: &mut PrevInput| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &PrevInput| { &m.prev_index }, + |m: &mut PrevInput| { &mut m.prev_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_sig", + |m: &PrevInput| { &m.script_sig }, + |m: &mut PrevInput| { &mut m.script_sig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &PrevInput| { &m.sequence }, + |m: &mut PrevInput| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_tree", + |m: &PrevInput| { &m.decred_tree }, + |m: &mut PrevInput| { &mut m.decred_tree }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PrevInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PrevInput { + const NAME: &'static str = "PrevInput"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + if self.script_sig.is_none() { + return false; + } + if self.sequence.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.script_sig = ::std::option::Option::Some(is.read_bytes()?); + }, + 40 => { + self.sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.decred_tree = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.script_sig.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.decred_tree { + my_size += ::protobuf::rt::uint32_size(9, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(3, v)?; + } + if let Some(v) = self.script_sig.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.sequence { + os.write_uint32(5, v)?; + } + if let Some(v) = self.decred_tree { + os.write_uint32(9, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PrevInput { + PrevInput::new() + } + + fn clear(&mut self) { + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.script_sig = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.decred_tree = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PrevInput { + static instance: PrevInput = PrevInput { + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + script_sig: ::std::option::Option::None, + sequence: ::std::option::Option::None, + decred_tree: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PrevInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PrevInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PrevInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PrevInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PrevOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PrevOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevOutput.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevOutput.script_pubkey) + pub script_pubkey: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevOutput.decred_script_version) + pub decred_script_version: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PrevOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PrevOutput { + fn default() -> &'a PrevOutput { + ::default_instance() + } +} + +impl PrevOutput { + pub fn new() -> PrevOutput { + ::std::default::Default::default() + } + + // required uint64 amount = 1; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // required bytes script_pubkey = 2; + + pub fn script_pubkey(&self) -> &[u8] { + match self.script_pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_pubkey(&mut self) { + self.script_pubkey = ::std::option::Option::None; + } + + pub fn has_script_pubkey(&self) -> bool { + self.script_pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { + self.script_pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.script_pubkey.is_none() { + self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { + self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 decred_script_version = 3; + + pub fn decred_script_version(&self) -> u32 { + self.decred_script_version.unwrap_or(0) + } + + pub fn clear_decred_script_version(&mut self) { + self.decred_script_version = ::std::option::Option::None; + } + + pub fn has_decred_script_version(&self) -> bool { + self.decred_script_version.is_some() + } + + // Param is passed by value, moved + pub fn set_decred_script_version(&mut self, v: u32) { + self.decred_script_version = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &PrevOutput| { &m.amount }, + |m: &mut PrevOutput| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_pubkey", + |m: &PrevOutput| { &m.script_pubkey }, + |m: &mut PrevOutput| { &mut m.script_pubkey }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decred_script_version", + |m: &PrevOutput| { &m.decred_script_version }, + |m: &mut PrevOutput| { &mut m.decred_script_version }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PrevOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PrevOutput { + const NAME: &'static str = "PrevOutput"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + if self.script_pubkey.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.decred_script_version = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.script_pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.decred_script_version { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount { + os.write_uint64(1, v)?; + } + if let Some(v) = self.script_pubkey.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.decred_script_version { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PrevOutput { + PrevOutput::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.script_pubkey = ::std::option::Option::None; + self.decred_script_version = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PrevOutput { + static instance: PrevOutput = PrevOutput { + amount: ::std::option::Option::None, + script_pubkey: ::std::option::Option::None, + decred_script_version: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PrevOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PrevOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PrevOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PrevOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAckPaymentRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.nonce) + pub nonce: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.recipient_name) + pub recipient_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.memos) + pub memos: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAckPaymentRequest { + fn default() -> &'a TxAckPaymentRequest { + ::default_instance() + } +} + +impl TxAckPaymentRequest { + pub fn new() -> TxAckPaymentRequest { + ::std::default::Default::default() + } + + // optional bytes nonce = 1; + + pub fn nonce(&self) -> &[u8] { + match self.nonce.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_nonce(&mut self) { + self.nonce = ::std::option::Option::None; + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: ::std::vec::Vec) { + self.nonce = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { + if self.nonce.is_none() { + self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.nonce.as_mut().unwrap() + } + + // Take field + pub fn take_nonce(&mut self) -> ::std::vec::Vec { + self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string recipient_name = 2; + + pub fn recipient_name(&self) -> &str { + match self.recipient_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_recipient_name(&mut self) { + self.recipient_name = ::std::option::Option::None; + } + + pub fn has_recipient_name(&self) -> bool { + self.recipient_name.is_some() + } + + // Param is passed by value, moved + pub fn set_recipient_name(&mut self, v: ::std::string::String) { + self.recipient_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_recipient_name(&mut self) -> &mut ::std::string::String { + if self.recipient_name.is_none() { + self.recipient_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.recipient_name.as_mut().unwrap() + } + + // Take field + pub fn take_recipient_name(&mut self) -> ::std::string::String { + self.recipient_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint64 amount = 4; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // required bytes signature = 5; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce", + |m: &TxAckPaymentRequest| { &m.nonce }, + |m: &mut TxAckPaymentRequest| { &mut m.nonce }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "recipient_name", + |m: &TxAckPaymentRequest| { &m.recipient_name }, + |m: &mut TxAckPaymentRequest| { &mut m.recipient_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "memos", + |m: &TxAckPaymentRequest| { &m.memos }, + |m: &mut TxAckPaymentRequest| { &mut m.memos }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TxAckPaymentRequest| { &m.amount }, + |m: &mut TxAckPaymentRequest| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &TxAckPaymentRequest| { &m.signature }, + |m: &mut TxAckPaymentRequest| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPaymentRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAckPaymentRequest { + const NAME: &'static str = "TxAckPaymentRequest"; + + fn is_initialized(&self) -> bool { + if self.recipient_name.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + for v in &self.memos { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.nonce = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.recipient_name = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.memos.push(is.read_message()?); + }, + 32 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 42 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.nonce.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.recipient_name.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + for value in &self.memos { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.nonce.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.recipient_name.as_ref() { + os.write_string(2, v)?; + } + for v in &self.memos { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + }; + if let Some(v) = self.amount { + os.write_uint64(4, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPaymentRequest { + TxAckPaymentRequest::new() + } + + fn clear(&mut self) { + self.nonce = ::std::option::Option::None; + self.recipient_name = ::std::option::Option::None; + self.memos.clear(); + self.amount = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPaymentRequest { + static instance: TxAckPaymentRequest = TxAckPaymentRequest { + nonce: ::std::option::Option::None, + recipient_name: ::std::option::Option::None, + memos: ::std::vec::Vec::new(), + amount: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAckPaymentRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPaymentRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAckPaymentRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAckPaymentRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxAckPaymentRequest` +pub mod tx_ack_payment_request { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct PaymentRequestMemo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.text_memo) + pub text_memo: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.refund_memo) + pub refund_memo: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.coin_purchase_memo) + pub coin_purchase_memo: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a PaymentRequestMemo { + fn default() -> &'a PaymentRequestMemo { + ::default_instance() + } + } + + impl PaymentRequestMemo { + pub fn new() -> PaymentRequestMemo { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, TextMemo>( + "text_memo", + |m: &PaymentRequestMemo| { &m.text_memo }, + |m: &mut PaymentRequestMemo| { &mut m.text_memo }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RefundMemo>( + "refund_memo", + |m: &PaymentRequestMemo| { &m.refund_memo }, + |m: &mut PaymentRequestMemo| { &mut m.refund_memo }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CoinPurchaseMemo>( + "coin_purchase_memo", + |m: &PaymentRequestMemo| { &m.coin_purchase_memo }, + |m: &mut PaymentRequestMemo| { &mut m.coin_purchase_memo }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPaymentRequest.PaymentRequestMemo", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for PaymentRequestMemo { + const NAME: &'static str = "PaymentRequestMemo"; + + fn is_initialized(&self) -> bool { + for v in &self.text_memo { + if !v.is_initialized() { + return false; + } + }; + for v in &self.refund_memo { + if !v.is_initialized() { + return false; + } + }; + for v in &self.coin_purchase_memo { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.text_memo)?; + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.refund_memo)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.coin_purchase_memo)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.text_memo.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.refund_memo.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.coin_purchase_memo.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.text_memo.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.refund_memo.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.coin_purchase_memo.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PaymentRequestMemo { + PaymentRequestMemo::new() + } + + fn clear(&mut self) { + self.text_memo.clear(); + self.refund_memo.clear(); + self.coin_purchase_memo.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static PaymentRequestMemo { + static instance: PaymentRequestMemo = PaymentRequestMemo { + text_memo: ::protobuf::MessageField::none(), + refund_memo: ::protobuf::MessageField::none(), + coin_purchase_memo: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for PaymentRequestMemo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.PaymentRequestMemo").unwrap()).clone() + } + } + + impl ::std::fmt::Display for PaymentRequestMemo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for PaymentRequestMemo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.TextMemo) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TextMemo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.TextMemo.text) + pub text: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.TextMemo.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TextMemo { + fn default() -> &'a TextMemo { + ::default_instance() + } + } + + impl TextMemo { + pub fn new() -> TextMemo { + ::std::default::Default::default() + } + + // required string text = 1; + + pub fn text(&self) -> &str { + match self.text.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_text(&mut self) { + self.text = ::std::option::Option::None; + } + + pub fn has_text(&self) -> bool { + self.text.is_some() + } + + // Param is passed by value, moved + pub fn set_text(&mut self, v: ::std::string::String) { + self.text = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_text(&mut self) -> &mut ::std::string::String { + if self.text.is_none() { + self.text = ::std::option::Option::Some(::std::string::String::new()); + } + self.text.as_mut().unwrap() + } + + // Take field + pub fn take_text(&mut self) -> ::std::string::String { + self.text.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "text", + |m: &TextMemo| { &m.text }, + |m: &mut TextMemo| { &mut m.text }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPaymentRequest.TextMemo", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TextMemo { + const NAME: &'static str = "TextMemo"; + + fn is_initialized(&self) -> bool { + if self.text.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.text = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.text.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.text.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TextMemo { + TextMemo::new() + } + + fn clear(&mut self) { + self.text = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TextMemo { + static instance: TextMemo = TextMemo { + text: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TextMemo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.TextMemo").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TextMemo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TextMemo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct RefundMemo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo.mac) + pub mac: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a RefundMemo { + fn default() -> &'a RefundMemo { + ::default_instance() + } + } + + impl RefundMemo { + pub fn new() -> RefundMemo { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes mac = 2; + + pub fn mac(&self) -> &[u8] { + match self.mac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mac(&mut self) { + self.mac = ::std::option::Option::None; + } + + pub fn has_mac(&self) -> bool { + self.mac.is_some() + } + + // Param is passed by value, moved + pub fn set_mac(&mut self, v: ::std::vec::Vec) { + self.mac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { + if self.mac.is_none() { + self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mac.as_mut().unwrap() + } + + // Take field + pub fn take_mac(&mut self) -> ::std::vec::Vec { + self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &RefundMemo| { &m.address }, + |m: &mut RefundMemo| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mac", + |m: &RefundMemo| { &m.mac }, + |m: &mut RefundMemo| { &mut m.mac }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPaymentRequest.RefundMemo", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for RefundMemo { + const NAME: &'static str = "RefundMemo"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + if self.mac.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.mac = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.mac.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.mac.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RefundMemo { + RefundMemo::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.mac = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RefundMemo { + static instance: RefundMemo = RefundMemo { + address: ::std::option::Option::None, + mac: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for RefundMemo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.RefundMemo").unwrap()).clone() + } + } + + impl ::std::fmt::Display for RefundMemo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for RefundMemo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct CoinPurchaseMemo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.coin_type) + pub coin_type: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.amount) + pub amount: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.mac) + pub mac: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a CoinPurchaseMemo { + fn default() -> &'a CoinPurchaseMemo { + ::default_instance() + } + } + + impl CoinPurchaseMemo { + pub fn new() -> CoinPurchaseMemo { + ::std::default::Default::default() + } + + // required uint32 coin_type = 1; + + pub fn coin_type(&self) -> u32 { + self.coin_type.unwrap_or(0) + } + + pub fn clear_coin_type(&mut self) { + self.coin_type = ::std::option::Option::None; + } + + pub fn has_coin_type(&self) -> bool { + self.coin_type.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_type(&mut self, v: u32) { + self.coin_type = ::std::option::Option::Some(v); + } + + // required string amount = 2; + + pub fn amount(&self) -> &str { + match self.amount.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: ::std::string::String) { + self.amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_amount(&mut self) -> &mut ::std::string::String { + if self.amount.is_none() { + self.amount = ::std::option::Option::Some(::std::string::String::new()); + } + self.amount.as_mut().unwrap() + } + + // Take field + pub fn take_amount(&mut self) -> ::std::string::String { + self.amount.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string address = 3; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes mac = 4; + + pub fn mac(&self) -> &[u8] { + match self.mac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mac(&mut self) { + self.mac = ::std::option::Option::None; + } + + pub fn has_mac(&self) -> bool { + self.mac.is_some() + } + + // Param is passed by value, moved + pub fn set_mac(&mut self, v: ::std::vec::Vec) { + self.mac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { + if self.mac.is_none() { + self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mac.as_mut().unwrap() + } + + // Take field + pub fn take_mac(&mut self) -> ::std::vec::Vec { + self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_type", + |m: &CoinPurchaseMemo| { &m.coin_type }, + |m: &mut CoinPurchaseMemo| { &mut m.coin_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &CoinPurchaseMemo| { &m.amount }, + |m: &mut CoinPurchaseMemo| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &CoinPurchaseMemo| { &m.address }, + |m: &mut CoinPurchaseMemo| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mac", + |m: &CoinPurchaseMemo| { &m.mac }, + |m: &mut CoinPurchaseMemo| { &mut m.mac }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPaymentRequest.CoinPurchaseMemo", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for CoinPurchaseMemo { + const NAME: &'static str = "CoinPurchaseMemo"; + + fn is_initialized(&self) -> bool { + if self.coin_type.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + if self.address.is_none() { + return false; + } + if self.mac.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.coin_type = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.amount = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.mac = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.coin_type { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.amount.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.mac.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.coin_type { + os.write_uint32(1, v)?; + } + if let Some(v) = self.amount.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.address.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.mac.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CoinPurchaseMemo { + CoinPurchaseMemo::new() + } + + fn clear(&mut self) { + self.coin_type = ::std::option::Option::None; + self.amount = ::std::option::Option::None; + self.address = ::std::option::Option::None; + self.mac = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CoinPurchaseMemo { + static instance: CoinPurchaseMemo = CoinPurchaseMemo { + coin_type: ::std::option::Option::None, + amount: ::std::option::Option::None, + address: ::std::option::Option::None, + mac: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for CoinPurchaseMemo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.CoinPurchaseMemo").unwrap()).clone() + } + } + + impl ::std::fmt::Display for CoinPurchaseMemo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for CoinPurchaseMemo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAckInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckInput.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAckInput { + fn default() -> &'a TxAckInput { + ::default_instance() + } +} + +impl TxAckInput { + pub fn new() -> TxAckInput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_input::TxAckInputWrapper>( + "tx", + |m: &TxAckInput| { &m.tx }, + |m: &mut TxAckInput| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAckInput { + const NAME: &'static str = "TxAckInput"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckInput { + TxAckInput::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckInput { + static instance: TxAckInput = TxAckInput { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAckInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAckInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAckInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxAckInput` +pub mod tx_ack_input { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckInput.TxAckInputWrapper) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxAckInputWrapper { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckInput.TxAckInputWrapper.input) + pub input: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckInput.TxAckInputWrapper.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxAckInputWrapper { + fn default() -> &'a TxAckInputWrapper { + ::default_instance() + } + } + + impl TxAckInputWrapper { + pub fn new() -> TxAckInputWrapper { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::TxInput>( + "input", + |m: &TxAckInputWrapper| { &m.input }, + |m: &mut TxAckInputWrapper| { &mut m.input }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckInput.TxAckInputWrapper", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxAckInputWrapper { + const NAME: &'static str = "TxAckInputWrapper"; + + fn is_initialized(&self) -> bool { + if self.input.is_none() { + return false; + } + for v in &self.input { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.input)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.input.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.input.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckInputWrapper { + TxAckInputWrapper::new() + } + + fn clear(&mut self) { + self.input.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckInputWrapper { + static instance: TxAckInputWrapper = TxAckInputWrapper { + input: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxAckInputWrapper { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckInput.TxAckInputWrapper").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxAckInputWrapper { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxAckInputWrapper { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAckOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckOutput.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAckOutput { + fn default() -> &'a TxAckOutput { + ::default_instance() + } +} + +impl TxAckOutput { + pub fn new() -> TxAckOutput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_output::TxAckOutputWrapper>( + "tx", + |m: &TxAckOutput| { &m.tx }, + |m: &mut TxAckOutput| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAckOutput { + const NAME: &'static str = "TxAckOutput"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckOutput { + TxAckOutput::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckOutput { + static instance: TxAckOutput = TxAckOutput { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAckOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAckOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAckOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxAckOutput` +pub mod tx_ack_output { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckOutput.TxAckOutputWrapper) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxAckOutputWrapper { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckOutput.TxAckOutputWrapper.output) + pub output: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckOutput.TxAckOutputWrapper.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxAckOutputWrapper { + fn default() -> &'a TxAckOutputWrapper { + ::default_instance() + } + } + + impl TxAckOutputWrapper { + pub fn new() -> TxAckOutputWrapper { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::TxOutput>( + "output", + |m: &TxAckOutputWrapper| { &m.output }, + |m: &mut TxAckOutputWrapper| { &mut m.output }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckOutput.TxAckOutputWrapper", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxAckOutputWrapper { + const NAME: &'static str = "TxAckOutputWrapper"; + + fn is_initialized(&self) -> bool { + if self.output.is_none() { + return false; + } + for v in &self.output { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.output)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.output.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.output.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckOutputWrapper { + TxAckOutputWrapper::new() + } + + fn clear(&mut self) { + self.output.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckOutputWrapper { + static instance: TxAckOutputWrapper = TxAckOutputWrapper { + output: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxAckOutputWrapper { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckOutput.TxAckOutputWrapper").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxAckOutputWrapper { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxAckOutputWrapper { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevMeta) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAckPrevMeta { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevMeta.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevMeta.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAckPrevMeta { + fn default() -> &'a TxAckPrevMeta { + ::default_instance() + } +} + +impl TxAckPrevMeta { + pub fn new() -> TxAckPrevMeta { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, PrevTx>( + "tx", + |m: &TxAckPrevMeta| { &m.tx }, + |m: &mut TxAckPrevMeta| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPrevMeta", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAckPrevMeta { + const NAME: &'static str = "TxAckPrevMeta"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPrevMeta { + TxAckPrevMeta::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPrevMeta { + static instance: TxAckPrevMeta = TxAckPrevMeta { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAckPrevMeta { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevMeta").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAckPrevMeta { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAckPrevMeta { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAckPrevInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevInput.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAckPrevInput { + fn default() -> &'a TxAckPrevInput { + ::default_instance() + } +} + +impl TxAckPrevInput { + pub fn new() -> TxAckPrevInput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_prev_input::TxAckPrevInputWrapper>( + "tx", + |m: &TxAckPrevInput| { &m.tx }, + |m: &mut TxAckPrevInput| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPrevInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAckPrevInput { + const NAME: &'static str = "TxAckPrevInput"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPrevInput { + TxAckPrevInput::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPrevInput { + static instance: TxAckPrevInput = TxAckPrevInput { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAckPrevInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAckPrevInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAckPrevInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxAckPrevInput` +pub mod tx_ack_prev_input { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapper) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxAckPrevInputWrapper { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapper.input) + pub input: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapper.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxAckPrevInputWrapper { + fn default() -> &'a TxAckPrevInputWrapper { + ::default_instance() + } + } + + impl TxAckPrevInputWrapper { + pub fn new() -> TxAckPrevInputWrapper { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::PrevInput>( + "input", + |m: &TxAckPrevInputWrapper| { &m.input }, + |m: &mut TxAckPrevInputWrapper| { &mut m.input }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPrevInput.TxAckPrevInputWrapper", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxAckPrevInputWrapper { + const NAME: &'static str = "TxAckPrevInputWrapper"; + + fn is_initialized(&self) -> bool { + if self.input.is_none() { + return false; + } + for v in &self.input { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.input)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.input.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.input.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPrevInputWrapper { + TxAckPrevInputWrapper::new() + } + + fn clear(&mut self) { + self.input.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPrevInputWrapper { + static instance: TxAckPrevInputWrapper = TxAckPrevInputWrapper { + input: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxAckPrevInputWrapper { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPrevInput.TxAckPrevInputWrapper").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxAckPrevInputWrapper { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxAckPrevInputWrapper { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAckPrevOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevOutput.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAckPrevOutput { + fn default() -> &'a TxAckPrevOutput { + ::default_instance() + } +} + +impl TxAckPrevOutput { + pub fn new() -> TxAckPrevOutput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_prev_output::TxAckPrevOutputWrapper>( + "tx", + |m: &TxAckPrevOutput| { &m.tx }, + |m: &mut TxAckPrevOutput| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPrevOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAckPrevOutput { + const NAME: &'static str = "TxAckPrevOutput"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPrevOutput { + TxAckPrevOutput::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPrevOutput { + static instance: TxAckPrevOutput = TxAckPrevOutput { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAckPrevOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAckPrevOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAckPrevOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxAckPrevOutput` +pub mod tx_ack_prev_output { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevOutput.TxAckPrevOutputWrapper) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxAckPrevOutputWrapper { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevOutput.TxAckPrevOutputWrapper.output) + pub output: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevOutput.TxAckPrevOutputWrapper.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxAckPrevOutputWrapper { + fn default() -> &'a TxAckPrevOutputWrapper { + ::default_instance() + } + } + + impl TxAckPrevOutputWrapper { + pub fn new() -> TxAckPrevOutputWrapper { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::PrevOutput>( + "output", + |m: &TxAckPrevOutputWrapper| { &m.output }, + |m: &mut TxAckPrevOutputWrapper| { &mut m.output }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPrevOutput.TxAckPrevOutputWrapper", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxAckPrevOutputWrapper { + const NAME: &'static str = "TxAckPrevOutputWrapper"; + + fn is_initialized(&self) -> bool { + if self.output.is_none() { + return false; + } + for v in &self.output { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.output)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.output.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.output.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPrevOutputWrapper { + TxAckPrevOutputWrapper::new() + } + + fn clear(&mut self) { + self.output.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPrevOutputWrapper { + static instance: TxAckPrevOutputWrapper = TxAckPrevOutputWrapper { + output: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxAckPrevOutputWrapper { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPrevOutput.TxAckPrevOutputWrapper").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxAckPrevOutputWrapper { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxAckPrevOutputWrapper { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevExtraData) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TxAckPrevExtraData { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TxAckPrevExtraData { + fn default() -> &'a TxAckPrevExtraData { + ::default_instance() + } +} + +impl TxAckPrevExtraData { + pub fn new() -> TxAckPrevExtraData { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_prev_extra_data::TxAckPrevExtraDataWrapper>( + "tx", + |m: &TxAckPrevExtraData| { &m.tx }, + |m: &mut TxAckPrevExtraData| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPrevExtraData", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TxAckPrevExtraData { + const NAME: &'static str = "TxAckPrevExtraData"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPrevExtraData { + TxAckPrevExtraData::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPrevExtraData { + static instance: TxAckPrevExtraData = TxAckPrevExtraData { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TxAckPrevExtraData { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevExtraData").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TxAckPrevExtraData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TxAckPrevExtraData { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TxAckPrevExtraData` +pub mod tx_ack_prev_extra_data { + // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevExtraData.TxAckPrevExtraDataWrapper) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TxAckPrevExtraDataWrapper { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.TxAckPrevExtraDataWrapper.extra_data_chunk) + pub extra_data_chunk: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.TxAckPrevExtraDataWrapper.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TxAckPrevExtraDataWrapper { + fn default() -> &'a TxAckPrevExtraDataWrapper { + ::default_instance() + } + } + + impl TxAckPrevExtraDataWrapper { + pub fn new() -> TxAckPrevExtraDataWrapper { + ::std::default::Default::default() + } + + // required bytes extra_data_chunk = 8; + + pub fn extra_data_chunk(&self) -> &[u8] { + match self.extra_data_chunk.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_extra_data_chunk(&mut self) { + self.extra_data_chunk = ::std::option::Option::None; + } + + pub fn has_extra_data_chunk(&self) -> bool { + self.extra_data_chunk.is_some() + } + + // Param is passed by value, moved + pub fn set_extra_data_chunk(&mut self, v: ::std::vec::Vec) { + self.extra_data_chunk = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_extra_data_chunk(&mut self) -> &mut ::std::vec::Vec { + if self.extra_data_chunk.is_none() { + self.extra_data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.extra_data_chunk.as_mut().unwrap() + } + + // Take field + pub fn take_extra_data_chunk(&mut self) -> ::std::vec::Vec { + self.extra_data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "extra_data_chunk", + |m: &TxAckPrevExtraDataWrapper| { &m.extra_data_chunk }, + |m: &mut TxAckPrevExtraDataWrapper| { &mut m.extra_data_chunk }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TxAckPrevExtraData.TxAckPrevExtraDataWrapper", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TxAckPrevExtraDataWrapper { + const NAME: &'static str = "TxAckPrevExtraDataWrapper"; + + fn is_initialized(&self) -> bool { + if self.extra_data_chunk.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 66 => { + self.extra_data_chunk = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.extra_data_chunk.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.extra_data_chunk.as_ref() { + os.write_bytes(8, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TxAckPrevExtraDataWrapper { + TxAckPrevExtraDataWrapper::new() + } + + fn clear(&mut self) { + self.extra_data_chunk = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TxAckPrevExtraDataWrapper { + static instance: TxAckPrevExtraDataWrapper = TxAckPrevExtraDataWrapper { + extra_data_chunk: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TxAckPrevExtraDataWrapper { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPrevExtraData.TxAckPrevExtraDataWrapper").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TxAckPrevExtraDataWrapper { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TxAckPrevExtraDataWrapper { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetOwnershipProof) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetOwnershipProof { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.user_confirmation) + pub user_confirmation: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.ownership_ids) + pub ownership_ids: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.commitment_data) + pub commitment_data: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetOwnershipProof.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetOwnershipProof { + fn default() -> &'a GetOwnershipProof { + ::default_instance() + } +} + +impl GetOwnershipProof { + pub fn new() -> GetOwnershipProof { + ::std::default::Default::default() + } + + // optional string coin_name = 2; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 3; + + pub fn script_type(&self) -> InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(InputScriptType::SPENDWITNESS), + None => InputScriptType::SPENDWITNESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool user_confirmation = 5; + + pub fn user_confirmation(&self) -> bool { + self.user_confirmation.unwrap_or(false) + } + + pub fn clear_user_confirmation(&mut self) { + self.user_confirmation = ::std::option::Option::None; + } + + pub fn has_user_confirmation(&self) -> bool { + self.user_confirmation.is_some() + } + + // Param is passed by value, moved + pub fn set_user_confirmation(&mut self, v: bool) { + self.user_confirmation = ::std::option::Option::Some(v); + } + + // optional bytes commitment_data = 7; + + pub fn commitment_data(&self) -> &[u8] { + match self.commitment_data.as_ref() { + Some(v) => v, + None => b"", + } + } + + pub fn clear_commitment_data(&mut self) { + self.commitment_data = ::std::option::Option::None; + } + + pub fn has_commitment_data(&self) -> bool { + self.commitment_data.is_some() + } + + // Param is passed by value, moved + pub fn set_commitment_data(&mut self, v: ::std::vec::Vec) { + self.commitment_data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_commitment_data(&mut self) -> &mut ::std::vec::Vec { + if self.commitment_data.is_none() { + self.commitment_data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.commitment_data.as_mut().unwrap() + } + + // Take field + pub fn take_commitment_data(&mut self) -> ::std::vec::Vec { + self.commitment_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &GetOwnershipProof| { &m.address_n }, + |m: &mut GetOwnershipProof| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &GetOwnershipProof| { &m.coin_name }, + |m: &mut GetOwnershipProof| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &GetOwnershipProof| { &m.script_type }, + |m: &mut GetOwnershipProof| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( + "multisig", + |m: &GetOwnershipProof| { &m.multisig }, + |m: &mut GetOwnershipProof| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "user_confirmation", + |m: &GetOwnershipProof| { &m.user_confirmation }, + |m: &mut GetOwnershipProof| { &mut m.user_confirmation }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "ownership_ids", + |m: &GetOwnershipProof| { &m.ownership_ids }, + |m: &mut GetOwnershipProof| { &mut m.ownership_ids }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "commitment_data", + |m: &GetOwnershipProof| { &m.commitment_data }, + |m: &mut GetOwnershipProof| { &mut m.commitment_data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetOwnershipProof", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetOwnershipProof { + const NAME: &'static str = "GetOwnershipProof"; + + fn is_initialized(&self) -> bool { + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 40 => { + self.user_confirmation = ::std::option::Option::Some(is.read_bool()?); + }, + 50 => { + self.ownership_ids.push(is.read_bytes()?); + }, + 58 => { + self.commitment_data = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(3, v.value()); + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.user_confirmation { + my_size += 1 + 1; + } + for value in &self.ownership_ids { + my_size += ::protobuf::rt::bytes_size(6, &value); + }; + if let Some(v) = self.commitment_data.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.coin_name.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.user_confirmation { + os.write_bool(5, v)?; + } + for v in &self.ownership_ids { + os.write_bytes(6, &v)?; + }; + if let Some(v) = self.commitment_data.as_ref() { + os.write_bytes(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetOwnershipProof { + GetOwnershipProof::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.coin_name = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.multisig.clear(); + self.user_confirmation = ::std::option::Option::None; + self.ownership_ids.clear(); + self.commitment_data = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetOwnershipProof { + static instance: GetOwnershipProof = GetOwnershipProof { + address_n: ::std::vec::Vec::new(), + coin_name: ::std::option::Option::None, + script_type: ::std::option::Option::None, + multisig: ::protobuf::MessageField::none(), + user_confirmation: ::std::option::Option::None, + ownership_ids: ::std::vec::Vec::new(), + commitment_data: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetOwnershipProof { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetOwnershipProof").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetOwnershipProof { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetOwnershipProof { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.OwnershipProof) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct OwnershipProof { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.OwnershipProof.ownership_proof) + pub ownership_proof: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.OwnershipProof.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.OwnershipProof.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a OwnershipProof { + fn default() -> &'a OwnershipProof { + ::default_instance() + } +} + +impl OwnershipProof { + pub fn new() -> OwnershipProof { + ::std::default::Default::default() + } + + // required bytes ownership_proof = 1; + + pub fn ownership_proof(&self) -> &[u8] { + match self.ownership_proof.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ownership_proof(&mut self) { + self.ownership_proof = ::std::option::Option::None; + } + + pub fn has_ownership_proof(&self) -> bool { + self.ownership_proof.is_some() + } + + // Param is passed by value, moved + pub fn set_ownership_proof(&mut self, v: ::std::vec::Vec) { + self.ownership_proof = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ownership_proof(&mut self) -> &mut ::std::vec::Vec { + if self.ownership_proof.is_none() { + self.ownership_proof = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ownership_proof.as_mut().unwrap() + } + + // Take field + pub fn take_ownership_proof(&mut self) -> ::std::vec::Vec { + self.ownership_proof.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ownership_proof", + |m: &OwnershipProof| { &m.ownership_proof }, + |m: &mut OwnershipProof| { &mut m.ownership_proof }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &OwnershipProof| { &m.signature }, + |m: &mut OwnershipProof| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "OwnershipProof", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for OwnershipProof { + const NAME: &'static str = "OwnershipProof"; + + fn is_initialized(&self) -> bool { + if self.ownership_proof.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.ownership_proof = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.ownership_proof.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.ownership_proof.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> OwnershipProof { + OwnershipProof::new() + } + + fn clear(&mut self) { + self.ownership_proof = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static OwnershipProof { + static instance: OwnershipProof = OwnershipProof { + ownership_proof: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for OwnershipProof { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("OwnershipProof").unwrap()).clone() + } +} + +impl ::std::fmt::Display for OwnershipProof { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OwnershipProof { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.AuthorizeCoinJoin) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct AuthorizeCoinJoin { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.coordinator) + pub coordinator: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.max_rounds) + pub max_rounds: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.max_coordinator_fee_rate) + pub max_coordinator_fee_rate: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.max_fee_per_kvbyte) + pub max_fee_per_kvbyte: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.coin_name) + pub coin_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.script_type) + pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.amount_unit) + pub amount_unit: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a AuthorizeCoinJoin { + fn default() -> &'a AuthorizeCoinJoin { + ::default_instance() + } +} + +impl AuthorizeCoinJoin { + pub fn new() -> AuthorizeCoinJoin { + ::std::default::Default::default() + } + + // required string coordinator = 1; + + pub fn coordinator(&self) -> &str { + match self.coordinator.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_coordinator(&mut self) { + self.coordinator = ::std::option::Option::None; + } + + pub fn has_coordinator(&self) -> bool { + self.coordinator.is_some() + } + + // Param is passed by value, moved + pub fn set_coordinator(&mut self, v: ::std::string::String) { + self.coordinator = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coordinator(&mut self) -> &mut ::std::string::String { + if self.coordinator.is_none() { + self.coordinator = ::std::option::Option::Some(::std::string::String::new()); + } + self.coordinator.as_mut().unwrap() + } + + // Take field + pub fn take_coordinator(&mut self) -> ::std::string::String { + self.coordinator.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 max_rounds = 2; + + pub fn max_rounds(&self) -> u64 { + self.max_rounds.unwrap_or(0) + } + + pub fn clear_max_rounds(&mut self) { + self.max_rounds = ::std::option::Option::None; + } + + pub fn has_max_rounds(&self) -> bool { + self.max_rounds.is_some() + } + + // Param is passed by value, moved + pub fn set_max_rounds(&mut self, v: u64) { + self.max_rounds = ::std::option::Option::Some(v); + } + + // required uint32 max_coordinator_fee_rate = 3; + + pub fn max_coordinator_fee_rate(&self) -> u32 { + self.max_coordinator_fee_rate.unwrap_or(0) + } + + pub fn clear_max_coordinator_fee_rate(&mut self) { + self.max_coordinator_fee_rate = ::std::option::Option::None; + } + + pub fn has_max_coordinator_fee_rate(&self) -> bool { + self.max_coordinator_fee_rate.is_some() + } + + // Param is passed by value, moved + pub fn set_max_coordinator_fee_rate(&mut self, v: u32) { + self.max_coordinator_fee_rate = ::std::option::Option::Some(v); + } + + // required uint32 max_fee_per_kvbyte = 4; + + pub fn max_fee_per_kvbyte(&self) -> u32 { + self.max_fee_per_kvbyte.unwrap_or(0) + } + + pub fn clear_max_fee_per_kvbyte(&mut self) { + self.max_fee_per_kvbyte = ::std::option::Option::None; + } + + pub fn has_max_fee_per_kvbyte(&self) -> bool { + self.max_fee_per_kvbyte.is_some() + } + + // Param is passed by value, moved + pub fn set_max_fee_per_kvbyte(&mut self, v: u32) { + self.max_fee_per_kvbyte = ::std::option::Option::Some(v); + } + + // optional string coin_name = 6; + + pub fn coin_name(&self) -> &str { + match self.coin_name.as_ref() { + Some(v) => v, + None => "Bitcoin", + } + } + + pub fn clear_coin_name(&mut self) { + self.coin_name = ::std::option::Option::None; + } + + pub fn has_coin_name(&self) -> bool { + self.coin_name.is_some() + } + + // Param is passed by value, moved + pub fn set_coin_name(&mut self, v: ::std::string::String) { + self.coin_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { + if self.coin_name.is_none() { + self.coin_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.coin_name.as_mut().unwrap() + } + + // Take field + pub fn take_coin_name(&mut self) -> ::std::string::String { + self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 7; + + pub fn script_type(&self) -> InputScriptType { + match self.script_type { + Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), + None => InputScriptType::SPENDADDRESS, + } + } + + pub fn clear_script_type(&mut self) { + self.script_type = ::std::option::Option::None; + } + + pub fn has_script_type(&self) -> bool { + self.script_type.is_some() + } + + // Param is passed by value, moved + pub fn set_script_type(&mut self, v: InputScriptType) { + self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional .hw.trezor.messages.bitcoin.AmountUnit amount_unit = 8; + + pub fn amount_unit(&self) -> AmountUnit { + match self.amount_unit { + Some(e) => e.enum_value_or(AmountUnit::BITCOIN), + None => AmountUnit::BITCOIN, + } + } + + pub fn clear_amount_unit(&mut self) { + self.amount_unit = ::std::option::Option::None; + } + + pub fn has_amount_unit(&self) -> bool { + self.amount_unit.is_some() + } + + // Param is passed by value, moved + pub fn set_amount_unit(&mut self, v: AmountUnit) { + self.amount_unit = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coordinator", + |m: &AuthorizeCoinJoin| { &m.coordinator }, + |m: &mut AuthorizeCoinJoin| { &mut m.coordinator }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "max_rounds", + |m: &AuthorizeCoinJoin| { &m.max_rounds }, + |m: &mut AuthorizeCoinJoin| { &mut m.max_rounds }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "max_coordinator_fee_rate", + |m: &AuthorizeCoinJoin| { &m.max_coordinator_fee_rate }, + |m: &mut AuthorizeCoinJoin| { &mut m.max_coordinator_fee_rate }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "max_fee_per_kvbyte", + |m: &AuthorizeCoinJoin| { &m.max_fee_per_kvbyte }, + |m: &mut AuthorizeCoinJoin| { &mut m.max_fee_per_kvbyte }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &AuthorizeCoinJoin| { &m.address_n }, + |m: &mut AuthorizeCoinJoin| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "coin_name", + |m: &AuthorizeCoinJoin| { &m.coin_name }, + |m: &mut AuthorizeCoinJoin| { &mut m.coin_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_type", + |m: &AuthorizeCoinJoin| { &m.script_type }, + |m: &mut AuthorizeCoinJoin| { &mut m.script_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount_unit", + |m: &AuthorizeCoinJoin| { &m.amount_unit }, + |m: &mut AuthorizeCoinJoin| { &mut m.amount_unit }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "AuthorizeCoinJoin", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for AuthorizeCoinJoin { + const NAME: &'static str = "AuthorizeCoinJoin"; + + fn is_initialized(&self) -> bool { + if self.coordinator.is_none() { + return false; + } + if self.max_rounds.is_none() { + return false; + } + if self.max_coordinator_fee_rate.is_none() { + return false; + } + if self.max_fee_per_kvbyte.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.coordinator = ::std::option::Option::Some(is.read_string()?); + }, + 16 => { + self.max_rounds = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.max_coordinator_fee_rate = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.max_fee_per_kvbyte = ::std::option::Option::Some(is.read_uint32()?); + }, + 42 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 40 => { + self.address_n.push(is.read_uint32()?); + }, + 50 => { + self.coin_name = ::std::option::Option::Some(is.read_string()?); + }, + 56 => { + self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 64 => { + self.amount_unit = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.coordinator.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.max_rounds { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.max_coordinator_fee_rate { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.max_fee_per_kvbyte { + my_size += ::protobuf::rt::uint32_size(4, v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(5, *value); + }; + if let Some(v) = self.coin_name.as_ref() { + my_size += ::protobuf::rt::string_size(6, &v); + } + if let Some(v) = self.script_type { + my_size += ::protobuf::rt::int32_size(7, v.value()); + } + if let Some(v) = self.amount_unit { + my_size += ::protobuf::rt::int32_size(8, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.coordinator.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.max_rounds { + os.write_uint64(2, v)?; + } + if let Some(v) = self.max_coordinator_fee_rate { + os.write_uint32(3, v)?; + } + if let Some(v) = self.max_fee_per_kvbyte { + os.write_uint32(4, v)?; + } + for v in &self.address_n { + os.write_uint32(5, *v)?; + }; + if let Some(v) = self.coin_name.as_ref() { + os.write_string(6, v)?; + } + if let Some(v) = self.script_type { + os.write_enum(7, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.amount_unit { + os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> AuthorizeCoinJoin { + AuthorizeCoinJoin::new() + } + + fn clear(&mut self) { + self.coordinator = ::std::option::Option::None; + self.max_rounds = ::std::option::Option::None; + self.max_coordinator_fee_rate = ::std::option::Option::None; + self.max_fee_per_kvbyte = ::std::option::Option::None; + self.address_n.clear(); + self.coin_name = ::std::option::Option::None; + self.script_type = ::std::option::Option::None; + self.amount_unit = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static AuthorizeCoinJoin { + static instance: AuthorizeCoinJoin = AuthorizeCoinJoin { + coordinator: ::std::option::Option::None, + max_rounds: ::std::option::Option::None, + max_coordinator_fee_rate: ::std::option::Option::None, + max_fee_per_kvbyte: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + coin_name: ::std::option::Option::None, + script_type: ::std::option::Option::None, + amount_unit: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for AuthorizeCoinJoin { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("AuthorizeCoinJoin").unwrap()).clone() + } +} + +impl ::std::fmt::Display for AuthorizeCoinJoin { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AuthorizeCoinJoin { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.InputScriptType) +pub enum InputScriptType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDADDRESS) + SPENDADDRESS = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDMULTISIG) + SPENDMULTISIG = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.EXTERNAL) + EXTERNAL = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDWITNESS) + SPENDWITNESS = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDP2SHWITNESS) + SPENDP2SHWITNESS = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDTAPROOT) + SPENDTAPROOT = 5, +} + +impl ::protobuf::Enum for InputScriptType { + const NAME: &'static str = "InputScriptType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(InputScriptType::SPENDADDRESS), + 1 => ::std::option::Option::Some(InputScriptType::SPENDMULTISIG), + 2 => ::std::option::Option::Some(InputScriptType::EXTERNAL), + 3 => ::std::option::Option::Some(InputScriptType::SPENDWITNESS), + 4 => ::std::option::Option::Some(InputScriptType::SPENDP2SHWITNESS), + 5 => ::std::option::Option::Some(InputScriptType::SPENDTAPROOT), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SPENDADDRESS" => ::std::option::Option::Some(InputScriptType::SPENDADDRESS), + "SPENDMULTISIG" => ::std::option::Option::Some(InputScriptType::SPENDMULTISIG), + "EXTERNAL" => ::std::option::Option::Some(InputScriptType::EXTERNAL), + "SPENDWITNESS" => ::std::option::Option::Some(InputScriptType::SPENDWITNESS), + "SPENDP2SHWITNESS" => ::std::option::Option::Some(InputScriptType::SPENDP2SHWITNESS), + "SPENDTAPROOT" => ::std::option::Option::Some(InputScriptType::SPENDTAPROOT), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [InputScriptType] = &[ + InputScriptType::SPENDADDRESS, + InputScriptType::SPENDMULTISIG, + InputScriptType::EXTERNAL, + InputScriptType::SPENDWITNESS, + InputScriptType::SPENDP2SHWITNESS, + InputScriptType::SPENDTAPROOT, + ]; +} + +impl ::protobuf::EnumFull for InputScriptType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("InputScriptType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for InputScriptType { + fn default() -> Self { + InputScriptType::SPENDADDRESS + } +} + +impl InputScriptType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("InputScriptType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.OutputScriptType) +pub enum OutputScriptType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOADDRESS) + PAYTOADDRESS = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOSCRIPTHASH) + PAYTOSCRIPTHASH = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOMULTISIG) + PAYTOMULTISIG = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOOPRETURN) + PAYTOOPRETURN = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOWITNESS) + PAYTOWITNESS = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOP2SHWITNESS) + PAYTOP2SHWITNESS = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOTAPROOT) + PAYTOTAPROOT = 6, +} + +impl ::protobuf::Enum for OutputScriptType { + const NAME: &'static str = "OutputScriptType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(OutputScriptType::PAYTOADDRESS), + 1 => ::std::option::Option::Some(OutputScriptType::PAYTOSCRIPTHASH), + 2 => ::std::option::Option::Some(OutputScriptType::PAYTOMULTISIG), + 3 => ::std::option::Option::Some(OutputScriptType::PAYTOOPRETURN), + 4 => ::std::option::Option::Some(OutputScriptType::PAYTOWITNESS), + 5 => ::std::option::Option::Some(OutputScriptType::PAYTOP2SHWITNESS), + 6 => ::std::option::Option::Some(OutputScriptType::PAYTOTAPROOT), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "PAYTOADDRESS" => ::std::option::Option::Some(OutputScriptType::PAYTOADDRESS), + "PAYTOSCRIPTHASH" => ::std::option::Option::Some(OutputScriptType::PAYTOSCRIPTHASH), + "PAYTOMULTISIG" => ::std::option::Option::Some(OutputScriptType::PAYTOMULTISIG), + "PAYTOOPRETURN" => ::std::option::Option::Some(OutputScriptType::PAYTOOPRETURN), + "PAYTOWITNESS" => ::std::option::Option::Some(OutputScriptType::PAYTOWITNESS), + "PAYTOP2SHWITNESS" => ::std::option::Option::Some(OutputScriptType::PAYTOP2SHWITNESS), + "PAYTOTAPROOT" => ::std::option::Option::Some(OutputScriptType::PAYTOTAPROOT), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [OutputScriptType] = &[ + OutputScriptType::PAYTOADDRESS, + OutputScriptType::PAYTOSCRIPTHASH, + OutputScriptType::PAYTOMULTISIG, + OutputScriptType::PAYTOOPRETURN, + OutputScriptType::PAYTOWITNESS, + OutputScriptType::PAYTOP2SHWITNESS, + OutputScriptType::PAYTOTAPROOT, + ]; +} + +impl ::protobuf::EnumFull for OutputScriptType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("OutputScriptType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for OutputScriptType { + fn default() -> Self { + OutputScriptType::PAYTOADDRESS + } +} + +impl OutputScriptType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("OutputScriptType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.DecredStakingSpendType) +pub enum DecredStakingSpendType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.DecredStakingSpendType.SSGen) + SSGen = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.DecredStakingSpendType.SSRTX) + SSRTX = 1, +} + +impl ::protobuf::Enum for DecredStakingSpendType { + const NAME: &'static str = "DecredStakingSpendType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DecredStakingSpendType::SSGen), + 1 => ::std::option::Option::Some(DecredStakingSpendType::SSRTX), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SSGen" => ::std::option::Option::Some(DecredStakingSpendType::SSGen), + "SSRTX" => ::std::option::Option::Some(DecredStakingSpendType::SSRTX), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [DecredStakingSpendType] = &[ + DecredStakingSpendType::SSGen, + DecredStakingSpendType::SSRTX, + ]; +} + +impl ::protobuf::EnumFull for DecredStakingSpendType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("DecredStakingSpendType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for DecredStakingSpendType { + fn default() -> Self { + DecredStakingSpendType::SSGen + } +} + +impl DecredStakingSpendType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DecredStakingSpendType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.AmountUnit) +pub enum AmountUnit { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.BITCOIN) + BITCOIN = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.MILLIBITCOIN) + MILLIBITCOIN = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.MICROBITCOIN) + MICROBITCOIN = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.SATOSHI) + SATOSHI = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.ML) + ML = 4, +} + +impl ::protobuf::Enum for AmountUnit { + const NAME: &'static str = "AmountUnit"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(AmountUnit::BITCOIN), + 1 => ::std::option::Option::Some(AmountUnit::MILLIBITCOIN), + 2 => ::std::option::Option::Some(AmountUnit::MICROBITCOIN), + 3 => ::std::option::Option::Some(AmountUnit::SATOSHI), + 4 => ::std::option::Option::Some(AmountUnit::ML), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "BITCOIN" => ::std::option::Option::Some(AmountUnit::BITCOIN), + "MILLIBITCOIN" => ::std::option::Option::Some(AmountUnit::MILLIBITCOIN), + "MICROBITCOIN" => ::std::option::Option::Some(AmountUnit::MICROBITCOIN), + "SATOSHI" => ::std::option::Option::Some(AmountUnit::SATOSHI), + "ML" => ::std::option::Option::Some(AmountUnit::ML), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [AmountUnit] = &[ + AmountUnit::BITCOIN, + AmountUnit::MILLIBITCOIN, + AmountUnit::MICROBITCOIN, + AmountUnit::SATOSHI, + AmountUnit::ML, + ]; +} + +impl ::protobuf::EnumFull for AmountUnit { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("AmountUnit").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for AmountUnit { + fn default() -> Self { + AmountUnit::BITCOIN + } +} + +impl AmountUnit { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("AmountUnit") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x16messages-bitcoin.proto\x12\x1ahw.trezor.messages.bitcoin\x1a\x0eme\ + ssages.proto\x1a\x15messages-common.proto\"\xeb\x02\n\x18MultisigRedeemS\ + criptType\x12]\n\x07pubkeys\x18\x01\x20\x03(\x0b2C.hw.trezor.messages.bi\ + tcoin.MultisigRedeemScriptType.HDNodePathTypeR\x07pubkeys\x12\x1e\n\nsig\ + natures\x18\x02\x20\x03(\x0cR\nsignatures\x12\x0c\n\x01m\x18\x03\x20\x02\ + (\rR\x01m\x12;\n\x05nodes\x18\x04\x20\x03(\x0b2%.hw.trezor.messages.comm\ + on.HDNodeTypeR\x05nodes\x12\x1b\n\taddress_n\x18\x05\x20\x03(\rR\x08addr\ + essN\x1ah\n\x0eHDNodePathType\x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.t\ + rezor.messages.common.HDNodeTypeR\x04node\x12\x1b\n\taddress_n\x18\x02\ + \x20\x03(\rR\x08addressN\"\xa6\x02\n\x0cGetPublicKey\x12\x1b\n\taddress_\ + n\x18\x01\x20\x03(\rR\x08addressN\x12(\n\x10ecdsa_curve_name\x18\x02\x20\ + \x01(\tR\x0eecdsaCurveName\x12!\n\x0cshow_display\x18\x03\x20\x01(\x08R\ + \x0bshowDisplay\x12$\n\tcoin_name\x18\x04\x20\x01(\t:\x07BitcoinR\x08coi\ + nName\x12Z\n\x0bscript_type\x18\x05\x20\x01(\x0e2+.hw.trezor.messages.bi\ + tcoin.InputScriptType:\x0cSPENDADDRESSR\nscriptType\x12*\n\x11ignore_xpu\ + b_magic\x18\x06\x20\x01(\x08R\x0fignoreXpubMagic\"\xa5\x01\n\tPublicKey\ + \x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trezor.messages.common.HDNodeT\ + ypeR\x04node\x12\x12\n\x04xpub\x18\x02\x20\x02(\tR\x04xpub\x12)\n\x10roo\ + t_fingerprint\x18\x03\x20\x01(\rR\x0frootFingerprint\x12\x1e\n\ndescript\ + or\x18\x04\x20\x01(\tR\ndescriptor\"\xe8\x02\n\nGetAddress\x12\x1b\n\tad\ + dress_n\x18\x01\x20\x03(\rR\x08addressN\x12$\n\tcoin_name\x18\x02\x20\ + \x01(\t:\x07BitcoinR\x08coinName\x12!\n\x0cshow_display\x18\x03\x20\x01(\ + \x08R\x0bshowDisplay\x12P\n\x08multisig\x18\x04\x20\x01(\x0b24.hw.trezor\ + .messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12Z\n\x0bscript\ + _type\x18\x05\x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputScriptType:\ + \x0cSPENDADDRESSR\nscriptType\x12*\n\x11ignore_xpub_magic\x18\x06\x20\ + \x01(\x08R\x0fignoreXpubMagic\x12\x1a\n\x08chunkify\x18\x07\x20\x01(\x08\ + R\x08chunkify\"5\n\x07Address\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ + \x07address\x12\x10\n\x03mac\x18\x02\x20\x01(\x0cR\x03mac\"\x81\x02\n\ + \x0eGetOwnershipId\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ + \x12$\n\tcoin_name\x18\x02\x20\x01(\t:\x07BitcoinR\x08coinName\x12P\n\ + \x08multisig\x18\x03\x20\x01(\x0b24.hw.trezor.messages.bitcoin.MultisigR\ + edeemScriptTypeR\x08multisig\x12Z\n\x0bscript_type\x18\x04\x20\x01(\x0e2\ + +.hw.trezor.messages.bitcoin.InputScriptType:\x0cSPENDADDRESSR\nscriptTy\ + pe\"0\n\x0bOwnershipId\x12!\n\x0cownership_id\x18\x01\x20\x02(\x0cR\x0bo\ + wnershipId\"\x88\x02\n\x0bSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\ + \x03(\rR\x08addressN\x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07messa\ + ge\x12$\n\tcoin_name\x18\x03\x20\x01(\t:\x07BitcoinR\x08coinName\x12Z\n\ + \x0bscript_type\x18\x04\x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputS\ + criptType:\x0cSPENDADDRESSR\nscriptType\x12$\n\x0eno_script_type\x18\x05\ + \x20\x01(\x08R\x0cnoScriptType\x12\x1a\n\x08chunkify\x18\x06\x20\x01(\ + \x08R\x08chunkify\"J\n\x10MessageSignature\x12\x18\n\x07address\x18\x01\ + \x20\x02(\tR\x07address\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsign\ + ature\"\xa3\x01\n\rVerifyMessage\x12\x18\n\x07address\x18\x01\x20\x02(\t\ + R\x07address\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\ + \x18\n\x07message\x18\x03\x20\x02(\x0cR\x07message\x12$\n\tcoin_name\x18\ + \x04\x20\x01(\t:\x07BitcoinR\x08coinName\x12\x1a\n\x08chunkify\x18\x05\ + \x20\x01(\x08R\x08chunkify\"\xd9\x06\n\x06SignTx\x12#\n\routputs_count\ + \x18\x01\x20\x02(\rR\x0coutputsCount\x12!\n\x0cinputs_count\x18\x02\x20\ + \x02(\rR\x0binputsCount\x12$\n\tcoin_name\x18\x03\x20\x01(\t:\x07Bitcoin\ + R\x08coinName\x12\x1b\n\x07version\x18\x04\x20\x01(\r:\x011R\x07version\ + \x12\x1e\n\tlock_time\x18\x05\x20\x01(\r:\x010R\x08lockTime\x12\x16\n\ + \x06expiry\x18\x06\x20\x01(\rR\x06expiry\x12&\n\x0coverwintered\x18\x07\ + \x20\x01(\x08R\x0coverwinteredB\x02\x18\x01\x12(\n\x10version_group_id\ + \x18\x08\x20\x01(\rR\x0eversionGroupId\x12\x1c\n\ttimestamp\x18\t\x20\ + \x01(\rR\ttimestamp\x12\x1b\n\tbranch_id\x18\n\x20\x01(\rR\x08branchId\ + \x12P\n\x0bamount_unit\x18\x0b\x20\x01(\x0e2&.hw.trezor.messages.bitcoin\ + .AmountUnit:\x07BITCOINR\namountUnit\x129\n\x15decred_staking_ticket\x18\ + \x0c\x20\x01(\x08:\x05falseR\x13decredStakingTicket\x12\"\n\tserialize\ + \x18\r\x20\x01(\x08:\x04trueR\tserialize\x12]\n\x10coinjoin_request\x18\ + \x0e\x20\x01(\x0b22.hw.trezor.messages.bitcoin.SignTx.CoinJoinRequestR\ + \x0fcoinjoinRequest\x12\x1a\n\x08chunkify\x18\x0f\x20\x01(\x08R\x08chunk\ + ify\x1a\xd2\x01\n\x0fCoinJoinRequest\x12\x19\n\x08fee_rate\x18\x01\x20\ + \x02(\rR\x07feeRate\x12(\n\x10no_fee_threshold\x18\x02\x20\x02(\x04R\x0e\ + noFeeThreshold\x124\n\x16min_registrable_amount\x18\x03\x20\x02(\x04R\ + \x14minRegistrableAmount\x12&\n\x0fmask_public_key\x18\x04\x20\x02(\x0cR\ + \rmaskPublicKey\x12\x1c\n\tsignature\x18\x05\x20\x02(\x0cR\tsignature\"\ + \xd4\x05\n\tTxRequest\x12T\n\x0crequest_type\x18\x01\x20\x01(\x0e21.hw.t\ + rezor.messages.bitcoin.TxRequest.RequestTypeR\x0brequestType\x12T\n\x07d\ + etails\x18\x02\x20\x01(\x0b2:.hw.trezor.messages.bitcoin.TxRequest.TxReq\ + uestDetailsTypeR\x07details\x12]\n\nserialized\x18\x03\x20\x01(\x0b2=.hw\ + .trezor.messages.bitcoin.TxRequest.TxRequestSerializedTypeR\nserialized\ + \x1a\xa6\x01\n\x14TxRequestDetailsType\x12#\n\rrequest_index\x18\x01\x20\ + \x01(\rR\x0crequestIndex\x12\x17\n\x07tx_hash\x18\x02\x20\x01(\x0cR\x06t\ + xHash\x12$\n\x0eextra_data_len\x18\x03\x20\x01(\rR\x0cextraDataLen\x12*\ + \n\x11extra_data_offset\x18\x04\x20\x01(\rR\x0fextraDataOffset\x1a\x85\ + \x01\n\x17TxRequestSerializedType\x12'\n\x0fsignature_index\x18\x01\x20\ + \x01(\rR\x0esignatureIndex\x12\x1c\n\tsignature\x18\x02\x20\x01(\x0cR\ts\ + ignature\x12#\n\rserialized_tx\x18\x03\x20\x01(\x0cR\x0cserializedTx\"\ + \x8a\x01\n\x0bRequestType\x12\x0b\n\x07TXINPUT\x10\0\x12\x0c\n\x08TXOUTP\ + UT\x10\x01\x12\n\n\x06TXMETA\x10\x02\x12\x0e\n\nTXFINISHED\x10\x03\x12\ + \x0f\n\x0bTXEXTRADATA\x10\x04\x12\x0f\n\x0bTXORIGINPUT\x10\x05\x12\x10\n\ + \x0cTXORIGOUTPUT\x10\x06\x12\x10\n\x0cTXPAYMENTREQ\x10\x07\"\xf4\x0f\n\ + \x05TxAck\x12A\n\x02tx\x18\x01\x20\x01(\x0b21.hw.trezor.messages.bitcoin\ + .TxAck.TransactionTypeR\x02tx\x1a\xa3\x0f\n\x0fTransactionType\x12\x18\n\ + \x07version\x18\x01\x20\x01(\rR\x07version\x12U\n\x06inputs\x18\x02\x20\ + \x03(\x0b2=.hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType\ + R\x06inputs\x12b\n\x0bbin_outputs\x18\x03\x20\x03(\x0b2A.hw.trezor.messa\ + ges.bitcoin.TxAck.TransactionType.TxOutputBinTypeR\nbinOutputs\x12\x1b\n\ + \tlock_time\x18\x04\x20\x01(\rR\x08lockTime\x12X\n\x07outputs\x18\x05\ + \x20\x03(\x0b2>.hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutpu\ + tTypeR\x07outputs\x12\x1d\n\ninputs_cnt\x18\x06\x20\x01(\rR\tinputsCnt\ + \x12\x1f\n\x0boutputs_cnt\x18\x07\x20\x01(\rR\noutputsCnt\x12\x1d\n\next\ + ra_data\x18\x08\x20\x01(\x0cR\textraData\x12$\n\x0eextra_data_len\x18\t\ + \x20\x01(\rR\x0cextraDataLen\x12\x16\n\x06expiry\x18\n\x20\x01(\rR\x06ex\ + piry\x12&\n\x0coverwintered\x18\x0b\x20\x01(\x08R\x0coverwinteredB\x02\ + \x18\x01\x12(\n\x10version_group_id\x18\x0c\x20\x01(\rR\x0eversionGroupI\ + d\x12\x1c\n\ttimestamp\x18\r\x20\x01(\rR\ttimestamp\x12\x1b\n\tbranch_id\ + \x18\x0e\x20\x01(\rR\x08branchId\x1a\xf1\x05\n\x0bTxInputType\x12\x1b\n\ + \taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1b\n\tprev_hash\x18\x02\ + \x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tpr\ + evIndex\x12\x1d\n\nscript_sig\x18\x04\x20\x01(\x0cR\tscriptSig\x12&\n\ + \x08sequence\x18\x05\x20\x01(\r:\n4294967295R\x08sequence\x12Z\n\x0bscri\ + pt_type\x18\x06\x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputScriptTyp\ + e:\x0cSPENDADDRESSR\nscriptType\x12P\n\x08multisig\x18\x07\x20\x01(\x0b2\ + 4.hw.trezor.messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12\ + \x16\n\x06amount\x18\x08\x20\x01(\x04R\x06amount\x12\x1f\n\x0bdecred_tre\ + e\x18\t\x20\x01(\rR\ndecredTree\x12\x18\n\x07witness\x18\r\x20\x01(\x0cR\ + \x07witness\x12'\n\x0fownership_proof\x18\x0e\x20\x01(\x0cR\x0eownership\ + Proof\x12'\n\x0fcommitment_data\x18\x0f\x20\x01(\x0cR\x0ecommitmentData\ + \x12\x1b\n\torig_hash\x18\x10\x20\x01(\x0cR\x08origHash\x12\x1d\n\norig_\ + index\x18\x11\x20\x01(\rR\torigIndex\x12d\n\x14decred_staking_spend\x18\ + \x12\x20\x01(\x0e22.hw.trezor.messages.bitcoin.DecredStakingSpendTypeR\ + \x12decredStakingSpend\x12#\n\rscript_pubkey\x18\x13\x20\x01(\x0cR\x0csc\ + riptPubkey\x12(\n\x0ecoinjoin_flags\x18\x14\x20\x01(\r:\x010R\rcoinjoinF\ + lags\x1a\x82\x01\n\x0fTxOutputBinType\x12\x16\n\x06amount\x18\x01\x20\ + \x02(\x04R\x06amount\x12#\n\rscript_pubkey\x18\x02\x20\x02(\x0cR\x0cscri\ + ptPubkey\x122\n\x15decred_script_version\x18\x03\x20\x01(\rR\x13decredSc\ + riptVersion\x1a\xa0\x03\n\x0cTxOutputType\x12\x18\n\x07address\x18\x01\ + \x20\x01(\tR\x07address\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addr\ + essN\x12\x16\n\x06amount\x18\x03\x20\x02(\x04R\x06amount\x12[\n\x0bscrip\ + t_type\x18\x04\x20\x01(\x0e2,.hw.trezor.messages.bitcoin.OutputScriptTyp\ + e:\x0cPAYTOADDRESSR\nscriptType\x12P\n\x08multisig\x18\x05\x20\x01(\x0b2\ + 4.hw.trezor.messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12$\ + \n\x0eop_return_data\x18\x06\x20\x01(\x0cR\x0copReturnData\x12\x1b\n\tor\ + ig_hash\x18\n\x20\x01(\x0cR\x08origHash\x12\x1d\n\norig_index\x18\x0b\ + \x20\x01(\rR\torigIndex\x120\n\x11payment_req_index\x18\x0c\x20\x01(\rR\ + \x0fpaymentReqIndexB\x04\xc8\xf0\x19\x01:\x02\x18\x01\"\xff\x05\n\x07TxI\ + nput\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1b\n\tpre\ + v_hash\x18\x02\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\ + \x20\x02(\rR\tprevIndex\x12\x1d\n\nscript_sig\x18\x04\x20\x01(\x0cR\tscr\ + iptSig\x12&\n\x08sequence\x18\x05\x20\x01(\r:\n4294967295R\x08sequence\ + \x12Z\n\x0bscript_type\x18\x06\x20\x01(\x0e2+.hw.trezor.messages.bitcoin\ + .InputScriptType:\x0cSPENDADDRESSR\nscriptType\x12P\n\x08multisig\x18\ + \x07\x20\x01(\x0b24.hw.trezor.messages.bitcoin.MultisigRedeemScriptTypeR\ + \x08multisig\x12\x16\n\x06amount\x18\x08\x20\x02(\x04R\x06amount\x12\x1f\ + \n\x0bdecred_tree\x18\t\x20\x01(\rR\ndecredTree\x12\x18\n\x07witness\x18\ + \r\x20\x01(\x0cR\x07witness\x12'\n\x0fownership_proof\x18\x0e\x20\x01(\ + \x0cR\x0eownershipProof\x12'\n\x0fcommitment_data\x18\x0f\x20\x01(\x0cR\ + \x0ecommitmentData\x12\x1b\n\torig_hash\x18\x10\x20\x01(\x0cR\x08origHas\ + h\x12\x1d\n\norig_index\x18\x11\x20\x01(\rR\torigIndex\x12d\n\x14decred_\ + staking_spend\x18\x12\x20\x01(\x0e22.hw.trezor.messages.bitcoin.DecredSt\ + akingSpendTypeR\x12decredStakingSpend\x12#\n\rscript_pubkey\x18\x13\x20\ + \x01(\x0cR\x0cscriptPubkey\x12(\n\x0ecoinjoin_flags\x18\x14\x20\x01(\r:\ + \x010R\rcoinjoinFlagsJ\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\ + \x0c\x10\r\"\xae\x03\n\x08TxOutput\x12\x18\n\x07address\x18\x01\x20\x01(\ + \tR\x07address\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12\ + \x16\n\x06amount\x18\x03\x20\x02(\x04R\x06amount\x12[\n\x0bscript_type\ + \x18\x04\x20\x01(\x0e2,.hw.trezor.messages.bitcoin.OutputScriptType:\x0c\ + PAYTOADDRESSR\nscriptType\x12P\n\x08multisig\x18\x05\x20\x01(\x0b24.hw.t\ + rezor.messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12$\n\x0eo\ + p_return_data\x18\x06\x20\x01(\x0cR\x0copReturnData\x12\x1b\n\torig_hash\ + \x18\n\x20\x01(\x0cR\x08origHash\x12\x1d\n\norig_index\x18\x0b\x20\x01(\ + \rR\torigIndex\x120\n\x11payment_req_index\x18\x0c\x20\x01(\rR\x0fpaymen\ + tReqIndexB\x04\xc8\xf0\x19\x01J\x04\x08\x07\x10\x08J\x04\x08\x08\x10\tJ\ + \x04\x08\t\x10\n\"\xcb\x02\n\x06PrevTx\x12\x18\n\x07version\x18\x01\x20\ + \x02(\rR\x07version\x12\x1b\n\tlock_time\x18\x04\x20\x02(\rR\x08lockTime\ + \x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\x0binputsCount\x12#\n\routpu\ + ts_count\x18\x07\x20\x02(\rR\x0coutputsCount\x12'\n\x0eextra_data_len\ + \x18\t\x20\x01(\r:\x010R\x0cextraDataLen\x12\x16\n\x06expiry\x18\n\x20\ + \x01(\rR\x06expiry\x12(\n\x10version_group_id\x18\x0c\x20\x01(\rR\x0ever\ + sionGroupId\x12\x1c\n\ttimestamp\x18\r\x20\x01(\rR\ttimestamp\x12\x1b\n\ + \tbranch_id\x18\x0e\x20\x01(\rR\x08branchIdJ\x04\x08\x02\x10\x03J\x04\ + \x08\x03\x10\x04J\x04\x08\x05\x10\x06J\x04\x08\x08\x10\tJ\x04\x08\x0b\ + \x10\x0c\"\xf7\x01\n\tPrevInput\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\ + \x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndex\ + \x12\x1d\n\nscript_sig\x18\x04\x20\x02(\x0cR\tscriptSig\x12\x1a\n\x08seq\ + uence\x18\x05\x20\x02(\rR\x08sequence\x12\x1f\n\x0bdecred_tree\x18\t\x20\ + \x01(\rR\ndecredTreeJ\x04\x08\x01\x10\x02J\x04\x08\x06\x10\x07J\x04\x08\ + \x07\x10\x08J\x04\x08\x08\x10\tJ\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\ + \x04\x08\x0c\x10\rJ\x04\x08\r\x10\x0eJ\x04\x08\x0e\x10\x0fJ\x04\x08\x0f\ + \x10\x10J\x04\x08\x10\x10\x11J\x04\x08\x11\x10\x12J\x04\x08\x12\x10\x13J\ + \x04\x08\x13\x10\x14\"}\n\nPrevOutput\x12\x16\n\x06amount\x18\x01\x20\ + \x02(\x04R\x06amount\x12#\n\rscript_pubkey\x18\x02\x20\x02(\x0cR\x0cscri\ + ptPubkey\x122\n\x15decred_script_version\x18\x03\x20\x01(\rR\x13decredSc\ + riptVersion\"\xf2\x05\n\x13TxAckPaymentRequest\x12\x14\n\x05nonce\x18\ + \x01\x20\x01(\x0cR\x05nonce\x12%\n\x0erecipient_name\x18\x02\x20\x02(\tR\ + \rrecipientName\x12X\n\x05memos\x18\x03\x20\x03(\x0b2B.hw.trezor.message\ + s.bitcoin.TxAckPaymentRequest.PaymentRequestMemoR\x05memos\x12\x16\n\x06\ + amount\x18\x04\x20\x01(\x04R\x06amount\x12\x1c\n\tsignature\x18\x05\x20\ + \x02(\x0cR\tsignature\x1a\xb8\x02\n\x12PaymentRequestMemo\x12U\n\ttext_m\ + emo\x18\x01\x20\x01(\x0b28.hw.trezor.messages.bitcoin.TxAckPaymentReques\ + t.TextMemoR\x08textMemo\x12[\n\x0brefund_memo\x18\x02\x20\x01(\x0b2:.hw.\ + trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemoR\nrefundMemo\x12n\ + \n\x12coin_purchase_memo\x18\x03\x20\x01(\x0b2@.hw.trezor.messages.bitco\ + in.TxAckPaymentRequest.CoinPurchaseMemoR\x10coinPurchaseMemo\x1a\x1e\n\ + \x08TextMemo\x12\x12\n\x04text\x18\x01\x20\x02(\tR\x04text\x1a8\n\nRefun\ + dMemo\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\x12\x10\n\x03m\ + ac\x18\x02\x20\x02(\x0cR\x03mac\x1as\n\x10CoinPurchaseMemo\x12\x1b\n\tco\ + in_type\x18\x01\x20\x02(\rR\x08coinType\x12\x16\n\x06amount\x18\x02\x20\ + \x02(\tR\x06amount\x12\x18\n\x07address\x18\x03\x20\x02(\tR\x07address\ + \x12\x10\n\x03mac\x18\x04\x20\x02(\x0cR\x03mac:\x04\x88\xb2\x19\x01\"\ + \xac\x01\n\nTxAckInput\x12H\n\x02tx\x18\x01\x20\x02(\x0b28.hw.trezor.mes\ + sages.bitcoin.TxAckInput.TxAckInputWrapperR\x02tx\x1aN\n\x11TxAckInputWr\ + apper\x129\n\x05input\x18\x02\x20\x02(\x0b2#.hw.trezor.messages.bitcoin.\ + TxInputR\x05input:\x04\x90\xb2\x19\x16\"\xb3\x01\n\x0bTxAckOutput\x12J\n\ + \x02tx\x18\x01\x20\x02(\x0b2:.hw.trezor.messages.bitcoin.TxAckOutput.TxA\ + ckOutputWrapperR\x02tx\x1aR\n\x12TxAckOutputWrapper\x12<\n\x06output\x18\ + \x05\x20\x02(\x0b2$.hw.trezor.messages.bitcoin.TxOutputR\x06output:\x04\ + \x90\xb2\x19\x16\"I\n\rTxAckPrevMeta\x122\n\x02tx\x18\x01\x20\x02(\x0b2\ + \".hw.trezor.messages.bitcoin.PrevTxR\x02tx:\x04\x90\xb2\x19\x16\"\xbe\ + \x01\n\x0eTxAckPrevInput\x12P\n\x02tx\x18\x01\x20\x02(\x0b2@.hw.trezor.m\ + essages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapperR\x02tx\x1aT\n\x15Tx\ + AckPrevInputWrapper\x12;\n\x05input\x18\x02\x20\x02(\x0b2%.hw.trezor.mes\ + sages.bitcoin.PrevInputR\x05input:\x04\x90\xb2\x19\x16\"\xc5\x01\n\x0fTx\ + AckPrevOutput\x12R\n\x02tx\x18\x01\x20\x02(\x0b2B.hw.trezor.messages.bit\ + coin.TxAckPrevOutput.TxAckPrevOutputWrapperR\x02tx\x1aX\n\x16TxAckPrevOu\ + tputWrapper\x12>\n\x06output\x18\x03\x20\x02(\x0b2&.hw.trezor.messages.b\ + itcoin.PrevOutputR\x06output:\x04\x90\xb2\x19\x16\"\xbb\x01\n\x12TxAckPr\ + evExtraData\x12X\n\x02tx\x18\x01\x20\x02(\x0b2H.hw.trezor.messages.bitco\ + in.TxAckPrevExtraData.TxAckPrevExtraDataWrapperR\x02tx\x1aE\n\x19TxAckPr\ + evExtraDataWrapper\x12(\n\x10extra_data_chunk\x18\x08\x20\x02(\x0cR\x0ee\ + xtraDataChunk:\x04\x90\xb2\x19\x16\"\x88\x03\n\x11GetOwnershipProof\x12\ + \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12$\n\tcoin_name\x18\ + \x02\x20\x01(\t:\x07BitcoinR\x08coinName\x12Z\n\x0bscript_type\x18\x03\ + \x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputScriptType:\x0cSPENDWITN\ + ESSR\nscriptType\x12P\n\x08multisig\x18\x04\x20\x01(\x0b24.hw.trezor.mes\ + sages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x122\n\x11user_confi\ + rmation\x18\x05\x20\x01(\x08:\x05falseR\x10userConfirmation\x12#\n\rowne\ + rship_ids\x18\x06\x20\x03(\x0cR\x0cownershipIds\x12)\n\x0fcommitment_dat\ + a\x18\x07\x20\x01(\x0c:\0R\x0ecommitmentData\"W\n\x0eOwnershipProof\x12'\ + \n\x0fownership_proof\x18\x01\x20\x02(\x0cR\x0eownershipProof\x12\x1c\n\ + \tsignature\x18\x02\x20\x02(\x0cR\tsignature\"\xab\x03\n\x11AuthorizeCoi\ + nJoin\x12\x20\n\x0bcoordinator\x18\x01\x20\x02(\tR\x0bcoordinator\x12\ + \x1d\n\nmax_rounds\x18\x02\x20\x02(\x04R\tmaxRounds\x127\n\x18max_coordi\ + nator_fee_rate\x18\x03\x20\x02(\rR\x15maxCoordinatorFeeRate\x12+\n\x12ma\ + x_fee_per_kvbyte\x18\x04\x20\x02(\rR\x0fmaxFeePerKvbyte\x12\x1b\n\taddre\ + ss_n\x18\x05\x20\x03(\rR\x08addressN\x12$\n\tcoin_name\x18\x06\x20\x01(\ + \t:\x07BitcoinR\x08coinName\x12Z\n\x0bscript_type\x18\x07\x20\x01(\x0e2+\ + .hw.trezor.messages.bitcoin.InputScriptType:\x0cSPENDADDRESSR\nscriptTyp\ + e\x12P\n\x0bamount_unit\x18\x08\x20\x01(\x0e2&.hw.trezor.messages.bitcoi\ + n.AmountUnit:\x07BITCOINR\namountUnit*~\n\x0fInputScriptType\x12\x10\n\ + \x0cSPENDADDRESS\x10\0\x12\x11\n\rSPENDMULTISIG\x10\x01\x12\x0c\n\x08EXT\ + ERNAL\x10\x02\x12\x10\n\x0cSPENDWITNESS\x10\x03\x12\x14\n\x10SPENDP2SHWI\ + TNESS\x10\x04\x12\x10\n\x0cSPENDTAPROOT\x10\x05*\x99\x01\n\x10OutputScri\ + ptType\x12\x10\n\x0cPAYTOADDRESS\x10\0\x12\x13\n\x0fPAYTOSCRIPTHASH\x10\ + \x01\x12\x11\n\rPAYTOMULTISIG\x10\x02\x12\x11\n\rPAYTOOPRETURN\x10\x03\ + \x12\x10\n\x0cPAYTOWITNESS\x10\x04\x12\x14\n\x10PAYTOP2SHWITNESS\x10\x05\ + \x12\x10\n\x0cPAYTOTAPROOT\x10\x06*.\n\x16DecredStakingSpendType\x12\t\n\ + \x05SSGen\x10\0\x12\t\n\x05SSRTX\x10\x01*R\n\nAmountUnit\x12\x0b\n\x07BI\ + TCOIN\x10\0\x12\x10\n\x0cMILLIBITCOIN\x10\x01\x12\x10\n\x0cMICROBITCOIN\ + \x10\x02\x12\x0b\n\x07SATOSHI\x10\x03\x12\x06\n\x02ML\x10\x04B?\n#com.sa\ + toshilabs.trezor.lib.protobufB\x14TrezorMessageBitcoin\x80\xa6\x1d\x01\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(2); + deps.push(super::messages::file_descriptor().clone()); + deps.push(super::messages_common::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(45); + messages.push(MultisigRedeemScriptType::generated_message_descriptor_data()); + messages.push(GetPublicKey::generated_message_descriptor_data()); + messages.push(PublicKey::generated_message_descriptor_data()); + messages.push(GetAddress::generated_message_descriptor_data()); + messages.push(Address::generated_message_descriptor_data()); + messages.push(GetOwnershipId::generated_message_descriptor_data()); + messages.push(OwnershipId::generated_message_descriptor_data()); + messages.push(SignMessage::generated_message_descriptor_data()); + messages.push(MessageSignature::generated_message_descriptor_data()); + messages.push(VerifyMessage::generated_message_descriptor_data()); + messages.push(SignTx::generated_message_descriptor_data()); + messages.push(TxRequest::generated_message_descriptor_data()); + messages.push(TxAck::generated_message_descriptor_data()); + messages.push(TxInput::generated_message_descriptor_data()); + messages.push(TxOutput::generated_message_descriptor_data()); + messages.push(PrevTx::generated_message_descriptor_data()); + messages.push(PrevInput::generated_message_descriptor_data()); + messages.push(PrevOutput::generated_message_descriptor_data()); + messages.push(TxAckPaymentRequest::generated_message_descriptor_data()); + messages.push(TxAckInput::generated_message_descriptor_data()); + messages.push(TxAckOutput::generated_message_descriptor_data()); + messages.push(TxAckPrevMeta::generated_message_descriptor_data()); + messages.push(TxAckPrevInput::generated_message_descriptor_data()); + messages.push(TxAckPrevOutput::generated_message_descriptor_data()); + messages.push(TxAckPrevExtraData::generated_message_descriptor_data()); + messages.push(GetOwnershipProof::generated_message_descriptor_data()); + messages.push(OwnershipProof::generated_message_descriptor_data()); + messages.push(AuthorizeCoinJoin::generated_message_descriptor_data()); + messages.push(multisig_redeem_script_type::HDNodePathType::generated_message_descriptor_data()); + messages.push(sign_tx::CoinJoinRequest::generated_message_descriptor_data()); + messages.push(tx_request::TxRequestDetailsType::generated_message_descriptor_data()); + messages.push(tx_request::TxRequestSerializedType::generated_message_descriptor_data()); + messages.push(tx_ack::TransactionType::generated_message_descriptor_data()); + messages.push(tx_ack::transaction_type::TxInputType::generated_message_descriptor_data()); + messages.push(tx_ack::transaction_type::TxOutputBinType::generated_message_descriptor_data()); + messages.push(tx_ack::transaction_type::TxOutputType::generated_message_descriptor_data()); + messages.push(tx_ack_payment_request::PaymentRequestMemo::generated_message_descriptor_data()); + messages.push(tx_ack_payment_request::TextMemo::generated_message_descriptor_data()); + messages.push(tx_ack_payment_request::RefundMemo::generated_message_descriptor_data()); + messages.push(tx_ack_payment_request::CoinPurchaseMemo::generated_message_descriptor_data()); + messages.push(tx_ack_input::TxAckInputWrapper::generated_message_descriptor_data()); + messages.push(tx_ack_output::TxAckOutputWrapper::generated_message_descriptor_data()); + messages.push(tx_ack_prev_input::TxAckPrevInputWrapper::generated_message_descriptor_data()); + messages.push(tx_ack_prev_output::TxAckPrevOutputWrapper::generated_message_descriptor_data()); + messages.push(tx_ack_prev_extra_data::TxAckPrevExtraDataWrapper::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(5); + enums.push(InputScriptType::generated_enum_descriptor_data()); + enums.push(OutputScriptType::generated_enum_descriptor_data()); + enums.push(DecredStakingSpendType::generated_enum_descriptor_data()); + enums.push(AmountUnit::generated_enum_descriptor_data()); + enums.push(tx_request::RequestType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_bootloader.rs b/wallet/trezor-client/src/protos/generated/messages_bootloader.rs new file mode 100644 index 0000000000..c8614be41a --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_bootloader.rs @@ -0,0 +1,767 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-bootloader.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.FirmwareErase) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct FirmwareErase { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareErase.length) + pub length: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.FirmwareErase.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a FirmwareErase { + fn default() -> &'a FirmwareErase { + ::default_instance() + } +} + +impl FirmwareErase { + pub fn new() -> FirmwareErase { + ::std::default::Default::default() + } + + // optional uint32 length = 1; + + pub fn length(&self) -> u32 { + self.length.unwrap_or(0) + } + + pub fn clear_length(&mut self) { + self.length = ::std::option::Option::None; + } + + pub fn has_length(&self) -> bool { + self.length.is_some() + } + + // Param is passed by value, moved + pub fn set_length(&mut self, v: u32) { + self.length = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "length", + |m: &FirmwareErase| { &m.length }, + |m: &mut FirmwareErase| { &mut m.length }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "FirmwareErase", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for FirmwareErase { + const NAME: &'static str = "FirmwareErase"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.length = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.length { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.length { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> FirmwareErase { + FirmwareErase::new() + } + + fn clear(&mut self) { + self.length = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static FirmwareErase { + static instance: FirmwareErase = FirmwareErase { + length: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for FirmwareErase { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareErase").unwrap()).clone() + } +} + +impl ::std::fmt::Display for FirmwareErase { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FirmwareErase { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.FirmwareRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct FirmwareRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareRequest.offset) + pub offset: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareRequest.length) + pub length: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.FirmwareRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a FirmwareRequest { + fn default() -> &'a FirmwareRequest { + ::default_instance() + } +} + +impl FirmwareRequest { + pub fn new() -> FirmwareRequest { + ::std::default::Default::default() + } + + // required uint32 offset = 1; + + pub fn offset(&self) -> u32 { + self.offset.unwrap_or(0) + } + + pub fn clear_offset(&mut self) { + self.offset = ::std::option::Option::None; + } + + pub fn has_offset(&self) -> bool { + self.offset.is_some() + } + + // Param is passed by value, moved + pub fn set_offset(&mut self, v: u32) { + self.offset = ::std::option::Option::Some(v); + } + + // required uint32 length = 2; + + pub fn length(&self) -> u32 { + self.length.unwrap_or(0) + } + + pub fn clear_length(&mut self) { + self.length = ::std::option::Option::None; + } + + pub fn has_length(&self) -> bool { + self.length.is_some() + } + + // Param is passed by value, moved + pub fn set_length(&mut self, v: u32) { + self.length = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "offset", + |m: &FirmwareRequest| { &m.offset }, + |m: &mut FirmwareRequest| { &mut m.offset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "length", + |m: &FirmwareRequest| { &m.length }, + |m: &mut FirmwareRequest| { &mut m.length }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "FirmwareRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for FirmwareRequest { + const NAME: &'static str = "FirmwareRequest"; + + fn is_initialized(&self) -> bool { + if self.offset.is_none() { + return false; + } + if self.length.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.offset = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.length = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.offset { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.length { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.offset { + os.write_uint32(1, v)?; + } + if let Some(v) = self.length { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> FirmwareRequest { + FirmwareRequest::new() + } + + fn clear(&mut self) { + self.offset = ::std::option::Option::None; + self.length = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static FirmwareRequest { + static instance: FirmwareRequest = FirmwareRequest { + offset: ::std::option::Option::None, + length: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for FirmwareRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for FirmwareRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FirmwareRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.FirmwareUpload) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct FirmwareUpload { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareUpload.payload) + pub payload: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareUpload.hash) + pub hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.FirmwareUpload.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a FirmwareUpload { + fn default() -> &'a FirmwareUpload { + ::default_instance() + } +} + +impl FirmwareUpload { + pub fn new() -> FirmwareUpload { + ::std::default::Default::default() + } + + // required bytes payload = 1; + + pub fn payload(&self) -> &[u8] { + match self.payload.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_payload(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_payload(&self) -> bool { + self.payload.is_some() + } + + // Param is passed by value, moved + pub fn set_payload(&mut self, v: ::std::vec::Vec) { + self.payload = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { + if self.payload.is_none() { + self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.payload.as_mut().unwrap() + } + + // Take field + pub fn take_payload(&mut self) -> ::std::vec::Vec { + self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes hash = 2; + + pub fn hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payload", + |m: &FirmwareUpload| { &m.payload }, + |m: &mut FirmwareUpload| { &mut m.payload }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hash", + |m: &FirmwareUpload| { &m.hash }, + |m: &mut FirmwareUpload| { &mut m.hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "FirmwareUpload", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for FirmwareUpload { + const NAME: &'static str = "FirmwareUpload"; + + fn is_initialized(&self) -> bool { + if self.payload.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.payload = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payload.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.payload.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.hash.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> FirmwareUpload { + FirmwareUpload::new() + } + + fn clear(&mut self) { + self.payload = ::std::option::Option::None; + self.hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static FirmwareUpload { + static instance: FirmwareUpload = FirmwareUpload { + payload: ::std::option::Option::None, + hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for FirmwareUpload { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareUpload").unwrap()).clone() + } +} + +impl ::std::fmt::Display for FirmwareUpload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FirmwareUpload { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.ProdTestT1) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ProdTestT1 { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.ProdTestT1.payload) + pub payload: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.ProdTestT1.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ProdTestT1 { + fn default() -> &'a ProdTestT1 { + ::default_instance() + } +} + +impl ProdTestT1 { + pub fn new() -> ProdTestT1 { + ::std::default::Default::default() + } + + // optional bytes payload = 1; + + pub fn payload(&self) -> &[u8] { + match self.payload.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_payload(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_payload(&self) -> bool { + self.payload.is_some() + } + + // Param is passed by value, moved + pub fn set_payload(&mut self, v: ::std::vec::Vec) { + self.payload = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { + if self.payload.is_none() { + self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.payload.as_mut().unwrap() + } + + // Take field + pub fn take_payload(&mut self) -> ::std::vec::Vec { + self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payload", + |m: &ProdTestT1| { &m.payload }, + |m: &mut ProdTestT1| { &mut m.payload }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ProdTestT1", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ProdTestT1 { + const NAME: &'static str = "ProdTestT1"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.payload = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payload.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.payload.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ProdTestT1 { + ProdTestT1::new() + } + + fn clear(&mut self) { + self.payload = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ProdTestT1 { + static instance: ProdTestT1 = ProdTestT1 { + payload: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ProdTestT1 { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ProdTestT1").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ProdTestT1 { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ProdTestT1 { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x19messages-bootloader.proto\x12\x1dhw.trezor.messages.bootloader\"'\ + \n\rFirmwareErase\x12\x16\n\x06length\x18\x01\x20\x01(\rR\x06length\"A\n\ + \x0fFirmwareRequest\x12\x16\n\x06offset\x18\x01\x20\x02(\rR\x06offset\ + \x12\x16\n\x06length\x18\x02\x20\x02(\rR\x06length\">\n\x0eFirmwareUploa\ + d\x12\x18\n\x07payload\x18\x01\x20\x02(\x0cR\x07payload\x12\x12\n\x04has\ + h\x18\x02\x20\x01(\x0cR\x04hash\"&\n\nProdTestT1\x12\x18\n\x07payload\ + \x18\x01\x20\x01(\x0cR\x07payloadB>\n#com.satoshilabs.trezor.lib.protobu\ + fB\x17TrezorMessageBootloader\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(4); + messages.push(FirmwareErase::generated_message_descriptor_data()); + messages.push(FirmwareRequest::generated_message_descriptor_data()); + messages.push(FirmwareUpload::generated_message_descriptor_data()); + messages.push(ProdTestT1::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_cardano.rs b/wallet/trezor-client/src/protos/generated/messages_cardano.rs new file mode 100644 index 0000000000..eebc579b05 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_cardano.rs @@ -0,0 +1,10240 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-cardano.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoBlockchainPointerType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoBlockchainPointerType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.block_index) + pub block_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.tx_index) + pub tx_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.certificate_index) + pub certificate_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoBlockchainPointerType { + fn default() -> &'a CardanoBlockchainPointerType { + ::default_instance() + } +} + +impl CardanoBlockchainPointerType { + pub fn new() -> CardanoBlockchainPointerType { + ::std::default::Default::default() + } + + // required uint32 block_index = 1; + + pub fn block_index(&self) -> u32 { + self.block_index.unwrap_or(0) + } + + pub fn clear_block_index(&mut self) { + self.block_index = ::std::option::Option::None; + } + + pub fn has_block_index(&self) -> bool { + self.block_index.is_some() + } + + // Param is passed by value, moved + pub fn set_block_index(&mut self, v: u32) { + self.block_index = ::std::option::Option::Some(v); + } + + // required uint32 tx_index = 2; + + pub fn tx_index(&self) -> u32 { + self.tx_index.unwrap_or(0) + } + + pub fn clear_tx_index(&mut self) { + self.tx_index = ::std::option::Option::None; + } + + pub fn has_tx_index(&self) -> bool { + self.tx_index.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_index(&mut self, v: u32) { + self.tx_index = ::std::option::Option::Some(v); + } + + // required uint32 certificate_index = 3; + + pub fn certificate_index(&self) -> u32 { + self.certificate_index.unwrap_or(0) + } + + pub fn clear_certificate_index(&mut self) { + self.certificate_index = ::std::option::Option::None; + } + + pub fn has_certificate_index(&self) -> bool { + self.certificate_index.is_some() + } + + // Param is passed by value, moved + pub fn set_certificate_index(&mut self, v: u32) { + self.certificate_index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "block_index", + |m: &CardanoBlockchainPointerType| { &m.block_index }, + |m: &mut CardanoBlockchainPointerType| { &mut m.block_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_index", + |m: &CardanoBlockchainPointerType| { &m.tx_index }, + |m: &mut CardanoBlockchainPointerType| { &mut m.tx_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "certificate_index", + |m: &CardanoBlockchainPointerType| { &m.certificate_index }, + |m: &mut CardanoBlockchainPointerType| { &mut m.certificate_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoBlockchainPointerType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoBlockchainPointerType { + const NAME: &'static str = "CardanoBlockchainPointerType"; + + fn is_initialized(&self) -> bool { + if self.block_index.is_none() { + return false; + } + if self.tx_index.is_none() { + return false; + } + if self.certificate_index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.block_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.tx_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.certificate_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.block_index { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.tx_index { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.certificate_index { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.block_index { + os.write_uint32(1, v)?; + } + if let Some(v) = self.tx_index { + os.write_uint32(2, v)?; + } + if let Some(v) = self.certificate_index { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoBlockchainPointerType { + CardanoBlockchainPointerType::new() + } + + fn clear(&mut self) { + self.block_index = ::std::option::Option::None; + self.tx_index = ::std::option::Option::None; + self.certificate_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoBlockchainPointerType { + static instance: CardanoBlockchainPointerType = CardanoBlockchainPointerType { + block_index: ::std::option::Option::None, + tx_index: ::std::option::Option::None, + certificate_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoBlockchainPointerType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoBlockchainPointerType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoBlockchainPointerType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoBlockchainPointerType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoNativeScript) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoNativeScript { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.scripts) + pub scripts: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.key_hash) + pub key_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.key_path) + pub key_path: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.required_signatures_count) + pub required_signatures_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.invalid_before) + pub invalid_before: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.invalid_hereafter) + pub invalid_hereafter: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoNativeScript.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoNativeScript { + fn default() -> &'a CardanoNativeScript { + ::default_instance() + } +} + +impl CardanoNativeScript { + pub fn new() -> CardanoNativeScript { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoNativeScriptType type = 1; + + pub fn type_(&self) -> CardanoNativeScriptType { + match self.type_ { + Some(e) => e.enum_value_or(CardanoNativeScriptType::PUB_KEY), + None => CardanoNativeScriptType::PUB_KEY, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: CardanoNativeScriptType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes key_hash = 3; + + pub fn key_hash(&self) -> &[u8] { + match self.key_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_key_hash(&mut self) { + self.key_hash = ::std::option::Option::None; + } + + pub fn has_key_hash(&self) -> bool { + self.key_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { + self.key_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { + if self.key_hash.is_none() { + self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.key_hash.as_mut().unwrap() + } + + // Take field + pub fn take_key_hash(&mut self) -> ::std::vec::Vec { + self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 required_signatures_count = 5; + + pub fn required_signatures_count(&self) -> u32 { + self.required_signatures_count.unwrap_or(0) + } + + pub fn clear_required_signatures_count(&mut self) { + self.required_signatures_count = ::std::option::Option::None; + } + + pub fn has_required_signatures_count(&self) -> bool { + self.required_signatures_count.is_some() + } + + // Param is passed by value, moved + pub fn set_required_signatures_count(&mut self, v: u32) { + self.required_signatures_count = ::std::option::Option::Some(v); + } + + // optional uint64 invalid_before = 6; + + pub fn invalid_before(&self) -> u64 { + self.invalid_before.unwrap_or(0) + } + + pub fn clear_invalid_before(&mut self) { + self.invalid_before = ::std::option::Option::None; + } + + pub fn has_invalid_before(&self) -> bool { + self.invalid_before.is_some() + } + + // Param is passed by value, moved + pub fn set_invalid_before(&mut self, v: u64) { + self.invalid_before = ::std::option::Option::Some(v); + } + + // optional uint64 invalid_hereafter = 7; + + pub fn invalid_hereafter(&self) -> u64 { + self.invalid_hereafter.unwrap_or(0) + } + + pub fn clear_invalid_hereafter(&mut self) { + self.invalid_hereafter = ::std::option::Option::None; + } + + pub fn has_invalid_hereafter(&self) -> bool { + self.invalid_hereafter.is_some() + } + + // Param is passed by value, moved + pub fn set_invalid_hereafter(&mut self, v: u64) { + self.invalid_hereafter = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &CardanoNativeScript| { &m.type_ }, + |m: &mut CardanoNativeScript| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "scripts", + |m: &CardanoNativeScript| { &m.scripts }, + |m: &mut CardanoNativeScript| { &mut m.scripts }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key_hash", + |m: &CardanoNativeScript| { &m.key_hash }, + |m: &mut CardanoNativeScript| { &mut m.key_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "key_path", + |m: &CardanoNativeScript| { &m.key_path }, + |m: &mut CardanoNativeScript| { &mut m.key_path }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "required_signatures_count", + |m: &CardanoNativeScript| { &m.required_signatures_count }, + |m: &mut CardanoNativeScript| { &mut m.required_signatures_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "invalid_before", + |m: &CardanoNativeScript| { &m.invalid_before }, + |m: &mut CardanoNativeScript| { &mut m.invalid_before }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "invalid_hereafter", + |m: &CardanoNativeScript| { &m.invalid_hereafter }, + |m: &mut CardanoNativeScript| { &mut m.invalid_hereafter }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoNativeScript", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoNativeScript { + const NAME: &'static str = "CardanoNativeScript"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + for v in &self.scripts { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.scripts.push(is.read_message()?); + }, + 26 => { + self.key_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + is.read_repeated_packed_uint32_into(&mut self.key_path)?; + }, + 32 => { + self.key_path.push(is.read_uint32()?); + }, + 40 => { + self.required_signatures_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.invalid_before = ::std::option::Option::Some(is.read_uint64()?); + }, + 56 => { + self.invalid_hereafter = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + for value in &self.scripts { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.key_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + for value in &self.key_path { + my_size += ::protobuf::rt::uint32_size(4, *value); + }; + if let Some(v) = self.required_signatures_count { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.invalid_before { + my_size += ::protobuf::rt::uint64_size(6, v); + } + if let Some(v) = self.invalid_hereafter { + my_size += ::protobuf::rt::uint64_size(7, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + for v in &self.scripts { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + }; + if let Some(v) = self.key_hash.as_ref() { + os.write_bytes(3, v)?; + } + for v in &self.key_path { + os.write_uint32(4, *v)?; + }; + if let Some(v) = self.required_signatures_count { + os.write_uint32(5, v)?; + } + if let Some(v) = self.invalid_before { + os.write_uint64(6, v)?; + } + if let Some(v) = self.invalid_hereafter { + os.write_uint64(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoNativeScript { + CardanoNativeScript::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.scripts.clear(); + self.key_hash = ::std::option::Option::None; + self.key_path.clear(); + self.required_signatures_count = ::std::option::Option::None; + self.invalid_before = ::std::option::Option::None; + self.invalid_hereafter = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoNativeScript { + static instance: CardanoNativeScript = CardanoNativeScript { + type_: ::std::option::Option::None, + scripts: ::std::vec::Vec::new(), + key_hash: ::std::option::Option::None, + key_path: ::std::vec::Vec::new(), + required_signatures_count: ::std::option::Option::None, + invalid_before: ::std::option::Option::None, + invalid_hereafter: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoNativeScript { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoNativeScript").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoNativeScript { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoNativeScript { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoGetNativeScriptHash) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoGetNativeScriptHash { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.script) + pub script: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.display_format) + pub display_format: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.derivation_type) + pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoGetNativeScriptHash { + fn default() -> &'a CardanoGetNativeScriptHash { + ::default_instance() + } +} + +impl CardanoGetNativeScriptHash { + pub fn new() -> CardanoGetNativeScriptHash { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat display_format = 2; + + pub fn display_format(&self) -> CardanoNativeScriptHashDisplayFormat { + match self.display_format { + Some(e) => e.enum_value_or(CardanoNativeScriptHashDisplayFormat::HIDE), + None => CardanoNativeScriptHashDisplayFormat::HIDE, + } + } + + pub fn clear_display_format(&mut self) { + self.display_format = ::std::option::Option::None; + } + + pub fn has_display_format(&self) -> bool { + self.display_format.is_some() + } + + // Param is passed by value, moved + pub fn set_display_format(&mut self, v: CardanoNativeScriptHashDisplayFormat) { + self.display_format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 3; + + pub fn derivation_type(&self) -> CardanoDerivationType { + match self.derivation_type { + Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), + None => CardanoDerivationType::LEDGER, + } + } + + pub fn clear_derivation_type(&mut self) { + self.derivation_type = ::std::option::Option::None; + } + + pub fn has_derivation_type(&self) -> bool { + self.derivation_type.is_some() + } + + // Param is passed by value, moved + pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { + self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoNativeScript>( + "script", + |m: &CardanoGetNativeScriptHash| { &m.script }, + |m: &mut CardanoGetNativeScriptHash| { &mut m.script }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "display_format", + |m: &CardanoGetNativeScriptHash| { &m.display_format }, + |m: &mut CardanoGetNativeScriptHash| { &mut m.display_format }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "derivation_type", + |m: &CardanoGetNativeScriptHash| { &m.derivation_type }, + |m: &mut CardanoGetNativeScriptHash| { &mut m.derivation_type }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoGetNativeScriptHash", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoGetNativeScriptHash { + const NAME: &'static str = "CardanoGetNativeScriptHash"; + + fn is_initialized(&self) -> bool { + if self.script.is_none() { + return false; + } + if self.display_format.is_none() { + return false; + } + if self.derivation_type.is_none() { + return false; + } + for v in &self.script { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.script)?; + }, + 16 => { + self.display_format = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 24 => { + self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.script.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.display_format { + my_size += ::protobuf::rt::int32_size(2, v.value()); + } + if let Some(v) = self.derivation_type { + my_size += ::protobuf::rt::int32_size(3, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.script.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.display_format { + os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.derivation_type { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoGetNativeScriptHash { + CardanoGetNativeScriptHash::new() + } + + fn clear(&mut self) { + self.script.clear(); + self.display_format = ::std::option::Option::None; + self.derivation_type = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoGetNativeScriptHash { + static instance: CardanoGetNativeScriptHash = CardanoGetNativeScriptHash { + script: ::protobuf::MessageField::none(), + display_format: ::std::option::Option::None, + derivation_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoGetNativeScriptHash { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoGetNativeScriptHash").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoGetNativeScriptHash { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoGetNativeScriptHash { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoNativeScriptHash) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoNativeScriptHash { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScriptHash.script_hash) + pub script_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoNativeScriptHash.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoNativeScriptHash { + fn default() -> &'a CardanoNativeScriptHash { + ::default_instance() + } +} + +impl CardanoNativeScriptHash { + pub fn new() -> CardanoNativeScriptHash { + ::std::default::Default::default() + } + + // required bytes script_hash = 1; + + pub fn script_hash(&self) -> &[u8] { + match self.script_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_hash(&mut self) { + self.script_hash = ::std::option::Option::None; + } + + pub fn has_script_hash(&self) -> bool { + self.script_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_script_hash(&mut self, v: ::std::vec::Vec) { + self.script_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_hash(&mut self) -> &mut ::std::vec::Vec { + if self.script_hash.is_none() { + self.script_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_hash.as_mut().unwrap() + } + + // Take field + pub fn take_script_hash(&mut self) -> ::std::vec::Vec { + self.script_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_hash", + |m: &CardanoNativeScriptHash| { &m.script_hash }, + |m: &mut CardanoNativeScriptHash| { &mut m.script_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoNativeScriptHash", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoNativeScriptHash { + const NAME: &'static str = "CardanoNativeScriptHash"; + + fn is_initialized(&self) -> bool { + if self.script_hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.script_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.script_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.script_hash.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoNativeScriptHash { + CardanoNativeScriptHash::new() + } + + fn clear(&mut self) { + self.script_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoNativeScriptHash { + static instance: CardanoNativeScriptHash = CardanoNativeScriptHash { + script_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoNativeScriptHash { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoNativeScriptHash").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoNativeScriptHash { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoNativeScriptHash { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoAddressParametersType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoAddressParametersType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.address_type) + pub address_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.address_n_staking) + pub address_n_staking: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.staking_key_hash) + pub staking_key_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.certificate_pointer) + pub certificate_pointer: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.script_payment_hash) + pub script_payment_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.script_staking_hash) + pub script_staking_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoAddressParametersType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoAddressParametersType { + fn default() -> &'a CardanoAddressParametersType { + ::default_instance() + } +} + +impl CardanoAddressParametersType { + pub fn new() -> CardanoAddressParametersType { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoAddressType address_type = 1; + + pub fn address_type(&self) -> CardanoAddressType { + match self.address_type { + Some(e) => e.enum_value_or(CardanoAddressType::BASE), + None => CardanoAddressType::BASE, + } + } + + pub fn clear_address_type(&mut self) { + self.address_type = ::std::option::Option::None; + } + + pub fn has_address_type(&self) -> bool { + self.address_type.is_some() + } + + // Param is passed by value, moved + pub fn set_address_type(&mut self, v: CardanoAddressType) { + self.address_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes staking_key_hash = 4; + + pub fn staking_key_hash(&self) -> &[u8] { + match self.staking_key_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_staking_key_hash(&mut self) { + self.staking_key_hash = ::std::option::Option::None; + } + + pub fn has_staking_key_hash(&self) -> bool { + self.staking_key_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_staking_key_hash(&mut self, v: ::std::vec::Vec) { + self.staking_key_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_staking_key_hash(&mut self) -> &mut ::std::vec::Vec { + if self.staking_key_hash.is_none() { + self.staking_key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.staking_key_hash.as_mut().unwrap() + } + + // Take field + pub fn take_staking_key_hash(&mut self) -> ::std::vec::Vec { + self.staking_key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes script_payment_hash = 6; + + pub fn script_payment_hash(&self) -> &[u8] { + match self.script_payment_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_payment_hash(&mut self) { + self.script_payment_hash = ::std::option::Option::None; + } + + pub fn has_script_payment_hash(&self) -> bool { + self.script_payment_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_script_payment_hash(&mut self, v: ::std::vec::Vec) { + self.script_payment_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_payment_hash(&mut self) -> &mut ::std::vec::Vec { + if self.script_payment_hash.is_none() { + self.script_payment_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_payment_hash.as_mut().unwrap() + } + + // Take field + pub fn take_script_payment_hash(&mut self) -> ::std::vec::Vec { + self.script_payment_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes script_staking_hash = 7; + + pub fn script_staking_hash(&self) -> &[u8] { + match self.script_staking_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_staking_hash(&mut self) { + self.script_staking_hash = ::std::option::Option::None; + } + + pub fn has_script_staking_hash(&self) -> bool { + self.script_staking_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_script_staking_hash(&mut self, v: ::std::vec::Vec) { + self.script_staking_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_staking_hash(&mut self) -> &mut ::std::vec::Vec { + if self.script_staking_hash.is_none() { + self.script_staking_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_staking_hash.as_mut().unwrap() + } + + // Take field + pub fn take_script_staking_hash(&mut self) -> ::std::vec::Vec { + self.script_staking_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address_type", + |m: &CardanoAddressParametersType| { &m.address_type }, + |m: &mut CardanoAddressParametersType| { &mut m.address_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &CardanoAddressParametersType| { &m.address_n }, + |m: &mut CardanoAddressParametersType| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n_staking", + |m: &CardanoAddressParametersType| { &m.address_n_staking }, + |m: &mut CardanoAddressParametersType| { &mut m.address_n_staking }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "staking_key_hash", + |m: &CardanoAddressParametersType| { &m.staking_key_hash }, + |m: &mut CardanoAddressParametersType| { &mut m.staking_key_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoBlockchainPointerType>( + "certificate_pointer", + |m: &CardanoAddressParametersType| { &m.certificate_pointer }, + |m: &mut CardanoAddressParametersType| { &mut m.certificate_pointer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_payment_hash", + |m: &CardanoAddressParametersType| { &m.script_payment_hash }, + |m: &mut CardanoAddressParametersType| { &mut m.script_payment_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_staking_hash", + |m: &CardanoAddressParametersType| { &m.script_staking_hash }, + |m: &mut CardanoAddressParametersType| { &mut m.script_staking_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoAddressParametersType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoAddressParametersType { + const NAME: &'static str = "CardanoAddressParametersType"; + + fn is_initialized(&self) -> bool { + if self.address_type.is_none() { + return false; + } + for v in &self.certificate_pointer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.address_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 26 => { + is.read_repeated_packed_uint32_into(&mut self.address_n_staking)?; + }, + 24 => { + self.address_n_staking.push(is.read_uint32()?); + }, + 34 => { + self.staking_key_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.certificate_pointer)?; + }, + 50 => { + self.script_payment_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 58 => { + self.script_staking_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address_type { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + for value in &self.address_n_staking { + my_size += ::protobuf::rt::uint32_size(3, *value); + }; + if let Some(v) = self.staking_key_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.certificate_pointer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.script_payment_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.script_staking_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address_type { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + for v in &self.address_n_staking { + os.write_uint32(3, *v)?; + }; + if let Some(v) = self.staking_key_hash.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.certificate_pointer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.script_payment_hash.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.script_staking_hash.as_ref() { + os.write_bytes(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoAddressParametersType { + CardanoAddressParametersType::new() + } + + fn clear(&mut self) { + self.address_type = ::std::option::Option::None; + self.address_n.clear(); + self.address_n_staking.clear(); + self.staking_key_hash = ::std::option::Option::None; + self.certificate_pointer.clear(); + self.script_payment_hash = ::std::option::Option::None; + self.script_staking_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoAddressParametersType { + static instance: CardanoAddressParametersType = CardanoAddressParametersType { + address_type: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + address_n_staking: ::std::vec::Vec::new(), + staking_key_hash: ::std::option::Option::None, + certificate_pointer: ::protobuf::MessageField::none(), + script_payment_hash: ::std::option::Option::None, + script_staking_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoAddressParametersType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoAddressParametersType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoAddressParametersType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoAddressParametersType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.protocol_magic) + pub protocol_magic: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.network_id) + pub network_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.address_parameters) + pub address_parameters: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.derivation_type) + pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoGetAddress { + fn default() -> &'a CardanoGetAddress { + ::default_instance() + } +} + +impl CardanoGetAddress { + pub fn new() -> CardanoGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // required uint32 protocol_magic = 3; + + pub fn protocol_magic(&self) -> u32 { + self.protocol_magic.unwrap_or(0) + } + + pub fn clear_protocol_magic(&mut self) { + self.protocol_magic = ::std::option::Option::None; + } + + pub fn has_protocol_magic(&self) -> bool { + self.protocol_magic.is_some() + } + + // Param is passed by value, moved + pub fn set_protocol_magic(&mut self, v: u32) { + self.protocol_magic = ::std::option::Option::Some(v); + } + + // required uint32 network_id = 4; + + pub fn network_id(&self) -> u32 { + self.network_id.unwrap_or(0) + } + + pub fn clear_network_id(&mut self) { + self.network_id = ::std::option::Option::None; + } + + pub fn has_network_id(&self) -> bool { + self.network_id.is_some() + } + + // Param is passed by value, moved + pub fn set_network_id(&mut self, v: u32) { + self.network_id = ::std::option::Option::Some(v); + } + + // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 6; + + pub fn derivation_type(&self) -> CardanoDerivationType { + match self.derivation_type { + Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), + None => CardanoDerivationType::LEDGER, + } + } + + pub fn clear_derivation_type(&mut self) { + self.derivation_type = ::std::option::Option::None; + } + + pub fn has_derivation_type(&self) -> bool { + self.derivation_type.is_some() + } + + // Param is passed by value, moved + pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { + self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool chunkify = 7; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &CardanoGetAddress| { &m.show_display }, + |m: &mut CardanoGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "protocol_magic", + |m: &CardanoGetAddress| { &m.protocol_magic }, + |m: &mut CardanoGetAddress| { &mut m.protocol_magic }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_id", + |m: &CardanoGetAddress| { &m.network_id }, + |m: &mut CardanoGetAddress| { &mut m.network_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoAddressParametersType>( + "address_parameters", + |m: &CardanoGetAddress| { &m.address_parameters }, + |m: &mut CardanoGetAddress| { &mut m.address_parameters }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "derivation_type", + |m: &CardanoGetAddress| { &m.derivation_type }, + |m: &mut CardanoGetAddress| { &mut m.derivation_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &CardanoGetAddress| { &m.chunkify }, + |m: &mut CardanoGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoGetAddress { + const NAME: &'static str = "CardanoGetAddress"; + + fn is_initialized(&self) -> bool { + if self.protocol_magic.is_none() { + return false; + } + if self.network_id.is_none() { + return false; + } + if self.address_parameters.is_none() { + return false; + } + if self.derivation_type.is_none() { + return false; + } + for v in &self.address_parameters { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.protocol_magic = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.network_id = ::std::option::Option::Some(is.read_uint32()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.address_parameters)?; + }, + 48 => { + self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 56 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.protocol_magic { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.network_id { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.address_parameters.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.derivation_type { + my_size += ::protobuf::rt::int32_size(6, v.value()); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.protocol_magic { + os.write_uint32(3, v)?; + } + if let Some(v) = self.network_id { + os.write_uint32(4, v)?; + } + if let Some(v) = self.address_parameters.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.derivation_type { + os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.chunkify { + os.write_bool(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoGetAddress { + CardanoGetAddress::new() + } + + fn clear(&mut self) { + self.show_display = ::std::option::Option::None; + self.protocol_magic = ::std::option::Option::None; + self.network_id = ::std::option::Option::None; + self.address_parameters.clear(); + self.derivation_type = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoGetAddress { + static instance: CardanoGetAddress = CardanoGetAddress { + show_display: ::std::option::Option::None, + protocol_magic: ::std::option::Option::None, + network_id: ::std::option::Option::None, + address_parameters: ::protobuf::MessageField::none(), + derivation_type: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoAddress { + fn default() -> &'a CardanoAddress { + ::default_instance() + } +} + +impl CardanoAddress { + pub fn new() -> CardanoAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &CardanoAddress| { &m.address }, + |m: &mut CardanoAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoAddress { + const NAME: &'static str = "CardanoAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoAddress { + CardanoAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoAddress { + static instance: CardanoAddress = CardanoAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoGetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoGetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetPublicKey.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetPublicKey.derivation_type) + pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoGetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoGetPublicKey { + fn default() -> &'a CardanoGetPublicKey { + ::default_instance() + } +} + +impl CardanoGetPublicKey { + pub fn new() -> CardanoGetPublicKey { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 3; + + pub fn derivation_type(&self) -> CardanoDerivationType { + match self.derivation_type { + Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), + None => CardanoDerivationType::LEDGER, + } + } + + pub fn clear_derivation_type(&mut self) { + self.derivation_type = ::std::option::Option::None; + } + + pub fn has_derivation_type(&self) -> bool { + self.derivation_type.is_some() + } + + // Param is passed by value, moved + pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { + self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &CardanoGetPublicKey| { &m.address_n }, + |m: &mut CardanoGetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &CardanoGetPublicKey| { &m.show_display }, + |m: &mut CardanoGetPublicKey| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "derivation_type", + |m: &CardanoGetPublicKey| { &m.derivation_type }, + |m: &mut CardanoGetPublicKey| { &mut m.derivation_type }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoGetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoGetPublicKey { + const NAME: &'static str = "CardanoGetPublicKey"; + + fn is_initialized(&self) -> bool { + if self.derivation_type.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.derivation_type { + my_size += ::protobuf::rt::int32_size(3, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.derivation_type { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoGetPublicKey { + CardanoGetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.derivation_type = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoGetPublicKey { + static instance: CardanoGetPublicKey = CardanoGetPublicKey { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + derivation_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoGetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoGetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoGetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoGetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPublicKey.xpub) + pub xpub: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPublicKey.node) + pub node: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoPublicKey { + fn default() -> &'a CardanoPublicKey { + ::default_instance() + } +} + +impl CardanoPublicKey { + pub fn new() -> CardanoPublicKey { + ::std::default::Default::default() + } + + // required string xpub = 1; + + pub fn xpub(&self) -> &str { + match self.xpub.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_xpub(&mut self) { + self.xpub = ::std::option::Option::None; + } + + pub fn has_xpub(&self) -> bool { + self.xpub.is_some() + } + + // Param is passed by value, moved + pub fn set_xpub(&mut self, v: ::std::string::String) { + self.xpub = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_xpub(&mut self) -> &mut ::std::string::String { + if self.xpub.is_none() { + self.xpub = ::std::option::Option::Some(::std::string::String::new()); + } + self.xpub.as_mut().unwrap() + } + + // Take field + pub fn take_xpub(&mut self) -> ::std::string::String { + self.xpub.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "xpub", + |m: &CardanoPublicKey| { &m.xpub }, + |m: &mut CardanoPublicKey| { &mut m.xpub }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( + "node", + |m: &CardanoPublicKey| { &m.node }, + |m: &mut CardanoPublicKey| { &mut m.node }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoPublicKey { + const NAME: &'static str = "CardanoPublicKey"; + + fn is_initialized(&self) -> bool { + if self.xpub.is_none() { + return false; + } + if self.node.is_none() { + return false; + } + for v in &self.node { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.xpub = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.xpub.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.node.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.xpub.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.node.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoPublicKey { + CardanoPublicKey::new() + } + + fn clear(&mut self) { + self.xpub = ::std::option::Option::None; + self.node.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoPublicKey { + static instance: CardanoPublicKey = CardanoPublicKey { + xpub: ::std::option::Option::None, + node: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoSignTxInit) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoSignTxInit { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.signing_mode) + pub signing_mode: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.protocol_magic) + pub protocol_magic: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.network_id) + pub network_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.inputs_count) + pub inputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.outputs_count) + pub outputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.ttl) + pub ttl: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.certificates_count) + pub certificates_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.withdrawals_count) + pub withdrawals_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.has_auxiliary_data) + pub has_auxiliary_data: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.validity_interval_start) + pub validity_interval_start: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.witness_requests_count) + pub witness_requests_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.minting_asset_groups_count) + pub minting_asset_groups_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.derivation_type) + pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.include_network_id) + pub include_network_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.script_data_hash) + pub script_data_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.collateral_inputs_count) + pub collateral_inputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.required_signers_count) + pub required_signers_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.has_collateral_return) + pub has_collateral_return: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.total_collateral) + pub total_collateral: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.reference_inputs_count) + pub reference_inputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoSignTxInit.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoSignTxInit { + fn default() -> &'a CardanoSignTxInit { + ::default_instance() + } +} + +impl CardanoSignTxInit { + pub fn new() -> CardanoSignTxInit { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoTxSigningMode signing_mode = 1; + + pub fn signing_mode(&self) -> CardanoTxSigningMode { + match self.signing_mode { + Some(e) => e.enum_value_or(CardanoTxSigningMode::ORDINARY_TRANSACTION), + None => CardanoTxSigningMode::ORDINARY_TRANSACTION, + } + } + + pub fn clear_signing_mode(&mut self) { + self.signing_mode = ::std::option::Option::None; + } + + pub fn has_signing_mode(&self) -> bool { + self.signing_mode.is_some() + } + + // Param is passed by value, moved + pub fn set_signing_mode(&mut self, v: CardanoTxSigningMode) { + self.signing_mode = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required uint32 protocol_magic = 2; + + pub fn protocol_magic(&self) -> u32 { + self.protocol_magic.unwrap_or(0) + } + + pub fn clear_protocol_magic(&mut self) { + self.protocol_magic = ::std::option::Option::None; + } + + pub fn has_protocol_magic(&self) -> bool { + self.protocol_magic.is_some() + } + + // Param is passed by value, moved + pub fn set_protocol_magic(&mut self, v: u32) { + self.protocol_magic = ::std::option::Option::Some(v); + } + + // required uint32 network_id = 3; + + pub fn network_id(&self) -> u32 { + self.network_id.unwrap_or(0) + } + + pub fn clear_network_id(&mut self) { + self.network_id = ::std::option::Option::None; + } + + pub fn has_network_id(&self) -> bool { + self.network_id.is_some() + } + + // Param is passed by value, moved + pub fn set_network_id(&mut self, v: u32) { + self.network_id = ::std::option::Option::Some(v); + } + + // required uint32 inputs_count = 4; + + pub fn inputs_count(&self) -> u32 { + self.inputs_count.unwrap_or(0) + } + + pub fn clear_inputs_count(&mut self) { + self.inputs_count = ::std::option::Option::None; + } + + pub fn has_inputs_count(&self) -> bool { + self.inputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_inputs_count(&mut self, v: u32) { + self.inputs_count = ::std::option::Option::Some(v); + } + + // required uint32 outputs_count = 5; + + pub fn outputs_count(&self) -> u32 { + self.outputs_count.unwrap_or(0) + } + + pub fn clear_outputs_count(&mut self) { + self.outputs_count = ::std::option::Option::None; + } + + pub fn has_outputs_count(&self) -> bool { + self.outputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_outputs_count(&mut self, v: u32) { + self.outputs_count = ::std::option::Option::Some(v); + } + + // required uint64 fee = 6; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // optional uint64 ttl = 7; + + pub fn ttl(&self) -> u64 { + self.ttl.unwrap_or(0) + } + + pub fn clear_ttl(&mut self) { + self.ttl = ::std::option::Option::None; + } + + pub fn has_ttl(&self) -> bool { + self.ttl.is_some() + } + + // Param is passed by value, moved + pub fn set_ttl(&mut self, v: u64) { + self.ttl = ::std::option::Option::Some(v); + } + + // required uint32 certificates_count = 8; + + pub fn certificates_count(&self) -> u32 { + self.certificates_count.unwrap_or(0) + } + + pub fn clear_certificates_count(&mut self) { + self.certificates_count = ::std::option::Option::None; + } + + pub fn has_certificates_count(&self) -> bool { + self.certificates_count.is_some() + } + + // Param is passed by value, moved + pub fn set_certificates_count(&mut self, v: u32) { + self.certificates_count = ::std::option::Option::Some(v); + } + + // required uint32 withdrawals_count = 9; + + pub fn withdrawals_count(&self) -> u32 { + self.withdrawals_count.unwrap_or(0) + } + + pub fn clear_withdrawals_count(&mut self) { + self.withdrawals_count = ::std::option::Option::None; + } + + pub fn has_withdrawals_count(&self) -> bool { + self.withdrawals_count.is_some() + } + + // Param is passed by value, moved + pub fn set_withdrawals_count(&mut self, v: u32) { + self.withdrawals_count = ::std::option::Option::Some(v); + } + + // required bool has_auxiliary_data = 10; + + pub fn has_auxiliary_data(&self) -> bool { + self.has_auxiliary_data.unwrap_or(false) + } + + pub fn clear_has_auxiliary_data(&mut self) { + self.has_auxiliary_data = ::std::option::Option::None; + } + + pub fn has_has_auxiliary_data(&self) -> bool { + self.has_auxiliary_data.is_some() + } + + // Param is passed by value, moved + pub fn set_has_auxiliary_data(&mut self, v: bool) { + self.has_auxiliary_data = ::std::option::Option::Some(v); + } + + // optional uint64 validity_interval_start = 11; + + pub fn validity_interval_start(&self) -> u64 { + self.validity_interval_start.unwrap_or(0) + } + + pub fn clear_validity_interval_start(&mut self) { + self.validity_interval_start = ::std::option::Option::None; + } + + pub fn has_validity_interval_start(&self) -> bool { + self.validity_interval_start.is_some() + } + + // Param is passed by value, moved + pub fn set_validity_interval_start(&mut self, v: u64) { + self.validity_interval_start = ::std::option::Option::Some(v); + } + + // required uint32 witness_requests_count = 12; + + pub fn witness_requests_count(&self) -> u32 { + self.witness_requests_count.unwrap_or(0) + } + + pub fn clear_witness_requests_count(&mut self) { + self.witness_requests_count = ::std::option::Option::None; + } + + pub fn has_witness_requests_count(&self) -> bool { + self.witness_requests_count.is_some() + } + + // Param is passed by value, moved + pub fn set_witness_requests_count(&mut self, v: u32) { + self.witness_requests_count = ::std::option::Option::Some(v); + } + + // required uint32 minting_asset_groups_count = 13; + + pub fn minting_asset_groups_count(&self) -> u32 { + self.minting_asset_groups_count.unwrap_or(0) + } + + pub fn clear_minting_asset_groups_count(&mut self) { + self.minting_asset_groups_count = ::std::option::Option::None; + } + + pub fn has_minting_asset_groups_count(&self) -> bool { + self.minting_asset_groups_count.is_some() + } + + // Param is passed by value, moved + pub fn set_minting_asset_groups_count(&mut self, v: u32) { + self.minting_asset_groups_count = ::std::option::Option::Some(v); + } + + // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 14; + + pub fn derivation_type(&self) -> CardanoDerivationType { + match self.derivation_type { + Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), + None => CardanoDerivationType::LEDGER, + } + } + + pub fn clear_derivation_type(&mut self) { + self.derivation_type = ::std::option::Option::None; + } + + pub fn has_derivation_type(&self) -> bool { + self.derivation_type.is_some() + } + + // Param is passed by value, moved + pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { + self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool include_network_id = 15; + + pub fn include_network_id(&self) -> bool { + self.include_network_id.unwrap_or(false) + } + + pub fn clear_include_network_id(&mut self) { + self.include_network_id = ::std::option::Option::None; + } + + pub fn has_include_network_id(&self) -> bool { + self.include_network_id.is_some() + } + + // Param is passed by value, moved + pub fn set_include_network_id(&mut self, v: bool) { + self.include_network_id = ::std::option::Option::Some(v); + } + + // optional bytes script_data_hash = 16; + + pub fn script_data_hash(&self) -> &[u8] { + match self.script_data_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_data_hash(&mut self) { + self.script_data_hash = ::std::option::Option::None; + } + + pub fn has_script_data_hash(&self) -> bool { + self.script_data_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_script_data_hash(&mut self, v: ::std::vec::Vec) { + self.script_data_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_data_hash(&mut self) -> &mut ::std::vec::Vec { + if self.script_data_hash.is_none() { + self.script_data_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_data_hash.as_mut().unwrap() + } + + // Take field + pub fn take_script_data_hash(&mut self) -> ::std::vec::Vec { + self.script_data_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 collateral_inputs_count = 17; + + pub fn collateral_inputs_count(&self) -> u32 { + self.collateral_inputs_count.unwrap_or(0) + } + + pub fn clear_collateral_inputs_count(&mut self) { + self.collateral_inputs_count = ::std::option::Option::None; + } + + pub fn has_collateral_inputs_count(&self) -> bool { + self.collateral_inputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_collateral_inputs_count(&mut self, v: u32) { + self.collateral_inputs_count = ::std::option::Option::Some(v); + } + + // required uint32 required_signers_count = 18; + + pub fn required_signers_count(&self) -> u32 { + self.required_signers_count.unwrap_or(0) + } + + pub fn clear_required_signers_count(&mut self) { + self.required_signers_count = ::std::option::Option::None; + } + + pub fn has_required_signers_count(&self) -> bool { + self.required_signers_count.is_some() + } + + // Param is passed by value, moved + pub fn set_required_signers_count(&mut self, v: u32) { + self.required_signers_count = ::std::option::Option::Some(v); + } + + // optional bool has_collateral_return = 19; + + pub fn has_collateral_return(&self) -> bool { + self.has_collateral_return.unwrap_or(false) + } + + pub fn clear_has_collateral_return(&mut self) { + self.has_collateral_return = ::std::option::Option::None; + } + + pub fn has_has_collateral_return(&self) -> bool { + self.has_collateral_return.is_some() + } + + // Param is passed by value, moved + pub fn set_has_collateral_return(&mut self, v: bool) { + self.has_collateral_return = ::std::option::Option::Some(v); + } + + // optional uint64 total_collateral = 20; + + pub fn total_collateral(&self) -> u64 { + self.total_collateral.unwrap_or(0) + } + + pub fn clear_total_collateral(&mut self) { + self.total_collateral = ::std::option::Option::None; + } + + pub fn has_total_collateral(&self) -> bool { + self.total_collateral.is_some() + } + + // Param is passed by value, moved + pub fn set_total_collateral(&mut self, v: u64) { + self.total_collateral = ::std::option::Option::Some(v); + } + + // optional uint32 reference_inputs_count = 21; + + pub fn reference_inputs_count(&self) -> u32 { + self.reference_inputs_count.unwrap_or(0u32) + } + + pub fn clear_reference_inputs_count(&mut self) { + self.reference_inputs_count = ::std::option::Option::None; + } + + pub fn has_reference_inputs_count(&self) -> bool { + self.reference_inputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_reference_inputs_count(&mut self, v: u32) { + self.reference_inputs_count = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 22; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(22); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signing_mode", + |m: &CardanoSignTxInit| { &m.signing_mode }, + |m: &mut CardanoSignTxInit| { &mut m.signing_mode }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "protocol_magic", + |m: &CardanoSignTxInit| { &m.protocol_magic }, + |m: &mut CardanoSignTxInit| { &mut m.protocol_magic }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_id", + |m: &CardanoSignTxInit| { &m.network_id }, + |m: &mut CardanoSignTxInit| { &mut m.network_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inputs_count", + |m: &CardanoSignTxInit| { &m.inputs_count }, + |m: &mut CardanoSignTxInit| { &mut m.inputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "outputs_count", + |m: &CardanoSignTxInit| { &m.outputs_count }, + |m: &mut CardanoSignTxInit| { &mut m.outputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &CardanoSignTxInit| { &m.fee }, + |m: &mut CardanoSignTxInit| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ttl", + |m: &CardanoSignTxInit| { &m.ttl }, + |m: &mut CardanoSignTxInit| { &mut m.ttl }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "certificates_count", + |m: &CardanoSignTxInit| { &m.certificates_count }, + |m: &mut CardanoSignTxInit| { &mut m.certificates_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "withdrawals_count", + |m: &CardanoSignTxInit| { &m.withdrawals_count }, + |m: &mut CardanoSignTxInit| { &mut m.withdrawals_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "has_auxiliary_data", + |m: &CardanoSignTxInit| { &m.has_auxiliary_data }, + |m: &mut CardanoSignTxInit| { &mut m.has_auxiliary_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "validity_interval_start", + |m: &CardanoSignTxInit| { &m.validity_interval_start }, + |m: &mut CardanoSignTxInit| { &mut m.validity_interval_start }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "witness_requests_count", + |m: &CardanoSignTxInit| { &m.witness_requests_count }, + |m: &mut CardanoSignTxInit| { &mut m.witness_requests_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "minting_asset_groups_count", + |m: &CardanoSignTxInit| { &m.minting_asset_groups_count }, + |m: &mut CardanoSignTxInit| { &mut m.minting_asset_groups_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "derivation_type", + |m: &CardanoSignTxInit| { &m.derivation_type }, + |m: &mut CardanoSignTxInit| { &mut m.derivation_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "include_network_id", + |m: &CardanoSignTxInit| { &m.include_network_id }, + |m: &mut CardanoSignTxInit| { &mut m.include_network_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_data_hash", + |m: &CardanoSignTxInit| { &m.script_data_hash }, + |m: &mut CardanoSignTxInit| { &mut m.script_data_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "collateral_inputs_count", + |m: &CardanoSignTxInit| { &m.collateral_inputs_count }, + |m: &mut CardanoSignTxInit| { &mut m.collateral_inputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "required_signers_count", + |m: &CardanoSignTxInit| { &m.required_signers_count }, + |m: &mut CardanoSignTxInit| { &mut m.required_signers_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "has_collateral_return", + |m: &CardanoSignTxInit| { &m.has_collateral_return }, + |m: &mut CardanoSignTxInit| { &mut m.has_collateral_return }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "total_collateral", + |m: &CardanoSignTxInit| { &m.total_collateral }, + |m: &mut CardanoSignTxInit| { &mut m.total_collateral }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "reference_inputs_count", + |m: &CardanoSignTxInit| { &m.reference_inputs_count }, + |m: &mut CardanoSignTxInit| { &mut m.reference_inputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &CardanoSignTxInit| { &m.chunkify }, + |m: &mut CardanoSignTxInit| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoSignTxInit", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoSignTxInit { + const NAME: &'static str = "CardanoSignTxInit"; + + fn is_initialized(&self) -> bool { + if self.signing_mode.is_none() { + return false; + } + if self.protocol_magic.is_none() { + return false; + } + if self.network_id.is_none() { + return false; + } + if self.inputs_count.is_none() { + return false; + } + if self.outputs_count.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + if self.certificates_count.is_none() { + return false; + } + if self.withdrawals_count.is_none() { + return false; + } + if self.has_auxiliary_data.is_none() { + return false; + } + if self.witness_requests_count.is_none() { + return false; + } + if self.minting_asset_groups_count.is_none() { + return false; + } + if self.derivation_type.is_none() { + return false; + } + if self.collateral_inputs_count.is_none() { + return false; + } + if self.required_signers_count.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.signing_mode = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 16 => { + self.protocol_magic = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.network_id = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 56 => { + self.ttl = ::std::option::Option::Some(is.read_uint64()?); + }, + 64 => { + self.certificates_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.withdrawals_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 80 => { + self.has_auxiliary_data = ::std::option::Option::Some(is.read_bool()?); + }, + 88 => { + self.validity_interval_start = ::std::option::Option::Some(is.read_uint64()?); + }, + 96 => { + self.witness_requests_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 104 => { + self.minting_asset_groups_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 112 => { + self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 120 => { + self.include_network_id = ::std::option::Option::Some(is.read_bool()?); + }, + 130 => { + self.script_data_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 136 => { + self.collateral_inputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 144 => { + self.required_signers_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 152 => { + self.has_collateral_return = ::std::option::Option::Some(is.read_bool()?); + }, + 160 => { + self.total_collateral = ::std::option::Option::Some(is.read_uint64()?); + }, + 168 => { + self.reference_inputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 176 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signing_mode { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.protocol_magic { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.network_id { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.inputs_count { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.outputs_count { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(6, v); + } + if let Some(v) = self.ttl { + my_size += ::protobuf::rt::uint64_size(7, v); + } + if let Some(v) = self.certificates_count { + my_size += ::protobuf::rt::uint32_size(8, v); + } + if let Some(v) = self.withdrawals_count { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.has_auxiliary_data { + my_size += 1 + 1; + } + if let Some(v) = self.validity_interval_start { + my_size += ::protobuf::rt::uint64_size(11, v); + } + if let Some(v) = self.witness_requests_count { + my_size += ::protobuf::rt::uint32_size(12, v); + } + if let Some(v) = self.minting_asset_groups_count { + my_size += ::protobuf::rt::uint32_size(13, v); + } + if let Some(v) = self.derivation_type { + my_size += ::protobuf::rt::int32_size(14, v.value()); + } + if let Some(v) = self.include_network_id { + my_size += 1 + 1; + } + if let Some(v) = self.script_data_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(16, &v); + } + if let Some(v) = self.collateral_inputs_count { + my_size += ::protobuf::rt::uint32_size(17, v); + } + if let Some(v) = self.required_signers_count { + my_size += ::protobuf::rt::uint32_size(18, v); + } + if let Some(v) = self.has_collateral_return { + my_size += 2 + 1; + } + if let Some(v) = self.total_collateral { + my_size += ::protobuf::rt::uint64_size(20, v); + } + if let Some(v) = self.reference_inputs_count { + my_size += ::protobuf::rt::uint32_size(21, v); + } + if let Some(v) = self.chunkify { + my_size += 2 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signing_mode { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.protocol_magic { + os.write_uint32(2, v)?; + } + if let Some(v) = self.network_id { + os.write_uint32(3, v)?; + } + if let Some(v) = self.inputs_count { + os.write_uint32(4, v)?; + } + if let Some(v) = self.outputs_count { + os.write_uint32(5, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(6, v)?; + } + if let Some(v) = self.ttl { + os.write_uint64(7, v)?; + } + if let Some(v) = self.certificates_count { + os.write_uint32(8, v)?; + } + if let Some(v) = self.withdrawals_count { + os.write_uint32(9, v)?; + } + if let Some(v) = self.has_auxiliary_data { + os.write_bool(10, v)?; + } + if let Some(v) = self.validity_interval_start { + os.write_uint64(11, v)?; + } + if let Some(v) = self.witness_requests_count { + os.write_uint32(12, v)?; + } + if let Some(v) = self.minting_asset_groups_count { + os.write_uint32(13, v)?; + } + if let Some(v) = self.derivation_type { + os.write_enum(14, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.include_network_id { + os.write_bool(15, v)?; + } + if let Some(v) = self.script_data_hash.as_ref() { + os.write_bytes(16, v)?; + } + if let Some(v) = self.collateral_inputs_count { + os.write_uint32(17, v)?; + } + if let Some(v) = self.required_signers_count { + os.write_uint32(18, v)?; + } + if let Some(v) = self.has_collateral_return { + os.write_bool(19, v)?; + } + if let Some(v) = self.total_collateral { + os.write_uint64(20, v)?; + } + if let Some(v) = self.reference_inputs_count { + os.write_uint32(21, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(22, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoSignTxInit { + CardanoSignTxInit::new() + } + + fn clear(&mut self) { + self.signing_mode = ::std::option::Option::None; + self.protocol_magic = ::std::option::Option::None; + self.network_id = ::std::option::Option::None; + self.inputs_count = ::std::option::Option::None; + self.outputs_count = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.ttl = ::std::option::Option::None; + self.certificates_count = ::std::option::Option::None; + self.withdrawals_count = ::std::option::Option::None; + self.has_auxiliary_data = ::std::option::Option::None; + self.validity_interval_start = ::std::option::Option::None; + self.witness_requests_count = ::std::option::Option::None; + self.minting_asset_groups_count = ::std::option::Option::None; + self.derivation_type = ::std::option::Option::None; + self.include_network_id = ::std::option::Option::None; + self.script_data_hash = ::std::option::Option::None; + self.collateral_inputs_count = ::std::option::Option::None; + self.required_signers_count = ::std::option::Option::None; + self.has_collateral_return = ::std::option::Option::None; + self.total_collateral = ::std::option::Option::None; + self.reference_inputs_count = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoSignTxInit { + static instance: CardanoSignTxInit = CardanoSignTxInit { + signing_mode: ::std::option::Option::None, + protocol_magic: ::std::option::Option::None, + network_id: ::std::option::Option::None, + inputs_count: ::std::option::Option::None, + outputs_count: ::std::option::Option::None, + fee: ::std::option::Option::None, + ttl: ::std::option::Option::None, + certificates_count: ::std::option::Option::None, + withdrawals_count: ::std::option::Option::None, + has_auxiliary_data: ::std::option::Option::None, + validity_interval_start: ::std::option::Option::None, + witness_requests_count: ::std::option::Option::None, + minting_asset_groups_count: ::std::option::Option::None, + derivation_type: ::std::option::Option::None, + include_network_id: ::std::option::Option::None, + script_data_hash: ::std::option::Option::None, + collateral_inputs_count: ::std::option::Option::None, + required_signers_count: ::std::option::Option::None, + has_collateral_return: ::std::option::Option::None, + total_collateral: ::std::option::Option::None, + reference_inputs_count: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoSignTxInit { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoSignTxInit").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoSignTxInit { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoSignTxInit { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxInput.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxInput.prev_index) + pub prev_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxInput { + fn default() -> &'a CardanoTxInput { + ::default_instance() + } +} + +impl CardanoTxInput { + pub fn new() -> CardanoTxInput { + ::std::default::Default::default() + } + + // required bytes prev_hash = 1; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 2; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &CardanoTxInput| { &m.prev_hash }, + |m: &mut CardanoTxInput| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &CardanoTxInput| { &m.prev_index }, + |m: &mut CardanoTxInput| { &mut m.prev_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxInput { + const NAME: &'static str = "CardanoTxInput"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxInput { + CardanoTxInput::new() + } + + fn clear(&mut self) { + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxInput { + static instance: CardanoTxInput = CardanoTxInput { + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.address_parameters) + pub address_parameters: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.asset_groups_count) + pub asset_groups_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.datum_hash) + pub datum_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.format) + pub format: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.inline_datum_size) + pub inline_datum_size: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.reference_script_size) + pub reference_script_size: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxOutput { + fn default() -> &'a CardanoTxOutput { + ::default_instance() + } +} + +impl CardanoTxOutput { + pub fn new() -> CardanoTxOutput { + ::std::default::Default::default() + } + + // optional string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 amount = 3; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // required uint32 asset_groups_count = 4; + + pub fn asset_groups_count(&self) -> u32 { + self.asset_groups_count.unwrap_or(0) + } + + pub fn clear_asset_groups_count(&mut self) { + self.asset_groups_count = ::std::option::Option::None; + } + + pub fn has_asset_groups_count(&self) -> bool { + self.asset_groups_count.is_some() + } + + // Param is passed by value, moved + pub fn set_asset_groups_count(&mut self, v: u32) { + self.asset_groups_count = ::std::option::Option::Some(v); + } + + // optional bytes datum_hash = 5; + + pub fn datum_hash(&self) -> &[u8] { + match self.datum_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_datum_hash(&mut self) { + self.datum_hash = ::std::option::Option::None; + } + + pub fn has_datum_hash(&self) -> bool { + self.datum_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_datum_hash(&mut self, v: ::std::vec::Vec) { + self.datum_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_datum_hash(&mut self) -> &mut ::std::vec::Vec { + if self.datum_hash.is_none() { + self.datum_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.datum_hash.as_mut().unwrap() + } + + // Take field + pub fn take_datum_hash(&mut self) -> ::std::vec::Vec { + self.datum_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional .hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat format = 6; + + pub fn format(&self) -> CardanoTxOutputSerializationFormat { + match self.format { + Some(e) => e.enum_value_or(CardanoTxOutputSerializationFormat::ARRAY_LEGACY), + None => CardanoTxOutputSerializationFormat::ARRAY_LEGACY, + } + } + + pub fn clear_format(&mut self) { + self.format = ::std::option::Option::None; + } + + pub fn has_format(&self) -> bool { + self.format.is_some() + } + + // Param is passed by value, moved + pub fn set_format(&mut self, v: CardanoTxOutputSerializationFormat) { + self.format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint32 inline_datum_size = 7; + + pub fn inline_datum_size(&self) -> u32 { + self.inline_datum_size.unwrap_or(0u32) + } + + pub fn clear_inline_datum_size(&mut self) { + self.inline_datum_size = ::std::option::Option::None; + } + + pub fn has_inline_datum_size(&self) -> bool { + self.inline_datum_size.is_some() + } + + // Param is passed by value, moved + pub fn set_inline_datum_size(&mut self, v: u32) { + self.inline_datum_size = ::std::option::Option::Some(v); + } + + // optional uint32 reference_script_size = 8; + + pub fn reference_script_size(&self) -> u32 { + self.reference_script_size.unwrap_or(0u32) + } + + pub fn clear_reference_script_size(&mut self) { + self.reference_script_size = ::std::option::Option::None; + } + + pub fn has_reference_script_size(&self) -> bool { + self.reference_script_size.is_some() + } + + // Param is passed by value, moved + pub fn set_reference_script_size(&mut self, v: u32) { + self.reference_script_size = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &CardanoTxOutput| { &m.address }, + |m: &mut CardanoTxOutput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoAddressParametersType>( + "address_parameters", + |m: &CardanoTxOutput| { &m.address_parameters }, + |m: &mut CardanoTxOutput| { &mut m.address_parameters }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &CardanoTxOutput| { &m.amount }, + |m: &mut CardanoTxOutput| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "asset_groups_count", + |m: &CardanoTxOutput| { &m.asset_groups_count }, + |m: &mut CardanoTxOutput| { &mut m.asset_groups_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "datum_hash", + |m: &CardanoTxOutput| { &m.datum_hash }, + |m: &mut CardanoTxOutput| { &mut m.datum_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "format", + |m: &CardanoTxOutput| { &m.format }, + |m: &mut CardanoTxOutput| { &mut m.format }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inline_datum_size", + |m: &CardanoTxOutput| { &m.inline_datum_size }, + |m: &mut CardanoTxOutput| { &mut m.inline_datum_size }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "reference_script_size", + |m: &CardanoTxOutput| { &m.reference_script_size }, + |m: &mut CardanoTxOutput| { &mut m.reference_script_size }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxOutput { + const NAME: &'static str = "CardanoTxOutput"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + if self.asset_groups_count.is_none() { + return false; + } + for v in &self.address_parameters { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.address_parameters)?; + }, + 24 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.asset_groups_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 42 => { + self.datum_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 48 => { + self.format = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 56 => { + self.inline_datum_size = ::std::option::Option::Some(is.read_uint32()?); + }, + 64 => { + self.reference_script_size = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.address_parameters.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.asset_groups_count { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.datum_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.format { + my_size += ::protobuf::rt::int32_size(6, v.value()); + } + if let Some(v) = self.inline_datum_size { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.reference_script_size { + my_size += ::protobuf::rt::uint32_size(8, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.address_parameters.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.amount { + os.write_uint64(3, v)?; + } + if let Some(v) = self.asset_groups_count { + os.write_uint32(4, v)?; + } + if let Some(v) = self.datum_hash.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.format { + os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.inline_datum_size { + os.write_uint32(7, v)?; + } + if let Some(v) = self.reference_script_size { + os.write_uint32(8, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxOutput { + CardanoTxOutput::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.address_parameters.clear(); + self.amount = ::std::option::Option::None; + self.asset_groups_count = ::std::option::Option::None; + self.datum_hash = ::std::option::Option::None; + self.format = ::std::option::Option::None; + self.inline_datum_size = ::std::option::Option::None; + self.reference_script_size = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxOutput { + static instance: CardanoTxOutput = CardanoTxOutput { + address: ::std::option::Option::None, + address_parameters: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + asset_groups_count: ::std::option::Option::None, + datum_hash: ::std::option::Option::None, + format: ::std::option::Option::None, + inline_datum_size: ::std::option::Option::None, + reference_script_size: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoAssetGroup) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoAssetGroup { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAssetGroup.policy_id) + pub policy_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAssetGroup.tokens_count) + pub tokens_count: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoAssetGroup.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoAssetGroup { + fn default() -> &'a CardanoAssetGroup { + ::default_instance() + } +} + +impl CardanoAssetGroup { + pub fn new() -> CardanoAssetGroup { + ::std::default::Default::default() + } + + // required bytes policy_id = 1; + + pub fn policy_id(&self) -> &[u8] { + match self.policy_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_policy_id(&mut self) { + self.policy_id = ::std::option::Option::None; + } + + pub fn has_policy_id(&self) -> bool { + self.policy_id.is_some() + } + + // Param is passed by value, moved + pub fn set_policy_id(&mut self, v: ::std::vec::Vec) { + self.policy_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_policy_id(&mut self) -> &mut ::std::vec::Vec { + if self.policy_id.is_none() { + self.policy_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.policy_id.as_mut().unwrap() + } + + // Take field + pub fn take_policy_id(&mut self) -> ::std::vec::Vec { + self.policy_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 tokens_count = 2; + + pub fn tokens_count(&self) -> u32 { + self.tokens_count.unwrap_or(0) + } + + pub fn clear_tokens_count(&mut self) { + self.tokens_count = ::std::option::Option::None; + } + + pub fn has_tokens_count(&self) -> bool { + self.tokens_count.is_some() + } + + // Param is passed by value, moved + pub fn set_tokens_count(&mut self, v: u32) { + self.tokens_count = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "policy_id", + |m: &CardanoAssetGroup| { &m.policy_id }, + |m: &mut CardanoAssetGroup| { &mut m.policy_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tokens_count", + |m: &CardanoAssetGroup| { &m.tokens_count }, + |m: &mut CardanoAssetGroup| { &mut m.tokens_count }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoAssetGroup", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoAssetGroup { + const NAME: &'static str = "CardanoAssetGroup"; + + fn is_initialized(&self) -> bool { + if self.policy_id.is_none() { + return false; + } + if self.tokens_count.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.policy_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.tokens_count = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.policy_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.tokens_count { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.policy_id.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.tokens_count { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoAssetGroup { + CardanoAssetGroup::new() + } + + fn clear(&mut self) { + self.policy_id = ::std::option::Option::None; + self.tokens_count = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoAssetGroup { + static instance: CardanoAssetGroup = CardanoAssetGroup { + policy_id: ::std::option::Option::None, + tokens_count: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoAssetGroup { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoAssetGroup").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoAssetGroup { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoAssetGroup { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoToken) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoToken { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoToken.asset_name_bytes) + pub asset_name_bytes: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoToken.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoToken.mint_amount) + pub mint_amount: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoToken.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoToken { + fn default() -> &'a CardanoToken { + ::default_instance() + } +} + +impl CardanoToken { + pub fn new() -> CardanoToken { + ::std::default::Default::default() + } + + // required bytes asset_name_bytes = 1; + + pub fn asset_name_bytes(&self) -> &[u8] { + match self.asset_name_bytes.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_asset_name_bytes(&mut self) { + self.asset_name_bytes = ::std::option::Option::None; + } + + pub fn has_asset_name_bytes(&self) -> bool { + self.asset_name_bytes.is_some() + } + + // Param is passed by value, moved + pub fn set_asset_name_bytes(&mut self, v: ::std::vec::Vec) { + self.asset_name_bytes = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_asset_name_bytes(&mut self) -> &mut ::std::vec::Vec { + if self.asset_name_bytes.is_none() { + self.asset_name_bytes = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.asset_name_bytes.as_mut().unwrap() + } + + // Take field + pub fn take_asset_name_bytes(&mut self) -> ::std::vec::Vec { + self.asset_name_bytes.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint64 amount = 2; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional sint64 mint_amount = 3; + + pub fn mint_amount(&self) -> i64 { + self.mint_amount.unwrap_or(0) + } + + pub fn clear_mint_amount(&mut self) { + self.mint_amount = ::std::option::Option::None; + } + + pub fn has_mint_amount(&self) -> bool { + self.mint_amount.is_some() + } + + // Param is passed by value, moved + pub fn set_mint_amount(&mut self, v: i64) { + self.mint_amount = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "asset_name_bytes", + |m: &CardanoToken| { &m.asset_name_bytes }, + |m: &mut CardanoToken| { &mut m.asset_name_bytes }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &CardanoToken| { &m.amount }, + |m: &mut CardanoToken| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mint_amount", + |m: &CardanoToken| { &m.mint_amount }, + |m: &mut CardanoToken| { &mut m.mint_amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoToken", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoToken { + const NAME: &'static str = "CardanoToken"; + + fn is_initialized(&self) -> bool { + if self.asset_name_bytes.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.asset_name_bytes = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.mint_amount = ::std::option::Option::Some(is.read_sint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.asset_name_bytes.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.mint_amount { + my_size += ::protobuf::rt::sint64_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.asset_name_bytes.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.amount { + os.write_uint64(2, v)?; + } + if let Some(v) = self.mint_amount { + os.write_sint64(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoToken { + CardanoToken::new() + } + + fn clear(&mut self) { + self.asset_name_bytes = ::std::option::Option::None; + self.amount = ::std::option::Option::None; + self.mint_amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoToken { + static instance: CardanoToken = CardanoToken { + asset_name_bytes: ::std::option::Option::None, + amount: ::std::option::Option::None, + mint_amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoToken { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoToken").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoToken { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoToken { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxInlineDatumChunk) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxInlineDatumChunk { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxInlineDatumChunk.data) + pub data: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxInlineDatumChunk.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxInlineDatumChunk { + fn default() -> &'a CardanoTxInlineDatumChunk { + ::default_instance() + } +} + +impl CardanoTxInlineDatumChunk { + pub fn new() -> CardanoTxInlineDatumChunk { + ::std::default::Default::default() + } + + // required bytes data = 1; + + pub fn data(&self) -> &[u8] { + match self.data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data(&mut self) { + self.data = ::std::option::Option::None; + } + + pub fn has_data(&self) -> bool { + self.data.is_some() + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data.as_mut().unwrap() + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data", + |m: &CardanoTxInlineDatumChunk| { &m.data }, + |m: &mut CardanoTxInlineDatumChunk| { &mut m.data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxInlineDatumChunk", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxInlineDatumChunk { + const NAME: &'static str = "CardanoTxInlineDatumChunk"; + + fn is_initialized(&self) -> bool { + if self.data.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.data = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxInlineDatumChunk { + CardanoTxInlineDatumChunk::new() + } + + fn clear(&mut self) { + self.data = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxInlineDatumChunk { + static instance: CardanoTxInlineDatumChunk = CardanoTxInlineDatumChunk { + data: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxInlineDatumChunk { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxInlineDatumChunk").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxInlineDatumChunk { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxInlineDatumChunk { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxReferenceScriptChunk) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxReferenceScriptChunk { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxReferenceScriptChunk.data) + pub data: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxReferenceScriptChunk.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxReferenceScriptChunk { + fn default() -> &'a CardanoTxReferenceScriptChunk { + ::default_instance() + } +} + +impl CardanoTxReferenceScriptChunk { + pub fn new() -> CardanoTxReferenceScriptChunk { + ::std::default::Default::default() + } + + // required bytes data = 1; + + pub fn data(&self) -> &[u8] { + match self.data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data(&mut self) { + self.data = ::std::option::Option::None; + } + + pub fn has_data(&self) -> bool { + self.data.is_some() + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data.as_mut().unwrap() + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data", + |m: &CardanoTxReferenceScriptChunk| { &m.data }, + |m: &mut CardanoTxReferenceScriptChunk| { &mut m.data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxReferenceScriptChunk", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxReferenceScriptChunk { + const NAME: &'static str = "CardanoTxReferenceScriptChunk"; + + fn is_initialized(&self) -> bool { + if self.data.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.data = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxReferenceScriptChunk { + CardanoTxReferenceScriptChunk::new() + } + + fn clear(&mut self) { + self.data = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxReferenceScriptChunk { + static instance: CardanoTxReferenceScriptChunk = CardanoTxReferenceScriptChunk { + data: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxReferenceScriptChunk { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxReferenceScriptChunk").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxReferenceScriptChunk { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxReferenceScriptChunk { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolOwner) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoPoolOwner { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolOwner.staking_key_path) + pub staking_key_path: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolOwner.staking_key_hash) + pub staking_key_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolOwner.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoPoolOwner { + fn default() -> &'a CardanoPoolOwner { + ::default_instance() + } +} + +impl CardanoPoolOwner { + pub fn new() -> CardanoPoolOwner { + ::std::default::Default::default() + } + + // optional bytes staking_key_hash = 2; + + pub fn staking_key_hash(&self) -> &[u8] { + match self.staking_key_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_staking_key_hash(&mut self) { + self.staking_key_hash = ::std::option::Option::None; + } + + pub fn has_staking_key_hash(&self) -> bool { + self.staking_key_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_staking_key_hash(&mut self, v: ::std::vec::Vec) { + self.staking_key_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_staking_key_hash(&mut self) -> &mut ::std::vec::Vec { + if self.staking_key_hash.is_none() { + self.staking_key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.staking_key_hash.as_mut().unwrap() + } + + // Take field + pub fn take_staking_key_hash(&mut self) -> ::std::vec::Vec { + self.staking_key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "staking_key_path", + |m: &CardanoPoolOwner| { &m.staking_key_path }, + |m: &mut CardanoPoolOwner| { &mut m.staking_key_path }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "staking_key_hash", + |m: &CardanoPoolOwner| { &m.staking_key_hash }, + |m: &mut CardanoPoolOwner| { &mut m.staking_key_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoPoolOwner", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoPoolOwner { + const NAME: &'static str = "CardanoPoolOwner"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.staking_key_path)?; + }, + 8 => { + self.staking_key_path.push(is.read_uint32()?); + }, + 18 => { + self.staking_key_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.staking_key_path { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.staking_key_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.staking_key_path { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.staking_key_hash.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoPoolOwner { + CardanoPoolOwner::new() + } + + fn clear(&mut self) { + self.staking_key_path.clear(); + self.staking_key_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoPoolOwner { + static instance: CardanoPoolOwner = CardanoPoolOwner { + staking_key_path: ::std::vec::Vec::new(), + staking_key_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoPoolOwner { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolOwner").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoPoolOwner { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoPoolOwner { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolRelayParameters) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoPoolRelayParameters { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.ipv4_address) + pub ipv4_address: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.ipv6_address) + pub ipv6_address: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.host_name) + pub host_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.port) + pub port: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoPoolRelayParameters { + fn default() -> &'a CardanoPoolRelayParameters { + ::default_instance() + } +} + +impl CardanoPoolRelayParameters { + pub fn new() -> CardanoPoolRelayParameters { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoPoolRelayType type = 1; + + pub fn type_(&self) -> CardanoPoolRelayType { + match self.type_ { + Some(e) => e.enum_value_or(CardanoPoolRelayType::SINGLE_HOST_IP), + None => CardanoPoolRelayType::SINGLE_HOST_IP, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: CardanoPoolRelayType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes ipv4_address = 2; + + pub fn ipv4_address(&self) -> &[u8] { + match self.ipv4_address.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ipv4_address(&mut self) { + self.ipv4_address = ::std::option::Option::None; + } + + pub fn has_ipv4_address(&self) -> bool { + self.ipv4_address.is_some() + } + + // Param is passed by value, moved + pub fn set_ipv4_address(&mut self, v: ::std::vec::Vec) { + self.ipv4_address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ipv4_address(&mut self) -> &mut ::std::vec::Vec { + if self.ipv4_address.is_none() { + self.ipv4_address = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ipv4_address.as_mut().unwrap() + } + + // Take field + pub fn take_ipv4_address(&mut self) -> ::std::vec::Vec { + self.ipv4_address.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes ipv6_address = 3; + + pub fn ipv6_address(&self) -> &[u8] { + match self.ipv6_address.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ipv6_address(&mut self) { + self.ipv6_address = ::std::option::Option::None; + } + + pub fn has_ipv6_address(&self) -> bool { + self.ipv6_address.is_some() + } + + // Param is passed by value, moved + pub fn set_ipv6_address(&mut self, v: ::std::vec::Vec) { + self.ipv6_address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ipv6_address(&mut self) -> &mut ::std::vec::Vec { + if self.ipv6_address.is_none() { + self.ipv6_address = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ipv6_address.as_mut().unwrap() + } + + // Take field + pub fn take_ipv6_address(&mut self) -> ::std::vec::Vec { + self.ipv6_address.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string host_name = 4; + + pub fn host_name(&self) -> &str { + match self.host_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_host_name(&mut self) { + self.host_name = ::std::option::Option::None; + } + + pub fn has_host_name(&self) -> bool { + self.host_name.is_some() + } + + // Param is passed by value, moved + pub fn set_host_name(&mut self, v: ::std::string::String) { + self.host_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_host_name(&mut self) -> &mut ::std::string::String { + if self.host_name.is_none() { + self.host_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.host_name.as_mut().unwrap() + } + + // Take field + pub fn take_host_name(&mut self) -> ::std::string::String { + self.host_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 port = 5; + + pub fn port(&self) -> u32 { + self.port.unwrap_or(0) + } + + pub fn clear_port(&mut self) { + self.port = ::std::option::Option::None; + } + + pub fn has_port(&self) -> bool { + self.port.is_some() + } + + // Param is passed by value, moved + pub fn set_port(&mut self, v: u32) { + self.port = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &CardanoPoolRelayParameters| { &m.type_ }, + |m: &mut CardanoPoolRelayParameters| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ipv4_address", + |m: &CardanoPoolRelayParameters| { &m.ipv4_address }, + |m: &mut CardanoPoolRelayParameters| { &mut m.ipv4_address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ipv6_address", + |m: &CardanoPoolRelayParameters| { &m.ipv6_address }, + |m: &mut CardanoPoolRelayParameters| { &mut m.ipv6_address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "host_name", + |m: &CardanoPoolRelayParameters| { &m.host_name }, + |m: &mut CardanoPoolRelayParameters| { &mut m.host_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "port", + |m: &CardanoPoolRelayParameters| { &m.port }, + |m: &mut CardanoPoolRelayParameters| { &mut m.port }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoPoolRelayParameters", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoPoolRelayParameters { + const NAME: &'static str = "CardanoPoolRelayParameters"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.ipv4_address = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.ipv6_address = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.host_name = ::std::option::Option::Some(is.read_string()?); + }, + 40 => { + self.port = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.ipv4_address.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.ipv6_address.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.host_name.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.port { + my_size += ::protobuf::rt::uint32_size(5, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.ipv4_address.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.ipv6_address.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.host_name.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.port { + os.write_uint32(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoPoolRelayParameters { + CardanoPoolRelayParameters::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.ipv4_address = ::std::option::Option::None; + self.ipv6_address = ::std::option::Option::None; + self.host_name = ::std::option::Option::None; + self.port = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoPoolRelayParameters { + static instance: CardanoPoolRelayParameters = CardanoPoolRelayParameters { + type_: ::std::option::Option::None, + ipv4_address: ::std::option::Option::None, + ipv6_address: ::std::option::Option::None, + host_name: ::std::option::Option::None, + port: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoPoolRelayParameters { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolRelayParameters").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoPoolRelayParameters { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoPoolRelayParameters { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolMetadataType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoPoolMetadataType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolMetadataType.url) + pub url: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolMetadataType.hash) + pub hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolMetadataType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoPoolMetadataType { + fn default() -> &'a CardanoPoolMetadataType { + ::default_instance() + } +} + +impl CardanoPoolMetadataType { + pub fn new() -> CardanoPoolMetadataType { + ::std::default::Default::default() + } + + // required string url = 1; + + pub fn url(&self) -> &str { + match self.url.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_url(&mut self) { + self.url = ::std::option::Option::None; + } + + pub fn has_url(&self) -> bool { + self.url.is_some() + } + + // Param is passed by value, moved + pub fn set_url(&mut self, v: ::std::string::String) { + self.url = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_url(&mut self) -> &mut ::std::string::String { + if self.url.is_none() { + self.url = ::std::option::Option::Some(::std::string::String::new()); + } + self.url.as_mut().unwrap() + } + + // Take field + pub fn take_url(&mut self) -> ::std::string::String { + self.url.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes hash = 2; + + pub fn hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "url", + |m: &CardanoPoolMetadataType| { &m.url }, + |m: &mut CardanoPoolMetadataType| { &mut m.url }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hash", + |m: &CardanoPoolMetadataType| { &m.hash }, + |m: &mut CardanoPoolMetadataType| { &mut m.hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoPoolMetadataType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoPoolMetadataType { + const NAME: &'static str = "CardanoPoolMetadataType"; + + fn is_initialized(&self) -> bool { + if self.url.is_none() { + return false; + } + if self.hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.url = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.url.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.url.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.hash.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoPoolMetadataType { + CardanoPoolMetadataType::new() + } + + fn clear(&mut self) { + self.url = ::std::option::Option::None; + self.hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoPoolMetadataType { + static instance: CardanoPoolMetadataType = CardanoPoolMetadataType { + url: ::std::option::Option::None, + hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoPoolMetadataType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolMetadataType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoPoolMetadataType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoPoolMetadataType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolParametersType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoPoolParametersType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.pool_id) + pub pool_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.vrf_key_hash) + pub vrf_key_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.pledge) + pub pledge: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.cost) + pub cost: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.margin_numerator) + pub margin_numerator: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.margin_denominator) + pub margin_denominator: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.reward_account) + pub reward_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.metadata) + pub metadata: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.owners_count) + pub owners_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.relays_count) + pub relays_count: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolParametersType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoPoolParametersType { + fn default() -> &'a CardanoPoolParametersType { + ::default_instance() + } +} + +impl CardanoPoolParametersType { + pub fn new() -> CardanoPoolParametersType { + ::std::default::Default::default() + } + + // required bytes pool_id = 1; + + pub fn pool_id(&self) -> &[u8] { + match self.pool_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pool_id(&mut self) { + self.pool_id = ::std::option::Option::None; + } + + pub fn has_pool_id(&self) -> bool { + self.pool_id.is_some() + } + + // Param is passed by value, moved + pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { + self.pool_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { + if self.pool_id.is_none() { + self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pool_id.as_mut().unwrap() + } + + // Take field + pub fn take_pool_id(&mut self) -> ::std::vec::Vec { + self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes vrf_key_hash = 2; + + pub fn vrf_key_hash(&self) -> &[u8] { + match self.vrf_key_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vrf_key_hash(&mut self) { + self.vrf_key_hash = ::std::option::Option::None; + } + + pub fn has_vrf_key_hash(&self) -> bool { + self.vrf_key_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_vrf_key_hash(&mut self, v: ::std::vec::Vec) { + self.vrf_key_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vrf_key_hash(&mut self) -> &mut ::std::vec::Vec { + if self.vrf_key_hash.is_none() { + self.vrf_key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vrf_key_hash.as_mut().unwrap() + } + + // Take field + pub fn take_vrf_key_hash(&mut self) -> ::std::vec::Vec { + self.vrf_key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 pledge = 3; + + pub fn pledge(&self) -> u64 { + self.pledge.unwrap_or(0) + } + + pub fn clear_pledge(&mut self) { + self.pledge = ::std::option::Option::None; + } + + pub fn has_pledge(&self) -> bool { + self.pledge.is_some() + } + + // Param is passed by value, moved + pub fn set_pledge(&mut self, v: u64) { + self.pledge = ::std::option::Option::Some(v); + } + + // required uint64 cost = 4; + + pub fn cost(&self) -> u64 { + self.cost.unwrap_or(0) + } + + pub fn clear_cost(&mut self) { + self.cost = ::std::option::Option::None; + } + + pub fn has_cost(&self) -> bool { + self.cost.is_some() + } + + // Param is passed by value, moved + pub fn set_cost(&mut self, v: u64) { + self.cost = ::std::option::Option::Some(v); + } + + // required uint64 margin_numerator = 5; + + pub fn margin_numerator(&self) -> u64 { + self.margin_numerator.unwrap_or(0) + } + + pub fn clear_margin_numerator(&mut self) { + self.margin_numerator = ::std::option::Option::None; + } + + pub fn has_margin_numerator(&self) -> bool { + self.margin_numerator.is_some() + } + + // Param is passed by value, moved + pub fn set_margin_numerator(&mut self, v: u64) { + self.margin_numerator = ::std::option::Option::Some(v); + } + + // required uint64 margin_denominator = 6; + + pub fn margin_denominator(&self) -> u64 { + self.margin_denominator.unwrap_or(0) + } + + pub fn clear_margin_denominator(&mut self) { + self.margin_denominator = ::std::option::Option::None; + } + + pub fn has_margin_denominator(&self) -> bool { + self.margin_denominator.is_some() + } + + // Param is passed by value, moved + pub fn set_margin_denominator(&mut self, v: u64) { + self.margin_denominator = ::std::option::Option::Some(v); + } + + // required string reward_account = 7; + + pub fn reward_account(&self) -> &str { + match self.reward_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_reward_account(&mut self) { + self.reward_account = ::std::option::Option::None; + } + + pub fn has_reward_account(&self) -> bool { + self.reward_account.is_some() + } + + // Param is passed by value, moved + pub fn set_reward_account(&mut self, v: ::std::string::String) { + self.reward_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_reward_account(&mut self) -> &mut ::std::string::String { + if self.reward_account.is_none() { + self.reward_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.reward_account.as_mut().unwrap() + } + + // Take field + pub fn take_reward_account(&mut self) -> ::std::string::String { + self.reward_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint32 owners_count = 11; + + pub fn owners_count(&self) -> u32 { + self.owners_count.unwrap_or(0) + } + + pub fn clear_owners_count(&mut self) { + self.owners_count = ::std::option::Option::None; + } + + pub fn has_owners_count(&self) -> bool { + self.owners_count.is_some() + } + + // Param is passed by value, moved + pub fn set_owners_count(&mut self, v: u32) { + self.owners_count = ::std::option::Option::Some(v); + } + + // required uint32 relays_count = 12; + + pub fn relays_count(&self) -> u32 { + self.relays_count.unwrap_or(0) + } + + pub fn clear_relays_count(&mut self) { + self.relays_count = ::std::option::Option::None; + } + + pub fn has_relays_count(&self) -> bool { + self.relays_count.is_some() + } + + // Param is passed by value, moved + pub fn set_relays_count(&mut self, v: u32) { + self.relays_count = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(10); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pool_id", + |m: &CardanoPoolParametersType| { &m.pool_id }, + |m: &mut CardanoPoolParametersType| { &mut m.pool_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vrf_key_hash", + |m: &CardanoPoolParametersType| { &m.vrf_key_hash }, + |m: &mut CardanoPoolParametersType| { &mut m.vrf_key_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pledge", + |m: &CardanoPoolParametersType| { &m.pledge }, + |m: &mut CardanoPoolParametersType| { &mut m.pledge }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "cost", + |m: &CardanoPoolParametersType| { &m.cost }, + |m: &mut CardanoPoolParametersType| { &mut m.cost }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "margin_numerator", + |m: &CardanoPoolParametersType| { &m.margin_numerator }, + |m: &mut CardanoPoolParametersType| { &mut m.margin_numerator }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "margin_denominator", + |m: &CardanoPoolParametersType| { &m.margin_denominator }, + |m: &mut CardanoPoolParametersType| { &mut m.margin_denominator }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "reward_account", + |m: &CardanoPoolParametersType| { &m.reward_account }, + |m: &mut CardanoPoolParametersType| { &mut m.reward_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoPoolMetadataType>( + "metadata", + |m: &CardanoPoolParametersType| { &m.metadata }, + |m: &mut CardanoPoolParametersType| { &mut m.metadata }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "owners_count", + |m: &CardanoPoolParametersType| { &m.owners_count }, + |m: &mut CardanoPoolParametersType| { &mut m.owners_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "relays_count", + |m: &CardanoPoolParametersType| { &m.relays_count }, + |m: &mut CardanoPoolParametersType| { &mut m.relays_count }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoPoolParametersType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoPoolParametersType { + const NAME: &'static str = "CardanoPoolParametersType"; + + fn is_initialized(&self) -> bool { + if self.pool_id.is_none() { + return false; + } + if self.vrf_key_hash.is_none() { + return false; + } + if self.pledge.is_none() { + return false; + } + if self.cost.is_none() { + return false; + } + if self.margin_numerator.is_none() { + return false; + } + if self.margin_denominator.is_none() { + return false; + } + if self.reward_account.is_none() { + return false; + } + if self.owners_count.is_none() { + return false; + } + if self.relays_count.is_none() { + return false; + } + for v in &self.metadata { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.pool_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.vrf_key_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.pledge = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.cost = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.margin_numerator = ::std::option::Option::Some(is.read_uint64()?); + }, + 48 => { + self.margin_denominator = ::std::option::Option::Some(is.read_uint64()?); + }, + 58 => { + self.reward_account = ::std::option::Option::Some(is.read_string()?); + }, + 82 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.metadata)?; + }, + 88 => { + self.owners_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 96 => { + self.relays_count = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.pool_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.vrf_key_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.pledge { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.cost { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.margin_numerator { + my_size += ::protobuf::rt::uint64_size(5, v); + } + if let Some(v) = self.margin_denominator { + my_size += ::protobuf::rt::uint64_size(6, v); + } + if let Some(v) = self.reward_account.as_ref() { + my_size += ::protobuf::rt::string_size(7, &v); + } + if let Some(v) = self.metadata.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.owners_count { + my_size += ::protobuf::rt::uint32_size(11, v); + } + if let Some(v) = self.relays_count { + my_size += ::protobuf::rt::uint32_size(12, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.pool_id.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.vrf_key_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.pledge { + os.write_uint64(3, v)?; + } + if let Some(v) = self.cost { + os.write_uint64(4, v)?; + } + if let Some(v) = self.margin_numerator { + os.write_uint64(5, v)?; + } + if let Some(v) = self.margin_denominator { + os.write_uint64(6, v)?; + } + if let Some(v) = self.reward_account.as_ref() { + os.write_string(7, v)?; + } + if let Some(v) = self.metadata.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; + } + if let Some(v) = self.owners_count { + os.write_uint32(11, v)?; + } + if let Some(v) = self.relays_count { + os.write_uint32(12, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoPoolParametersType { + CardanoPoolParametersType::new() + } + + fn clear(&mut self) { + self.pool_id = ::std::option::Option::None; + self.vrf_key_hash = ::std::option::Option::None; + self.pledge = ::std::option::Option::None; + self.cost = ::std::option::Option::None; + self.margin_numerator = ::std::option::Option::None; + self.margin_denominator = ::std::option::Option::None; + self.reward_account = ::std::option::Option::None; + self.metadata.clear(); + self.owners_count = ::std::option::Option::None; + self.relays_count = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoPoolParametersType { + static instance: CardanoPoolParametersType = CardanoPoolParametersType { + pool_id: ::std::option::Option::None, + vrf_key_hash: ::std::option::Option::None, + pledge: ::std::option::Option::None, + cost: ::std::option::Option::None, + margin_numerator: ::std::option::Option::None, + margin_denominator: ::std::option::Option::None, + reward_account: ::std::option::Option::None, + metadata: ::protobuf::MessageField::none(), + owners_count: ::std::option::Option::None, + relays_count: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoPoolParametersType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolParametersType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoPoolParametersType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoPoolParametersType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxCertificate) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxCertificate { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.path) + pub path: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.pool) + pub pool: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.pool_parameters) + pub pool_parameters: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.script_hash) + pub script_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.key_hash) + pub key_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxCertificate.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxCertificate { + fn default() -> &'a CardanoTxCertificate { + ::default_instance() + } +} + +impl CardanoTxCertificate { + pub fn new() -> CardanoTxCertificate { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoCertificateType type = 1; + + pub fn type_(&self) -> CardanoCertificateType { + match self.type_ { + Some(e) => e.enum_value_or(CardanoCertificateType::STAKE_REGISTRATION), + None => CardanoCertificateType::STAKE_REGISTRATION, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: CardanoCertificateType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes pool = 3; + + pub fn pool(&self) -> &[u8] { + match self.pool.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pool(&mut self) { + self.pool = ::std::option::Option::None; + } + + pub fn has_pool(&self) -> bool { + self.pool.is_some() + } + + // Param is passed by value, moved + pub fn set_pool(&mut self, v: ::std::vec::Vec) { + self.pool = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pool(&mut self) -> &mut ::std::vec::Vec { + if self.pool.is_none() { + self.pool = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pool.as_mut().unwrap() + } + + // Take field + pub fn take_pool(&mut self) -> ::std::vec::Vec { + self.pool.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes script_hash = 5; + + pub fn script_hash(&self) -> &[u8] { + match self.script_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_hash(&mut self) { + self.script_hash = ::std::option::Option::None; + } + + pub fn has_script_hash(&self) -> bool { + self.script_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_script_hash(&mut self, v: ::std::vec::Vec) { + self.script_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_hash(&mut self) -> &mut ::std::vec::Vec { + if self.script_hash.is_none() { + self.script_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_hash.as_mut().unwrap() + } + + // Take field + pub fn take_script_hash(&mut self) -> ::std::vec::Vec { + self.script_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes key_hash = 6; + + pub fn key_hash(&self) -> &[u8] { + match self.key_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_key_hash(&mut self) { + self.key_hash = ::std::option::Option::None; + } + + pub fn has_key_hash(&self) -> bool { + self.key_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { + self.key_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { + if self.key_hash.is_none() { + self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.key_hash.as_mut().unwrap() + } + + // Take field + pub fn take_key_hash(&mut self) -> ::std::vec::Vec { + self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &CardanoTxCertificate| { &m.type_ }, + |m: &mut CardanoTxCertificate| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "path", + |m: &CardanoTxCertificate| { &m.path }, + |m: &mut CardanoTxCertificate| { &mut m.path }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pool", + |m: &CardanoTxCertificate| { &m.pool }, + |m: &mut CardanoTxCertificate| { &mut m.pool }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoPoolParametersType>( + "pool_parameters", + |m: &CardanoTxCertificate| { &m.pool_parameters }, + |m: &mut CardanoTxCertificate| { &mut m.pool_parameters }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_hash", + |m: &CardanoTxCertificate| { &m.script_hash }, + |m: &mut CardanoTxCertificate| { &mut m.script_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key_hash", + |m: &CardanoTxCertificate| { &m.key_hash }, + |m: &mut CardanoTxCertificate| { &mut m.key_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxCertificate", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxCertificate { + const NAME: &'static str = "CardanoTxCertificate"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + for v in &self.pool_parameters { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.path)?; + }, + 16 => { + self.path.push(is.read_uint32()?); + }, + 26 => { + self.pool = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.pool_parameters)?; + }, + 42 => { + self.script_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.key_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + for value in &self.path { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.pool.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.pool_parameters.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.script_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.key_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + for v in &self.path { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.pool.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.pool_parameters.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.script_hash.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.key_hash.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxCertificate { + CardanoTxCertificate::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.path.clear(); + self.pool = ::std::option::Option::None; + self.pool_parameters.clear(); + self.script_hash = ::std::option::Option::None; + self.key_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxCertificate { + static instance: CardanoTxCertificate = CardanoTxCertificate { + type_: ::std::option::Option::None, + path: ::std::vec::Vec::new(), + pool: ::std::option::Option::None, + pool_parameters: ::protobuf::MessageField::none(), + script_hash: ::std::option::Option::None, + key_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxCertificate { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxCertificate").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxCertificate { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxCertificate { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxWithdrawal) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxWithdrawal { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.path) + pub path: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.script_hash) + pub script_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.key_hash) + pub key_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxWithdrawal.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxWithdrawal { + fn default() -> &'a CardanoTxWithdrawal { + ::default_instance() + } +} + +impl CardanoTxWithdrawal { + pub fn new() -> CardanoTxWithdrawal { + ::std::default::Default::default() + } + + // required uint64 amount = 2; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional bytes script_hash = 3; + + pub fn script_hash(&self) -> &[u8] { + match self.script_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script_hash(&mut self) { + self.script_hash = ::std::option::Option::None; + } + + pub fn has_script_hash(&self) -> bool { + self.script_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_script_hash(&mut self, v: ::std::vec::Vec) { + self.script_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script_hash(&mut self) -> &mut ::std::vec::Vec { + if self.script_hash.is_none() { + self.script_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script_hash.as_mut().unwrap() + } + + // Take field + pub fn take_script_hash(&mut self) -> ::std::vec::Vec { + self.script_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes key_hash = 4; + + pub fn key_hash(&self) -> &[u8] { + match self.key_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_key_hash(&mut self) { + self.key_hash = ::std::option::Option::None; + } + + pub fn has_key_hash(&self) -> bool { + self.key_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { + self.key_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { + if self.key_hash.is_none() { + self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.key_hash.as_mut().unwrap() + } + + // Take field + pub fn take_key_hash(&mut self) -> ::std::vec::Vec { + self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "path", + |m: &CardanoTxWithdrawal| { &m.path }, + |m: &mut CardanoTxWithdrawal| { &mut m.path }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &CardanoTxWithdrawal| { &m.amount }, + |m: &mut CardanoTxWithdrawal| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script_hash", + |m: &CardanoTxWithdrawal| { &m.script_hash }, + |m: &mut CardanoTxWithdrawal| { &mut m.script_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key_hash", + |m: &CardanoTxWithdrawal| { &m.key_hash }, + |m: &mut CardanoTxWithdrawal| { &mut m.key_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxWithdrawal", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxWithdrawal { + const NAME: &'static str = "CardanoTxWithdrawal"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.path)?; + }, + 8 => { + self.path.push(is.read_uint32()?); + }, + 16 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + self.script_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.key_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.path { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.script_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.key_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.path { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.amount { + os.write_uint64(2, v)?; + } + if let Some(v) = self.script_hash.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.key_hash.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxWithdrawal { + CardanoTxWithdrawal::new() + } + + fn clear(&mut self) { + self.path.clear(); + self.amount = ::std::option::Option::None; + self.script_hash = ::std::option::Option::None; + self.key_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxWithdrawal { + static instance: CardanoTxWithdrawal = CardanoTxWithdrawal { + path: ::std::vec::Vec::new(), + amount: ::std::option::Option::None, + script_hash: ::std::option::Option::None, + key_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxWithdrawal { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxWithdrawal").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxWithdrawal { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxWithdrawal { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoCVoteRegistrationDelegation { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation.vote_public_key) + pub vote_public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation.weight) + pub weight: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoCVoteRegistrationDelegation { + fn default() -> &'a CardanoCVoteRegistrationDelegation { + ::default_instance() + } +} + +impl CardanoCVoteRegistrationDelegation { + pub fn new() -> CardanoCVoteRegistrationDelegation { + ::std::default::Default::default() + } + + // required bytes vote_public_key = 1; + + pub fn vote_public_key(&self) -> &[u8] { + match self.vote_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vote_public_key(&mut self) { + self.vote_public_key = ::std::option::Option::None; + } + + pub fn has_vote_public_key(&self) -> bool { + self.vote_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_vote_public_key(&mut self, v: ::std::vec::Vec) { + self.vote_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vote_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.vote_public_key.is_none() { + self.vote_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vote_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_vote_public_key(&mut self) -> ::std::vec::Vec { + self.vote_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 weight = 2; + + pub fn weight(&self) -> u32 { + self.weight.unwrap_or(0) + } + + pub fn clear_weight(&mut self) { + self.weight = ::std::option::Option::None; + } + + pub fn has_weight(&self) -> bool { + self.weight.is_some() + } + + // Param is passed by value, moved + pub fn set_weight(&mut self, v: u32) { + self.weight = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vote_public_key", + |m: &CardanoCVoteRegistrationDelegation| { &m.vote_public_key }, + |m: &mut CardanoCVoteRegistrationDelegation| { &mut m.vote_public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "weight", + |m: &CardanoCVoteRegistrationDelegation| { &m.weight }, + |m: &mut CardanoCVoteRegistrationDelegation| { &mut m.weight }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoCVoteRegistrationDelegation", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoCVoteRegistrationDelegation { + const NAME: &'static str = "CardanoCVoteRegistrationDelegation"; + + fn is_initialized(&self) -> bool { + if self.vote_public_key.is_none() { + return false; + } + if self.weight.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.vote_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.weight = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.vote_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.weight { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.vote_public_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.weight { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoCVoteRegistrationDelegation { + CardanoCVoteRegistrationDelegation::new() + } + + fn clear(&mut self) { + self.vote_public_key = ::std::option::Option::None; + self.weight = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoCVoteRegistrationDelegation { + static instance: CardanoCVoteRegistrationDelegation = CardanoCVoteRegistrationDelegation { + vote_public_key: ::std::option::Option::None, + weight: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoCVoteRegistrationDelegation { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoCVoteRegistrationDelegation").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoCVoteRegistrationDelegation { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoCVoteRegistrationDelegation { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoCVoteRegistrationParametersType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.vote_public_key) + pub vote_public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.staking_path) + pub staking_path: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.payment_address_parameters) + pub payment_address_parameters: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.nonce) + pub nonce: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.format) + pub format: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.delegations) + pub delegations: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.voting_purpose) + pub voting_purpose: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.payment_address) + pub payment_address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoCVoteRegistrationParametersType { + fn default() -> &'a CardanoCVoteRegistrationParametersType { + ::default_instance() + } +} + +impl CardanoCVoteRegistrationParametersType { + pub fn new() -> CardanoCVoteRegistrationParametersType { + ::std::default::Default::default() + } + + // optional bytes vote_public_key = 1; + + pub fn vote_public_key(&self) -> &[u8] { + match self.vote_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vote_public_key(&mut self) { + self.vote_public_key = ::std::option::Option::None; + } + + pub fn has_vote_public_key(&self) -> bool { + self.vote_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_vote_public_key(&mut self, v: ::std::vec::Vec) { + self.vote_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vote_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.vote_public_key.is_none() { + self.vote_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vote_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_vote_public_key(&mut self) -> ::std::vec::Vec { + self.vote_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 nonce = 4; + + pub fn nonce(&self) -> u64 { + self.nonce.unwrap_or(0) + } + + pub fn clear_nonce(&mut self) { + self.nonce = ::std::option::Option::None; + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: u64) { + self.nonce = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat format = 5; + + pub fn format(&self) -> CardanoCVoteRegistrationFormat { + match self.format { + Some(e) => e.enum_value_or(CardanoCVoteRegistrationFormat::CIP15), + None => CardanoCVoteRegistrationFormat::CIP15, + } + } + + pub fn clear_format(&mut self) { + self.format = ::std::option::Option::None; + } + + pub fn has_format(&self) -> bool { + self.format.is_some() + } + + // Param is passed by value, moved + pub fn set_format(&mut self, v: CardanoCVoteRegistrationFormat) { + self.format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint64 voting_purpose = 7; + + pub fn voting_purpose(&self) -> u64 { + self.voting_purpose.unwrap_or(0) + } + + pub fn clear_voting_purpose(&mut self) { + self.voting_purpose = ::std::option::Option::None; + } + + pub fn has_voting_purpose(&self) -> bool { + self.voting_purpose.is_some() + } + + // Param is passed by value, moved + pub fn set_voting_purpose(&mut self, v: u64) { + self.voting_purpose = ::std::option::Option::Some(v); + } + + // optional string payment_address = 8; + + pub fn payment_address(&self) -> &str { + match self.payment_address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_payment_address(&mut self) { + self.payment_address = ::std::option::Option::None; + } + + pub fn has_payment_address(&self) -> bool { + self.payment_address.is_some() + } + + // Param is passed by value, moved + pub fn set_payment_address(&mut self, v: ::std::string::String) { + self.payment_address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payment_address(&mut self) -> &mut ::std::string::String { + if self.payment_address.is_none() { + self.payment_address = ::std::option::Option::Some(::std::string::String::new()); + } + self.payment_address.as_mut().unwrap() + } + + // Take field + pub fn take_payment_address(&mut self) -> ::std::string::String { + self.payment_address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vote_public_key", + |m: &CardanoCVoteRegistrationParametersType| { &m.vote_public_key }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.vote_public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "staking_path", + |m: &CardanoCVoteRegistrationParametersType| { &m.staking_path }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.staking_path }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoAddressParametersType>( + "payment_address_parameters", + |m: &CardanoCVoteRegistrationParametersType| { &m.payment_address_parameters }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.payment_address_parameters }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce", + |m: &CardanoCVoteRegistrationParametersType| { &m.nonce }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.nonce }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "format", + |m: &CardanoCVoteRegistrationParametersType| { &m.format }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.format }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "delegations", + |m: &CardanoCVoteRegistrationParametersType| { &m.delegations }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.delegations }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "voting_purpose", + |m: &CardanoCVoteRegistrationParametersType| { &m.voting_purpose }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.voting_purpose }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payment_address", + |m: &CardanoCVoteRegistrationParametersType| { &m.payment_address }, + |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.payment_address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoCVoteRegistrationParametersType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoCVoteRegistrationParametersType { + const NAME: &'static str = "CardanoCVoteRegistrationParametersType"; + + fn is_initialized(&self) -> bool { + if self.nonce.is_none() { + return false; + } + for v in &self.payment_address_parameters { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delegations { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.vote_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.staking_path)?; + }, + 16 => { + self.staking_path.push(is.read_uint32()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.payment_address_parameters)?; + }, + 32 => { + self.nonce = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.format = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 50 => { + self.delegations.push(is.read_message()?); + }, + 56 => { + self.voting_purpose = ::std::option::Option::Some(is.read_uint64()?); + }, + 66 => { + self.payment_address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.vote_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + for value in &self.staking_path { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.payment_address_parameters.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.nonce { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.format { + my_size += ::protobuf::rt::int32_size(5, v.value()); + } + for value in &self.delegations { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.voting_purpose { + my_size += ::protobuf::rt::uint64_size(7, v); + } + if let Some(v) = self.payment_address.as_ref() { + my_size += ::protobuf::rt::string_size(8, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.vote_public_key.as_ref() { + os.write_bytes(1, v)?; + } + for v in &self.staking_path { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.payment_address_parameters.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.nonce { + os.write_uint64(4, v)?; + } + if let Some(v) = self.format { + os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; + } + for v in &self.delegations { + ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; + }; + if let Some(v) = self.voting_purpose { + os.write_uint64(7, v)?; + } + if let Some(v) = self.payment_address.as_ref() { + os.write_string(8, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoCVoteRegistrationParametersType { + CardanoCVoteRegistrationParametersType::new() + } + + fn clear(&mut self) { + self.vote_public_key = ::std::option::Option::None; + self.staking_path.clear(); + self.payment_address_parameters.clear(); + self.nonce = ::std::option::Option::None; + self.format = ::std::option::Option::None; + self.delegations.clear(); + self.voting_purpose = ::std::option::Option::None; + self.payment_address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoCVoteRegistrationParametersType { + static instance: CardanoCVoteRegistrationParametersType = CardanoCVoteRegistrationParametersType { + vote_public_key: ::std::option::Option::None, + staking_path: ::std::vec::Vec::new(), + payment_address_parameters: ::protobuf::MessageField::none(), + nonce: ::std::option::Option::None, + format: ::std::option::Option::None, + delegations: ::std::vec::Vec::new(), + voting_purpose: ::std::option::Option::None, + payment_address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoCVoteRegistrationParametersType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoCVoteRegistrationParametersType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoCVoteRegistrationParametersType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoCVoteRegistrationParametersType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxAuxiliaryData) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxAuxiliaryData { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryData.cvote_registration_parameters) + pub cvote_registration_parameters: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryData.hash) + pub hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxAuxiliaryData.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxAuxiliaryData { + fn default() -> &'a CardanoTxAuxiliaryData { + ::default_instance() + } +} + +impl CardanoTxAuxiliaryData { + pub fn new() -> CardanoTxAuxiliaryData { + ::std::default::Default::default() + } + + // optional bytes hash = 2; + + pub fn hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoCVoteRegistrationParametersType>( + "cvote_registration_parameters", + |m: &CardanoTxAuxiliaryData| { &m.cvote_registration_parameters }, + |m: &mut CardanoTxAuxiliaryData| { &mut m.cvote_registration_parameters }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hash", + |m: &CardanoTxAuxiliaryData| { &m.hash }, + |m: &mut CardanoTxAuxiliaryData| { &mut m.hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxAuxiliaryData", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxAuxiliaryData { + const NAME: &'static str = "CardanoTxAuxiliaryData"; + + fn is_initialized(&self) -> bool { + for v in &self.cvote_registration_parameters { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.cvote_registration_parameters)?; + }, + 18 => { + self.hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.cvote_registration_parameters.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.cvote_registration_parameters.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.hash.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxAuxiliaryData { + CardanoTxAuxiliaryData::new() + } + + fn clear(&mut self) { + self.cvote_registration_parameters.clear(); + self.hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxAuxiliaryData { + static instance: CardanoTxAuxiliaryData = CardanoTxAuxiliaryData { + cvote_registration_parameters: ::protobuf::MessageField::none(), + hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxAuxiliaryData { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxAuxiliaryData").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxAuxiliaryData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxAuxiliaryData { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxMint) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxMint { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxMint.asset_groups_count) + pub asset_groups_count: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxMint.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxMint { + fn default() -> &'a CardanoTxMint { + ::default_instance() + } +} + +impl CardanoTxMint { + pub fn new() -> CardanoTxMint { + ::std::default::Default::default() + } + + // required uint32 asset_groups_count = 1; + + pub fn asset_groups_count(&self) -> u32 { + self.asset_groups_count.unwrap_or(0) + } + + pub fn clear_asset_groups_count(&mut self) { + self.asset_groups_count = ::std::option::Option::None; + } + + pub fn has_asset_groups_count(&self) -> bool { + self.asset_groups_count.is_some() + } + + // Param is passed by value, moved + pub fn set_asset_groups_count(&mut self, v: u32) { + self.asset_groups_count = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "asset_groups_count", + |m: &CardanoTxMint| { &m.asset_groups_count }, + |m: &mut CardanoTxMint| { &mut m.asset_groups_count }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxMint", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxMint { + const NAME: &'static str = "CardanoTxMint"; + + fn is_initialized(&self) -> bool { + if self.asset_groups_count.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.asset_groups_count = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.asset_groups_count { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.asset_groups_count { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxMint { + CardanoTxMint::new() + } + + fn clear(&mut self) { + self.asset_groups_count = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxMint { + static instance: CardanoTxMint = CardanoTxMint { + asset_groups_count: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxMint { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxMint").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxMint { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxMint { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxCollateralInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxCollateralInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCollateralInput.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCollateralInput.prev_index) + pub prev_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxCollateralInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxCollateralInput { + fn default() -> &'a CardanoTxCollateralInput { + ::default_instance() + } +} + +impl CardanoTxCollateralInput { + pub fn new() -> CardanoTxCollateralInput { + ::std::default::Default::default() + } + + // required bytes prev_hash = 1; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 2; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &CardanoTxCollateralInput| { &m.prev_hash }, + |m: &mut CardanoTxCollateralInput| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &CardanoTxCollateralInput| { &m.prev_index }, + |m: &mut CardanoTxCollateralInput| { &mut m.prev_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxCollateralInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxCollateralInput { + const NAME: &'static str = "CardanoTxCollateralInput"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxCollateralInput { + CardanoTxCollateralInput::new() + } + + fn clear(&mut self) { + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxCollateralInput { + static instance: CardanoTxCollateralInput = CardanoTxCollateralInput { + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxCollateralInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxCollateralInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxCollateralInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxCollateralInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxRequiredSigner) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxRequiredSigner { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxRequiredSigner.key_hash) + pub key_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxRequiredSigner.key_path) + pub key_path: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxRequiredSigner.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxRequiredSigner { + fn default() -> &'a CardanoTxRequiredSigner { + ::default_instance() + } +} + +impl CardanoTxRequiredSigner { + pub fn new() -> CardanoTxRequiredSigner { + ::std::default::Default::default() + } + + // optional bytes key_hash = 1; + + pub fn key_hash(&self) -> &[u8] { + match self.key_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_key_hash(&mut self) { + self.key_hash = ::std::option::Option::None; + } + + pub fn has_key_hash(&self) -> bool { + self.key_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { + self.key_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { + if self.key_hash.is_none() { + self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.key_hash.as_mut().unwrap() + } + + // Take field + pub fn take_key_hash(&mut self) -> ::std::vec::Vec { + self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key_hash", + |m: &CardanoTxRequiredSigner| { &m.key_hash }, + |m: &mut CardanoTxRequiredSigner| { &mut m.key_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "key_path", + |m: &CardanoTxRequiredSigner| { &m.key_path }, + |m: &mut CardanoTxRequiredSigner| { &mut m.key_path }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxRequiredSigner", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxRequiredSigner { + const NAME: &'static str = "CardanoTxRequiredSigner"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.key_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.key_path)?; + }, + 16 => { + self.key_path.push(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.key_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + for value in &self.key_path { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.key_hash.as_ref() { + os.write_bytes(1, v)?; + } + for v in &self.key_path { + os.write_uint32(2, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxRequiredSigner { + CardanoTxRequiredSigner::new() + } + + fn clear(&mut self) { + self.key_hash = ::std::option::Option::None; + self.key_path.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxRequiredSigner { + static instance: CardanoTxRequiredSigner = CardanoTxRequiredSigner { + key_hash: ::std::option::Option::None, + key_path: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxRequiredSigner { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxRequiredSigner").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxRequiredSigner { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxRequiredSigner { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxReferenceInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxReferenceInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxReferenceInput.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxReferenceInput.prev_index) + pub prev_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxReferenceInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxReferenceInput { + fn default() -> &'a CardanoTxReferenceInput { + ::default_instance() + } +} + +impl CardanoTxReferenceInput { + pub fn new() -> CardanoTxReferenceInput { + ::std::default::Default::default() + } + + // required bytes prev_hash = 1; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 2; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &CardanoTxReferenceInput| { &m.prev_hash }, + |m: &mut CardanoTxReferenceInput| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &CardanoTxReferenceInput| { &m.prev_index }, + |m: &mut CardanoTxReferenceInput| { &mut m.prev_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxReferenceInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxReferenceInput { + const NAME: &'static str = "CardanoTxReferenceInput"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxReferenceInput { + CardanoTxReferenceInput::new() + } + + fn clear(&mut self) { + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxReferenceInput { + static instance: CardanoTxReferenceInput = CardanoTxReferenceInput { + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxReferenceInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxReferenceInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxReferenceInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxReferenceInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxItemAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxItemAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxItemAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxItemAck { + fn default() -> &'a CardanoTxItemAck { + ::default_instance() + } +} + +impl CardanoTxItemAck { + pub fn new() -> CardanoTxItemAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxItemAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxItemAck { + const NAME: &'static str = "CardanoTxItemAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxItemAck { + CardanoTxItemAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxItemAck { + static instance: CardanoTxItemAck = CardanoTxItemAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxItemAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxItemAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxItemAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxItemAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxAuxiliaryDataSupplement { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.auxiliary_data_hash) + pub auxiliary_data_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.cvote_registration_signature) + pub cvote_registration_signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxAuxiliaryDataSupplement { + fn default() -> &'a CardanoTxAuxiliaryDataSupplement { + ::default_instance() + } +} + +impl CardanoTxAuxiliaryDataSupplement { + pub fn new() -> CardanoTxAuxiliaryDataSupplement { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType type = 1; + + pub fn type_(&self) -> CardanoTxAuxiliaryDataSupplementType { + match self.type_ { + Some(e) => e.enum_value_or(CardanoTxAuxiliaryDataSupplementType::NONE), + None => CardanoTxAuxiliaryDataSupplementType::NONE, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: CardanoTxAuxiliaryDataSupplementType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes auxiliary_data_hash = 2; + + pub fn auxiliary_data_hash(&self) -> &[u8] { + match self.auxiliary_data_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_auxiliary_data_hash(&mut self) { + self.auxiliary_data_hash = ::std::option::Option::None; + } + + pub fn has_auxiliary_data_hash(&self) -> bool { + self.auxiliary_data_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_auxiliary_data_hash(&mut self, v: ::std::vec::Vec) { + self.auxiliary_data_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_auxiliary_data_hash(&mut self) -> &mut ::std::vec::Vec { + if self.auxiliary_data_hash.is_none() { + self.auxiliary_data_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.auxiliary_data_hash.as_mut().unwrap() + } + + // Take field + pub fn take_auxiliary_data_hash(&mut self) -> ::std::vec::Vec { + self.auxiliary_data_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes cvote_registration_signature = 3; + + pub fn cvote_registration_signature(&self) -> &[u8] { + match self.cvote_registration_signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_cvote_registration_signature(&mut self) { + self.cvote_registration_signature = ::std::option::Option::None; + } + + pub fn has_cvote_registration_signature(&self) -> bool { + self.cvote_registration_signature.is_some() + } + + // Param is passed by value, moved + pub fn set_cvote_registration_signature(&mut self, v: ::std::vec::Vec) { + self.cvote_registration_signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cvote_registration_signature(&mut self) -> &mut ::std::vec::Vec { + if self.cvote_registration_signature.is_none() { + self.cvote_registration_signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.cvote_registration_signature.as_mut().unwrap() + } + + // Take field + pub fn take_cvote_registration_signature(&mut self) -> ::std::vec::Vec { + self.cvote_registration_signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &CardanoTxAuxiliaryDataSupplement| { &m.type_ }, + |m: &mut CardanoTxAuxiliaryDataSupplement| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "auxiliary_data_hash", + |m: &CardanoTxAuxiliaryDataSupplement| { &m.auxiliary_data_hash }, + |m: &mut CardanoTxAuxiliaryDataSupplement| { &mut m.auxiliary_data_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "cvote_registration_signature", + |m: &CardanoTxAuxiliaryDataSupplement| { &m.cvote_registration_signature }, + |m: &mut CardanoTxAuxiliaryDataSupplement| { &mut m.cvote_registration_signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxAuxiliaryDataSupplement", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxAuxiliaryDataSupplement { + const NAME: &'static str = "CardanoTxAuxiliaryDataSupplement"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.auxiliary_data_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.cvote_registration_signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.auxiliary_data_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.cvote_registration_signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.auxiliary_data_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.cvote_registration_signature.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxAuxiliaryDataSupplement { + CardanoTxAuxiliaryDataSupplement::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.auxiliary_data_hash = ::std::option::Option::None; + self.cvote_registration_signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxAuxiliaryDataSupplement { + static instance: CardanoTxAuxiliaryDataSupplement = CardanoTxAuxiliaryDataSupplement { + type_: ::std::option::Option::None, + auxiliary_data_hash: ::std::option::Option::None, + cvote_registration_signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxAuxiliaryDataSupplement { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxAuxiliaryDataSupplement").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxAuxiliaryDataSupplement { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxAuxiliaryDataSupplement { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxWitnessRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxWitnessRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessRequest.path) + pub path: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxWitnessRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxWitnessRequest { + fn default() -> &'a CardanoTxWitnessRequest { + ::default_instance() + } +} + +impl CardanoTxWitnessRequest { + pub fn new() -> CardanoTxWitnessRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "path", + |m: &CardanoTxWitnessRequest| { &m.path }, + |m: &mut CardanoTxWitnessRequest| { &mut m.path }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxWitnessRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxWitnessRequest { + const NAME: &'static str = "CardanoTxWitnessRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.path)?; + }, + 8 => { + self.path.push(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.path { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.path { + os.write_uint32(1, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxWitnessRequest { + CardanoTxWitnessRequest::new() + } + + fn clear(&mut self) { + self.path.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxWitnessRequest { + static instance: CardanoTxWitnessRequest = CardanoTxWitnessRequest { + path: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxWitnessRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxWitnessRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxWitnessRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxWitnessRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxWitnessResponse) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxWitnessResponse { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.pub_key) + pub pub_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.chain_code) + pub chain_code: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxWitnessResponse { + fn default() -> &'a CardanoTxWitnessResponse { + ::default_instance() + } +} + +impl CardanoTxWitnessResponse { + pub fn new() -> CardanoTxWitnessResponse { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.cardano.CardanoTxWitnessType type = 1; + + pub fn type_(&self) -> CardanoTxWitnessType { + match self.type_ { + Some(e) => e.enum_value_or(CardanoTxWitnessType::BYRON_WITNESS), + None => CardanoTxWitnessType::BYRON_WITNESS, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: CardanoTxWitnessType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required bytes pub_key = 2; + + pub fn pub_key(&self) -> &[u8] { + match self.pub_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pub_key(&mut self) { + self.pub_key = ::std::option::Option::None; + } + + pub fn has_pub_key(&self) -> bool { + self.pub_key.is_some() + } + + // Param is passed by value, moved + pub fn set_pub_key(&mut self, v: ::std::vec::Vec) { + self.pub_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pub_key(&mut self) -> &mut ::std::vec::Vec { + if self.pub_key.is_none() { + self.pub_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pub_key.as_mut().unwrap() + } + + // Take field + pub fn take_pub_key(&mut self) -> ::std::vec::Vec { + self.pub_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes signature = 3; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes chain_code = 4; + + pub fn chain_code(&self) -> &[u8] { + match self.chain_code.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_chain_code(&mut self) { + self.chain_code = ::std::option::Option::None; + } + + pub fn has_chain_code(&self) -> bool { + self.chain_code.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_code(&mut self, v: ::std::vec::Vec) { + self.chain_code = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_chain_code(&mut self) -> &mut ::std::vec::Vec { + if self.chain_code.is_none() { + self.chain_code = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.chain_code.as_mut().unwrap() + } + + // Take field + pub fn take_chain_code(&mut self) -> ::std::vec::Vec { + self.chain_code.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &CardanoTxWitnessResponse| { &m.type_ }, + |m: &mut CardanoTxWitnessResponse| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pub_key", + |m: &CardanoTxWitnessResponse| { &m.pub_key }, + |m: &mut CardanoTxWitnessResponse| { &mut m.pub_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &CardanoTxWitnessResponse| { &m.signature }, + |m: &mut CardanoTxWitnessResponse| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_code", + |m: &CardanoTxWitnessResponse| { &m.chain_code }, + |m: &mut CardanoTxWitnessResponse| { &mut m.chain_code }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxWitnessResponse", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxWitnessResponse { + const NAME: &'static str = "CardanoTxWitnessResponse"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + if self.pub_key.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.pub_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.chain_code = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.pub_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.chain_code.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.pub_key.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.chain_code.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxWitnessResponse { + CardanoTxWitnessResponse::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.pub_key = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.chain_code = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxWitnessResponse { + static instance: CardanoTxWitnessResponse = CardanoTxWitnessResponse { + type_: ::std::option::Option::None, + pub_key: ::std::option::Option::None, + signature: ::std::option::Option::None, + chain_code: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxWitnessResponse { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxWitnessResponse").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxWitnessResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxWitnessResponse { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxHostAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxHostAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxHostAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxHostAck { + fn default() -> &'a CardanoTxHostAck { + ::default_instance() + } +} + +impl CardanoTxHostAck { + pub fn new() -> CardanoTxHostAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxHostAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxHostAck { + const NAME: &'static str = "CardanoTxHostAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxHostAck { + CardanoTxHostAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxHostAck { + static instance: CardanoTxHostAck = CardanoTxHostAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxHostAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxHostAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxHostAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxHostAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxBodyHash) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoTxBodyHash { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxBodyHash.tx_hash) + pub tx_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxBodyHash.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoTxBodyHash { + fn default() -> &'a CardanoTxBodyHash { + ::default_instance() + } +} + +impl CardanoTxBodyHash { + pub fn new() -> CardanoTxBodyHash { + ::std::default::Default::default() + } + + // required bytes tx_hash = 1; + + pub fn tx_hash(&self) -> &[u8] { + match self.tx_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_hash(&mut self) { + self.tx_hash = ::std::option::Option::None; + } + + pub fn has_tx_hash(&self) -> bool { + self.tx_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_hash(&mut self, v: ::std::vec::Vec) { + self.tx_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_hash(&mut self) -> &mut ::std::vec::Vec { + if self.tx_hash.is_none() { + self.tx_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_hash.as_mut().unwrap() + } + + // Take field + pub fn take_tx_hash(&mut self) -> ::std::vec::Vec { + self.tx_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_hash", + |m: &CardanoTxBodyHash| { &m.tx_hash }, + |m: &mut CardanoTxBodyHash| { &mut m.tx_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoTxBodyHash", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoTxBodyHash { + const NAME: &'static str = "CardanoTxBodyHash"; + + fn is_initialized(&self) -> bool { + if self.tx_hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.tx_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx_hash.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoTxBodyHash { + CardanoTxBodyHash::new() + } + + fn clear(&mut self) { + self.tx_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoTxBodyHash { + static instance: CardanoTxBodyHash = CardanoTxBodyHash { + tx_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoTxBodyHash { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxBodyHash").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoTxBodyHash { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoTxBodyHash { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoSignTxFinished) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CardanoSignTxFinished { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoSignTxFinished.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CardanoSignTxFinished { + fn default() -> &'a CardanoSignTxFinished { + ::default_instance() + } +} + +impl CardanoSignTxFinished { + pub fn new() -> CardanoSignTxFinished { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CardanoSignTxFinished", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CardanoSignTxFinished { + const NAME: &'static str = "CardanoSignTxFinished"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CardanoSignTxFinished { + CardanoSignTxFinished::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static CardanoSignTxFinished { + static instance: CardanoSignTxFinished = CardanoSignTxFinished { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CardanoSignTxFinished { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoSignTxFinished").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CardanoSignTxFinished { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CardanoSignTxFinished { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoDerivationType) +pub enum CardanoDerivationType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDerivationType.LEDGER) + LEDGER = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDerivationType.ICARUS) + ICARUS = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDerivationType.ICARUS_TREZOR) + ICARUS_TREZOR = 2, +} + +impl ::protobuf::Enum for CardanoDerivationType { + const NAME: &'static str = "CardanoDerivationType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoDerivationType::LEDGER), + 1 => ::std::option::Option::Some(CardanoDerivationType::ICARUS), + 2 => ::std::option::Option::Some(CardanoDerivationType::ICARUS_TREZOR), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "LEDGER" => ::std::option::Option::Some(CardanoDerivationType::LEDGER), + "ICARUS" => ::std::option::Option::Some(CardanoDerivationType::ICARUS), + "ICARUS_TREZOR" => ::std::option::Option::Some(CardanoDerivationType::ICARUS_TREZOR), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoDerivationType] = &[ + CardanoDerivationType::LEDGER, + CardanoDerivationType::ICARUS, + CardanoDerivationType::ICARUS_TREZOR, + ]; +} + +impl ::protobuf::EnumFull for CardanoDerivationType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoDerivationType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoDerivationType { + fn default() -> Self { + CardanoDerivationType::LEDGER + } +} + +impl CardanoDerivationType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoDerivationType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoAddressType) +pub enum CardanoAddressType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE) + BASE = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE_SCRIPT_KEY) + BASE_SCRIPT_KEY = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE_KEY_SCRIPT) + BASE_KEY_SCRIPT = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE_SCRIPT_SCRIPT) + BASE_SCRIPT_SCRIPT = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.POINTER) + POINTER = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.POINTER_SCRIPT) + POINTER_SCRIPT = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.ENTERPRISE) + ENTERPRISE = 6, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.ENTERPRISE_SCRIPT) + ENTERPRISE_SCRIPT = 7, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BYRON) + BYRON = 8, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.REWARD) + REWARD = 14, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.REWARD_SCRIPT) + REWARD_SCRIPT = 15, +} + +impl ::protobuf::Enum for CardanoAddressType { + const NAME: &'static str = "CardanoAddressType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoAddressType::BASE), + 1 => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_KEY), + 2 => ::std::option::Option::Some(CardanoAddressType::BASE_KEY_SCRIPT), + 3 => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_SCRIPT), + 4 => ::std::option::Option::Some(CardanoAddressType::POINTER), + 5 => ::std::option::Option::Some(CardanoAddressType::POINTER_SCRIPT), + 6 => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE), + 7 => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE_SCRIPT), + 8 => ::std::option::Option::Some(CardanoAddressType::BYRON), + 14 => ::std::option::Option::Some(CardanoAddressType::REWARD), + 15 => ::std::option::Option::Some(CardanoAddressType::REWARD_SCRIPT), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "BASE" => ::std::option::Option::Some(CardanoAddressType::BASE), + "BASE_SCRIPT_KEY" => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_KEY), + "BASE_KEY_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::BASE_KEY_SCRIPT), + "BASE_SCRIPT_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_SCRIPT), + "POINTER" => ::std::option::Option::Some(CardanoAddressType::POINTER), + "POINTER_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::POINTER_SCRIPT), + "ENTERPRISE" => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE), + "ENTERPRISE_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE_SCRIPT), + "BYRON" => ::std::option::Option::Some(CardanoAddressType::BYRON), + "REWARD" => ::std::option::Option::Some(CardanoAddressType::REWARD), + "REWARD_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::REWARD_SCRIPT), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoAddressType] = &[ + CardanoAddressType::BASE, + CardanoAddressType::BASE_SCRIPT_KEY, + CardanoAddressType::BASE_KEY_SCRIPT, + CardanoAddressType::BASE_SCRIPT_SCRIPT, + CardanoAddressType::POINTER, + CardanoAddressType::POINTER_SCRIPT, + CardanoAddressType::ENTERPRISE, + CardanoAddressType::ENTERPRISE_SCRIPT, + CardanoAddressType::BYRON, + CardanoAddressType::REWARD, + CardanoAddressType::REWARD_SCRIPT, + ]; +} + +impl ::protobuf::EnumFull for CardanoAddressType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoAddressType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + CardanoAddressType::BASE => 0, + CardanoAddressType::BASE_SCRIPT_KEY => 1, + CardanoAddressType::BASE_KEY_SCRIPT => 2, + CardanoAddressType::BASE_SCRIPT_SCRIPT => 3, + CardanoAddressType::POINTER => 4, + CardanoAddressType::POINTER_SCRIPT => 5, + CardanoAddressType::ENTERPRISE => 6, + CardanoAddressType::ENTERPRISE_SCRIPT => 7, + CardanoAddressType::BYRON => 8, + CardanoAddressType::REWARD => 9, + CardanoAddressType::REWARD_SCRIPT => 10, + }; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoAddressType { + fn default() -> Self { + CardanoAddressType::BASE + } +} + +impl CardanoAddressType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoAddressType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoNativeScriptType) +pub enum CardanoNativeScriptType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.PUB_KEY) + PUB_KEY = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.ALL) + ALL = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.ANY) + ANY = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.N_OF_K) + N_OF_K = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.INVALID_BEFORE) + INVALID_BEFORE = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.INVALID_HEREAFTER) + INVALID_HEREAFTER = 5, +} + +impl ::protobuf::Enum for CardanoNativeScriptType { + const NAME: &'static str = "CardanoNativeScriptType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoNativeScriptType::PUB_KEY), + 1 => ::std::option::Option::Some(CardanoNativeScriptType::ALL), + 2 => ::std::option::Option::Some(CardanoNativeScriptType::ANY), + 3 => ::std::option::Option::Some(CardanoNativeScriptType::N_OF_K), + 4 => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_BEFORE), + 5 => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_HEREAFTER), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "PUB_KEY" => ::std::option::Option::Some(CardanoNativeScriptType::PUB_KEY), + "ALL" => ::std::option::Option::Some(CardanoNativeScriptType::ALL), + "ANY" => ::std::option::Option::Some(CardanoNativeScriptType::ANY), + "N_OF_K" => ::std::option::Option::Some(CardanoNativeScriptType::N_OF_K), + "INVALID_BEFORE" => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_BEFORE), + "INVALID_HEREAFTER" => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_HEREAFTER), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoNativeScriptType] = &[ + CardanoNativeScriptType::PUB_KEY, + CardanoNativeScriptType::ALL, + CardanoNativeScriptType::ANY, + CardanoNativeScriptType::N_OF_K, + CardanoNativeScriptType::INVALID_BEFORE, + CardanoNativeScriptType::INVALID_HEREAFTER, + ]; +} + +impl ::protobuf::EnumFull for CardanoNativeScriptType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoNativeScriptType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoNativeScriptType { + fn default() -> Self { + CardanoNativeScriptType::PUB_KEY + } +} + +impl CardanoNativeScriptType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoNativeScriptType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat) +pub enum CardanoNativeScriptHashDisplayFormat { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat.HIDE) + HIDE = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat.BECH32) + BECH32 = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat.POLICY_ID) + POLICY_ID = 2, +} + +impl ::protobuf::Enum for CardanoNativeScriptHashDisplayFormat { + const NAME: &'static str = "CardanoNativeScriptHashDisplayFormat"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::HIDE), + 1 => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::BECH32), + 2 => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::POLICY_ID), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "HIDE" => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::HIDE), + "BECH32" => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::BECH32), + "POLICY_ID" => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::POLICY_ID), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoNativeScriptHashDisplayFormat] = &[ + CardanoNativeScriptHashDisplayFormat::HIDE, + CardanoNativeScriptHashDisplayFormat::BECH32, + CardanoNativeScriptHashDisplayFormat::POLICY_ID, + ]; +} + +impl ::protobuf::EnumFull for CardanoNativeScriptHashDisplayFormat { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoNativeScriptHashDisplayFormat").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoNativeScriptHashDisplayFormat { + fn default() -> Self { + CardanoNativeScriptHashDisplayFormat::HIDE + } +} + +impl CardanoNativeScriptHashDisplayFormat { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoNativeScriptHashDisplayFormat") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat) +pub enum CardanoTxOutputSerializationFormat { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat.ARRAY_LEGACY) + ARRAY_LEGACY = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat.MAP_BABBAGE) + MAP_BABBAGE = 1, +} + +impl ::protobuf::Enum for CardanoTxOutputSerializationFormat { + const NAME: &'static str = "CardanoTxOutputSerializationFormat"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::ARRAY_LEGACY), + 1 => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::MAP_BABBAGE), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "ARRAY_LEGACY" => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::ARRAY_LEGACY), + "MAP_BABBAGE" => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::MAP_BABBAGE), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoTxOutputSerializationFormat] = &[ + CardanoTxOutputSerializationFormat::ARRAY_LEGACY, + CardanoTxOutputSerializationFormat::MAP_BABBAGE, + ]; +} + +impl ::protobuf::EnumFull for CardanoTxOutputSerializationFormat { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxOutputSerializationFormat").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoTxOutputSerializationFormat { + fn default() -> Self { + CardanoTxOutputSerializationFormat::ARRAY_LEGACY + } +} + +impl CardanoTxOutputSerializationFormat { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxOutputSerializationFormat") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoCertificateType) +pub enum CardanoCertificateType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_REGISTRATION) + STAKE_REGISTRATION = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_DEREGISTRATION) + STAKE_DEREGISTRATION = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_DELEGATION) + STAKE_DELEGATION = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_POOL_REGISTRATION) + STAKE_POOL_REGISTRATION = 3, +} + +impl ::protobuf::Enum for CardanoCertificateType { + const NAME: &'static str = "CardanoCertificateType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoCertificateType::STAKE_REGISTRATION), + 1 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION), + 2 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION), + 3 => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "STAKE_REGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_REGISTRATION), + "STAKE_DEREGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION), + "STAKE_DELEGATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION), + "STAKE_POOL_REGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoCertificateType] = &[ + CardanoCertificateType::STAKE_REGISTRATION, + CardanoCertificateType::STAKE_DEREGISTRATION, + CardanoCertificateType::STAKE_DELEGATION, + CardanoCertificateType::STAKE_POOL_REGISTRATION, + ]; +} + +impl ::protobuf::EnumFull for CardanoCertificateType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoCertificateType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoCertificateType { + fn default() -> Self { + CardanoCertificateType::STAKE_REGISTRATION + } +} + +impl CardanoCertificateType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoCertificateType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoPoolRelayType) +pub enum CardanoPoolRelayType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoPoolRelayType.SINGLE_HOST_IP) + SINGLE_HOST_IP = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoPoolRelayType.SINGLE_HOST_NAME) + SINGLE_HOST_NAME = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoPoolRelayType.MULTIPLE_HOST_NAME) + MULTIPLE_HOST_NAME = 2, +} + +impl ::protobuf::Enum for CardanoPoolRelayType { + const NAME: &'static str = "CardanoPoolRelayType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_IP), + 1 => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_NAME), + 2 => ::std::option::Option::Some(CardanoPoolRelayType::MULTIPLE_HOST_NAME), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SINGLE_HOST_IP" => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_IP), + "SINGLE_HOST_NAME" => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_NAME), + "MULTIPLE_HOST_NAME" => ::std::option::Option::Some(CardanoPoolRelayType::MULTIPLE_HOST_NAME), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoPoolRelayType] = &[ + CardanoPoolRelayType::SINGLE_HOST_IP, + CardanoPoolRelayType::SINGLE_HOST_NAME, + CardanoPoolRelayType::MULTIPLE_HOST_NAME, + ]; +} + +impl ::protobuf::EnumFull for CardanoPoolRelayType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoPoolRelayType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoPoolRelayType { + fn default() -> Self { + CardanoPoolRelayType::SINGLE_HOST_IP + } +} + +impl CardanoPoolRelayType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoPoolRelayType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType) +pub enum CardanoTxAuxiliaryDataSupplementType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType.NONE) + NONE = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType.CVOTE_REGISTRATION_SIGNATURE) + CVOTE_REGISTRATION_SIGNATURE = 1, +} + +impl ::protobuf::Enum for CardanoTxAuxiliaryDataSupplementType { + const NAME: &'static str = "CardanoTxAuxiliaryDataSupplementType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::NONE), + 1 => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::CVOTE_REGISTRATION_SIGNATURE), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "NONE" => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::NONE), + "CVOTE_REGISTRATION_SIGNATURE" => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::CVOTE_REGISTRATION_SIGNATURE), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoTxAuxiliaryDataSupplementType] = &[ + CardanoTxAuxiliaryDataSupplementType::NONE, + CardanoTxAuxiliaryDataSupplementType::CVOTE_REGISTRATION_SIGNATURE, + ]; +} + +impl ::protobuf::EnumFull for CardanoTxAuxiliaryDataSupplementType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxAuxiliaryDataSupplementType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoTxAuxiliaryDataSupplementType { + fn default() -> Self { + CardanoTxAuxiliaryDataSupplementType::NONE + } +} + +impl CardanoTxAuxiliaryDataSupplementType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxAuxiliaryDataSupplementType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat) +pub enum CardanoCVoteRegistrationFormat { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat.CIP15) + CIP15 = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat.CIP36) + CIP36 = 1, +} + +impl ::protobuf::Enum for CardanoCVoteRegistrationFormat { + const NAME: &'static str = "CardanoCVoteRegistrationFormat"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP15), + 1 => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP36), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "CIP15" => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP15), + "CIP36" => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP36), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoCVoteRegistrationFormat] = &[ + CardanoCVoteRegistrationFormat::CIP15, + CardanoCVoteRegistrationFormat::CIP36, + ]; +} + +impl ::protobuf::EnumFull for CardanoCVoteRegistrationFormat { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoCVoteRegistrationFormat").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoCVoteRegistrationFormat { + fn default() -> Self { + CardanoCVoteRegistrationFormat::CIP15 + } +} + +impl CardanoCVoteRegistrationFormat { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoCVoteRegistrationFormat") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxSigningMode) +pub enum CardanoTxSigningMode { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.ORDINARY_TRANSACTION) + ORDINARY_TRANSACTION = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.POOL_REGISTRATION_AS_OWNER) + POOL_REGISTRATION_AS_OWNER = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.MULTISIG_TRANSACTION) + MULTISIG_TRANSACTION = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.PLUTUS_TRANSACTION) + PLUTUS_TRANSACTION = 3, +} + +impl ::protobuf::Enum for CardanoTxSigningMode { + const NAME: &'static str = "CardanoTxSigningMode"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoTxSigningMode::ORDINARY_TRANSACTION), + 1 => ::std::option::Option::Some(CardanoTxSigningMode::POOL_REGISTRATION_AS_OWNER), + 2 => ::std::option::Option::Some(CardanoTxSigningMode::MULTISIG_TRANSACTION), + 3 => ::std::option::Option::Some(CardanoTxSigningMode::PLUTUS_TRANSACTION), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "ORDINARY_TRANSACTION" => ::std::option::Option::Some(CardanoTxSigningMode::ORDINARY_TRANSACTION), + "POOL_REGISTRATION_AS_OWNER" => ::std::option::Option::Some(CardanoTxSigningMode::POOL_REGISTRATION_AS_OWNER), + "MULTISIG_TRANSACTION" => ::std::option::Option::Some(CardanoTxSigningMode::MULTISIG_TRANSACTION), + "PLUTUS_TRANSACTION" => ::std::option::Option::Some(CardanoTxSigningMode::PLUTUS_TRANSACTION), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoTxSigningMode] = &[ + CardanoTxSigningMode::ORDINARY_TRANSACTION, + CardanoTxSigningMode::POOL_REGISTRATION_AS_OWNER, + CardanoTxSigningMode::MULTISIG_TRANSACTION, + CardanoTxSigningMode::PLUTUS_TRANSACTION, + ]; +} + +impl ::protobuf::EnumFull for CardanoTxSigningMode { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxSigningMode").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoTxSigningMode { + fn default() -> Self { + CardanoTxSigningMode::ORDINARY_TRANSACTION + } +} + +impl CardanoTxSigningMode { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxSigningMode") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxWitnessType) +pub enum CardanoTxWitnessType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxWitnessType.BYRON_WITNESS) + BYRON_WITNESS = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxWitnessType.SHELLEY_WITNESS) + SHELLEY_WITNESS = 1, +} + +impl ::protobuf::Enum for CardanoTxWitnessType { + const NAME: &'static str = "CardanoTxWitnessType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CardanoTxWitnessType::BYRON_WITNESS), + 1 => ::std::option::Option::Some(CardanoTxWitnessType::SHELLEY_WITNESS), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "BYRON_WITNESS" => ::std::option::Option::Some(CardanoTxWitnessType::BYRON_WITNESS), + "SHELLEY_WITNESS" => ::std::option::Option::Some(CardanoTxWitnessType::SHELLEY_WITNESS), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [CardanoTxWitnessType] = &[ + CardanoTxWitnessType::BYRON_WITNESS, + CardanoTxWitnessType::SHELLEY_WITNESS, + ]; +} + +impl ::protobuf::EnumFull for CardanoTxWitnessType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxWitnessType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for CardanoTxWitnessType { + fn default() -> Self { + CardanoTxWitnessType::BYRON_WITNESS + } +} + +impl CardanoTxWitnessType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxWitnessType") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x16messages-cardano.proto\x12\x1ahw.trezor.messages.cardano\x1a\x15me\ + ssages-common.proto\"\x87\x01\n\x1cCardanoBlockchainPointerType\x12\x1f\ + \n\x0bblock_index\x18\x01\x20\x02(\rR\nblockIndex\x12\x19\n\x08tx_index\ + \x18\x02\x20\x02(\rR\x07txIndex\x12+\n\x11certificate_index\x18\x03\x20\ + \x02(\rR\x10certificateIndex\"\xef\x02\n\x13CardanoNativeScript\x12G\n\ + \x04type\x18\x01\x20\x02(\x0e23.hw.trezor.messages.cardano.CardanoNative\ + ScriptTypeR\x04type\x12I\n\x07scripts\x18\x02\x20\x03(\x0b2/.hw.trezor.m\ + essages.cardano.CardanoNativeScriptR\x07scripts\x12\x19\n\x08key_hash\ + \x18\x03\x20\x01(\x0cR\x07keyHash\x12\x19\n\x08key_path\x18\x04\x20\x03(\ + \rR\x07keyPath\x12:\n\x19required_signatures_count\x18\x05\x20\x01(\rR\ + \x17requiredSignaturesCount\x12%\n\x0einvalid_before\x18\x06\x20\x01(\ + \x04R\rinvalidBefore\x12+\n\x11invalid_hereafter\x18\x07\x20\x01(\x04R\ + \x10invalidHereafter\"\xaa\x02\n\x1aCardanoGetNativeScriptHash\x12G\n\ + \x06script\x18\x01\x20\x02(\x0b2/.hw.trezor.messages.cardano.CardanoNati\ + veScriptR\x06script\x12g\n\x0edisplay_format\x18\x02\x20\x02(\x0e2@.hw.t\ + rezor.messages.cardano.CardanoNativeScriptHashDisplayFormatR\rdisplayFor\ + mat\x12Z\n\x0fderivation_type\x18\x03\x20\x02(\x0e21.hw.trezor.messages.\ + cardano.CardanoDerivationTypeR\x0ederivationType\":\n\x17CardanoNativeSc\ + riptHash\x12\x1f\n\x0bscript_hash\x18\x01\x20\x02(\x0cR\nscriptHash\"\ + \xaf\x03\n\x1cCardanoAddressParametersType\x12Q\n\x0caddress_type\x18\ + \x01\x20\x02(\x0e2..hw.trezor.messages.cardano.CardanoAddressTypeR\x0bad\ + dressType\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12*\n\ + \x11address_n_staking\x18\x03\x20\x03(\rR\x0faddressNStaking\x12(\n\x10s\ + taking_key_hash\x18\x04\x20\x01(\x0cR\x0estakingKeyHash\x12i\n\x13certif\ + icate_pointer\x18\x05\x20\x01(\x0b28.hw.trezor.messages.cardano.CardanoB\ + lockchainPointerTypeR\x12certificatePointer\x12.\n\x13script_payment_has\ + h\x18\x06\x20\x01(\x0cR\x11scriptPaymentHash\x12.\n\x13script_staking_ha\ + sh\x18\x07\x20\x01(\x0cR\x11scriptStakingHash\"\xe4\x02\n\x11CardanoGetA\ + ddress\x12(\n\x0cshow_display\x18\x02\x20\x01(\x08:\x05falseR\x0bshowDis\ + play\x12%\n\x0eprotocol_magic\x18\x03\x20\x02(\rR\rprotocolMagic\x12\x1d\ + \n\nnetwork_id\x18\x04\x20\x02(\rR\tnetworkId\x12g\n\x12address_paramete\ + rs\x18\x05\x20\x02(\x0b28.hw.trezor.messages.cardano.CardanoAddressParam\ + etersTypeR\x11addressParameters\x12Z\n\x0fderivation_type\x18\x06\x20\ + \x02(\x0e21.hw.trezor.messages.cardano.CardanoDerivationTypeR\x0ederivat\ + ionType\x12\x1a\n\x08chunkify\x18\x07\x20\x01(\x08R\x08chunkify\"*\n\x0e\ + CardanoAddress\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"\xb1\ + \x01\n\x13CardanoGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\ + \x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\ + \x12Z\n\x0fderivation_type\x18\x03\x20\x02(\x0e21.hw.trezor.messages.car\ + dano.CardanoDerivationTypeR\x0ederivationType\"a\n\x10CardanoPublicKey\ + \x12\x12\n\x04xpub\x18\x01\x20\x02(\tR\x04xpub\x129\n\x04node\x18\x02\ + \x20\x02(\x0b2%.hw.trezor.messages.common.HDNodeTypeR\x04node\"\xb3\x08\ + \n\x11CardanoSignTxInit\x12S\n\x0csigning_mode\x18\x01\x20\x02(\x0e20.hw\ + .trezor.messages.cardano.CardanoTxSigningModeR\x0bsigningMode\x12%\n\x0e\ + protocol_magic\x18\x02\x20\x02(\rR\rprotocolMagic\x12\x1d\n\nnetwork_id\ + \x18\x03\x20\x02(\rR\tnetworkId\x12!\n\x0cinputs_count\x18\x04\x20\x02(\ + \rR\x0binputsCount\x12#\n\routputs_count\x18\x05\x20\x02(\rR\x0coutputsC\ + ount\x12\x10\n\x03fee\x18\x06\x20\x02(\x04R\x03fee\x12\x10\n\x03ttl\x18\ + \x07\x20\x01(\x04R\x03ttl\x12-\n\x12certificates_count\x18\x08\x20\x02(\ + \rR\x11certificatesCount\x12+\n\x11withdrawals_count\x18\t\x20\x02(\rR\ + \x10withdrawalsCount\x12,\n\x12has_auxiliary_data\x18\n\x20\x02(\x08R\ + \x10hasAuxiliaryData\x126\n\x17validity_interval_start\x18\x0b\x20\x01(\ + \x04R\x15validityIntervalStart\x124\n\x16witness_requests_count\x18\x0c\ + \x20\x02(\rR\x14witnessRequestsCount\x12;\n\x1aminting_asset_groups_coun\ + t\x18\r\x20\x02(\rR\x17mintingAssetGroupsCount\x12Z\n\x0fderivation_type\ + \x18\x0e\x20\x02(\x0e21.hw.trezor.messages.cardano.CardanoDerivationType\ + R\x0ederivationType\x123\n\x12include_network_id\x18\x0f\x20\x01(\x08:\ + \x05falseR\x10includeNetworkId\x12(\n\x10script_data_hash\x18\x10\x20\ + \x01(\x0cR\x0escriptDataHash\x126\n\x17collateral_inputs_count\x18\x11\ + \x20\x02(\rR\x15collateralInputsCount\x124\n\x16required_signers_count\ + \x18\x12\x20\x02(\rR\x14requiredSignersCount\x129\n\x15has_collateral_re\ + turn\x18\x13\x20\x01(\x08:\x05falseR\x13hasCollateralReturn\x12)\n\x10to\ + tal_collateral\x18\x14\x20\x01(\x04R\x0ftotalCollateral\x127\n\x16refere\ + nce_inputs_count\x18\x15\x20\x01(\r:\x010R\x14referenceInputsCount\x12\ + \x1a\n\x08chunkify\x18\x16\x20\x01(\x08R\x08chunkify\"L\n\x0eCardanoTxIn\ + put\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\x12\x1d\n\npr\ + ev_index\x18\x02\x20\x02(\rR\tprevIndex\"\xc5\x03\n\x0fCardanoTxOutput\ + \x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12g\n\x12address_p\ + arameters\x18\x02\x20\x01(\x0b28.hw.trezor.messages.cardano.CardanoAddre\ + ssParametersTypeR\x11addressParameters\x12\x16\n\x06amount\x18\x03\x20\ + \x02(\x04R\x06amount\x12,\n\x12asset_groups_count\x18\x04\x20\x02(\rR\ + \x10assetGroupsCount\x12\x1d\n\ndatum_hash\x18\x05\x20\x01(\x0cR\tdatumH\ + ash\x12d\n\x06format\x18\x06\x20\x01(\x0e2>.hw.trezor.messages.cardano.C\ + ardanoTxOutputSerializationFormat:\x0cARRAY_LEGACYR\x06format\x12-\n\x11\ + inline_datum_size\x18\x07\x20\x01(\r:\x010R\x0finlineDatumSize\x125\n\ + \x15reference_script_size\x18\x08\x20\x01(\r:\x010R\x13referenceScriptSi\ + ze\"S\n\x11CardanoAssetGroup\x12\x1b\n\tpolicy_id\x18\x01\x20\x02(\x0cR\ + \x08policyId\x12!\n\x0ctokens_count\x18\x02\x20\x02(\rR\x0btokensCount\"\ + q\n\x0cCardanoToken\x12(\n\x10asset_name_bytes\x18\x01\x20\x02(\x0cR\x0e\ + assetNameBytes\x12\x16\n\x06amount\x18\x02\x20\x01(\x04R\x06amount\x12\ + \x1f\n\x0bmint_amount\x18\x03\x20\x01(\x12R\nmintAmount\"/\n\x19CardanoT\ + xInlineDatumChunk\x12\x12\n\x04data\x18\x01\x20\x02(\x0cR\x04data\"3\n\ + \x1dCardanoTxReferenceScriptChunk\x12\x12\n\x04data\x18\x01\x20\x02(\x0c\ + R\x04data\"f\n\x10CardanoPoolOwner\x12(\n\x10staking_key_path\x18\x01\ + \x20\x03(\rR\x0estakingKeyPath\x12(\n\x10staking_key_hash\x18\x02\x20\ + \x01(\x0cR\x0estakingKeyHash\"\xd9\x01\n\x1aCardanoPoolRelayParameters\ + \x12D\n\x04type\x18\x01\x20\x02(\x0e20.hw.trezor.messages.cardano.Cardan\ + oPoolRelayTypeR\x04type\x12!\n\x0cipv4_address\x18\x02\x20\x01(\x0cR\x0b\ + ipv4Address\x12!\n\x0cipv6_address\x18\x03\x20\x01(\x0cR\x0bipv6Address\ + \x12\x1b\n\thost_name\x18\x04\x20\x01(\tR\x08hostName\x12\x12\n\x04port\ + \x18\x05\x20\x01(\rR\x04port\"?\n\x17CardanoPoolMetadataType\x12\x10\n\ + \x03url\x18\x01\x20\x02(\tR\x03url\x12\x12\n\x04hash\x18\x02\x20\x02(\ + \x0cR\x04hash\"\x9a\x03\n\x19CardanoPoolParametersType\x12\x17\n\x07pool\ + _id\x18\x01\x20\x02(\x0cR\x06poolId\x12\x20\n\x0cvrf_key_hash\x18\x02\ + \x20\x02(\x0cR\nvrfKeyHash\x12\x16\n\x06pledge\x18\x03\x20\x02(\x04R\x06\ + pledge\x12\x12\n\x04cost\x18\x04\x20\x02(\x04R\x04cost\x12)\n\x10margin_\ + numerator\x18\x05\x20\x02(\x04R\x0fmarginNumerator\x12-\n\x12margin_deno\ + minator\x18\x06\x20\x02(\x04R\x11marginDenominator\x12%\n\x0ereward_acco\ + unt\x18\x07\x20\x02(\tR\rrewardAccount\x12O\n\x08metadata\x18\n\x20\x01(\ + \x0b23.hw.trezor.messages.cardano.CardanoPoolMetadataTypeR\x08metadata\ + \x12!\n\x0cowners_count\x18\x0b\x20\x02(\rR\x0bownersCount\x12!\n\x0crel\ + ays_count\x18\x0c\x20\x02(\rR\x0brelaysCount\"\xa2\x02\n\x14CardanoTxCer\ + tificate\x12F\n\x04type\x18\x01\x20\x02(\x0e22.hw.trezor.messages.cardan\ + o.CardanoCertificateTypeR\x04type\x12\x12\n\x04path\x18\x02\x20\x03(\rR\ + \x04path\x12\x12\n\x04pool\x18\x03\x20\x01(\x0cR\x04pool\x12^\n\x0fpool_\ + parameters\x18\x04\x20\x01(\x0b25.hw.trezor.messages.cardano.CardanoPool\ + ParametersTypeR\x0epoolParameters\x12\x1f\n\x0bscript_hash\x18\x05\x20\ + \x01(\x0cR\nscriptHash\x12\x19\n\x08key_hash\x18\x06\x20\x01(\x0cR\x07ke\ + yHash\"}\n\x13CardanoTxWithdrawal\x12\x12\n\x04path\x18\x01\x20\x03(\rR\ + \x04path\x12\x16\n\x06amount\x18\x02\x20\x02(\x04R\x06amount\x12\x1f\n\ + \x0bscript_hash\x18\x03\x20\x01(\x0cR\nscriptHash\x12\x19\n\x08key_hash\ + \x18\x04\x20\x01(\x0cR\x07keyHash\"d\n\"CardanoCVoteRegistrationDelegati\ + on\x12&\n\x0fvote_public_key\x18\x01\x20\x02(\x0cR\rvotePublicKey\x12\ + \x16\n\x06weight\x18\x02\x20\x02(\rR\x06weight\"\x8e\x04\n&CardanoCVoteR\ + egistrationParametersType\x12&\n\x0fvote_public_key\x18\x01\x20\x01(\x0c\ + R\rvotePublicKey\x12!\n\x0cstaking_path\x18\x02\x20\x03(\rR\x0bstakingPa\ + th\x12v\n\x1apayment_address_parameters\x18\x03\x20\x01(\x0b28.hw.trezor\ + .messages.cardano.CardanoAddressParametersTypeR\x18paymentAddressParamet\ + ers\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\x12Y\n\x06format\ + \x18\x05\x20\x01(\x0e2:.hw.trezor.messages.cardano.CardanoCVoteRegistrat\ + ionFormat:\x05CIP15R\x06format\x12`\n\x0bdelegations\x18\x06\x20\x03(\ + \x0b2>.hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegationR\ + \x0bdelegations\x12%\n\x0evoting_purpose\x18\x07\x20\x01(\x04R\rvotingPu\ + rpose\x12'\n\x0fpayment_address\x18\x08\x20\x01(\tR\x0epaymentAddress\"\ + \xb5\x01\n\x16CardanoTxAuxiliaryData\x12\x86\x01\n\x1dcvote_registration\ + _parameters\x18\x01\x20\x01(\x0b2B.hw.trezor.messages.cardano.CardanoCVo\ + teRegistrationParametersTypeR\x1bcvoteRegistrationParameters\x12\x12\n\ + \x04hash\x18\x02\x20\x01(\x0cR\x04hash\"=\n\rCardanoTxMint\x12,\n\x12ass\ + et_groups_count\x18\x01\x20\x02(\rR\x10assetGroupsCount\"V\n\x18CardanoT\ + xCollateralInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\ + \x12\x1d\n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"O\n\x17CardanoTxR\ + equiredSigner\x12\x19\n\x08key_hash\x18\x01\x20\x01(\x0cR\x07keyHash\x12\ + \x19\n\x08key_path\x18\x02\x20\x03(\rR\x07keyPath\"U\n\x17CardanoTxRefer\ + enceInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\x12\x1d\ + \n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"\x12\n\x10CardanoTxItemAc\ + k\"\xea\x01\n\x20CardanoTxAuxiliaryDataSupplement\x12T\n\x04type\x18\x01\ + \x20\x02(\x0e2@.hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplem\ + entTypeR\x04type\x12.\n\x13auxiliary_data_hash\x18\x02\x20\x01(\x0cR\x11\ + auxiliaryDataHash\x12@\n\x1ccvote_registration_signature\x18\x03\x20\x01\ + (\x0cR\x1acvoteRegistrationSignature\"-\n\x17CardanoTxWitnessRequest\x12\ + \x12\n\x04path\x18\x01\x20\x03(\rR\x04path\"\xb6\x01\n\x18CardanoTxWitne\ + ssResponse\x12D\n\x04type\x18\x01\x20\x02(\x0e20.hw.trezor.messages.card\ + ano.CardanoTxWitnessTypeR\x04type\x12\x17\n\x07pub_key\x18\x02\x20\x02(\ + \x0cR\x06pubKey\x12\x1c\n\tsignature\x18\x03\x20\x02(\x0cR\tsignature\ + \x12\x1d\n\nchain_code\x18\x04\x20\x01(\x0cR\tchainCode\"\x12\n\x10Carda\ + noTxHostAck\",\n\x11CardanoTxBodyHash\x12\x17\n\x07tx_hash\x18\x01\x20\ + \x02(\x0cR\x06txHash\"\x17\n\x15CardanoSignTxFinished*B\n\x15CardanoDeri\ + vationType\x12\n\n\x06LEDGER\x10\0\x12\n\n\x06ICARUS\x10\x01\x12\x11\n\r\ + ICARUS_TREZOR\x10\x02*\xd2\x01\n\x12CardanoAddressType\x12\x08\n\x04BASE\ + \x10\0\x12\x13\n\x0fBASE_SCRIPT_KEY\x10\x01\x12\x13\n\x0fBASE_KEY_SCRIPT\ + \x10\x02\x12\x16\n\x12BASE_SCRIPT_SCRIPT\x10\x03\x12\x0b\n\x07POINTER\ + \x10\x04\x12\x12\n\x0ePOINTER_SCRIPT\x10\x05\x12\x0e\n\nENTERPRISE\x10\ + \x06\x12\x15\n\x11ENTERPRISE_SCRIPT\x10\x07\x12\t\n\x05BYRON\x10\x08\x12\ + \n\n\x06REWARD\x10\x0e\x12\x11\n\rREWARD_SCRIPT\x10\x0f*o\n\x17CardanoNa\ + tiveScriptType\x12\x0b\n\x07PUB_KEY\x10\0\x12\x07\n\x03ALL\x10\x01\x12\ + \x07\n\x03ANY\x10\x02\x12\n\n\x06N_OF_K\x10\x03\x12\x12\n\x0eINVALID_BEF\ + ORE\x10\x04\x12\x15\n\x11INVALID_HEREAFTER\x10\x05*K\n$CardanoNativeScri\ + ptHashDisplayFormat\x12\x08\n\x04HIDE\x10\0\x12\n\n\x06BECH32\x10\x01\ + \x12\r\n\tPOLICY_ID\x10\x02*G\n\"CardanoTxOutputSerializationFormat\x12\ + \x10\n\x0cARRAY_LEGACY\x10\0\x12\x0f\n\x0bMAP_BABBAGE\x10\x01*}\n\x16Car\ + danoCertificateType\x12\x16\n\x12STAKE_REGISTRATION\x10\0\x12\x18\n\x14S\ + TAKE_DEREGISTRATION\x10\x01\x12\x14\n\x10STAKE_DELEGATION\x10\x02\x12\ + \x1b\n\x17STAKE_POOL_REGISTRATION\x10\x03*X\n\x14CardanoPoolRelayType\ + \x12\x12\n\x0eSINGLE_HOST_IP\x10\0\x12\x14\n\x10SINGLE_HOST_NAME\x10\x01\ + \x12\x16\n\x12MULTIPLE_HOST_NAME\x10\x02*R\n$CardanoTxAuxiliaryDataSuppl\ + ementType\x12\x08\n\x04NONE\x10\0\x12\x20\n\x1cCVOTE_REGISTRATION_SIGNAT\ + URE\x10\x01*6\n\x1eCardanoCVoteRegistrationFormat\x12\t\n\x05CIP15\x10\0\ + \x12\t\n\x05CIP36\x10\x01*\x82\x01\n\x14CardanoTxSigningMode\x12\x18\n\ + \x14ORDINARY_TRANSACTION\x10\0\x12\x1e\n\x1aPOOL_REGISTRATION_AS_OWNER\ + \x10\x01\x12\x18\n\x14MULTISIG_TRANSACTION\x10\x02\x12\x16\n\x12PLUTUS_T\ + RANSACTION\x10\x03*>\n\x14CardanoTxWitnessType\x12\x11\n\rBYRON_WITNESS\ + \x10\0\x12\x13\n\x0fSHELLEY_WITNESS\x10\x01B;\n#com.satoshilabs.trezor.l\ + ib.protobufB\x14TrezorMessageCardano\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(super::messages_common::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(36); + messages.push(CardanoBlockchainPointerType::generated_message_descriptor_data()); + messages.push(CardanoNativeScript::generated_message_descriptor_data()); + messages.push(CardanoGetNativeScriptHash::generated_message_descriptor_data()); + messages.push(CardanoNativeScriptHash::generated_message_descriptor_data()); + messages.push(CardanoAddressParametersType::generated_message_descriptor_data()); + messages.push(CardanoGetAddress::generated_message_descriptor_data()); + messages.push(CardanoAddress::generated_message_descriptor_data()); + messages.push(CardanoGetPublicKey::generated_message_descriptor_data()); + messages.push(CardanoPublicKey::generated_message_descriptor_data()); + messages.push(CardanoSignTxInit::generated_message_descriptor_data()); + messages.push(CardanoTxInput::generated_message_descriptor_data()); + messages.push(CardanoTxOutput::generated_message_descriptor_data()); + messages.push(CardanoAssetGroup::generated_message_descriptor_data()); + messages.push(CardanoToken::generated_message_descriptor_data()); + messages.push(CardanoTxInlineDatumChunk::generated_message_descriptor_data()); + messages.push(CardanoTxReferenceScriptChunk::generated_message_descriptor_data()); + messages.push(CardanoPoolOwner::generated_message_descriptor_data()); + messages.push(CardanoPoolRelayParameters::generated_message_descriptor_data()); + messages.push(CardanoPoolMetadataType::generated_message_descriptor_data()); + messages.push(CardanoPoolParametersType::generated_message_descriptor_data()); + messages.push(CardanoTxCertificate::generated_message_descriptor_data()); + messages.push(CardanoTxWithdrawal::generated_message_descriptor_data()); + messages.push(CardanoCVoteRegistrationDelegation::generated_message_descriptor_data()); + messages.push(CardanoCVoteRegistrationParametersType::generated_message_descriptor_data()); + messages.push(CardanoTxAuxiliaryData::generated_message_descriptor_data()); + messages.push(CardanoTxMint::generated_message_descriptor_data()); + messages.push(CardanoTxCollateralInput::generated_message_descriptor_data()); + messages.push(CardanoTxRequiredSigner::generated_message_descriptor_data()); + messages.push(CardanoTxReferenceInput::generated_message_descriptor_data()); + messages.push(CardanoTxItemAck::generated_message_descriptor_data()); + messages.push(CardanoTxAuxiliaryDataSupplement::generated_message_descriptor_data()); + messages.push(CardanoTxWitnessRequest::generated_message_descriptor_data()); + messages.push(CardanoTxWitnessResponse::generated_message_descriptor_data()); + messages.push(CardanoTxHostAck::generated_message_descriptor_data()); + messages.push(CardanoTxBodyHash::generated_message_descriptor_data()); + messages.push(CardanoSignTxFinished::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(11); + enums.push(CardanoDerivationType::generated_enum_descriptor_data()); + enums.push(CardanoAddressType::generated_enum_descriptor_data()); + enums.push(CardanoNativeScriptType::generated_enum_descriptor_data()); + enums.push(CardanoNativeScriptHashDisplayFormat::generated_enum_descriptor_data()); + enums.push(CardanoTxOutputSerializationFormat::generated_enum_descriptor_data()); + enums.push(CardanoCertificateType::generated_enum_descriptor_data()); + enums.push(CardanoPoolRelayType::generated_enum_descriptor_data()); + enums.push(CardanoTxAuxiliaryDataSupplementType::generated_enum_descriptor_data()); + enums.push(CardanoCVoteRegistrationFormat::generated_enum_descriptor_data()); + enums.push(CardanoTxSigningMode::generated_enum_descriptor_data()); + enums.push(CardanoTxWitnessType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_common.rs b/wallet/trezor-client/src/protos/generated/messages_common.rs new file mode 100644 index 0000000000..49e0f1dfd2 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_common.rs @@ -0,0 +1,2521 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-common.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.common.Success) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Success { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.Success.message) + pub message: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Success.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Success { + fn default() -> &'a Success { + ::default_instance() + } +} + +impl Success { + pub fn new() -> Success { + ::std::default::Default::default() + } + + // optional string message = 1; + + pub fn message(&self) -> &str { + match self.message.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::string::String) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::string::String { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::string::String::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::string::String { + self.message.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &Success| { &m.message }, + |m: &mut Success| { &mut m.message }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Success", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Success { + const NAME: &'static str = "Success"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.message = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.message.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Success { + Success::new() + } + + fn clear(&mut self) { + self.message = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Success { + static instance: Success = Success { + message: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Success { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Success").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Success { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Success { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.Failure) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Failure { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.Failure.code) + pub code: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.common.Failure.message) + pub message: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Failure.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Failure { + fn default() -> &'a Failure { + ::default_instance() + } +} + +impl Failure { + pub fn new() -> Failure { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.common.Failure.FailureType code = 1; + + pub fn code(&self) -> failure::FailureType { + match self.code { + Some(e) => e.enum_value_or(failure::FailureType::Failure_UnexpectedMessage), + None => failure::FailureType::Failure_UnexpectedMessage, + } + } + + pub fn clear_code(&mut self) { + self.code = ::std::option::Option::None; + } + + pub fn has_code(&self) -> bool { + self.code.is_some() + } + + // Param is passed by value, moved + pub fn set_code(&mut self, v: failure::FailureType) { + self.code = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional string message = 2; + + pub fn message(&self) -> &str { + match self.message.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::string::String) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::string::String { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::string::String::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::string::String { + self.message.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "code", + |m: &Failure| { &m.code }, + |m: &mut Failure| { &mut m.code }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &Failure| { &m.message }, + |m: &mut Failure| { &mut m.message }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Failure", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Failure { + const NAME: &'static str = "Failure"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.code = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.message = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.code { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.code { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.message.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Failure { + Failure::new() + } + + fn clear(&mut self) { + self.code = ::std::option::Option::None; + self.message = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Failure { + static instance: Failure = Failure { + code: ::std::option::Option::None, + message: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Failure { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Failure").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Failure { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Failure { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `Failure` +pub mod failure { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.common.Failure.FailureType) + pub enum FailureType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_UnexpectedMessage) + Failure_UnexpectedMessage = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_ButtonExpected) + Failure_ButtonExpected = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_DataError) + Failure_DataError = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_ActionCancelled) + Failure_ActionCancelled = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinExpected) + Failure_PinExpected = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinCancelled) + Failure_PinCancelled = 6, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinInvalid) + Failure_PinInvalid = 7, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_InvalidSignature) + Failure_InvalidSignature = 8, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_ProcessError) + Failure_ProcessError = 9, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_NotEnoughFunds) + Failure_NotEnoughFunds = 10, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_NotInitialized) + Failure_NotInitialized = 11, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinMismatch) + Failure_PinMismatch = 12, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_WipeCodeMismatch) + Failure_WipeCodeMismatch = 13, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_InvalidSession) + Failure_InvalidSession = 14, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_FirmwareError) + Failure_FirmwareError = 99, + } + + impl ::protobuf::Enum for FailureType { + const NAME: &'static str = "FailureType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(FailureType::Failure_UnexpectedMessage), + 2 => ::std::option::Option::Some(FailureType::Failure_ButtonExpected), + 3 => ::std::option::Option::Some(FailureType::Failure_DataError), + 4 => ::std::option::Option::Some(FailureType::Failure_ActionCancelled), + 5 => ::std::option::Option::Some(FailureType::Failure_PinExpected), + 6 => ::std::option::Option::Some(FailureType::Failure_PinCancelled), + 7 => ::std::option::Option::Some(FailureType::Failure_PinInvalid), + 8 => ::std::option::Option::Some(FailureType::Failure_InvalidSignature), + 9 => ::std::option::Option::Some(FailureType::Failure_ProcessError), + 10 => ::std::option::Option::Some(FailureType::Failure_NotEnoughFunds), + 11 => ::std::option::Option::Some(FailureType::Failure_NotInitialized), + 12 => ::std::option::Option::Some(FailureType::Failure_PinMismatch), + 13 => ::std::option::Option::Some(FailureType::Failure_WipeCodeMismatch), + 14 => ::std::option::Option::Some(FailureType::Failure_InvalidSession), + 99 => ::std::option::Option::Some(FailureType::Failure_FirmwareError), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Failure_UnexpectedMessage" => ::std::option::Option::Some(FailureType::Failure_UnexpectedMessage), + "Failure_ButtonExpected" => ::std::option::Option::Some(FailureType::Failure_ButtonExpected), + "Failure_DataError" => ::std::option::Option::Some(FailureType::Failure_DataError), + "Failure_ActionCancelled" => ::std::option::Option::Some(FailureType::Failure_ActionCancelled), + "Failure_PinExpected" => ::std::option::Option::Some(FailureType::Failure_PinExpected), + "Failure_PinCancelled" => ::std::option::Option::Some(FailureType::Failure_PinCancelled), + "Failure_PinInvalid" => ::std::option::Option::Some(FailureType::Failure_PinInvalid), + "Failure_InvalidSignature" => ::std::option::Option::Some(FailureType::Failure_InvalidSignature), + "Failure_ProcessError" => ::std::option::Option::Some(FailureType::Failure_ProcessError), + "Failure_NotEnoughFunds" => ::std::option::Option::Some(FailureType::Failure_NotEnoughFunds), + "Failure_NotInitialized" => ::std::option::Option::Some(FailureType::Failure_NotInitialized), + "Failure_PinMismatch" => ::std::option::Option::Some(FailureType::Failure_PinMismatch), + "Failure_WipeCodeMismatch" => ::std::option::Option::Some(FailureType::Failure_WipeCodeMismatch), + "Failure_InvalidSession" => ::std::option::Option::Some(FailureType::Failure_InvalidSession), + "Failure_FirmwareError" => ::std::option::Option::Some(FailureType::Failure_FirmwareError), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [FailureType] = &[ + FailureType::Failure_UnexpectedMessage, + FailureType::Failure_ButtonExpected, + FailureType::Failure_DataError, + FailureType::Failure_ActionCancelled, + FailureType::Failure_PinExpected, + FailureType::Failure_PinCancelled, + FailureType::Failure_PinInvalid, + FailureType::Failure_InvalidSignature, + FailureType::Failure_ProcessError, + FailureType::Failure_NotEnoughFunds, + FailureType::Failure_NotInitialized, + FailureType::Failure_PinMismatch, + FailureType::Failure_WipeCodeMismatch, + FailureType::Failure_InvalidSession, + FailureType::Failure_FirmwareError, + ]; + } + + impl ::protobuf::EnumFull for FailureType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Failure.FailureType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + FailureType::Failure_UnexpectedMessage => 0, + FailureType::Failure_ButtonExpected => 1, + FailureType::Failure_DataError => 2, + FailureType::Failure_ActionCancelled => 3, + FailureType::Failure_PinExpected => 4, + FailureType::Failure_PinCancelled => 5, + FailureType::Failure_PinInvalid => 6, + FailureType::Failure_InvalidSignature => 7, + FailureType::Failure_ProcessError => 8, + FailureType::Failure_NotEnoughFunds => 9, + FailureType::Failure_NotInitialized => 10, + FailureType::Failure_PinMismatch => 11, + FailureType::Failure_WipeCodeMismatch => 12, + FailureType::Failure_InvalidSession => 13, + FailureType::Failure_FirmwareError => 14, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for FailureType { + fn default() -> Self { + FailureType::Failure_UnexpectedMessage + } + } + + impl FailureType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Failure.FailureType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.ButtonRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ButtonRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.ButtonRequest.code) + pub code: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.common.ButtonRequest.pages) + pub pages: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.ButtonRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ButtonRequest { + fn default() -> &'a ButtonRequest { + ::default_instance() + } +} + +impl ButtonRequest { + pub fn new() -> ButtonRequest { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.common.ButtonRequest.ButtonRequestType code = 1; + + pub fn code(&self) -> button_request::ButtonRequestType { + match self.code { + Some(e) => e.enum_value_or(button_request::ButtonRequestType::ButtonRequest_Other), + None => button_request::ButtonRequestType::ButtonRequest_Other, + } + } + + pub fn clear_code(&mut self) { + self.code = ::std::option::Option::None; + } + + pub fn has_code(&self) -> bool { + self.code.is_some() + } + + // Param is passed by value, moved + pub fn set_code(&mut self, v: button_request::ButtonRequestType) { + self.code = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint32 pages = 2; + + pub fn pages(&self) -> u32 { + self.pages.unwrap_or(0) + } + + pub fn clear_pages(&mut self) { + self.pages = ::std::option::Option::None; + } + + pub fn has_pages(&self) -> bool { + self.pages.is_some() + } + + // Param is passed by value, moved + pub fn set_pages(&mut self, v: u32) { + self.pages = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "code", + |m: &ButtonRequest| { &m.code }, + |m: &mut ButtonRequest| { &mut m.code }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pages", + |m: &ButtonRequest| { &m.pages }, + |m: &mut ButtonRequest| { &mut m.pages }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ButtonRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ButtonRequest { + const NAME: &'static str = "ButtonRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.code = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 16 => { + self.pages = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.code { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.pages { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.code { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.pages { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ButtonRequest { + ButtonRequest::new() + } + + fn clear(&mut self) { + self.code = ::std::option::Option::None; + self.pages = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ButtonRequest { + static instance: ButtonRequest = ButtonRequest { + code: ::std::option::Option::None, + pages: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ButtonRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ButtonRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ButtonRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ButtonRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `ButtonRequest` +pub mod button_request { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.common.ButtonRequest.ButtonRequestType) + pub enum ButtonRequestType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Other) + ButtonRequest_Other = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_FeeOverThreshold) + ButtonRequest_FeeOverThreshold = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ConfirmOutput) + ButtonRequest_ConfirmOutput = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ResetDevice) + ButtonRequest_ResetDevice = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ConfirmWord) + ButtonRequest_ConfirmWord = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_WipeDevice) + ButtonRequest_WipeDevice = 6, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ProtectCall) + ButtonRequest_ProtectCall = 7, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_SignTx) + ButtonRequest_SignTx = 8, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_FirmwareCheck) + ButtonRequest_FirmwareCheck = 9, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Address) + ButtonRequest_Address = 10, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_PublicKey) + ButtonRequest_PublicKey = 11, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_MnemonicWordCount) + ButtonRequest_MnemonicWordCount = 12, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_MnemonicInput) + ButtonRequest_MnemonicInput = 13, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType._Deprecated_ButtonRequest_PassphraseType) + _Deprecated_ButtonRequest_PassphraseType = 14, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_UnknownDerivationPath) + ButtonRequest_UnknownDerivationPath = 15, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_RecoveryHomepage) + ButtonRequest_RecoveryHomepage = 16, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Success) + ButtonRequest_Success = 17, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Warning) + ButtonRequest_Warning = 18, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_PassphraseEntry) + ButtonRequest_PassphraseEntry = 19, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_PinEntry) + ButtonRequest_PinEntry = 20, + } + + impl ::protobuf::Enum for ButtonRequestType { + const NAME: &'static str = "ButtonRequestType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Other), + 2 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FeeOverThreshold), + 3 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmOutput), + 4 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ResetDevice), + 5 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmWord), + 6 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_WipeDevice), + 7 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ProtectCall), + 8 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_SignTx), + 9 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FirmwareCheck), + 10 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Address), + 11 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PublicKey), + 12 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicWordCount), + 13 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicInput), + 14 => ::std::option::Option::Some(ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType), + 15 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_UnknownDerivationPath), + 16 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_RecoveryHomepage), + 17 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Success), + 18 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Warning), + 19 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PassphraseEntry), + 20 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PinEntry), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "ButtonRequest_Other" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Other), + "ButtonRequest_FeeOverThreshold" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FeeOverThreshold), + "ButtonRequest_ConfirmOutput" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmOutput), + "ButtonRequest_ResetDevice" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ResetDevice), + "ButtonRequest_ConfirmWord" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmWord), + "ButtonRequest_WipeDevice" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_WipeDevice), + "ButtonRequest_ProtectCall" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ProtectCall), + "ButtonRequest_SignTx" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_SignTx), + "ButtonRequest_FirmwareCheck" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FirmwareCheck), + "ButtonRequest_Address" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Address), + "ButtonRequest_PublicKey" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PublicKey), + "ButtonRequest_MnemonicWordCount" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicWordCount), + "ButtonRequest_MnemonicInput" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicInput), + "_Deprecated_ButtonRequest_PassphraseType" => ::std::option::Option::Some(ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType), + "ButtonRequest_UnknownDerivationPath" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_UnknownDerivationPath), + "ButtonRequest_RecoveryHomepage" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_RecoveryHomepage), + "ButtonRequest_Success" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Success), + "ButtonRequest_Warning" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Warning), + "ButtonRequest_PassphraseEntry" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PassphraseEntry), + "ButtonRequest_PinEntry" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PinEntry), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [ButtonRequestType] = &[ + ButtonRequestType::ButtonRequest_Other, + ButtonRequestType::ButtonRequest_FeeOverThreshold, + ButtonRequestType::ButtonRequest_ConfirmOutput, + ButtonRequestType::ButtonRequest_ResetDevice, + ButtonRequestType::ButtonRequest_ConfirmWord, + ButtonRequestType::ButtonRequest_WipeDevice, + ButtonRequestType::ButtonRequest_ProtectCall, + ButtonRequestType::ButtonRequest_SignTx, + ButtonRequestType::ButtonRequest_FirmwareCheck, + ButtonRequestType::ButtonRequest_Address, + ButtonRequestType::ButtonRequest_PublicKey, + ButtonRequestType::ButtonRequest_MnemonicWordCount, + ButtonRequestType::ButtonRequest_MnemonicInput, + ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType, + ButtonRequestType::ButtonRequest_UnknownDerivationPath, + ButtonRequestType::ButtonRequest_RecoveryHomepage, + ButtonRequestType::ButtonRequest_Success, + ButtonRequestType::ButtonRequest_Warning, + ButtonRequestType::ButtonRequest_PassphraseEntry, + ButtonRequestType::ButtonRequest_PinEntry, + ]; + } + + impl ::protobuf::EnumFull for ButtonRequestType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("ButtonRequest.ButtonRequestType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + ButtonRequestType::ButtonRequest_Other => 0, + ButtonRequestType::ButtonRequest_FeeOverThreshold => 1, + ButtonRequestType::ButtonRequest_ConfirmOutput => 2, + ButtonRequestType::ButtonRequest_ResetDevice => 3, + ButtonRequestType::ButtonRequest_ConfirmWord => 4, + ButtonRequestType::ButtonRequest_WipeDevice => 5, + ButtonRequestType::ButtonRequest_ProtectCall => 6, + ButtonRequestType::ButtonRequest_SignTx => 7, + ButtonRequestType::ButtonRequest_FirmwareCheck => 8, + ButtonRequestType::ButtonRequest_Address => 9, + ButtonRequestType::ButtonRequest_PublicKey => 10, + ButtonRequestType::ButtonRequest_MnemonicWordCount => 11, + ButtonRequestType::ButtonRequest_MnemonicInput => 12, + ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType => 13, + ButtonRequestType::ButtonRequest_UnknownDerivationPath => 14, + ButtonRequestType::ButtonRequest_RecoveryHomepage => 15, + ButtonRequestType::ButtonRequest_Success => 16, + ButtonRequestType::ButtonRequest_Warning => 17, + ButtonRequestType::ButtonRequest_PassphraseEntry => 18, + ButtonRequestType::ButtonRequest_PinEntry => 19, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for ButtonRequestType { + fn default() -> Self { + ButtonRequestType::ButtonRequest_Other + } + } + + impl ButtonRequestType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("ButtonRequest.ButtonRequestType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.ButtonAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ButtonAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.ButtonAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ButtonAck { + fn default() -> &'a ButtonAck { + ::default_instance() + } +} + +impl ButtonAck { + pub fn new() -> ButtonAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ButtonAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ButtonAck { + const NAME: &'static str = "ButtonAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ButtonAck { + ButtonAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static ButtonAck { + static instance: ButtonAck = ButtonAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ButtonAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ButtonAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ButtonAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ButtonAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.PinMatrixRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PinMatrixRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.PinMatrixRequest.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PinMatrixRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PinMatrixRequest { + fn default() -> &'a PinMatrixRequest { + ::default_instance() + } +} + +impl PinMatrixRequest { + pub fn new() -> PinMatrixRequest { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType type = 1; + + pub fn type_(&self) -> pin_matrix_request::PinMatrixRequestType { + match self.type_ { + Some(e) => e.enum_value_or(pin_matrix_request::PinMatrixRequestType::PinMatrixRequestType_Current), + None => pin_matrix_request::PinMatrixRequestType::PinMatrixRequestType_Current, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: pin_matrix_request::PinMatrixRequestType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &PinMatrixRequest| { &m.type_ }, + |m: &mut PinMatrixRequest| { &mut m.type_ }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PinMatrixRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PinMatrixRequest { + const NAME: &'static str = "PinMatrixRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PinMatrixRequest { + PinMatrixRequest::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PinMatrixRequest { + static instance: PinMatrixRequest = PinMatrixRequest { + type_: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PinMatrixRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PinMatrixRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PinMatrixRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PinMatrixRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `PinMatrixRequest` +pub mod pin_matrix_request { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType) + pub enum PinMatrixRequestType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_Current) + PinMatrixRequestType_Current = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_NewFirst) + PinMatrixRequestType_NewFirst = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_NewSecond) + PinMatrixRequestType_NewSecond = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_WipeCodeFirst) + PinMatrixRequestType_WipeCodeFirst = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_WipeCodeSecond) + PinMatrixRequestType_WipeCodeSecond = 5, + } + + impl ::protobuf::Enum for PinMatrixRequestType { + const NAME: &'static str = "PinMatrixRequestType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_Current), + 2 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewFirst), + 3 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewSecond), + 4 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst), + 5 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "PinMatrixRequestType_Current" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_Current), + "PinMatrixRequestType_NewFirst" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewFirst), + "PinMatrixRequestType_NewSecond" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewSecond), + "PinMatrixRequestType_WipeCodeFirst" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst), + "PinMatrixRequestType_WipeCodeSecond" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [PinMatrixRequestType] = &[ + PinMatrixRequestType::PinMatrixRequestType_Current, + PinMatrixRequestType::PinMatrixRequestType_NewFirst, + PinMatrixRequestType::PinMatrixRequestType_NewSecond, + PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst, + PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond, + ]; + } + + impl ::protobuf::EnumFull for PinMatrixRequestType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("PinMatrixRequest.PinMatrixRequestType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + PinMatrixRequestType::PinMatrixRequestType_Current => 0, + PinMatrixRequestType::PinMatrixRequestType_NewFirst => 1, + PinMatrixRequestType::PinMatrixRequestType_NewSecond => 2, + PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst => 3, + PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond => 4, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for PinMatrixRequestType { + fn default() -> Self { + PinMatrixRequestType::PinMatrixRequestType_Current + } + } + + impl PinMatrixRequestType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("PinMatrixRequest.PinMatrixRequestType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.PinMatrixAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PinMatrixAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.PinMatrixAck.pin) + pub pin: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PinMatrixAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PinMatrixAck { + fn default() -> &'a PinMatrixAck { + ::default_instance() + } +} + +impl PinMatrixAck { + pub fn new() -> PinMatrixAck { + ::std::default::Default::default() + } + + // required string pin = 1; + + pub fn pin(&self) -> &str { + match self.pin.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_pin(&mut self) { + self.pin = ::std::option::Option::None; + } + + pub fn has_pin(&self) -> bool { + self.pin.is_some() + } + + // Param is passed by value, moved + pub fn set_pin(&mut self, v: ::std::string::String) { + self.pin = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pin(&mut self) -> &mut ::std::string::String { + if self.pin.is_none() { + self.pin = ::std::option::Option::Some(::std::string::String::new()); + } + self.pin.as_mut().unwrap() + } + + // Take field + pub fn take_pin(&mut self) -> ::std::string::String { + self.pin.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pin", + |m: &PinMatrixAck| { &m.pin }, + |m: &mut PinMatrixAck| { &mut m.pin }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PinMatrixAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PinMatrixAck { + const NAME: &'static str = "PinMatrixAck"; + + fn is_initialized(&self) -> bool { + if self.pin.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.pin = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.pin.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.pin.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PinMatrixAck { + PinMatrixAck::new() + } + + fn clear(&mut self) { + self.pin = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PinMatrixAck { + static instance: PinMatrixAck = PinMatrixAck { + pin: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PinMatrixAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PinMatrixAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PinMatrixAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PinMatrixAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.PassphraseRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PassphraseRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseRequest._on_device) + pub _on_device: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PassphraseRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PassphraseRequest { + fn default() -> &'a PassphraseRequest { + ::default_instance() + } +} + +impl PassphraseRequest { + pub fn new() -> PassphraseRequest { + ::std::default::Default::default() + } + + // optional bool _on_device = 1; + + pub fn _on_device(&self) -> bool { + self._on_device.unwrap_or(false) + } + + pub fn clear__on_device(&mut self) { + self._on_device = ::std::option::Option::None; + } + + pub fn has__on_device(&self) -> bool { + self._on_device.is_some() + } + + // Param is passed by value, moved + pub fn set__on_device(&mut self, v: bool) { + self._on_device = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "_on_device", + |m: &PassphraseRequest| { &m._on_device }, + |m: &mut PassphraseRequest| { &mut m._on_device }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PassphraseRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PassphraseRequest { + const NAME: &'static str = "PassphraseRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self._on_device = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self._on_device { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self._on_device { + os.write_bool(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PassphraseRequest { + PassphraseRequest::new() + } + + fn clear(&mut self) { + self._on_device = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PassphraseRequest { + static instance: PassphraseRequest = PassphraseRequest { + _on_device: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PassphraseRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PassphraseRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PassphraseRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PassphraseRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.PassphraseAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PassphraseAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseAck.passphrase) + pub passphrase: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseAck._state) + pub _state: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseAck.on_device) + pub on_device: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PassphraseAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PassphraseAck { + fn default() -> &'a PassphraseAck { + ::default_instance() + } +} + +impl PassphraseAck { + pub fn new() -> PassphraseAck { + ::std::default::Default::default() + } + + // optional string passphrase = 1; + + pub fn passphrase(&self) -> &str { + match self.passphrase.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_passphrase(&mut self) { + self.passphrase = ::std::option::Option::None; + } + + pub fn has_passphrase(&self) -> bool { + self.passphrase.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase(&mut self, v: ::std::string::String) { + self.passphrase = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_passphrase(&mut self) -> &mut ::std::string::String { + if self.passphrase.is_none() { + self.passphrase = ::std::option::Option::Some(::std::string::String::new()); + } + self.passphrase.as_mut().unwrap() + } + + // Take field + pub fn take_passphrase(&mut self) -> ::std::string::String { + self.passphrase.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes _state = 2; + + pub fn _state(&self) -> &[u8] { + match self._state.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear__state(&mut self) { + self._state = ::std::option::Option::None; + } + + pub fn has__state(&self) -> bool { + self._state.is_some() + } + + // Param is passed by value, moved + pub fn set__state(&mut self, v: ::std::vec::Vec) { + self._state = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut__state(&mut self) -> &mut ::std::vec::Vec { + if self._state.is_none() { + self._state = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self._state.as_mut().unwrap() + } + + // Take field + pub fn take__state(&mut self) -> ::std::vec::Vec { + self._state.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool on_device = 3; + + pub fn on_device(&self) -> bool { + self.on_device.unwrap_or(false) + } + + pub fn clear_on_device(&mut self) { + self.on_device = ::std::option::Option::None; + } + + pub fn has_on_device(&self) -> bool { + self.on_device.is_some() + } + + // Param is passed by value, moved + pub fn set_on_device(&mut self, v: bool) { + self.on_device = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase", + |m: &PassphraseAck| { &m.passphrase }, + |m: &mut PassphraseAck| { &mut m.passphrase }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "_state", + |m: &PassphraseAck| { &m._state }, + |m: &mut PassphraseAck| { &mut m._state }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "on_device", + |m: &PassphraseAck| { &m.on_device }, + |m: &mut PassphraseAck| { &mut m.on_device }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PassphraseAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PassphraseAck { + const NAME: &'static str = "PassphraseAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.passphrase = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self._state = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.on_device = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.passphrase.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self._state.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.on_device { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.passphrase.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self._state.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.on_device { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PassphraseAck { + PassphraseAck::new() + } + + fn clear(&mut self) { + self.passphrase = ::std::option::Option::None; + self._state = ::std::option::Option::None; + self.on_device = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PassphraseAck { + static instance: PassphraseAck = PassphraseAck { + passphrase: ::std::option::Option::None, + _state: ::std::option::Option::None, + on_device: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PassphraseAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PassphraseAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PassphraseAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PassphraseAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.Deprecated_PassphraseStateRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Deprecated_PassphraseStateRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.Deprecated_PassphraseStateRequest.state) + pub state: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Deprecated_PassphraseStateRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Deprecated_PassphraseStateRequest { + fn default() -> &'a Deprecated_PassphraseStateRequest { + ::default_instance() + } +} + +impl Deprecated_PassphraseStateRequest { + pub fn new() -> Deprecated_PassphraseStateRequest { + ::std::default::Default::default() + } + + // optional bytes state = 1; + + pub fn state(&self) -> &[u8] { + match self.state.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_state(&mut self) { + self.state = ::std::option::Option::None; + } + + pub fn has_state(&self) -> bool { + self.state.is_some() + } + + // Param is passed by value, moved + pub fn set_state(&mut self, v: ::std::vec::Vec) { + self.state = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_state(&mut self) -> &mut ::std::vec::Vec { + if self.state.is_none() { + self.state = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.state.as_mut().unwrap() + } + + // Take field + pub fn take_state(&mut self) -> ::std::vec::Vec { + self.state.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "state", + |m: &Deprecated_PassphraseStateRequest| { &m.state }, + |m: &mut Deprecated_PassphraseStateRequest| { &mut m.state }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Deprecated_PassphraseStateRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Deprecated_PassphraseStateRequest { + const NAME: &'static str = "Deprecated_PassphraseStateRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.state = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.state.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.state.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Deprecated_PassphraseStateRequest { + Deprecated_PassphraseStateRequest::new() + } + + fn clear(&mut self) { + self.state = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Deprecated_PassphraseStateRequest { + static instance: Deprecated_PassphraseStateRequest = Deprecated_PassphraseStateRequest { + state: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Deprecated_PassphraseStateRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Deprecated_PassphraseStateRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Deprecated_PassphraseStateRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Deprecated_PassphraseStateRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.Deprecated_PassphraseStateAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Deprecated_PassphraseStateAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Deprecated_PassphraseStateAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Deprecated_PassphraseStateAck { + fn default() -> &'a Deprecated_PassphraseStateAck { + ::default_instance() + } +} + +impl Deprecated_PassphraseStateAck { + pub fn new() -> Deprecated_PassphraseStateAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Deprecated_PassphraseStateAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Deprecated_PassphraseStateAck { + const NAME: &'static str = "Deprecated_PassphraseStateAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Deprecated_PassphraseStateAck { + Deprecated_PassphraseStateAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static Deprecated_PassphraseStateAck { + static instance: Deprecated_PassphraseStateAck = Deprecated_PassphraseStateAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Deprecated_PassphraseStateAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Deprecated_PassphraseStateAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Deprecated_PassphraseStateAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Deprecated_PassphraseStateAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.common.HDNodeType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct HDNodeType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.depth) + pub depth: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.fingerprint) + pub fingerprint: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.child_num) + pub child_num: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.chain_code) + pub chain_code: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.private_key) + pub private_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.common.HDNodeType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a HDNodeType { + fn default() -> &'a HDNodeType { + ::default_instance() + } +} + +impl HDNodeType { + pub fn new() -> HDNodeType { + ::std::default::Default::default() + } + + // required uint32 depth = 1; + + pub fn depth(&self) -> u32 { + self.depth.unwrap_or(0) + } + + pub fn clear_depth(&mut self) { + self.depth = ::std::option::Option::None; + } + + pub fn has_depth(&self) -> bool { + self.depth.is_some() + } + + // Param is passed by value, moved + pub fn set_depth(&mut self, v: u32) { + self.depth = ::std::option::Option::Some(v); + } + + // required uint32 fingerprint = 2; + + pub fn fingerprint(&self) -> u32 { + self.fingerprint.unwrap_or(0) + } + + pub fn clear_fingerprint(&mut self) { + self.fingerprint = ::std::option::Option::None; + } + + pub fn has_fingerprint(&self) -> bool { + self.fingerprint.is_some() + } + + // Param is passed by value, moved + pub fn set_fingerprint(&mut self, v: u32) { + self.fingerprint = ::std::option::Option::Some(v); + } + + // required uint32 child_num = 3; + + pub fn child_num(&self) -> u32 { + self.child_num.unwrap_or(0) + } + + pub fn clear_child_num(&mut self) { + self.child_num = ::std::option::Option::None; + } + + pub fn has_child_num(&self) -> bool { + self.child_num.is_some() + } + + // Param is passed by value, moved + pub fn set_child_num(&mut self, v: u32) { + self.child_num = ::std::option::Option::Some(v); + } + + // required bytes chain_code = 4; + + pub fn chain_code(&self) -> &[u8] { + match self.chain_code.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_chain_code(&mut self) { + self.chain_code = ::std::option::Option::None; + } + + pub fn has_chain_code(&self) -> bool { + self.chain_code.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_code(&mut self, v: ::std::vec::Vec) { + self.chain_code = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_chain_code(&mut self) -> &mut ::std::vec::Vec { + if self.chain_code.is_none() { + self.chain_code = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.chain_code.as_mut().unwrap() + } + + // Take field + pub fn take_chain_code(&mut self) -> ::std::vec::Vec { + self.chain_code.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes private_key = 5; + + pub fn private_key(&self) -> &[u8] { + match self.private_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_private_key(&mut self) { + self.private_key = ::std::option::Option::None; + } + + pub fn has_private_key(&self) -> bool { + self.private_key.is_some() + } + + // Param is passed by value, moved + pub fn set_private_key(&mut self, v: ::std::vec::Vec) { + self.private_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_private_key(&mut self) -> &mut ::std::vec::Vec { + if self.private_key.is_none() { + self.private_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.private_key.as_mut().unwrap() + } + + // Take field + pub fn take_private_key(&mut self) -> ::std::vec::Vec { + self.private_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes public_key = 6; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "depth", + |m: &HDNodeType| { &m.depth }, + |m: &mut HDNodeType| { &mut m.depth }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fingerprint", + |m: &HDNodeType| { &m.fingerprint }, + |m: &mut HDNodeType| { &mut m.fingerprint }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "child_num", + |m: &HDNodeType| { &m.child_num }, + |m: &mut HDNodeType| { &mut m.child_num }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_code", + |m: &HDNodeType| { &m.chain_code }, + |m: &mut HDNodeType| { &mut m.chain_code }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "private_key", + |m: &HDNodeType| { &m.private_key }, + |m: &mut HDNodeType| { &mut m.private_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &HDNodeType| { &m.public_key }, + |m: &mut HDNodeType| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "HDNodeType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for HDNodeType { + const NAME: &'static str = "HDNodeType"; + + fn is_initialized(&self) -> bool { + if self.depth.is_none() { + return false; + } + if self.fingerprint.is_none() { + return false; + } + if self.child_num.is_none() { + return false; + } + if self.chain_code.is_none() { + return false; + } + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.depth = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.fingerprint = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.child_num = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.chain_code = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.private_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.depth { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.fingerprint { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.child_num { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.chain_code.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.private_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.depth { + os.write_uint32(1, v)?; + } + if let Some(v) = self.fingerprint { + os.write_uint32(2, v)?; + } + if let Some(v) = self.child_num { + os.write_uint32(3, v)?; + } + if let Some(v) = self.chain_code.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.private_key.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> HDNodeType { + HDNodeType::new() + } + + fn clear(&mut self) { + self.depth = ::std::option::Option::None; + self.fingerprint = ::std::option::Option::None; + self.child_num = ::std::option::Option::None; + self.chain_code = ::std::option::Option::None; + self.private_key = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static HDNodeType { + static instance: HDNodeType = HDNodeType { + depth: ::std::option::Option::None, + fingerprint: ::std::option::Option::None, + child_num: ::std::option::Option::None, + chain_code: ::std::option::Option::None, + private_key: ::std::option::Option::None, + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for HDNodeType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("HDNodeType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for HDNodeType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for HDNodeType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x15messages-common.proto\x12\x19hw.trezor.messages.common\x1a\x0emess\ + ages.proto\"%\n\x07Success\x12\x1a\n\x07message\x18\x01\x20\x01(\t:\0R\ + \x07message\"\x8f\x04\n\x07Failure\x12B\n\x04code\x18\x01\x20\x01(\x0e2.\ + .hw.trezor.messages.common.Failure.FailureTypeR\x04code\x12\x18\n\x07mes\ + sage\x18\x02\x20\x01(\tR\x07message\"\xa5\x03\n\x0bFailureType\x12\x1d\n\ + \x19Failure_UnexpectedMessage\x10\x01\x12\x1a\n\x16Failure_ButtonExpecte\ + d\x10\x02\x12\x15\n\x11Failure_DataError\x10\x03\x12\x1b\n\x17Failure_Ac\ + tionCancelled\x10\x04\x12\x17\n\x13Failure_PinExpected\x10\x05\x12\x18\n\ + \x14Failure_PinCancelled\x10\x06\x12\x16\n\x12Failure_PinInvalid\x10\x07\ + \x12\x1c\n\x18Failure_InvalidSignature\x10\x08\x12\x18\n\x14Failure_Proc\ + essError\x10\t\x12\x1a\n\x16Failure_NotEnoughFunds\x10\n\x12\x1a\n\x16Fa\ + ilure_NotInitialized\x10\x0b\x12\x17\n\x13Failure_PinMismatch\x10\x0c\ + \x12\x1c\n\x18Failure_WipeCodeMismatch\x10\r\x12\x1a\n\x16Failure_Invali\ + dSession\x10\x0e\x12\x19\n\x15Failure_FirmwareError\x10c\"\x91\x06\n\rBu\ + ttonRequest\x12N\n\x04code\x18\x01\x20\x01(\x0e2:.hw.trezor.messages.com\ + mon.ButtonRequest.ButtonRequestTypeR\x04code\x12\x14\n\x05pages\x18\x02\ + \x20\x01(\rR\x05pages\"\x99\x05\n\x11ButtonRequestType\x12\x17\n\x13Butt\ + onRequest_Other\x10\x01\x12\"\n\x1eButtonRequest_FeeOverThreshold\x10\ + \x02\x12\x1f\n\x1bButtonRequest_ConfirmOutput\x10\x03\x12\x1d\n\x19Butto\ + nRequest_ResetDevice\x10\x04\x12\x1d\n\x19ButtonRequest_ConfirmWord\x10\ + \x05\x12\x1c\n\x18ButtonRequest_WipeDevice\x10\x06\x12\x1d\n\x19ButtonRe\ + quest_ProtectCall\x10\x07\x12\x18\n\x14ButtonRequest_SignTx\x10\x08\x12\ + \x1f\n\x1bButtonRequest_FirmwareCheck\x10\t\x12\x19\n\x15ButtonRequest_A\ + ddress\x10\n\x12\x1b\n\x17ButtonRequest_PublicKey\x10\x0b\x12#\n\x1fButt\ + onRequest_MnemonicWordCount\x10\x0c\x12\x1f\n\x1bButtonRequest_MnemonicI\ + nput\x10\r\x120\n(_Deprecated_ButtonRequest_PassphraseType\x10\x0e\x1a\ + \x02\x08\x01\x12'\n#ButtonRequest_UnknownDerivationPath\x10\x0f\x12\"\n\ + \x1eButtonRequest_RecoveryHomepage\x10\x10\x12\x19\n\x15ButtonRequest_Su\ + ccess\x10\x11\x12\x19\n\x15ButtonRequest_Warning\x10\x12\x12!\n\x1dButto\ + nRequest_PassphraseEntry\x10\x13\x12\x1a\n\x16ButtonRequest_PinEntry\x10\ + \x14\"\x0b\n\tButtonAck\"\xbb\x02\n\x10PinMatrixRequest\x12T\n\x04type\ + \x18\x01\x20\x01(\x0e2@.hw.trezor.messages.common.PinMatrixRequest.PinMa\ + trixRequestTypeR\x04type\"\xd0\x01\n\x14PinMatrixRequestType\x12\x20\n\ + \x1cPinMatrixRequestType_Current\x10\x01\x12!\n\x1dPinMatrixRequestType_\ + NewFirst\x10\x02\x12\"\n\x1ePinMatrixRequestType_NewSecond\x10\x03\x12&\ + \n\"PinMatrixRequestType_WipeCodeFirst\x10\x04\x12'\n#PinMatrixRequestTy\ + pe_WipeCodeSecond\x10\x05\"\x20\n\x0cPinMatrixAck\x12\x10\n\x03pin\x18\ + \x01\x20\x02(\tR\x03pin\"5\n\x11PassphraseRequest\x12\x20\n\n_on_device\ + \x18\x01\x20\x01(\x08R\x08OnDeviceB\x02\x18\x01\"g\n\rPassphraseAck\x12\ + \x1e\n\npassphrase\x18\x01\x20\x01(\tR\npassphrase\x12\x19\n\x06_state\ + \x18\x02\x20\x01(\x0cR\x05StateB\x02\x18\x01\x12\x1b\n\ton_device\x18\ + \x03\x20\x01(\x08R\x08onDevice\"=\n!Deprecated_PassphraseStateRequest\ + \x12\x14\n\x05state\x18\x01\x20\x01(\x0cR\x05state:\x02\x18\x01\"#\n\x1d\ + Deprecated_PassphraseStateAck:\x02\x18\x01\"\xc0\x01\n\nHDNodeType\x12\ + \x14\n\x05depth\x18\x01\x20\x02(\rR\x05depth\x12\x20\n\x0bfingerprint\ + \x18\x02\x20\x02(\rR\x0bfingerprint\x12\x1b\n\tchild_num\x18\x03\x20\x02\ + (\rR\x08childNum\x12\x1d\n\nchain_code\x18\x04\x20\x02(\x0cR\tchainCode\ + \x12\x1f\n\x0bprivate_key\x18\x05\x20\x01(\x0cR\nprivateKey\x12\x1d\n\np\ + ublic_key\x18\x06\x20\x02(\x0cR\tpublicKeyB>\n#com.satoshilabs.trezor.li\ + b.protobufB\x13TrezorMessageCommon\x80\xa6\x1d\x01\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(super::messages::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(11); + messages.push(Success::generated_message_descriptor_data()); + messages.push(Failure::generated_message_descriptor_data()); + messages.push(ButtonRequest::generated_message_descriptor_data()); + messages.push(ButtonAck::generated_message_descriptor_data()); + messages.push(PinMatrixRequest::generated_message_descriptor_data()); + messages.push(PinMatrixAck::generated_message_descriptor_data()); + messages.push(PassphraseRequest::generated_message_descriptor_data()); + messages.push(PassphraseAck::generated_message_descriptor_data()); + messages.push(Deprecated_PassphraseStateRequest::generated_message_descriptor_data()); + messages.push(Deprecated_PassphraseStateAck::generated_message_descriptor_data()); + messages.push(HDNodeType::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(3); + enums.push(failure::FailureType::generated_enum_descriptor_data()); + enums.push(button_request::ButtonRequestType::generated_enum_descriptor_data()); + enums.push(pin_matrix_request::PinMatrixRequestType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_crypto.rs b/wallet/trezor-client/src/protos/generated/messages_crypto.rs new file mode 100644 index 0000000000..5fec7d5f8f --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_crypto.rs @@ -0,0 +1,2956 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-crypto.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CipherKeyValue) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CipherKeyValue { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.key) + pub key: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.value) + pub value: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.encrypt) + pub encrypt: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.ask_on_encrypt) + pub ask_on_encrypt: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.ask_on_decrypt) + pub ask_on_decrypt: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.iv) + pub iv: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CipherKeyValue.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CipherKeyValue { + fn default() -> &'a CipherKeyValue { + ::default_instance() + } +} + +impl CipherKeyValue { + pub fn new() -> CipherKeyValue { + ::std::default::Default::default() + } + + // required string key = 2; + + pub fn key(&self) -> &str { + match self.key.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_key(&mut self) { + self.key = ::std::option::Option::None; + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::string::String) { + self.key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::string::String { + if self.key.is_none() { + self.key = ::std::option::Option::Some(::std::string::String::new()); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::string::String { + self.key.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes value = 3; + + pub fn value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool encrypt = 4; + + pub fn encrypt(&self) -> bool { + self.encrypt.unwrap_or(false) + } + + pub fn clear_encrypt(&mut self) { + self.encrypt = ::std::option::Option::None; + } + + pub fn has_encrypt(&self) -> bool { + self.encrypt.is_some() + } + + // Param is passed by value, moved + pub fn set_encrypt(&mut self, v: bool) { + self.encrypt = ::std::option::Option::Some(v); + } + + // optional bool ask_on_encrypt = 5; + + pub fn ask_on_encrypt(&self) -> bool { + self.ask_on_encrypt.unwrap_or(false) + } + + pub fn clear_ask_on_encrypt(&mut self) { + self.ask_on_encrypt = ::std::option::Option::None; + } + + pub fn has_ask_on_encrypt(&self) -> bool { + self.ask_on_encrypt.is_some() + } + + // Param is passed by value, moved + pub fn set_ask_on_encrypt(&mut self, v: bool) { + self.ask_on_encrypt = ::std::option::Option::Some(v); + } + + // optional bool ask_on_decrypt = 6; + + pub fn ask_on_decrypt(&self) -> bool { + self.ask_on_decrypt.unwrap_or(false) + } + + pub fn clear_ask_on_decrypt(&mut self) { + self.ask_on_decrypt = ::std::option::Option::None; + } + + pub fn has_ask_on_decrypt(&self) -> bool { + self.ask_on_decrypt.is_some() + } + + // Param is passed by value, moved + pub fn set_ask_on_decrypt(&mut self, v: bool) { + self.ask_on_decrypt = ::std::option::Option::Some(v); + } + + // optional bytes iv = 7; + + pub fn iv(&self) -> &[u8] { + match self.iv.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_iv(&mut self) { + self.iv = ::std::option::Option::None; + } + + pub fn has_iv(&self) -> bool { + self.iv.is_some() + } + + // Param is passed by value, moved + pub fn set_iv(&mut self, v: ::std::vec::Vec) { + self.iv = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_iv(&mut self) -> &mut ::std::vec::Vec { + if self.iv.is_none() { + self.iv = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.iv.as_mut().unwrap() + } + + // Take field + pub fn take_iv(&mut self) -> ::std::vec::Vec { + self.iv.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &CipherKeyValue| { &m.address_n }, + |m: &mut CipherKeyValue| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key", + |m: &CipherKeyValue| { &m.key }, + |m: &mut CipherKeyValue| { &mut m.key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &CipherKeyValue| { &m.value }, + |m: &mut CipherKeyValue| { &mut m.value }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "encrypt", + |m: &CipherKeyValue| { &m.encrypt }, + |m: &mut CipherKeyValue| { &mut m.encrypt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ask_on_encrypt", + |m: &CipherKeyValue| { &m.ask_on_encrypt }, + |m: &mut CipherKeyValue| { &mut m.ask_on_encrypt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ask_on_decrypt", + |m: &CipherKeyValue| { &m.ask_on_decrypt }, + |m: &mut CipherKeyValue| { &mut m.ask_on_decrypt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "iv", + |m: &CipherKeyValue| { &m.iv }, + |m: &mut CipherKeyValue| { &mut m.iv }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CipherKeyValue", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CipherKeyValue { + const NAME: &'static str = "CipherKeyValue"; + + fn is_initialized(&self) -> bool { + if self.key.is_none() { + return false; + } + if self.value.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.key = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.value = ::std::option::Option::Some(is.read_bytes()?); + }, + 32 => { + self.encrypt = ::std::option::Option::Some(is.read_bool()?); + }, + 40 => { + self.ask_on_encrypt = ::std::option::Option::Some(is.read_bool()?); + }, + 48 => { + self.ask_on_decrypt = ::std::option::Option::Some(is.read_bool()?); + }, + 58 => { + self.iv = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.key.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.encrypt { + my_size += 1 + 1; + } + if let Some(v) = self.ask_on_encrypt { + my_size += 1 + 1; + } + if let Some(v) = self.ask_on_decrypt { + my_size += 1 + 1; + } + if let Some(v) = self.iv.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.key.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.value.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.encrypt { + os.write_bool(4, v)?; + } + if let Some(v) = self.ask_on_encrypt { + os.write_bool(5, v)?; + } + if let Some(v) = self.ask_on_decrypt { + os.write_bool(6, v)?; + } + if let Some(v) = self.iv.as_ref() { + os.write_bytes(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CipherKeyValue { + CipherKeyValue::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.key = ::std::option::Option::None; + self.value = ::std::option::Option::None; + self.encrypt = ::std::option::Option::None; + self.ask_on_encrypt = ::std::option::Option::None; + self.ask_on_decrypt = ::std::option::Option::None; + self.iv = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CipherKeyValue { + static instance: CipherKeyValue = CipherKeyValue { + address_n: ::std::vec::Vec::new(), + key: ::std::option::Option::None, + value: ::std::option::Option::None, + encrypt: ::std::option::Option::None, + ask_on_encrypt: ::std::option::Option::None, + ask_on_decrypt: ::std::option::Option::None, + iv: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CipherKeyValue { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CipherKeyValue").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CipherKeyValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CipherKeyValue { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CipheredKeyValue) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CipheredKeyValue { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipheredKeyValue.value) + pub value: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CipheredKeyValue.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CipheredKeyValue { + fn default() -> &'a CipheredKeyValue { + ::default_instance() + } +} + +impl CipheredKeyValue { + pub fn new() -> CipheredKeyValue { + ::std::default::Default::default() + } + + // required bytes value = 1; + + pub fn value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &CipheredKeyValue| { &m.value }, + |m: &mut CipheredKeyValue| { &mut m.value }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CipheredKeyValue", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CipheredKeyValue { + const NAME: &'static str = "CipheredKeyValue"; + + fn is_initialized(&self) -> bool { + if self.value.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.value = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.value.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CipheredKeyValue { + CipheredKeyValue::new() + } + + fn clear(&mut self) { + self.value = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CipheredKeyValue { + static instance: CipheredKeyValue = CipheredKeyValue { + value: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CipheredKeyValue { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CipheredKeyValue").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CipheredKeyValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CipheredKeyValue { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.IdentityType) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct IdentityType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.proto) + pub proto: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.user) + pub user: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.host) + pub host: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.port) + pub port: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.path) + pub path: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.index) + pub index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.IdentityType.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a IdentityType { + fn default() -> &'a IdentityType { + ::default_instance() + } +} + +impl IdentityType { + pub fn new() -> IdentityType { + ::std::default::Default::default() + } + + // optional string proto = 1; + + pub fn proto(&self) -> &str { + match self.proto.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_proto(&mut self) { + self.proto = ::std::option::Option::None; + } + + pub fn has_proto(&self) -> bool { + self.proto.is_some() + } + + // Param is passed by value, moved + pub fn set_proto(&mut self, v: ::std::string::String) { + self.proto = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_proto(&mut self) -> &mut ::std::string::String { + if self.proto.is_none() { + self.proto = ::std::option::Option::Some(::std::string::String::new()); + } + self.proto.as_mut().unwrap() + } + + // Take field + pub fn take_proto(&mut self) -> ::std::string::String { + self.proto.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string user = 2; + + pub fn user(&self) -> &str { + match self.user.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_user(&mut self) { + self.user = ::std::option::Option::None; + } + + pub fn has_user(&self) -> bool { + self.user.is_some() + } + + // Param is passed by value, moved + pub fn set_user(&mut self, v: ::std::string::String) { + self.user = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_user(&mut self) -> &mut ::std::string::String { + if self.user.is_none() { + self.user = ::std::option::Option::Some(::std::string::String::new()); + } + self.user.as_mut().unwrap() + } + + // Take field + pub fn take_user(&mut self) -> ::std::string::String { + self.user.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string host = 3; + + pub fn host(&self) -> &str { + match self.host.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_host(&mut self) { + self.host = ::std::option::Option::None; + } + + pub fn has_host(&self) -> bool { + self.host.is_some() + } + + // Param is passed by value, moved + pub fn set_host(&mut self, v: ::std::string::String) { + self.host = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_host(&mut self) -> &mut ::std::string::String { + if self.host.is_none() { + self.host = ::std::option::Option::Some(::std::string::String::new()); + } + self.host.as_mut().unwrap() + } + + // Take field + pub fn take_host(&mut self) -> ::std::string::String { + self.host.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string port = 4; + + pub fn port(&self) -> &str { + match self.port.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_port(&mut self) { + self.port = ::std::option::Option::None; + } + + pub fn has_port(&self) -> bool { + self.port.is_some() + } + + // Param is passed by value, moved + pub fn set_port(&mut self, v: ::std::string::String) { + self.port = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_port(&mut self) -> &mut ::std::string::String { + if self.port.is_none() { + self.port = ::std::option::Option::Some(::std::string::String::new()); + } + self.port.as_mut().unwrap() + } + + // Take field + pub fn take_port(&mut self) -> ::std::string::String { + self.port.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string path = 5; + + pub fn path(&self) -> &str { + match self.path.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_path(&mut self) { + self.path = ::std::option::Option::None; + } + + pub fn has_path(&self) -> bool { + self.path.is_some() + } + + // Param is passed by value, moved + pub fn set_path(&mut self, v: ::std::string::String) { + self.path = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_path(&mut self) -> &mut ::std::string::String { + if self.path.is_none() { + self.path = ::std::option::Option::Some(::std::string::String::new()); + } + self.path.as_mut().unwrap() + } + + // Take field + pub fn take_path(&mut self) -> ::std::string::String { + self.path.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 index = 6; + + pub fn index(&self) -> u32 { + self.index.unwrap_or(0u32) + } + + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u32) { + self.index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "proto", + |m: &IdentityType| { &m.proto }, + |m: &mut IdentityType| { &mut m.proto }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "user", + |m: &IdentityType| { &m.user }, + |m: &mut IdentityType| { &mut m.user }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "host", + |m: &IdentityType| { &m.host }, + |m: &mut IdentityType| { &mut m.host }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "port", + |m: &IdentityType| { &m.port }, + |m: &mut IdentityType| { &mut m.port }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "path", + |m: &IdentityType| { &m.path }, + |m: &mut IdentityType| { &mut m.path }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "index", + |m: &IdentityType| { &m.index }, + |m: &mut IdentityType| { &mut m.index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "IdentityType", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for IdentityType { + const NAME: &'static str = "IdentityType"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.proto = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.user = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.host = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.port = ::std::option::Option::Some(is.read_string()?); + }, + 42 => { + self.path = ::std::option::Option::Some(is.read_string()?); + }, + 48 => { + self.index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.proto.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.user.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.host.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.port.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.path.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.index { + my_size += ::protobuf::rt::uint32_size(6, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.proto.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.user.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.host.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.port.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.path.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.index { + os.write_uint32(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> IdentityType { + IdentityType::new() + } + + fn clear(&mut self) { + self.proto = ::std::option::Option::None; + self.user = ::std::option::Option::None; + self.host = ::std::option::Option::None; + self.port = ::std::option::Option::None; + self.path = ::std::option::Option::None; + self.index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static IdentityType { + static instance: IdentityType = IdentityType { + proto: ::std::option::Option::None, + user: ::std::option::Option::None, + host: ::std::option::Option::None, + port: ::std::option::Option::None, + path: ::std::option::Option::None, + index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for IdentityType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("IdentityType").unwrap()).clone() + } +} + +impl ::std::fmt::Display for IdentityType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for IdentityType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.SignIdentity) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SignIdentity { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.identity) + pub identity: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.challenge_hidden) + pub challenge_hidden: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.challenge_visual) + pub challenge_visual: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.ecdsa_curve_name) + pub ecdsa_curve_name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.SignIdentity.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SignIdentity { + fn default() -> &'a SignIdentity { + ::default_instance() + } +} + +impl SignIdentity { + pub fn new() -> SignIdentity { + ::std::default::Default::default() + } + + // optional bytes challenge_hidden = 2; + + pub fn challenge_hidden(&self) -> &[u8] { + match self.challenge_hidden.as_ref() { + Some(v) => v, + None => b"", + } + } + + pub fn clear_challenge_hidden(&mut self) { + self.challenge_hidden = ::std::option::Option::None; + } + + pub fn has_challenge_hidden(&self) -> bool { + self.challenge_hidden.is_some() + } + + // Param is passed by value, moved + pub fn set_challenge_hidden(&mut self, v: ::std::vec::Vec) { + self.challenge_hidden = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_challenge_hidden(&mut self) -> &mut ::std::vec::Vec { + if self.challenge_hidden.is_none() { + self.challenge_hidden = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.challenge_hidden.as_mut().unwrap() + } + + // Take field + pub fn take_challenge_hidden(&mut self) -> ::std::vec::Vec { + self.challenge_hidden.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string challenge_visual = 3; + + pub fn challenge_visual(&self) -> &str { + match self.challenge_visual.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_challenge_visual(&mut self) { + self.challenge_visual = ::std::option::Option::None; + } + + pub fn has_challenge_visual(&self) -> bool { + self.challenge_visual.is_some() + } + + // Param is passed by value, moved + pub fn set_challenge_visual(&mut self, v: ::std::string::String) { + self.challenge_visual = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_challenge_visual(&mut self) -> &mut ::std::string::String { + if self.challenge_visual.is_none() { + self.challenge_visual = ::std::option::Option::Some(::std::string::String::new()); + } + self.challenge_visual.as_mut().unwrap() + } + + // Take field + pub fn take_challenge_visual(&mut self) -> ::std::string::String { + self.challenge_visual.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string ecdsa_curve_name = 4; + + pub fn ecdsa_curve_name(&self) -> &str { + match self.ecdsa_curve_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_ecdsa_curve_name(&mut self) { + self.ecdsa_curve_name = ::std::option::Option::None; + } + + pub fn has_ecdsa_curve_name(&self) -> bool { + self.ecdsa_curve_name.is_some() + } + + // Param is passed by value, moved + pub fn set_ecdsa_curve_name(&mut self, v: ::std::string::String) { + self.ecdsa_curve_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ecdsa_curve_name(&mut self) -> &mut ::std::string::String { + if self.ecdsa_curve_name.is_none() { + self.ecdsa_curve_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.ecdsa_curve_name.as_mut().unwrap() + } + + // Take field + pub fn take_ecdsa_curve_name(&mut self) -> ::std::string::String { + self.ecdsa_curve_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, IdentityType>( + "identity", + |m: &SignIdentity| { &m.identity }, + |m: &mut SignIdentity| { &mut m.identity }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "challenge_hidden", + |m: &SignIdentity| { &m.challenge_hidden }, + |m: &mut SignIdentity| { &mut m.challenge_hidden }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "challenge_visual", + |m: &SignIdentity| { &m.challenge_visual }, + |m: &mut SignIdentity| { &mut m.challenge_visual }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ecdsa_curve_name", + |m: &SignIdentity| { &m.ecdsa_curve_name }, + |m: &mut SignIdentity| { &mut m.ecdsa_curve_name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SignIdentity", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SignIdentity { + const NAME: &'static str = "SignIdentity"; + + fn is_initialized(&self) -> bool { + if self.identity.is_none() { + return false; + } + for v in &self.identity { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.identity)?; + }, + 18 => { + self.challenge_hidden = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.challenge_visual = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.ecdsa_curve_name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.identity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.challenge_hidden.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.challenge_visual.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.ecdsa_curve_name.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.identity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.challenge_hidden.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.challenge_visual.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.ecdsa_curve_name.as_ref() { + os.write_string(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SignIdentity { + SignIdentity::new() + } + + fn clear(&mut self) { + self.identity.clear(); + self.challenge_hidden = ::std::option::Option::None; + self.challenge_visual = ::std::option::Option::None; + self.ecdsa_curve_name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SignIdentity { + static instance: SignIdentity = SignIdentity { + identity: ::protobuf::MessageField::none(), + challenge_hidden: ::std::option::Option::None, + challenge_visual: ::std::option::Option::None, + ecdsa_curve_name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SignIdentity { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SignIdentity").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SignIdentity { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SignIdentity { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.SignedIdentity) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SignedIdentity { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignedIdentity.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignedIdentity.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignedIdentity.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.SignedIdentity.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SignedIdentity { + fn default() -> &'a SignedIdentity { + ::default_instance() + } +} + +impl SignedIdentity { + pub fn new() -> SignedIdentity { + ::std::default::Default::default() + } + + // optional string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes public_key = 2; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes signature = 3; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &SignedIdentity| { &m.address }, + |m: &mut SignedIdentity| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &SignedIdentity| { &m.public_key }, + |m: &mut SignedIdentity| { &mut m.public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &SignedIdentity| { &m.signature }, + |m: &mut SignedIdentity| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SignedIdentity", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SignedIdentity { + const NAME: &'static str = "SignedIdentity"; + + fn is_initialized(&self) -> bool { + if self.public_key.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SignedIdentity { + SignedIdentity::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SignedIdentity { + static instance: SignedIdentity = SignedIdentity { + address: ::std::option::Option::None, + public_key: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SignedIdentity { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SignedIdentity").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SignedIdentity { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SignedIdentity { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.GetECDHSessionKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetECDHSessionKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.GetECDHSessionKey.identity) + pub identity: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.GetECDHSessionKey.peer_public_key) + pub peer_public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.GetECDHSessionKey.ecdsa_curve_name) + pub ecdsa_curve_name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.GetECDHSessionKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetECDHSessionKey { + fn default() -> &'a GetECDHSessionKey { + ::default_instance() + } +} + +impl GetECDHSessionKey { + pub fn new() -> GetECDHSessionKey { + ::std::default::Default::default() + } + + // required bytes peer_public_key = 2; + + pub fn peer_public_key(&self) -> &[u8] { + match self.peer_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_peer_public_key(&mut self) { + self.peer_public_key = ::std::option::Option::None; + } + + pub fn has_peer_public_key(&self) -> bool { + self.peer_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_peer_public_key(&mut self, v: ::std::vec::Vec) { + self.peer_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.peer_public_key.is_none() { + self.peer_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.peer_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_peer_public_key(&mut self) -> ::std::vec::Vec { + self.peer_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string ecdsa_curve_name = 3; + + pub fn ecdsa_curve_name(&self) -> &str { + match self.ecdsa_curve_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_ecdsa_curve_name(&mut self) { + self.ecdsa_curve_name = ::std::option::Option::None; + } + + pub fn has_ecdsa_curve_name(&self) -> bool { + self.ecdsa_curve_name.is_some() + } + + // Param is passed by value, moved + pub fn set_ecdsa_curve_name(&mut self, v: ::std::string::String) { + self.ecdsa_curve_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ecdsa_curve_name(&mut self) -> &mut ::std::string::String { + if self.ecdsa_curve_name.is_none() { + self.ecdsa_curve_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.ecdsa_curve_name.as_mut().unwrap() + } + + // Take field + pub fn take_ecdsa_curve_name(&mut self) -> ::std::string::String { + self.ecdsa_curve_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, IdentityType>( + "identity", + |m: &GetECDHSessionKey| { &m.identity }, + |m: &mut GetECDHSessionKey| { &mut m.identity }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "peer_public_key", + |m: &GetECDHSessionKey| { &m.peer_public_key }, + |m: &mut GetECDHSessionKey| { &mut m.peer_public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ecdsa_curve_name", + |m: &GetECDHSessionKey| { &m.ecdsa_curve_name }, + |m: &mut GetECDHSessionKey| { &mut m.ecdsa_curve_name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetECDHSessionKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetECDHSessionKey { + const NAME: &'static str = "GetECDHSessionKey"; + + fn is_initialized(&self) -> bool { + if self.identity.is_none() { + return false; + } + if self.peer_public_key.is_none() { + return false; + } + for v in &self.identity { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.identity)?; + }, + 18 => { + self.peer_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.ecdsa_curve_name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.identity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.peer_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.ecdsa_curve_name.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.identity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.peer_public_key.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.ecdsa_curve_name.as_ref() { + os.write_string(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetECDHSessionKey { + GetECDHSessionKey::new() + } + + fn clear(&mut self) { + self.identity.clear(); + self.peer_public_key = ::std::option::Option::None; + self.ecdsa_curve_name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetECDHSessionKey { + static instance: GetECDHSessionKey = GetECDHSessionKey { + identity: ::protobuf::MessageField::none(), + peer_public_key: ::std::option::Option::None, + ecdsa_curve_name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetECDHSessionKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetECDHSessionKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetECDHSessionKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetECDHSessionKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.ECDHSessionKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ECDHSessionKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.ECDHSessionKey.session_key) + pub session_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.ECDHSessionKey.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.ECDHSessionKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ECDHSessionKey { + fn default() -> &'a ECDHSessionKey { + ::default_instance() + } +} + +impl ECDHSessionKey { + pub fn new() -> ECDHSessionKey { + ::std::default::Default::default() + } + + // required bytes session_key = 1; + + pub fn session_key(&self) -> &[u8] { + match self.session_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_session_key(&mut self) { + self.session_key = ::std::option::Option::None; + } + + pub fn has_session_key(&self) -> bool { + self.session_key.is_some() + } + + // Param is passed by value, moved + pub fn set_session_key(&mut self, v: ::std::vec::Vec) { + self.session_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_session_key(&mut self) -> &mut ::std::vec::Vec { + if self.session_key.is_none() { + self.session_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.session_key.as_mut().unwrap() + } + + // Take field + pub fn take_session_key(&mut self) -> ::std::vec::Vec { + self.session_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes public_key = 2; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "session_key", + |m: &ECDHSessionKey| { &m.session_key }, + |m: &mut ECDHSessionKey| { &mut m.session_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &ECDHSessionKey| { &m.public_key }, + |m: &mut ECDHSessionKey| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ECDHSessionKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ECDHSessionKey { + const NAME: &'static str = "ECDHSessionKey"; + + fn is_initialized(&self) -> bool { + if self.session_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.session_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.session_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.session_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ECDHSessionKey { + ECDHSessionKey::new() + } + + fn clear(&mut self) { + self.session_key = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ECDHSessionKey { + static instance: ECDHSessionKey = ECDHSessionKey { + session_key: ::std::option::Option::None, + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ECDHSessionKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ECDHSessionKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ECDHSessionKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ECDHSessionKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiCommit) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CosiCommit { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommit.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommit.data) + pub data: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiCommit.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CosiCommit { + fn default() -> &'a CosiCommit { + ::default_instance() + } +} + +impl CosiCommit { + pub fn new() -> CosiCommit { + ::std::default::Default::default() + } + + // optional bytes data = 2; + + pub fn data(&self) -> &[u8] { + match self.data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data(&mut self) { + self.data = ::std::option::Option::None; + } + + pub fn has_data(&self) -> bool { + self.data.is_some() + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data.as_mut().unwrap() + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &CosiCommit| { &m.address_n }, + |m: &mut CosiCommit| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data", + |m: &CosiCommit| { &m.data }, + |m: &mut CosiCommit| { &mut m.data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CosiCommit", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CosiCommit { + const NAME: &'static str = "CosiCommit"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.data = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.data.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CosiCommit { + CosiCommit::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.data = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CosiCommit { + static instance: CosiCommit = CosiCommit { + address_n: ::std::vec::Vec::new(), + data: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CosiCommit { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiCommit").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CosiCommit { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CosiCommit { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiCommitment) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CosiCommitment { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommitment.commitment) + pub commitment: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommitment.pubkey) + pub pubkey: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiCommitment.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CosiCommitment { + fn default() -> &'a CosiCommitment { + ::default_instance() + } +} + +impl CosiCommitment { + pub fn new() -> CosiCommitment { + ::std::default::Default::default() + } + + // required bytes commitment = 1; + + pub fn commitment(&self) -> &[u8] { + match self.commitment.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_commitment(&mut self) { + self.commitment = ::std::option::Option::None; + } + + pub fn has_commitment(&self) -> bool { + self.commitment.is_some() + } + + // Param is passed by value, moved + pub fn set_commitment(&mut self, v: ::std::vec::Vec) { + self.commitment = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_commitment(&mut self) -> &mut ::std::vec::Vec { + if self.commitment.is_none() { + self.commitment = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.commitment.as_mut().unwrap() + } + + // Take field + pub fn take_commitment(&mut self) -> ::std::vec::Vec { + self.commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes pubkey = 2; + + pub fn pubkey(&self) -> &[u8] { + match self.pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pubkey(&mut self) { + self.pubkey = ::std::option::Option::None; + } + + pub fn has_pubkey(&self) -> bool { + self.pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_pubkey(&mut self, v: ::std::vec::Vec) { + self.pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.pubkey.is_none() { + self.pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_pubkey(&mut self) -> ::std::vec::Vec { + self.pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "commitment", + |m: &CosiCommitment| { &m.commitment }, + |m: &mut CosiCommitment| { &mut m.commitment }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pubkey", + |m: &CosiCommitment| { &m.pubkey }, + |m: &mut CosiCommitment| { &mut m.pubkey }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CosiCommitment", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CosiCommitment { + const NAME: &'static str = "CosiCommitment"; + + fn is_initialized(&self) -> bool { + if self.commitment.is_none() { + return false; + } + if self.pubkey.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.commitment = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.commitment.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.commitment.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.pubkey.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CosiCommitment { + CosiCommitment::new() + } + + fn clear(&mut self) { + self.commitment = ::std::option::Option::None; + self.pubkey = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CosiCommitment { + static instance: CosiCommitment = CosiCommitment { + commitment: ::std::option::Option::None, + pubkey: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CosiCommitment { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiCommitment").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CosiCommitment { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CosiCommitment { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiSign) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CosiSign { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.data) + pub data: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.global_commitment) + pub global_commitment: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.global_pubkey) + pub global_pubkey: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiSign.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CosiSign { + fn default() -> &'a CosiSign { + ::default_instance() + } +} + +impl CosiSign { + pub fn new() -> CosiSign { + ::std::default::Default::default() + } + + // required bytes data = 2; + + pub fn data(&self) -> &[u8] { + match self.data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data(&mut self) { + self.data = ::std::option::Option::None; + } + + pub fn has_data(&self) -> bool { + self.data.is_some() + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data.as_mut().unwrap() + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes global_commitment = 3; + + pub fn global_commitment(&self) -> &[u8] { + match self.global_commitment.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_global_commitment(&mut self) { + self.global_commitment = ::std::option::Option::None; + } + + pub fn has_global_commitment(&self) -> bool { + self.global_commitment.is_some() + } + + // Param is passed by value, moved + pub fn set_global_commitment(&mut self, v: ::std::vec::Vec) { + self.global_commitment = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_global_commitment(&mut self) -> &mut ::std::vec::Vec { + if self.global_commitment.is_none() { + self.global_commitment = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.global_commitment.as_mut().unwrap() + } + + // Take field + pub fn take_global_commitment(&mut self) -> ::std::vec::Vec { + self.global_commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes global_pubkey = 4; + + pub fn global_pubkey(&self) -> &[u8] { + match self.global_pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_global_pubkey(&mut self) { + self.global_pubkey = ::std::option::Option::None; + } + + pub fn has_global_pubkey(&self) -> bool { + self.global_pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_global_pubkey(&mut self, v: ::std::vec::Vec) { + self.global_pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_global_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.global_pubkey.is_none() { + self.global_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.global_pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_global_pubkey(&mut self) -> ::std::vec::Vec { + self.global_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &CosiSign| { &m.address_n }, + |m: &mut CosiSign| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data", + |m: &CosiSign| { &m.data }, + |m: &mut CosiSign| { &mut m.data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "global_commitment", + |m: &CosiSign| { &m.global_commitment }, + |m: &mut CosiSign| { &mut m.global_commitment }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "global_pubkey", + |m: &CosiSign| { &m.global_pubkey }, + |m: &mut CosiSign| { &mut m.global_pubkey }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CosiSign", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CosiSign { + const NAME: &'static str = "CosiSign"; + + fn is_initialized(&self) -> bool { + if self.data.is_none() { + return false; + } + if self.global_commitment.is_none() { + return false; + } + if self.global_pubkey.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.data = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.global_commitment = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.global_pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.global_commitment.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.global_pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.data.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.global_commitment.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.global_pubkey.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CosiSign { + CosiSign::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.data = ::std::option::Option::None; + self.global_commitment = ::std::option::Option::None; + self.global_pubkey = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CosiSign { + static instance: CosiSign = CosiSign { + address_n: ::std::vec::Vec::new(), + data: ::std::option::Option::None, + global_commitment: ::std::option::Option::None, + global_pubkey: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CosiSign { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiSign").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CosiSign { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CosiSign { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiSignature) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CosiSignature { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSignature.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiSignature.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CosiSignature { + fn default() -> &'a CosiSignature { + ::default_instance() + } +} + +impl CosiSignature { + pub fn new() -> CosiSignature { + ::std::default::Default::default() + } + + // required bytes signature = 1; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &CosiSignature| { &m.signature }, + |m: &mut CosiSignature| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CosiSignature", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CosiSignature { + const NAME: &'static str = "CosiSignature"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CosiSignature { + CosiSignature::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CosiSignature { + static instance: CosiSignature = CosiSignature { + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CosiSignature { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiSignature").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CosiSignature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CosiSignature { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x15messages-crypto.proto\x12\x19hw.trezor.messages.crypto\x1a\x0emess\ + ages.proto\"\xcb\x01\n\x0eCipherKeyValue\x12\x1b\n\taddress_n\x18\x01\ + \x20\x03(\rR\x08addressN\x12\x10\n\x03key\x18\x02\x20\x02(\tR\x03key\x12\ + \x14\n\x05value\x18\x03\x20\x02(\x0cR\x05value\x12\x18\n\x07encrypt\x18\ + \x04\x20\x01(\x08R\x07encrypt\x12$\n\x0eask_on_encrypt\x18\x05\x20\x01(\ + \x08R\x0caskOnEncrypt\x12$\n\x0eask_on_decrypt\x18\x06\x20\x01(\x08R\x0c\ + askOnDecrypt\x12\x0e\n\x02iv\x18\x07\x20\x01(\x0cR\x02iv\"(\n\x10Ciphere\ + dKeyValue\x12\x14\n\x05value\x18\x01\x20\x02(\x0cR\x05value\"\x8d\x01\n\ + \x0cIdentityType\x12\x14\n\x05proto\x18\x01\x20\x01(\tR\x05proto\x12\x12\ + \n\x04user\x18\x02\x20\x01(\tR\x04user\x12\x12\n\x04host\x18\x03\x20\x01\ + (\tR\x04host\x12\x12\n\x04port\x18\x04\x20\x01(\tR\x04port\x12\x12\n\x04\ + path\x18\x05\x20\x01(\tR\x04path\x12\x17\n\x05index\x18\x06\x20\x01(\r:\ + \x010R\x05index\"\xd7\x01\n\x0cSignIdentity\x12C\n\x08identity\x18\x01\ + \x20\x02(\x0b2'.hw.trezor.messages.crypto.IdentityTypeR\x08identity\x12+\ + \n\x10challenge_hidden\x18\x02\x20\x01(\x0c:\0R\x0fchallengeHidden\x12+\ + \n\x10challenge_visual\x18\x03\x20\x01(\t:\0R\x0fchallengeVisual\x12(\n\ + \x10ecdsa_curve_name\x18\x04\x20\x01(\tR\x0eecdsaCurveName\"g\n\x0eSigne\ + dIdentity\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12\x1d\n\ + \npublic_key\x18\x02\x20\x02(\x0cR\tpublicKey\x12\x1c\n\tsignature\x18\ + \x03\x20\x02(\x0cR\tsignature\"\xaa\x01\n\x11GetECDHSessionKey\x12C\n\ + \x08identity\x18\x01\x20\x02(\x0b2'.hw.trezor.messages.crypto.IdentityTy\ + peR\x08identity\x12&\n\x0fpeer_public_key\x18\x02\x20\x02(\x0cR\rpeerPub\ + licKey\x12(\n\x10ecdsa_curve_name\x18\x03\x20\x01(\tR\x0eecdsaCurveName\ + \"P\n\x0eECDHSessionKey\x12\x1f\n\x0bsession_key\x18\x01\x20\x02(\x0cR\n\ + sessionKey\x12\x1d\n\npublic_key\x18\x02\x20\x01(\x0cR\tpublicKey\"A\n\n\ + CosiCommit\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x16\ + \n\x04data\x18\x02\x20\x01(\x0cR\x04dataB\x02\x18\x01\"H\n\x0eCosiCommit\ + ment\x12\x1e\n\ncommitment\x18\x01\x20\x02(\x0cR\ncommitment\x12\x16\n\ + \x06pubkey\x18\x02\x20\x02(\x0cR\x06pubkey\"\x8d\x01\n\x08CosiSign\x12\ + \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x12\n\x04data\x18\ + \x02\x20\x02(\x0cR\x04data\x12+\n\x11global_commitment\x18\x03\x20\x02(\ + \x0cR\x10globalCommitment\x12#\n\rglobal_pubkey\x18\x04\x20\x02(\x0cR\ + \x0cglobalPubkey\"-\n\rCosiSignature\x12\x1c\n\tsignature\x18\x01\x20\ + \x02(\x0cR\tsignatureB>\n#com.satoshilabs.trezor.lib.protobufB\x13Trezor\ + MessageCrypto\x80\xa6\x1d\x01\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(super::messages::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(11); + messages.push(CipherKeyValue::generated_message_descriptor_data()); + messages.push(CipheredKeyValue::generated_message_descriptor_data()); + messages.push(IdentityType::generated_message_descriptor_data()); + messages.push(SignIdentity::generated_message_descriptor_data()); + messages.push(SignedIdentity::generated_message_descriptor_data()); + messages.push(GetECDHSessionKey::generated_message_descriptor_data()); + messages.push(ECDHSessionKey::generated_message_descriptor_data()); + messages.push(CosiCommit::generated_message_descriptor_data()); + messages.push(CosiCommitment::generated_message_descriptor_data()); + messages.push(CosiSign::generated_message_descriptor_data()); + messages.push(CosiSignature::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_debug.rs b/wallet/trezor-client/src/protos/generated/messages_debug.rs new file mode 100644 index 0000000000..7bf28d1bf9 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_debug.rs @@ -0,0 +1,3555 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-debug.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkDecision) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkDecision { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.button) + pub button: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.swipe) + pub swipe: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.input) + pub input: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.x) + pub x: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.y) + pub y: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.wait) + pub wait: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.hold_ms) + pub hold_ms: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.physical_button) + pub physical_button: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkDecision.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkDecision { + fn default() -> &'a DebugLinkDecision { + ::default_instance() + } +} + +impl DebugLinkDecision { + pub fn new() -> DebugLinkDecision { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.debug.DebugLinkDecision.DebugButton button = 1; + + pub fn button(&self) -> debug_link_decision::DebugButton { + match self.button { + Some(e) => e.enum_value_or(debug_link_decision::DebugButton::NO), + None => debug_link_decision::DebugButton::NO, + } + } + + pub fn clear_button(&mut self) { + self.button = ::std::option::Option::None; + } + + pub fn has_button(&self) -> bool { + self.button.is_some() + } + + // Param is passed by value, moved + pub fn set_button(&mut self, v: debug_link_decision::DebugButton) { + self.button = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional .hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection swipe = 2; + + pub fn swipe(&self) -> debug_link_decision::DebugSwipeDirection { + match self.swipe { + Some(e) => e.enum_value_or(debug_link_decision::DebugSwipeDirection::UP), + None => debug_link_decision::DebugSwipeDirection::UP, + } + } + + pub fn clear_swipe(&mut self) { + self.swipe = ::std::option::Option::None; + } + + pub fn has_swipe(&self) -> bool { + self.swipe.is_some() + } + + // Param is passed by value, moved + pub fn set_swipe(&mut self, v: debug_link_decision::DebugSwipeDirection) { + self.swipe = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional string input = 3; + + pub fn input(&self) -> &str { + match self.input.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_input(&mut self) { + self.input = ::std::option::Option::None; + } + + pub fn has_input(&self) -> bool { + self.input.is_some() + } + + // Param is passed by value, moved + pub fn set_input(&mut self, v: ::std::string::String) { + self.input = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_input(&mut self) -> &mut ::std::string::String { + if self.input.is_none() { + self.input = ::std::option::Option::Some(::std::string::String::new()); + } + self.input.as_mut().unwrap() + } + + // Take field + pub fn take_input(&mut self) -> ::std::string::String { + self.input.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 x = 4; + + pub fn x(&self) -> u32 { + self.x.unwrap_or(0) + } + + pub fn clear_x(&mut self) { + self.x = ::std::option::Option::None; + } + + pub fn has_x(&self) -> bool { + self.x.is_some() + } + + // Param is passed by value, moved + pub fn set_x(&mut self, v: u32) { + self.x = ::std::option::Option::Some(v); + } + + // optional uint32 y = 5; + + pub fn y(&self) -> u32 { + self.y.unwrap_or(0) + } + + pub fn clear_y(&mut self) { + self.y = ::std::option::Option::None; + } + + pub fn has_y(&self) -> bool { + self.y.is_some() + } + + // Param is passed by value, moved + pub fn set_y(&mut self, v: u32) { + self.y = ::std::option::Option::Some(v); + } + + // optional bool wait = 6; + + pub fn wait(&self) -> bool { + self.wait.unwrap_or(false) + } + + pub fn clear_wait(&mut self) { + self.wait = ::std::option::Option::None; + } + + pub fn has_wait(&self) -> bool { + self.wait.is_some() + } + + // Param is passed by value, moved + pub fn set_wait(&mut self, v: bool) { + self.wait = ::std::option::Option::Some(v); + } + + // optional uint32 hold_ms = 7; + + pub fn hold_ms(&self) -> u32 { + self.hold_ms.unwrap_or(0) + } + + pub fn clear_hold_ms(&mut self) { + self.hold_ms = ::std::option::Option::None; + } + + pub fn has_hold_ms(&self) -> bool { + self.hold_ms.is_some() + } + + // Param is passed by value, moved + pub fn set_hold_ms(&mut self, v: u32) { + self.hold_ms = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton physical_button = 8; + + pub fn physical_button(&self) -> debug_link_decision::DebugPhysicalButton { + match self.physical_button { + Some(e) => e.enum_value_or(debug_link_decision::DebugPhysicalButton::LEFT_BTN), + None => debug_link_decision::DebugPhysicalButton::LEFT_BTN, + } + } + + pub fn clear_physical_button(&mut self) { + self.physical_button = ::std::option::Option::None; + } + + pub fn has_physical_button(&self) -> bool { + self.physical_button.is_some() + } + + // Param is passed by value, moved + pub fn set_physical_button(&mut self, v: debug_link_decision::DebugPhysicalButton) { + self.physical_button = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "button", + |m: &DebugLinkDecision| { &m.button }, + |m: &mut DebugLinkDecision| { &mut m.button }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "swipe", + |m: &DebugLinkDecision| { &m.swipe }, + |m: &mut DebugLinkDecision| { &mut m.swipe }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "input", + |m: &DebugLinkDecision| { &m.input }, + |m: &mut DebugLinkDecision| { &mut m.input }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "x", + |m: &DebugLinkDecision| { &m.x }, + |m: &mut DebugLinkDecision| { &mut m.x }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "y", + |m: &DebugLinkDecision| { &m.y }, + |m: &mut DebugLinkDecision| { &mut m.y }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "wait", + |m: &DebugLinkDecision| { &m.wait }, + |m: &mut DebugLinkDecision| { &mut m.wait }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hold_ms", + |m: &DebugLinkDecision| { &m.hold_ms }, + |m: &mut DebugLinkDecision| { &mut m.hold_ms }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "physical_button", + |m: &DebugLinkDecision| { &m.physical_button }, + |m: &mut DebugLinkDecision| { &mut m.physical_button }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkDecision", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkDecision { + const NAME: &'static str = "DebugLinkDecision"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.button = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 16 => { + self.swipe = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 26 => { + self.input = ::std::option::Option::Some(is.read_string()?); + }, + 32 => { + self.x = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.y = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.wait = ::std::option::Option::Some(is.read_bool()?); + }, + 56 => { + self.hold_ms = ::std::option::Option::Some(is.read_uint32()?); + }, + 64 => { + self.physical_button = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.button { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.swipe { + my_size += ::protobuf::rt::int32_size(2, v.value()); + } + if let Some(v) = self.input.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.x { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.y { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.wait { + my_size += 1 + 1; + } + if let Some(v) = self.hold_ms { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.physical_button { + my_size += ::protobuf::rt::int32_size(8, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.button { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.swipe { + os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.input.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.x { + os.write_uint32(4, v)?; + } + if let Some(v) = self.y { + os.write_uint32(5, v)?; + } + if let Some(v) = self.wait { + os.write_bool(6, v)?; + } + if let Some(v) = self.hold_ms { + os.write_uint32(7, v)?; + } + if let Some(v) = self.physical_button { + os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkDecision { + DebugLinkDecision::new() + } + + fn clear(&mut self) { + self.button = ::std::option::Option::None; + self.swipe = ::std::option::Option::None; + self.input = ::std::option::Option::None; + self.x = ::std::option::Option::None; + self.y = ::std::option::Option::None; + self.wait = ::std::option::Option::None; + self.hold_ms = ::std::option::Option::None; + self.physical_button = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkDecision { + static instance: DebugLinkDecision = DebugLinkDecision { + button: ::std::option::Option::None, + swipe: ::std::option::Option::None, + input: ::std::option::Option::None, + x: ::std::option::Option::None, + y: ::std::option::Option::None, + wait: ::std::option::Option::None, + hold_ms: ::std::option::Option::None, + physical_button: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkDecision { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkDecision").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkDecision { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkDecision { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `DebugLinkDecision` +pub mod debug_link_decision { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection) + pub enum DebugSwipeDirection { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.UP) + UP = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.DOWN) + DOWN = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.LEFT) + LEFT = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.RIGHT) + RIGHT = 3, + } + + impl ::protobuf::Enum for DebugSwipeDirection { + const NAME: &'static str = "DebugSwipeDirection"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DebugSwipeDirection::UP), + 1 => ::std::option::Option::Some(DebugSwipeDirection::DOWN), + 2 => ::std::option::Option::Some(DebugSwipeDirection::LEFT), + 3 => ::std::option::Option::Some(DebugSwipeDirection::RIGHT), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "UP" => ::std::option::Option::Some(DebugSwipeDirection::UP), + "DOWN" => ::std::option::Option::Some(DebugSwipeDirection::DOWN), + "LEFT" => ::std::option::Option::Some(DebugSwipeDirection::LEFT), + "RIGHT" => ::std::option::Option::Some(DebugSwipeDirection::RIGHT), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [DebugSwipeDirection] = &[ + DebugSwipeDirection::UP, + DebugSwipeDirection::DOWN, + DebugSwipeDirection::LEFT, + DebugSwipeDirection::RIGHT, + ]; + } + + impl ::protobuf::EnumFull for DebugSwipeDirection { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("DebugLinkDecision.DebugSwipeDirection").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for DebugSwipeDirection { + fn default() -> Self { + DebugSwipeDirection::UP + } + } + + impl DebugSwipeDirection { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DebugLinkDecision.DebugSwipeDirection") + } + } + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.debug.DebugLinkDecision.DebugButton) + pub enum DebugButton { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugButton.NO) + NO = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugButton.YES) + YES = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugButton.INFO) + INFO = 2, + } + + impl ::protobuf::Enum for DebugButton { + const NAME: &'static str = "DebugButton"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DebugButton::NO), + 1 => ::std::option::Option::Some(DebugButton::YES), + 2 => ::std::option::Option::Some(DebugButton::INFO), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "NO" => ::std::option::Option::Some(DebugButton::NO), + "YES" => ::std::option::Option::Some(DebugButton::YES), + "INFO" => ::std::option::Option::Some(DebugButton::INFO), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [DebugButton] = &[ + DebugButton::NO, + DebugButton::YES, + DebugButton::INFO, + ]; + } + + impl ::protobuf::EnumFull for DebugButton { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("DebugLinkDecision.DebugButton").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for DebugButton { + fn default() -> Self { + DebugButton::NO + } + } + + impl DebugButton { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DebugLinkDecision.DebugButton") + } + } + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton) + pub enum DebugPhysicalButton { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton.LEFT_BTN) + LEFT_BTN = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton.MIDDLE_BTN) + MIDDLE_BTN = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton.RIGHT_BTN) + RIGHT_BTN = 2, + } + + impl ::protobuf::Enum for DebugPhysicalButton { + const NAME: &'static str = "DebugPhysicalButton"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DebugPhysicalButton::LEFT_BTN), + 1 => ::std::option::Option::Some(DebugPhysicalButton::MIDDLE_BTN), + 2 => ::std::option::Option::Some(DebugPhysicalButton::RIGHT_BTN), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "LEFT_BTN" => ::std::option::Option::Some(DebugPhysicalButton::LEFT_BTN), + "MIDDLE_BTN" => ::std::option::Option::Some(DebugPhysicalButton::MIDDLE_BTN), + "RIGHT_BTN" => ::std::option::Option::Some(DebugPhysicalButton::RIGHT_BTN), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [DebugPhysicalButton] = &[ + DebugPhysicalButton::LEFT_BTN, + DebugPhysicalButton::MIDDLE_BTN, + DebugPhysicalButton::RIGHT_BTN, + ]; + } + + impl ::protobuf::EnumFull for DebugPhysicalButton { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("DebugLinkDecision.DebugPhysicalButton").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for DebugPhysicalButton { + fn default() -> Self { + DebugPhysicalButton::LEFT_BTN + } + } + + impl DebugPhysicalButton { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DebugLinkDecision.DebugPhysicalButton") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkLayout) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkLayout { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLayout.tokens) + pub tokens: ::std::vec::Vec<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkLayout.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkLayout { + fn default() -> &'a DebugLinkLayout { + ::default_instance() + } +} + +impl DebugLinkLayout { + pub fn new() -> DebugLinkLayout { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "tokens", + |m: &DebugLinkLayout| { &m.tokens }, + |m: &mut DebugLinkLayout| { &mut m.tokens }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkLayout", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkLayout { + const NAME: &'static str = "DebugLinkLayout"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.tokens.push(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.tokens { + my_size += ::protobuf::rt::string_size(1, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.tokens { + os.write_string(1, &v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkLayout { + DebugLinkLayout::new() + } + + fn clear(&mut self) { + self.tokens.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkLayout { + static instance: DebugLinkLayout = DebugLinkLayout { + tokens: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkLayout { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkLayout").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkLayout { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkLayout { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkReseedRandom) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkReseedRandom { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkReseedRandom.value) + pub value: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkReseedRandom.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkReseedRandom { + fn default() -> &'a DebugLinkReseedRandom { + ::default_instance() + } +} + +impl DebugLinkReseedRandom { + pub fn new() -> DebugLinkReseedRandom { + ::std::default::Default::default() + } + + // optional uint32 value = 1; + + pub fn value(&self) -> u32 { + self.value.unwrap_or(0) + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: u32) { + self.value = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &DebugLinkReseedRandom| { &m.value }, + |m: &mut DebugLinkReseedRandom| { &mut m.value }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkReseedRandom", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkReseedRandom { + const NAME: &'static str = "DebugLinkReseedRandom"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.value = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.value { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.value { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkReseedRandom { + DebugLinkReseedRandom::new() + } + + fn clear(&mut self) { + self.value = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkReseedRandom { + static instance: DebugLinkReseedRandom = DebugLinkReseedRandom { + value: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkReseedRandom { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkReseedRandom").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkReseedRandom { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkReseedRandom { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkRecordScreen) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkRecordScreen { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkRecordScreen.target_directory) + pub target_directory: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkRecordScreen.refresh_index) + pub refresh_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkRecordScreen.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkRecordScreen { + fn default() -> &'a DebugLinkRecordScreen { + ::default_instance() + } +} + +impl DebugLinkRecordScreen { + pub fn new() -> DebugLinkRecordScreen { + ::std::default::Default::default() + } + + // optional string target_directory = 1; + + pub fn target_directory(&self) -> &str { + match self.target_directory.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_target_directory(&mut self) { + self.target_directory = ::std::option::Option::None; + } + + pub fn has_target_directory(&self) -> bool { + self.target_directory.is_some() + } + + // Param is passed by value, moved + pub fn set_target_directory(&mut self, v: ::std::string::String) { + self.target_directory = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_target_directory(&mut self) -> &mut ::std::string::String { + if self.target_directory.is_none() { + self.target_directory = ::std::option::Option::Some(::std::string::String::new()); + } + self.target_directory.as_mut().unwrap() + } + + // Take field + pub fn take_target_directory(&mut self) -> ::std::string::String { + self.target_directory.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 refresh_index = 2; + + pub fn refresh_index(&self) -> u32 { + self.refresh_index.unwrap_or(0u32) + } + + pub fn clear_refresh_index(&mut self) { + self.refresh_index = ::std::option::Option::None; + } + + pub fn has_refresh_index(&self) -> bool { + self.refresh_index.is_some() + } + + // Param is passed by value, moved + pub fn set_refresh_index(&mut self, v: u32) { + self.refresh_index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "target_directory", + |m: &DebugLinkRecordScreen| { &m.target_directory }, + |m: &mut DebugLinkRecordScreen| { &mut m.target_directory }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "refresh_index", + |m: &DebugLinkRecordScreen| { &m.refresh_index }, + |m: &mut DebugLinkRecordScreen| { &mut m.refresh_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkRecordScreen", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkRecordScreen { + const NAME: &'static str = "DebugLinkRecordScreen"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.target_directory = ::std::option::Option::Some(is.read_string()?); + }, + 16 => { + self.refresh_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.target_directory.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.refresh_index { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.target_directory.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.refresh_index { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkRecordScreen { + DebugLinkRecordScreen::new() + } + + fn clear(&mut self) { + self.target_directory = ::std::option::Option::None; + self.refresh_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkRecordScreen { + static instance: DebugLinkRecordScreen = DebugLinkRecordScreen { + target_directory: ::std::option::Option::None, + refresh_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkRecordScreen { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkRecordScreen").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkRecordScreen { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkRecordScreen { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkGetState) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkGetState { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkGetState.wait_word_list) + pub wait_word_list: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkGetState.wait_word_pos) + pub wait_word_pos: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkGetState.wait_layout) + pub wait_layout: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkGetState.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkGetState { + fn default() -> &'a DebugLinkGetState { + ::default_instance() + } +} + +impl DebugLinkGetState { + pub fn new() -> DebugLinkGetState { + ::std::default::Default::default() + } + + // optional bool wait_word_list = 1; + + pub fn wait_word_list(&self) -> bool { + self.wait_word_list.unwrap_or(false) + } + + pub fn clear_wait_word_list(&mut self) { + self.wait_word_list = ::std::option::Option::None; + } + + pub fn has_wait_word_list(&self) -> bool { + self.wait_word_list.is_some() + } + + // Param is passed by value, moved + pub fn set_wait_word_list(&mut self, v: bool) { + self.wait_word_list = ::std::option::Option::Some(v); + } + + // optional bool wait_word_pos = 2; + + pub fn wait_word_pos(&self) -> bool { + self.wait_word_pos.unwrap_or(false) + } + + pub fn clear_wait_word_pos(&mut self) { + self.wait_word_pos = ::std::option::Option::None; + } + + pub fn has_wait_word_pos(&self) -> bool { + self.wait_word_pos.is_some() + } + + // Param is passed by value, moved + pub fn set_wait_word_pos(&mut self, v: bool) { + self.wait_word_pos = ::std::option::Option::Some(v); + } + + // optional bool wait_layout = 3; + + pub fn wait_layout(&self) -> bool { + self.wait_layout.unwrap_or(false) + } + + pub fn clear_wait_layout(&mut self) { + self.wait_layout = ::std::option::Option::None; + } + + pub fn has_wait_layout(&self) -> bool { + self.wait_layout.is_some() + } + + // Param is passed by value, moved + pub fn set_wait_layout(&mut self, v: bool) { + self.wait_layout = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "wait_word_list", + |m: &DebugLinkGetState| { &m.wait_word_list }, + |m: &mut DebugLinkGetState| { &mut m.wait_word_list }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "wait_word_pos", + |m: &DebugLinkGetState| { &m.wait_word_pos }, + |m: &mut DebugLinkGetState| { &mut m.wait_word_pos }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "wait_layout", + |m: &DebugLinkGetState| { &m.wait_layout }, + |m: &mut DebugLinkGetState| { &mut m.wait_layout }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkGetState", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkGetState { + const NAME: &'static str = "DebugLinkGetState"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.wait_word_list = ::std::option::Option::Some(is.read_bool()?); + }, + 16 => { + self.wait_word_pos = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.wait_layout = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.wait_word_list { + my_size += 1 + 1; + } + if let Some(v) = self.wait_word_pos { + my_size += 1 + 1; + } + if let Some(v) = self.wait_layout { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.wait_word_list { + os.write_bool(1, v)?; + } + if let Some(v) = self.wait_word_pos { + os.write_bool(2, v)?; + } + if let Some(v) = self.wait_layout { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkGetState { + DebugLinkGetState::new() + } + + fn clear(&mut self) { + self.wait_word_list = ::std::option::Option::None; + self.wait_word_pos = ::std::option::Option::None; + self.wait_layout = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkGetState { + static instance: DebugLinkGetState = DebugLinkGetState { + wait_word_list: ::std::option::Option::None, + wait_word_pos: ::std::option::Option::None, + wait_layout: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkGetState { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkGetState").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkGetState { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkGetState { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkState) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkState { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.layout) + pub layout: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.pin) + pub pin: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.matrix) + pub matrix: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.mnemonic_secret) + pub mnemonic_secret: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.node) + pub node: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.passphrase_protection) + pub passphrase_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.reset_word) + pub reset_word: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.reset_entropy) + pub reset_entropy: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.recovery_fake_word) + pub recovery_fake_word: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.recovery_word_pos) + pub recovery_word_pos: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.reset_word_pos) + pub reset_word_pos: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.mnemonic_type) + pub mnemonic_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.tokens) + pub tokens: ::std::vec::Vec<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkState.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkState { + fn default() -> &'a DebugLinkState { + ::default_instance() + } +} + +impl DebugLinkState { + pub fn new() -> DebugLinkState { + ::std::default::Default::default() + } + + // optional bytes layout = 1; + + pub fn layout(&self) -> &[u8] { + match self.layout.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_layout(&mut self) { + self.layout = ::std::option::Option::None; + } + + pub fn has_layout(&self) -> bool { + self.layout.is_some() + } + + // Param is passed by value, moved + pub fn set_layout(&mut self, v: ::std::vec::Vec) { + self.layout = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_layout(&mut self) -> &mut ::std::vec::Vec { + if self.layout.is_none() { + self.layout = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.layout.as_mut().unwrap() + } + + // Take field + pub fn take_layout(&mut self) -> ::std::vec::Vec { + self.layout.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string pin = 2; + + pub fn pin(&self) -> &str { + match self.pin.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_pin(&mut self) { + self.pin = ::std::option::Option::None; + } + + pub fn has_pin(&self) -> bool { + self.pin.is_some() + } + + // Param is passed by value, moved + pub fn set_pin(&mut self, v: ::std::string::String) { + self.pin = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pin(&mut self) -> &mut ::std::string::String { + if self.pin.is_none() { + self.pin = ::std::option::Option::Some(::std::string::String::new()); + } + self.pin.as_mut().unwrap() + } + + // Take field + pub fn take_pin(&mut self) -> ::std::string::String { + self.pin.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string matrix = 3; + + pub fn matrix(&self) -> &str { + match self.matrix.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_matrix(&mut self) { + self.matrix = ::std::option::Option::None; + } + + pub fn has_matrix(&self) -> bool { + self.matrix.is_some() + } + + // Param is passed by value, moved + pub fn set_matrix(&mut self, v: ::std::string::String) { + self.matrix = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_matrix(&mut self) -> &mut ::std::string::String { + if self.matrix.is_none() { + self.matrix = ::std::option::Option::Some(::std::string::String::new()); + } + self.matrix.as_mut().unwrap() + } + + // Take field + pub fn take_matrix(&mut self) -> ::std::string::String { + self.matrix.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes mnemonic_secret = 4; + + pub fn mnemonic_secret(&self) -> &[u8] { + match self.mnemonic_secret.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mnemonic_secret(&mut self) { + self.mnemonic_secret = ::std::option::Option::None; + } + + pub fn has_mnemonic_secret(&self) -> bool { + self.mnemonic_secret.is_some() + } + + // Param is passed by value, moved + pub fn set_mnemonic_secret(&mut self, v: ::std::vec::Vec) { + self.mnemonic_secret = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mnemonic_secret(&mut self) -> &mut ::std::vec::Vec { + if self.mnemonic_secret.is_none() { + self.mnemonic_secret = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mnemonic_secret.as_mut().unwrap() + } + + // Take field + pub fn take_mnemonic_secret(&mut self) -> ::std::vec::Vec { + self.mnemonic_secret.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool passphrase_protection = 6; + + pub fn passphrase_protection(&self) -> bool { + self.passphrase_protection.unwrap_or(false) + } + + pub fn clear_passphrase_protection(&mut self) { + self.passphrase_protection = ::std::option::Option::None; + } + + pub fn has_passphrase_protection(&self) -> bool { + self.passphrase_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase_protection(&mut self, v: bool) { + self.passphrase_protection = ::std::option::Option::Some(v); + } + + // optional string reset_word = 7; + + pub fn reset_word(&self) -> &str { + match self.reset_word.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_reset_word(&mut self) { + self.reset_word = ::std::option::Option::None; + } + + pub fn has_reset_word(&self) -> bool { + self.reset_word.is_some() + } + + // Param is passed by value, moved + pub fn set_reset_word(&mut self, v: ::std::string::String) { + self.reset_word = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_reset_word(&mut self) -> &mut ::std::string::String { + if self.reset_word.is_none() { + self.reset_word = ::std::option::Option::Some(::std::string::String::new()); + } + self.reset_word.as_mut().unwrap() + } + + // Take field + pub fn take_reset_word(&mut self) -> ::std::string::String { + self.reset_word.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes reset_entropy = 8; + + pub fn reset_entropy(&self) -> &[u8] { + match self.reset_entropy.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_reset_entropy(&mut self) { + self.reset_entropy = ::std::option::Option::None; + } + + pub fn has_reset_entropy(&self) -> bool { + self.reset_entropy.is_some() + } + + // Param is passed by value, moved + pub fn set_reset_entropy(&mut self, v: ::std::vec::Vec) { + self.reset_entropy = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_reset_entropy(&mut self) -> &mut ::std::vec::Vec { + if self.reset_entropy.is_none() { + self.reset_entropy = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.reset_entropy.as_mut().unwrap() + } + + // Take field + pub fn take_reset_entropy(&mut self) -> ::std::vec::Vec { + self.reset_entropy.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string recovery_fake_word = 9; + + pub fn recovery_fake_word(&self) -> &str { + match self.recovery_fake_word.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_recovery_fake_word(&mut self) { + self.recovery_fake_word = ::std::option::Option::None; + } + + pub fn has_recovery_fake_word(&self) -> bool { + self.recovery_fake_word.is_some() + } + + // Param is passed by value, moved + pub fn set_recovery_fake_word(&mut self, v: ::std::string::String) { + self.recovery_fake_word = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_recovery_fake_word(&mut self) -> &mut ::std::string::String { + if self.recovery_fake_word.is_none() { + self.recovery_fake_word = ::std::option::Option::Some(::std::string::String::new()); + } + self.recovery_fake_word.as_mut().unwrap() + } + + // Take field + pub fn take_recovery_fake_word(&mut self) -> ::std::string::String { + self.recovery_fake_word.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 recovery_word_pos = 10; + + pub fn recovery_word_pos(&self) -> u32 { + self.recovery_word_pos.unwrap_or(0) + } + + pub fn clear_recovery_word_pos(&mut self) { + self.recovery_word_pos = ::std::option::Option::None; + } + + pub fn has_recovery_word_pos(&self) -> bool { + self.recovery_word_pos.is_some() + } + + // Param is passed by value, moved + pub fn set_recovery_word_pos(&mut self, v: u32) { + self.recovery_word_pos = ::std::option::Option::Some(v); + } + + // optional uint32 reset_word_pos = 11; + + pub fn reset_word_pos(&self) -> u32 { + self.reset_word_pos.unwrap_or(0) + } + + pub fn clear_reset_word_pos(&mut self) { + self.reset_word_pos = ::std::option::Option::None; + } + + pub fn has_reset_word_pos(&self) -> bool { + self.reset_word_pos.is_some() + } + + // Param is passed by value, moved + pub fn set_reset_word_pos(&mut self, v: u32) { + self.reset_word_pos = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.management.BackupType mnemonic_type = 12; + + pub fn mnemonic_type(&self) -> super::messages_management::BackupType { + match self.mnemonic_type { + Some(e) => e.enum_value_or(super::messages_management::BackupType::Bip39), + None => super::messages_management::BackupType::Bip39, + } + } + + pub fn clear_mnemonic_type(&mut self) { + self.mnemonic_type = ::std::option::Option::None; + } + + pub fn has_mnemonic_type(&self) -> bool { + self.mnemonic_type.is_some() + } + + // Param is passed by value, moved + pub fn set_mnemonic_type(&mut self, v: super::messages_management::BackupType) { + self.mnemonic_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(13); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "layout", + |m: &DebugLinkState| { &m.layout }, + |m: &mut DebugLinkState| { &mut m.layout }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pin", + |m: &DebugLinkState| { &m.pin }, + |m: &mut DebugLinkState| { &mut m.pin }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "matrix", + |m: &DebugLinkState| { &m.matrix }, + |m: &mut DebugLinkState| { &mut m.matrix }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mnemonic_secret", + |m: &DebugLinkState| { &m.mnemonic_secret }, + |m: &mut DebugLinkState| { &mut m.mnemonic_secret }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( + "node", + |m: &DebugLinkState| { &m.node }, + |m: &mut DebugLinkState| { &mut m.node }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase_protection", + |m: &DebugLinkState| { &m.passphrase_protection }, + |m: &mut DebugLinkState| { &mut m.passphrase_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "reset_word", + |m: &DebugLinkState| { &m.reset_word }, + |m: &mut DebugLinkState| { &mut m.reset_word }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "reset_entropy", + |m: &DebugLinkState| { &m.reset_entropy }, + |m: &mut DebugLinkState| { &mut m.reset_entropy }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "recovery_fake_word", + |m: &DebugLinkState| { &m.recovery_fake_word }, + |m: &mut DebugLinkState| { &mut m.recovery_fake_word }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "recovery_word_pos", + |m: &DebugLinkState| { &m.recovery_word_pos }, + |m: &mut DebugLinkState| { &mut m.recovery_word_pos }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "reset_word_pos", + |m: &DebugLinkState| { &m.reset_word_pos }, + |m: &mut DebugLinkState| { &mut m.reset_word_pos }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mnemonic_type", + |m: &DebugLinkState| { &m.mnemonic_type }, + |m: &mut DebugLinkState| { &mut m.mnemonic_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "tokens", + |m: &DebugLinkState| { &m.tokens }, + |m: &mut DebugLinkState| { &mut m.tokens }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkState", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkState { + const NAME: &'static str = "DebugLinkState"; + + fn is_initialized(&self) -> bool { + for v in &self.node { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.layout = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.pin = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.matrix = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.mnemonic_secret = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; + }, + 48 => { + self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 58 => { + self.reset_word = ::std::option::Option::Some(is.read_string()?); + }, + 66 => { + self.reset_entropy = ::std::option::Option::Some(is.read_bytes()?); + }, + 74 => { + self.recovery_fake_word = ::std::option::Option::Some(is.read_string()?); + }, + 80 => { + self.recovery_word_pos = ::std::option::Option::Some(is.read_uint32()?); + }, + 88 => { + self.reset_word_pos = ::std::option::Option::Some(is.read_uint32()?); + }, + 96 => { + self.mnemonic_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 106 => { + self.tokens.push(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.layout.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.pin.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.matrix.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.mnemonic_secret.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.node.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.passphrase_protection { + my_size += 1 + 1; + } + if let Some(v) = self.reset_word.as_ref() { + my_size += ::protobuf::rt::string_size(7, &v); + } + if let Some(v) = self.reset_entropy.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + if let Some(v) = self.recovery_fake_word.as_ref() { + my_size += ::protobuf::rt::string_size(9, &v); + } + if let Some(v) = self.recovery_word_pos { + my_size += ::protobuf::rt::uint32_size(10, v); + } + if let Some(v) = self.reset_word_pos { + my_size += ::protobuf::rt::uint32_size(11, v); + } + if let Some(v) = self.mnemonic_type { + my_size += ::protobuf::rt::int32_size(12, v.value()); + } + for value in &self.tokens { + my_size += ::protobuf::rt::string_size(13, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.layout.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.pin.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.matrix.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.mnemonic_secret.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.node.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.passphrase_protection { + os.write_bool(6, v)?; + } + if let Some(v) = self.reset_word.as_ref() { + os.write_string(7, v)?; + } + if let Some(v) = self.reset_entropy.as_ref() { + os.write_bytes(8, v)?; + } + if let Some(v) = self.recovery_fake_word.as_ref() { + os.write_string(9, v)?; + } + if let Some(v) = self.recovery_word_pos { + os.write_uint32(10, v)?; + } + if let Some(v) = self.reset_word_pos { + os.write_uint32(11, v)?; + } + if let Some(v) = self.mnemonic_type { + os.write_enum(12, ::protobuf::EnumOrUnknown::value(&v))?; + } + for v in &self.tokens { + os.write_string(13, &v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkState { + DebugLinkState::new() + } + + fn clear(&mut self) { + self.layout = ::std::option::Option::None; + self.pin = ::std::option::Option::None; + self.matrix = ::std::option::Option::None; + self.mnemonic_secret = ::std::option::Option::None; + self.node.clear(); + self.passphrase_protection = ::std::option::Option::None; + self.reset_word = ::std::option::Option::None; + self.reset_entropy = ::std::option::Option::None; + self.recovery_fake_word = ::std::option::Option::None; + self.recovery_word_pos = ::std::option::Option::None; + self.reset_word_pos = ::std::option::Option::None; + self.mnemonic_type = ::std::option::Option::None; + self.tokens.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkState { + static instance: DebugLinkState = DebugLinkState { + layout: ::std::option::Option::None, + pin: ::std::option::Option::None, + matrix: ::std::option::Option::None, + mnemonic_secret: ::std::option::Option::None, + node: ::protobuf::MessageField::none(), + passphrase_protection: ::std::option::Option::None, + reset_word: ::std::option::Option::None, + reset_entropy: ::std::option::Option::None, + recovery_fake_word: ::std::option::Option::None, + recovery_word_pos: ::std::option::Option::None, + reset_word_pos: ::std::option::Option::None, + mnemonic_type: ::std::option::Option::None, + tokens: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkState { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkState").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkState { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkState { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkStop) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkStop { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkStop.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkStop { + fn default() -> &'a DebugLinkStop { + ::default_instance() + } +} + +impl DebugLinkStop { + pub fn new() -> DebugLinkStop { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkStop", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkStop { + const NAME: &'static str = "DebugLinkStop"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkStop { + DebugLinkStop::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkStop { + static instance: DebugLinkStop = DebugLinkStop { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkStop { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkStop").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkStop { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkStop { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkLog) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkLog { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLog.level) + pub level: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLog.bucket) + pub bucket: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLog.text) + pub text: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkLog.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkLog { + fn default() -> &'a DebugLinkLog { + ::default_instance() + } +} + +impl DebugLinkLog { + pub fn new() -> DebugLinkLog { + ::std::default::Default::default() + } + + // optional uint32 level = 1; + + pub fn level(&self) -> u32 { + self.level.unwrap_or(0) + } + + pub fn clear_level(&mut self) { + self.level = ::std::option::Option::None; + } + + pub fn has_level(&self) -> bool { + self.level.is_some() + } + + // Param is passed by value, moved + pub fn set_level(&mut self, v: u32) { + self.level = ::std::option::Option::Some(v); + } + + // optional string bucket = 2; + + pub fn bucket(&self) -> &str { + match self.bucket.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_bucket(&mut self) { + self.bucket = ::std::option::Option::None; + } + + pub fn has_bucket(&self) -> bool { + self.bucket.is_some() + } + + // Param is passed by value, moved + pub fn set_bucket(&mut self, v: ::std::string::String) { + self.bucket = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_bucket(&mut self) -> &mut ::std::string::String { + if self.bucket.is_none() { + self.bucket = ::std::option::Option::Some(::std::string::String::new()); + } + self.bucket.as_mut().unwrap() + } + + // Take field + pub fn take_bucket(&mut self) -> ::std::string::String { + self.bucket.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string text = 3; + + pub fn text(&self) -> &str { + match self.text.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_text(&mut self) { + self.text = ::std::option::Option::None; + } + + pub fn has_text(&self) -> bool { + self.text.is_some() + } + + // Param is passed by value, moved + pub fn set_text(&mut self, v: ::std::string::String) { + self.text = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_text(&mut self) -> &mut ::std::string::String { + if self.text.is_none() { + self.text = ::std::option::Option::Some(::std::string::String::new()); + } + self.text.as_mut().unwrap() + } + + // Take field + pub fn take_text(&mut self) -> ::std::string::String { + self.text.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "level", + |m: &DebugLinkLog| { &m.level }, + |m: &mut DebugLinkLog| { &mut m.level }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bucket", + |m: &DebugLinkLog| { &m.bucket }, + |m: &mut DebugLinkLog| { &mut m.bucket }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "text", + |m: &DebugLinkLog| { &m.text }, + |m: &mut DebugLinkLog| { &mut m.text }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkLog", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkLog { + const NAME: &'static str = "DebugLinkLog"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.level = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.bucket = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.text = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.level { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.bucket.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.text.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.level { + os.write_uint32(1, v)?; + } + if let Some(v) = self.bucket.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.text.as_ref() { + os.write_string(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkLog { + DebugLinkLog::new() + } + + fn clear(&mut self) { + self.level = ::std::option::Option::None; + self.bucket = ::std::option::Option::None; + self.text = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkLog { + static instance: DebugLinkLog = DebugLinkLog { + level: ::std::option::Option::None, + bucket: ::std::option::Option::None, + text: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkLog { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkLog").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkLog { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkLog { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkMemoryRead) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkMemoryRead { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryRead.address) + pub address: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryRead.length) + pub length: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkMemoryRead.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkMemoryRead { + fn default() -> &'a DebugLinkMemoryRead { + ::default_instance() + } +} + +impl DebugLinkMemoryRead { + pub fn new() -> DebugLinkMemoryRead { + ::std::default::Default::default() + } + + // optional uint32 address = 1; + + pub fn address(&self) -> u32 { + self.address.unwrap_or(0) + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: u32) { + self.address = ::std::option::Option::Some(v); + } + + // optional uint32 length = 2; + + pub fn length(&self) -> u32 { + self.length.unwrap_or(0) + } + + pub fn clear_length(&mut self) { + self.length = ::std::option::Option::None; + } + + pub fn has_length(&self) -> bool { + self.length.is_some() + } + + // Param is passed by value, moved + pub fn set_length(&mut self, v: u32) { + self.length = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &DebugLinkMemoryRead| { &m.address }, + |m: &mut DebugLinkMemoryRead| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "length", + |m: &DebugLinkMemoryRead| { &m.length }, + |m: &mut DebugLinkMemoryRead| { &mut m.length }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkMemoryRead", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkMemoryRead { + const NAME: &'static str = "DebugLinkMemoryRead"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.address = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.length = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.length { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address { + os.write_uint32(1, v)?; + } + if let Some(v) = self.length { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkMemoryRead { + DebugLinkMemoryRead::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.length = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkMemoryRead { + static instance: DebugLinkMemoryRead = DebugLinkMemoryRead { + address: ::std::option::Option::None, + length: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkMemoryRead { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkMemoryRead").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkMemoryRead { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkMemoryRead { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkMemory) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkMemory { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemory.memory) + pub memory: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkMemory.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkMemory { + fn default() -> &'a DebugLinkMemory { + ::default_instance() + } +} + +impl DebugLinkMemory { + pub fn new() -> DebugLinkMemory { + ::std::default::Default::default() + } + + // optional bytes memory = 1; + + pub fn memory(&self) -> &[u8] { + match self.memory.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_memory(&mut self) { + self.memory = ::std::option::Option::None; + } + + pub fn has_memory(&self) -> bool { + self.memory.is_some() + } + + // Param is passed by value, moved + pub fn set_memory(&mut self, v: ::std::vec::Vec) { + self.memory = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_memory(&mut self) -> &mut ::std::vec::Vec { + if self.memory.is_none() { + self.memory = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.memory.as_mut().unwrap() + } + + // Take field + pub fn take_memory(&mut self) -> ::std::vec::Vec { + self.memory.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memory", + |m: &DebugLinkMemory| { &m.memory }, + |m: &mut DebugLinkMemory| { &mut m.memory }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkMemory", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkMemory { + const NAME: &'static str = "DebugLinkMemory"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.memory = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.memory.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.memory.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkMemory { + DebugLinkMemory::new() + } + + fn clear(&mut self) { + self.memory = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkMemory { + static instance: DebugLinkMemory = DebugLinkMemory { + memory: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkMemory { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkMemory").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkMemory { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkMemory { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkMemoryWrite) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkMemoryWrite { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryWrite.address) + pub address: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryWrite.memory) + pub memory: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryWrite.flash) + pub flash: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkMemoryWrite.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkMemoryWrite { + fn default() -> &'a DebugLinkMemoryWrite { + ::default_instance() + } +} + +impl DebugLinkMemoryWrite { + pub fn new() -> DebugLinkMemoryWrite { + ::std::default::Default::default() + } + + // optional uint32 address = 1; + + pub fn address(&self) -> u32 { + self.address.unwrap_or(0) + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: u32) { + self.address = ::std::option::Option::Some(v); + } + + // optional bytes memory = 2; + + pub fn memory(&self) -> &[u8] { + match self.memory.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_memory(&mut self) { + self.memory = ::std::option::Option::None; + } + + pub fn has_memory(&self) -> bool { + self.memory.is_some() + } + + // Param is passed by value, moved + pub fn set_memory(&mut self, v: ::std::vec::Vec) { + self.memory = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_memory(&mut self) -> &mut ::std::vec::Vec { + if self.memory.is_none() { + self.memory = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.memory.as_mut().unwrap() + } + + // Take field + pub fn take_memory(&mut self) -> ::std::vec::Vec { + self.memory.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool flash = 3; + + pub fn flash(&self) -> bool { + self.flash.unwrap_or(false) + } + + pub fn clear_flash(&mut self) { + self.flash = ::std::option::Option::None; + } + + pub fn has_flash(&self) -> bool { + self.flash.is_some() + } + + // Param is passed by value, moved + pub fn set_flash(&mut self, v: bool) { + self.flash = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &DebugLinkMemoryWrite| { &m.address }, + |m: &mut DebugLinkMemoryWrite| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memory", + |m: &DebugLinkMemoryWrite| { &m.memory }, + |m: &mut DebugLinkMemoryWrite| { &mut m.memory }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "flash", + |m: &DebugLinkMemoryWrite| { &m.flash }, + |m: &mut DebugLinkMemoryWrite| { &mut m.flash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkMemoryWrite", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkMemoryWrite { + const NAME: &'static str = "DebugLinkMemoryWrite"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.address = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.memory = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.flash = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.memory.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.flash { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address { + os.write_uint32(1, v)?; + } + if let Some(v) = self.memory.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.flash { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkMemoryWrite { + DebugLinkMemoryWrite::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.memory = ::std::option::Option::None; + self.flash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkMemoryWrite { + static instance: DebugLinkMemoryWrite = DebugLinkMemoryWrite { + address: ::std::option::Option::None, + memory: ::std::option::Option::None, + flash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkMemoryWrite { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkMemoryWrite").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkMemoryWrite { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkMemoryWrite { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkFlashErase) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkFlashErase { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashErase.sector) + pub sector: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkFlashErase.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkFlashErase { + fn default() -> &'a DebugLinkFlashErase { + ::default_instance() + } +} + +impl DebugLinkFlashErase { + pub fn new() -> DebugLinkFlashErase { + ::std::default::Default::default() + } + + // optional uint32 sector = 1; + + pub fn sector(&self) -> u32 { + self.sector.unwrap_or(0) + } + + pub fn clear_sector(&mut self) { + self.sector = ::std::option::Option::None; + } + + pub fn has_sector(&self) -> bool { + self.sector.is_some() + } + + // Param is passed by value, moved + pub fn set_sector(&mut self, v: u32) { + self.sector = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sector", + |m: &DebugLinkFlashErase| { &m.sector }, + |m: &mut DebugLinkFlashErase| { &mut m.sector }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkFlashErase", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkFlashErase { + const NAME: &'static str = "DebugLinkFlashErase"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.sector = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.sector { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.sector { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkFlashErase { + DebugLinkFlashErase::new() + } + + fn clear(&mut self) { + self.sector = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkFlashErase { + static instance: DebugLinkFlashErase = DebugLinkFlashErase { + sector: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkFlashErase { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkFlashErase").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkFlashErase { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkFlashErase { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkEraseSdCard) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkEraseSdCard { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkEraseSdCard.format) + pub format: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkEraseSdCard.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkEraseSdCard { + fn default() -> &'a DebugLinkEraseSdCard { + ::default_instance() + } +} + +impl DebugLinkEraseSdCard { + pub fn new() -> DebugLinkEraseSdCard { + ::std::default::Default::default() + } + + // optional bool format = 1; + + pub fn format(&self) -> bool { + self.format.unwrap_or(false) + } + + pub fn clear_format(&mut self) { + self.format = ::std::option::Option::None; + } + + pub fn has_format(&self) -> bool { + self.format.is_some() + } + + // Param is passed by value, moved + pub fn set_format(&mut self, v: bool) { + self.format = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "format", + |m: &DebugLinkEraseSdCard| { &m.format }, + |m: &mut DebugLinkEraseSdCard| { &mut m.format }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkEraseSdCard", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkEraseSdCard { + const NAME: &'static str = "DebugLinkEraseSdCard"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.format = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.format { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.format { + os.write_bool(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkEraseSdCard { + DebugLinkEraseSdCard::new() + } + + fn clear(&mut self) { + self.format = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkEraseSdCard { + static instance: DebugLinkEraseSdCard = DebugLinkEraseSdCard { + format: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkEraseSdCard { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkEraseSdCard").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkEraseSdCard { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkEraseSdCard { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkWatchLayout) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkWatchLayout { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkWatchLayout.watch) + pub watch: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkWatchLayout.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkWatchLayout { + fn default() -> &'a DebugLinkWatchLayout { + ::default_instance() + } +} + +impl DebugLinkWatchLayout { + pub fn new() -> DebugLinkWatchLayout { + ::std::default::Default::default() + } + + // optional bool watch = 1; + + pub fn watch(&self) -> bool { + self.watch.unwrap_or(false) + } + + pub fn clear_watch(&mut self) { + self.watch = ::std::option::Option::None; + } + + pub fn has_watch(&self) -> bool { + self.watch.is_some() + } + + // Param is passed by value, moved + pub fn set_watch(&mut self, v: bool) { + self.watch = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "watch", + |m: &DebugLinkWatchLayout| { &m.watch }, + |m: &mut DebugLinkWatchLayout| { &mut m.watch }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkWatchLayout", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkWatchLayout { + const NAME: &'static str = "DebugLinkWatchLayout"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.watch = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.watch { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.watch { + os.write_bool(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkWatchLayout { + DebugLinkWatchLayout::new() + } + + fn clear(&mut self) { + self.watch = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkWatchLayout { + static instance: DebugLinkWatchLayout = DebugLinkWatchLayout { + watch: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkWatchLayout { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkWatchLayout").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkWatchLayout { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkWatchLayout { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkResetDebugEvents) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugLinkResetDebugEvents { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkResetDebugEvents.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugLinkResetDebugEvents { + fn default() -> &'a DebugLinkResetDebugEvents { + ::default_instance() + } +} + +impl DebugLinkResetDebugEvents { + pub fn new() -> DebugLinkResetDebugEvents { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugLinkResetDebugEvents", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugLinkResetDebugEvents { + const NAME: &'static str = "DebugLinkResetDebugEvents"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugLinkResetDebugEvents { + DebugLinkResetDebugEvents::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugLinkResetDebugEvents { + static instance: DebugLinkResetDebugEvents = DebugLinkResetDebugEvents { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugLinkResetDebugEvents { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkResetDebugEvents").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugLinkResetDebugEvents { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugLinkResetDebugEvents { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x14messages-debug.proto\x12\x18hw.trezor.messages.debug\x1a\x0emessag\ + es.proto\x1a\x15messages-common.proto\x1a\x19messages-management.proto\"\ + \xb0\x04\n\x11DebugLinkDecision\x12O\n\x06button\x18\x01\x20\x01(\x0e27.\ + hw.trezor.messages.debug.DebugLinkDecision.DebugButtonR\x06button\x12U\n\ + \x05swipe\x18\x02\x20\x01(\x0e2?.hw.trezor.messages.debug.DebugLinkDecis\ + ion.DebugSwipeDirectionR\x05swipe\x12\x14\n\x05input\x18\x03\x20\x01(\tR\ + \x05input\x12\x0c\n\x01x\x18\x04\x20\x01(\rR\x01x\x12\x0c\n\x01y\x18\x05\ + \x20\x01(\rR\x01y\x12\x12\n\x04wait\x18\x06\x20\x01(\x08R\x04wait\x12\ + \x17\n\x07hold_ms\x18\x07\x20\x01(\rR\x06holdMs\x12h\n\x0fphysical_butto\ + n\x18\x08\x20\x01(\x0e2?.hw.trezor.messages.debug.DebugLinkDecision.Debu\ + gPhysicalButtonR\x0ephysicalButton\"<\n\x13DebugSwipeDirection\x12\x06\n\ + \x02UP\x10\0\x12\x08\n\x04DOWN\x10\x01\x12\x08\n\x04LEFT\x10\x02\x12\t\n\ + \x05RIGHT\x10\x03\"(\n\x0bDebugButton\x12\x06\n\x02NO\x10\0\x12\x07\n\ + \x03YES\x10\x01\x12\x08\n\x04INFO\x10\x02\"B\n\x13DebugPhysicalButton\ + \x12\x0c\n\x08LEFT_BTN\x10\0\x12\x0e\n\nMIDDLE_BTN\x10\x01\x12\r\n\tRIGH\ + T_BTN\x10\x02\")\n\x0fDebugLinkLayout\x12\x16\n\x06tokens\x18\x01\x20\ + \x03(\tR\x06tokens\"-\n\x15DebugLinkReseedRandom\x12\x14\n\x05value\x18\ + \x01\x20\x01(\rR\x05value\"j\n\x15DebugLinkRecordScreen\x12)\n\x10target\ + _directory\x18\x01\x20\x01(\tR\x0ftargetDirectory\x12&\n\rrefresh_index\ + \x18\x02\x20\x01(\r:\x010R\x0crefreshIndex\"~\n\x11DebugLinkGetState\x12\ + $\n\x0ewait_word_list\x18\x01\x20\x01(\x08R\x0cwaitWordList\x12\"\n\rwai\ + t_word_pos\x18\x02\x20\x01(\x08R\x0bwaitWordPos\x12\x1f\n\x0bwait_layout\ + \x18\x03\x20\x01(\x08R\nwaitLayout\"\x97\x04\n\x0eDebugLinkState\x12\x16\ + \n\x06layout\x18\x01\x20\x01(\x0cR\x06layout\x12\x10\n\x03pin\x18\x02\ + \x20\x01(\tR\x03pin\x12\x16\n\x06matrix\x18\x03\x20\x01(\tR\x06matrix\ + \x12'\n\x0fmnemonic_secret\x18\x04\x20\x01(\x0cR\x0emnemonicSecret\x129\ + \n\x04node\x18\x05\x20\x01(\x0b2%.hw.trezor.messages.common.HDNodeTypeR\ + \x04node\x123\n\x15passphrase_protection\x18\x06\x20\x01(\x08R\x14passph\ + raseProtection\x12\x1d\n\nreset_word\x18\x07\x20\x01(\tR\tresetWord\x12#\ + \n\rreset_entropy\x18\x08\x20\x01(\x0cR\x0cresetEntropy\x12,\n\x12recove\ + ry_fake_word\x18\t\x20\x01(\tR\x10recoveryFakeWord\x12*\n\x11recovery_wo\ + rd_pos\x18\n\x20\x01(\rR\x0frecoveryWordPos\x12$\n\x0ereset_word_pos\x18\ + \x0b\x20\x01(\rR\x0cresetWordPos\x12N\n\rmnemonic_type\x18\x0c\x20\x01(\ + \x0e2).hw.trezor.messages.management.BackupTypeR\x0cmnemonicType\x12\x16\ + \n\x06tokens\x18\r\x20\x03(\tR\x06tokens\"\x0f\n\rDebugLinkStop\"P\n\x0c\ + DebugLinkLog\x12\x14\n\x05level\x18\x01\x20\x01(\rR\x05level\x12\x16\n\ + \x06bucket\x18\x02\x20\x01(\tR\x06bucket\x12\x12\n\x04text\x18\x03\x20\ + \x01(\tR\x04text\"G\n\x13DebugLinkMemoryRead\x12\x18\n\x07address\x18\ + \x01\x20\x01(\rR\x07address\x12\x16\n\x06length\x18\x02\x20\x01(\rR\x06l\ + ength\")\n\x0fDebugLinkMemory\x12\x16\n\x06memory\x18\x01\x20\x01(\x0cR\ + \x06memory\"^\n\x14DebugLinkMemoryWrite\x12\x18\n\x07address\x18\x01\x20\ + \x01(\rR\x07address\x12\x16\n\x06memory\x18\x02\x20\x01(\x0cR\x06memory\ + \x12\x14\n\x05flash\x18\x03\x20\x01(\x08R\x05flash\"-\n\x13DebugLinkFlas\ + hErase\x12\x16\n\x06sector\x18\x01\x20\x01(\rR\x06sector\".\n\x14DebugLi\ + nkEraseSdCard\x12\x16\n\x06format\x18\x01\x20\x01(\x08R\x06format\",\n\ + \x14DebugLinkWatchLayout\x12\x14\n\x05watch\x18\x01\x20\x01(\x08R\x05wat\ + ch\"\x1b\n\x19DebugLinkResetDebugEventsB=\n#com.satoshilabs.trezor.lib.p\ + rotobufB\x12TrezorMessageDebug\x80\xa6\x1d\x01\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(3); + deps.push(super::messages::file_descriptor().clone()); + deps.push(super::messages_common::file_descriptor().clone()); + deps.push(super::messages_management::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(15); + messages.push(DebugLinkDecision::generated_message_descriptor_data()); + messages.push(DebugLinkLayout::generated_message_descriptor_data()); + messages.push(DebugLinkReseedRandom::generated_message_descriptor_data()); + messages.push(DebugLinkRecordScreen::generated_message_descriptor_data()); + messages.push(DebugLinkGetState::generated_message_descriptor_data()); + messages.push(DebugLinkState::generated_message_descriptor_data()); + messages.push(DebugLinkStop::generated_message_descriptor_data()); + messages.push(DebugLinkLog::generated_message_descriptor_data()); + messages.push(DebugLinkMemoryRead::generated_message_descriptor_data()); + messages.push(DebugLinkMemory::generated_message_descriptor_data()); + messages.push(DebugLinkMemoryWrite::generated_message_descriptor_data()); + messages.push(DebugLinkFlashErase::generated_message_descriptor_data()); + messages.push(DebugLinkEraseSdCard::generated_message_descriptor_data()); + messages.push(DebugLinkWatchLayout::generated_message_descriptor_data()); + messages.push(DebugLinkResetDebugEvents::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(3); + enums.push(debug_link_decision::DebugSwipeDirection::generated_enum_descriptor_data()); + enums.push(debug_link_decision::DebugButton::generated_enum_descriptor_data()); + enums.push(debug_link_decision::DebugPhysicalButton::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_eos.rs b/wallet/trezor-client/src/protos/generated/messages_eos.rs new file mode 100644 index 0000000000..15a989f143 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_eos.rs @@ -0,0 +1,6536 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-eos.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosGetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EosGetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosGetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosGetPublicKey.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosGetPublicKey.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosGetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EosGetPublicKey { + fn default() -> &'a EosGetPublicKey { + ::default_instance() + } +} + +impl EosGetPublicKey { + pub fn new() -> EosGetPublicKey { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EosGetPublicKey| { &m.address_n }, + |m: &mut EosGetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &EosGetPublicKey| { &m.show_display }, + |m: &mut EosGetPublicKey| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &EosGetPublicKey| { &m.chunkify }, + |m: &mut EosGetPublicKey| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosGetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EosGetPublicKey { + const NAME: &'static str = "EosGetPublicKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosGetPublicKey { + EosGetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosGetPublicKey { + static instance: EosGetPublicKey = EosGetPublicKey { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EosGetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EosGetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EosGetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EosGetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EosPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosPublicKey.wif_public_key) + pub wif_public_key: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosPublicKey.raw_public_key) + pub raw_public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EosPublicKey { + fn default() -> &'a EosPublicKey { + ::default_instance() + } +} + +impl EosPublicKey { + pub fn new() -> EosPublicKey { + ::std::default::Default::default() + } + + // required string wif_public_key = 1; + + pub fn wif_public_key(&self) -> &str { + match self.wif_public_key.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_wif_public_key(&mut self) { + self.wif_public_key = ::std::option::Option::None; + } + + pub fn has_wif_public_key(&self) -> bool { + self.wif_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_wif_public_key(&mut self, v: ::std::string::String) { + self.wif_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_wif_public_key(&mut self) -> &mut ::std::string::String { + if self.wif_public_key.is_none() { + self.wif_public_key = ::std::option::Option::Some(::std::string::String::new()); + } + self.wif_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_wif_public_key(&mut self) -> ::std::string::String { + self.wif_public_key.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes raw_public_key = 2; + + pub fn raw_public_key(&self) -> &[u8] { + match self.raw_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_raw_public_key(&mut self) { + self.raw_public_key = ::std::option::Option::None; + } + + pub fn has_raw_public_key(&self) -> bool { + self.raw_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_raw_public_key(&mut self, v: ::std::vec::Vec) { + self.raw_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_raw_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.raw_public_key.is_none() { + self.raw_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.raw_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_raw_public_key(&mut self) -> ::std::vec::Vec { + self.raw_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "wif_public_key", + |m: &EosPublicKey| { &m.wif_public_key }, + |m: &mut EosPublicKey| { &mut m.wif_public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "raw_public_key", + |m: &EosPublicKey| { &m.raw_public_key }, + |m: &mut EosPublicKey| { &mut m.raw_public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EosPublicKey { + const NAME: &'static str = "EosPublicKey"; + + fn is_initialized(&self) -> bool { + if self.wif_public_key.is_none() { + return false; + } + if self.raw_public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.wif_public_key = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.raw_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.wif_public_key.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.raw_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.wif_public_key.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.raw_public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosPublicKey { + EosPublicKey::new() + } + + fn clear(&mut self) { + self.wif_public_key = ::std::option::Option::None; + self.raw_public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosPublicKey { + static instance: EosPublicKey = EosPublicKey { + wif_public_key: ::std::option::Option::None, + raw_public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EosPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EosPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EosPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EosPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EosSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.chain_id) + pub chain_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.header) + pub header: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.num_actions) + pub num_actions: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EosSignTx { + fn default() -> &'a EosSignTx { + ::default_instance() + } +} + +impl EosSignTx { + pub fn new() -> EosSignTx { + ::std::default::Default::default() + } + + // required bytes chain_id = 2; + + pub fn chain_id(&self) -> &[u8] { + match self.chain_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_chain_id(&mut self) { + self.chain_id = ::std::option::Option::None; + } + + pub fn has_chain_id(&self) -> bool { + self.chain_id.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_id(&mut self, v: ::std::vec::Vec) { + self.chain_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_chain_id(&mut self) -> &mut ::std::vec::Vec { + if self.chain_id.is_none() { + self.chain_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.chain_id.as_mut().unwrap() + } + + // Take field + pub fn take_chain_id(&mut self) -> ::std::vec::Vec { + self.chain_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 num_actions = 4; + + pub fn num_actions(&self) -> u32 { + self.num_actions.unwrap_or(0) + } + + pub fn clear_num_actions(&mut self) { + self.num_actions = ::std::option::Option::None; + } + + pub fn has_num_actions(&self) -> bool { + self.num_actions.is_some() + } + + // Param is passed by value, moved + pub fn set_num_actions(&mut self, v: u32) { + self.num_actions = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 5; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EosSignTx| { &m.address_n }, + |m: &mut EosSignTx| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_id", + |m: &EosSignTx| { &m.chain_id }, + |m: &mut EosSignTx| { &mut m.chain_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_sign_tx::EosTxHeader>( + "header", + |m: &EosSignTx| { &m.header }, + |m: &mut EosSignTx| { &mut m.header }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "num_actions", + |m: &EosSignTx| { &m.num_actions }, + |m: &mut EosSignTx| { &mut m.num_actions }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &EosSignTx| { &m.chunkify }, + |m: &mut EosSignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EosSignTx { + const NAME: &'static str = "EosSignTx"; + + fn is_initialized(&self) -> bool { + if self.chain_id.is_none() { + return false; + } + if self.header.is_none() { + return false; + } + if self.num_actions.is_none() { + return false; + } + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.chain_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.header)?; + }, + 32 => { + self.num_actions = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.chain_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.num_actions { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.chain_id.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.header.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.num_actions { + os.write_uint32(4, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosSignTx { + EosSignTx::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.chain_id = ::std::option::Option::None; + self.header.clear(); + self.num_actions = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosSignTx { + static instance: EosSignTx = EosSignTx { + address_n: ::std::vec::Vec::new(), + chain_id: ::std::option::Option::None, + header: ::protobuf::MessageField::none(), + num_actions: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EosSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EosSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EosSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EosSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `EosSignTx` +pub mod eos_sign_tx { + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosSignTx.EosTxHeader) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosTxHeader { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.expiration) + pub expiration: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.ref_block_num) + pub ref_block_num: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.ref_block_prefix) + pub ref_block_prefix: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.max_net_usage_words) + pub max_net_usage_words: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.max_cpu_usage_ms) + pub max_cpu_usage_ms: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.delay_sec) + pub delay_sec: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosTxHeader { + fn default() -> &'a EosTxHeader { + ::default_instance() + } + } + + impl EosTxHeader { + pub fn new() -> EosTxHeader { + ::std::default::Default::default() + } + + // required uint32 expiration = 1; + + pub fn expiration(&self) -> u32 { + self.expiration.unwrap_or(0) + } + + pub fn clear_expiration(&mut self) { + self.expiration = ::std::option::Option::None; + } + + pub fn has_expiration(&self) -> bool { + self.expiration.is_some() + } + + // Param is passed by value, moved + pub fn set_expiration(&mut self, v: u32) { + self.expiration = ::std::option::Option::Some(v); + } + + // required uint32 ref_block_num = 2; + + pub fn ref_block_num(&self) -> u32 { + self.ref_block_num.unwrap_or(0) + } + + pub fn clear_ref_block_num(&mut self) { + self.ref_block_num = ::std::option::Option::None; + } + + pub fn has_ref_block_num(&self) -> bool { + self.ref_block_num.is_some() + } + + // Param is passed by value, moved + pub fn set_ref_block_num(&mut self, v: u32) { + self.ref_block_num = ::std::option::Option::Some(v); + } + + // required uint32 ref_block_prefix = 3; + + pub fn ref_block_prefix(&self) -> u32 { + self.ref_block_prefix.unwrap_or(0) + } + + pub fn clear_ref_block_prefix(&mut self) { + self.ref_block_prefix = ::std::option::Option::None; + } + + pub fn has_ref_block_prefix(&self) -> bool { + self.ref_block_prefix.is_some() + } + + // Param is passed by value, moved + pub fn set_ref_block_prefix(&mut self, v: u32) { + self.ref_block_prefix = ::std::option::Option::Some(v); + } + + // required uint32 max_net_usage_words = 4; + + pub fn max_net_usage_words(&self) -> u32 { + self.max_net_usage_words.unwrap_or(0) + } + + pub fn clear_max_net_usage_words(&mut self) { + self.max_net_usage_words = ::std::option::Option::None; + } + + pub fn has_max_net_usage_words(&self) -> bool { + self.max_net_usage_words.is_some() + } + + // Param is passed by value, moved + pub fn set_max_net_usage_words(&mut self, v: u32) { + self.max_net_usage_words = ::std::option::Option::Some(v); + } + + // required uint32 max_cpu_usage_ms = 5; + + pub fn max_cpu_usage_ms(&self) -> u32 { + self.max_cpu_usage_ms.unwrap_or(0) + } + + pub fn clear_max_cpu_usage_ms(&mut self) { + self.max_cpu_usage_ms = ::std::option::Option::None; + } + + pub fn has_max_cpu_usage_ms(&self) -> bool { + self.max_cpu_usage_ms.is_some() + } + + // Param is passed by value, moved + pub fn set_max_cpu_usage_ms(&mut self, v: u32) { + self.max_cpu_usage_ms = ::std::option::Option::Some(v); + } + + // required uint32 delay_sec = 6; + + pub fn delay_sec(&self) -> u32 { + self.delay_sec.unwrap_or(0) + } + + pub fn clear_delay_sec(&mut self) { + self.delay_sec = ::std::option::Option::None; + } + + pub fn has_delay_sec(&self) -> bool { + self.delay_sec.is_some() + } + + // Param is passed by value, moved + pub fn set_delay_sec(&mut self, v: u32) { + self.delay_sec = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "expiration", + |m: &EosTxHeader| { &m.expiration }, + |m: &mut EosTxHeader| { &mut m.expiration }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ref_block_num", + |m: &EosTxHeader| { &m.ref_block_num }, + |m: &mut EosTxHeader| { &mut m.ref_block_num }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ref_block_prefix", + |m: &EosTxHeader| { &m.ref_block_prefix }, + |m: &mut EosTxHeader| { &mut m.ref_block_prefix }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "max_net_usage_words", + |m: &EosTxHeader| { &m.max_net_usage_words }, + |m: &mut EosTxHeader| { &mut m.max_net_usage_words }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "max_cpu_usage_ms", + |m: &EosTxHeader| { &m.max_cpu_usage_ms }, + |m: &mut EosTxHeader| { &mut m.max_cpu_usage_ms }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "delay_sec", + |m: &EosTxHeader| { &m.delay_sec }, + |m: &mut EosTxHeader| { &mut m.delay_sec }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosSignTx.EosTxHeader", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosTxHeader { + const NAME: &'static str = "EosTxHeader"; + + fn is_initialized(&self) -> bool { + if self.expiration.is_none() { + return false; + } + if self.ref_block_num.is_none() { + return false; + } + if self.ref_block_prefix.is_none() { + return false; + } + if self.max_net_usage_words.is_none() { + return false; + } + if self.max_cpu_usage_ms.is_none() { + return false; + } + if self.delay_sec.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.expiration = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.ref_block_num = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.ref_block_prefix = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.max_net_usage_words = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.max_cpu_usage_ms = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.delay_sec = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.expiration { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.ref_block_num { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.ref_block_prefix { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.max_net_usage_words { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.max_cpu_usage_ms { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.delay_sec { + my_size += ::protobuf::rt::uint32_size(6, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.expiration { + os.write_uint32(1, v)?; + } + if let Some(v) = self.ref_block_num { + os.write_uint32(2, v)?; + } + if let Some(v) = self.ref_block_prefix { + os.write_uint32(3, v)?; + } + if let Some(v) = self.max_net_usage_words { + os.write_uint32(4, v)?; + } + if let Some(v) = self.max_cpu_usage_ms { + os.write_uint32(5, v)?; + } + if let Some(v) = self.delay_sec { + os.write_uint32(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosTxHeader { + EosTxHeader::new() + } + + fn clear(&mut self) { + self.expiration = ::std::option::Option::None; + self.ref_block_num = ::std::option::Option::None; + self.ref_block_prefix = ::std::option::Option::None; + self.max_net_usage_words = ::std::option::Option::None; + self.max_cpu_usage_ms = ::std::option::Option::None; + self.delay_sec = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosTxHeader { + static instance: EosTxHeader = EosTxHeader { + expiration: ::std::option::Option::None, + ref_block_num: ::std::option::Option::None, + ref_block_prefix: ::std::option::Option::None, + max_net_usage_words: ::std::option::Option::None, + max_cpu_usage_ms: ::std::option::Option::None, + delay_sec: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosTxHeader { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosSignTx.EosTxHeader").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosTxHeader { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosTxHeader { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EosTxActionRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionRequest.data_size) + pub data_size: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EosTxActionRequest { + fn default() -> &'a EosTxActionRequest { + ::default_instance() + } +} + +impl EosTxActionRequest { + pub fn new() -> EosTxActionRequest { + ::std::default::Default::default() + } + + // optional uint32 data_size = 1; + + pub fn data_size(&self) -> u32 { + self.data_size.unwrap_or(0) + } + + pub fn clear_data_size(&mut self) { + self.data_size = ::std::option::Option::None; + } + + pub fn has_data_size(&self) -> bool { + self.data_size.is_some() + } + + // Param is passed by value, moved + pub fn set_data_size(&mut self, v: u32) { + self.data_size = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_size", + |m: &EosTxActionRequest| { &m.data_size }, + |m: &mut EosTxActionRequest| { &mut m.data_size }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EosTxActionRequest { + const NAME: &'static str = "EosTxActionRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.data_size = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_size { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_size { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosTxActionRequest { + EosTxActionRequest::new() + } + + fn clear(&mut self) { + self.data_size = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosTxActionRequest { + static instance: EosTxActionRequest = EosTxActionRequest { + data_size: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EosTxActionRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EosTxActionRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EosTxActionRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EosTxActionRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EosTxActionAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.common) + pub common: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.transfer) + pub transfer: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.delegate) + pub delegate: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.undelegate) + pub undelegate: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.refund) + pub refund: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.buy_ram) + pub buy_ram: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.buy_ram_bytes) + pub buy_ram_bytes: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.sell_ram) + pub sell_ram: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.vote_producer) + pub vote_producer: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.update_auth) + pub update_auth: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.delete_auth) + pub delete_auth: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.link_auth) + pub link_auth: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.unlink_auth) + pub unlink_auth: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.new_account) + pub new_account: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.unknown) + pub unknown: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EosTxActionAck { + fn default() -> &'a EosTxActionAck { + ::default_instance() + } +} + +impl EosTxActionAck { + pub fn new() -> EosTxActionAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(15); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionCommon>( + "common", + |m: &EosTxActionAck| { &m.common }, + |m: &mut EosTxActionAck| { &mut m.common }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionTransfer>( + "transfer", + |m: &EosTxActionAck| { &m.transfer }, + |m: &mut EosTxActionAck| { &mut m.transfer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionDelegate>( + "delegate", + |m: &EosTxActionAck| { &m.delegate }, + |m: &mut EosTxActionAck| { &mut m.delegate }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUndelegate>( + "undelegate", + |m: &EosTxActionAck| { &m.undelegate }, + |m: &mut EosTxActionAck| { &mut m.undelegate }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionRefund>( + "refund", + |m: &EosTxActionAck| { &m.refund }, + |m: &mut EosTxActionAck| { &mut m.refund }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionBuyRam>( + "buy_ram", + |m: &EosTxActionAck| { &m.buy_ram }, + |m: &mut EosTxActionAck| { &mut m.buy_ram }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionBuyRamBytes>( + "buy_ram_bytes", + |m: &EosTxActionAck| { &m.buy_ram_bytes }, + |m: &mut EosTxActionAck| { &mut m.buy_ram_bytes }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionSellRam>( + "sell_ram", + |m: &EosTxActionAck| { &m.sell_ram }, + |m: &mut EosTxActionAck| { &mut m.sell_ram }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionVoteProducer>( + "vote_producer", + |m: &EosTxActionAck| { &m.vote_producer }, + |m: &mut EosTxActionAck| { &mut m.vote_producer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUpdateAuth>( + "update_auth", + |m: &EosTxActionAck| { &m.update_auth }, + |m: &mut EosTxActionAck| { &mut m.update_auth }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionDeleteAuth>( + "delete_auth", + |m: &EosTxActionAck| { &m.delete_auth }, + |m: &mut EosTxActionAck| { &mut m.delete_auth }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionLinkAuth>( + "link_auth", + |m: &EosTxActionAck| { &m.link_auth }, + |m: &mut EosTxActionAck| { &mut m.link_auth }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUnlinkAuth>( + "unlink_auth", + |m: &EosTxActionAck| { &m.unlink_auth }, + |m: &mut EosTxActionAck| { &mut m.unlink_auth }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionNewAccount>( + "new_account", + |m: &EosTxActionAck| { &m.new_account }, + |m: &mut EosTxActionAck| { &mut m.new_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUnknown>( + "unknown", + |m: &EosTxActionAck| { &m.unknown }, + |m: &mut EosTxActionAck| { &mut m.unknown }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EosTxActionAck { + const NAME: &'static str = "EosTxActionAck"; + + fn is_initialized(&self) -> bool { + if self.common.is_none() { + return false; + } + for v in &self.common { + if !v.is_initialized() { + return false; + } + }; + for v in &self.transfer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delegate { + if !v.is_initialized() { + return false; + } + }; + for v in &self.undelegate { + if !v.is_initialized() { + return false; + } + }; + for v in &self.refund { + if !v.is_initialized() { + return false; + } + }; + for v in &self.buy_ram { + if !v.is_initialized() { + return false; + } + }; + for v in &self.buy_ram_bytes { + if !v.is_initialized() { + return false; + } + }; + for v in &self.sell_ram { + if !v.is_initialized() { + return false; + } + }; + for v in &self.vote_producer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.update_auth { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delete_auth { + if !v.is_initialized() { + return false; + } + }; + for v in &self.link_auth { + if !v.is_initialized() { + return false; + } + }; + for v in &self.unlink_auth { + if !v.is_initialized() { + return false; + } + }; + for v in &self.new_account { + if !v.is_initialized() { + return false; + } + }; + for v in &self.unknown { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.common)?; + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.delegate)?; + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.undelegate)?; + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.refund)?; + }, + 50 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.buy_ram)?; + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.buy_ram_bytes)?; + }, + 66 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.sell_ram)?; + }, + 74 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.vote_producer)?; + }, + 82 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.update_auth)?; + }, + 90 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.delete_auth)?; + }, + 98 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.link_auth)?; + }, + 106 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.unlink_auth)?; + }, + 114 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.new_account)?; + }, + 122 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.unknown)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.common.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.transfer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.delegate.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.undelegate.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.refund.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.buy_ram.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.buy_ram_bytes.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.sell_ram.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.vote_producer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.update_auth.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.delete_auth.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.link_auth.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.unlink_auth.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.new_account.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.unknown.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.common.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.transfer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.delegate.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.undelegate.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.refund.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.buy_ram.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; + } + if let Some(v) = self.buy_ram_bytes.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.sell_ram.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; + } + if let Some(v) = self.vote_producer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; + } + if let Some(v) = self.update_auth.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; + } + if let Some(v) = self.delete_auth.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; + } + if let Some(v) = self.link_auth.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; + } + if let Some(v) = self.unlink_auth.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(13, v, os)?; + } + if let Some(v) = self.new_account.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(14, v, os)?; + } + if let Some(v) = self.unknown.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(15, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosTxActionAck { + EosTxActionAck::new() + } + + fn clear(&mut self) { + self.common.clear(); + self.transfer.clear(); + self.delegate.clear(); + self.undelegate.clear(); + self.refund.clear(); + self.buy_ram.clear(); + self.buy_ram_bytes.clear(); + self.sell_ram.clear(); + self.vote_producer.clear(); + self.update_auth.clear(); + self.delete_auth.clear(); + self.link_auth.clear(); + self.unlink_auth.clear(); + self.new_account.clear(); + self.unknown.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosTxActionAck { + static instance: EosTxActionAck = EosTxActionAck { + common: ::protobuf::MessageField::none(), + transfer: ::protobuf::MessageField::none(), + delegate: ::protobuf::MessageField::none(), + undelegate: ::protobuf::MessageField::none(), + refund: ::protobuf::MessageField::none(), + buy_ram: ::protobuf::MessageField::none(), + buy_ram_bytes: ::protobuf::MessageField::none(), + sell_ram: ::protobuf::MessageField::none(), + vote_producer: ::protobuf::MessageField::none(), + update_auth: ::protobuf::MessageField::none(), + delete_auth: ::protobuf::MessageField::none(), + link_auth: ::protobuf::MessageField::none(), + unlink_auth: ::protobuf::MessageField::none(), + new_account: ::protobuf::MessageField::none(), + unknown: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EosTxActionAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EosTxActionAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EosTxActionAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EosTxActionAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `EosTxActionAck` +pub mod eos_tx_action_ack { + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAsset) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosAsset { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAsset.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAsset.symbol) + pub symbol: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAsset.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosAsset { + fn default() -> &'a EosAsset { + ::default_instance() + } + } + + impl EosAsset { + pub fn new() -> EosAsset { + ::std::default::Default::default() + } + + // required sint64 amount = 1; + + pub fn amount(&self) -> i64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: i64) { + self.amount = ::std::option::Option::Some(v); + } + + // required uint64 symbol = 2; + + pub fn symbol(&self) -> u64 { + self.symbol.unwrap_or(0) + } + + pub fn clear_symbol(&mut self) { + self.symbol = ::std::option::Option::None; + } + + pub fn has_symbol(&self) -> bool { + self.symbol.is_some() + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: u64) { + self.symbol = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &EosAsset| { &m.amount }, + |m: &mut EosAsset| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "symbol", + |m: &EosAsset| { &m.symbol }, + |m: &mut EosAsset| { &mut m.symbol }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosAsset", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosAsset { + const NAME: &'static str = "EosAsset"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + if self.symbol.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.amount = ::std::option::Option::Some(is.read_sint64()?); + }, + 16 => { + self.symbol = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::sint64_size(1, v); + } + if let Some(v) = self.symbol { + my_size += ::protobuf::rt::uint64_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount { + os.write_sint64(1, v)?; + } + if let Some(v) = self.symbol { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosAsset { + EosAsset::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.symbol = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosAsset { + static instance: EosAsset = EosAsset { + amount: ::std::option::Option::None, + symbol: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosAsset { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAsset").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosAsset { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosAsset { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosPermissionLevel { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel.actor) + pub actor: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel.permission) + pub permission: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosPermissionLevel { + fn default() -> &'a EosPermissionLevel { + ::default_instance() + } + } + + impl EosPermissionLevel { + pub fn new() -> EosPermissionLevel { + ::std::default::Default::default() + } + + // required uint64 actor = 1; + + pub fn actor(&self) -> u64 { + self.actor.unwrap_or(0) + } + + pub fn clear_actor(&mut self) { + self.actor = ::std::option::Option::None; + } + + pub fn has_actor(&self) -> bool { + self.actor.is_some() + } + + // Param is passed by value, moved + pub fn set_actor(&mut self, v: u64) { + self.actor = ::std::option::Option::Some(v); + } + + // required uint64 permission = 2; + + pub fn permission(&self) -> u64 { + self.permission.unwrap_or(0) + } + + pub fn clear_permission(&mut self) { + self.permission = ::std::option::Option::None; + } + + pub fn has_permission(&self) -> bool { + self.permission.is_some() + } + + // Param is passed by value, moved + pub fn set_permission(&mut self, v: u64) { + self.permission = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "actor", + |m: &EosPermissionLevel| { &m.actor }, + |m: &mut EosPermissionLevel| { &mut m.actor }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "permission", + |m: &EosPermissionLevel| { &m.permission }, + |m: &mut EosPermissionLevel| { &mut m.permission }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosPermissionLevel", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosPermissionLevel { + const NAME: &'static str = "EosPermissionLevel"; + + fn is_initialized(&self) -> bool { + if self.actor.is_none() { + return false; + } + if self.permission.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.actor = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.permission = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.actor { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.permission { + my_size += ::protobuf::rt::uint64_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.actor { + os.write_uint64(1, v)?; + } + if let Some(v) = self.permission { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosPermissionLevel { + EosPermissionLevel::new() + } + + fn clear(&mut self) { + self.actor = ::std::option::Option::None; + self.permission = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosPermissionLevel { + static instance: EosPermissionLevel = EosPermissionLevel { + actor: ::std::option::Option::None, + permission: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosPermissionLevel { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosPermissionLevel").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosPermissionLevel { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosPermissionLevel { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosAuthorizationKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.type) + pub type_: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.key) + pub key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.weight) + pub weight: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosAuthorizationKey { + fn default() -> &'a EosAuthorizationKey { + ::default_instance() + } + } + + impl EosAuthorizationKey { + pub fn new() -> EosAuthorizationKey { + ::std::default::Default::default() + } + + // required uint32 type = 1; + + pub fn type_(&self) -> u32 { + self.type_.unwrap_or(0) + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: u32) { + self.type_ = ::std::option::Option::Some(v); + } + + // optional bytes key = 2; + + pub fn key(&self) -> &[u8] { + match self.key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_key(&mut self) { + self.key = ::std::option::Option::None; + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + if self.key.is_none() { + self.key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 weight = 4; + + pub fn weight(&self) -> u32 { + self.weight.unwrap_or(0) + } + + pub fn clear_weight(&mut self) { + self.weight = ::std::option::Option::None; + } + + pub fn has_weight(&self) -> bool { + self.weight.is_some() + } + + // Param is passed by value, moved + pub fn set_weight(&mut self, v: u32) { + self.weight = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &EosAuthorizationKey| { &m.type_ }, + |m: &mut EosAuthorizationKey| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key", + |m: &EosAuthorizationKey| { &m.key }, + |m: &mut EosAuthorizationKey| { &mut m.key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EosAuthorizationKey| { &m.address_n }, + |m: &mut EosAuthorizationKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "weight", + |m: &EosAuthorizationKey| { &m.weight }, + |m: &mut EosAuthorizationKey| { &mut m.weight }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosAuthorizationKey", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosAuthorizationKey { + const NAME: &'static str = "EosAuthorizationKey"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + if self.weight.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.key = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 24 => { + self.address_n.push(is.read_uint32()?); + }, + 32 => { + self.weight = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(3, *value); + }; + if let Some(v) = self.weight { + my_size += ::protobuf::rt::uint32_size(4, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_uint32(1, v)?; + } + if let Some(v) = self.key.as_ref() { + os.write_bytes(2, v)?; + } + for v in &self.address_n { + os.write_uint32(3, *v)?; + }; + if let Some(v) = self.weight { + os.write_uint32(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosAuthorizationKey { + EosAuthorizationKey::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.key = ::std::option::Option::None; + self.address_n.clear(); + self.weight = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosAuthorizationKey { + static instance: EosAuthorizationKey = EosAuthorizationKey { + type_: ::std::option::Option::None, + key: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + weight: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosAuthorizationKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorizationKey").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosAuthorizationKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosAuthorizationKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosAuthorizationAccount { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount.account) + pub account: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount.weight) + pub weight: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosAuthorizationAccount { + fn default() -> &'a EosAuthorizationAccount { + ::default_instance() + } + } + + impl EosAuthorizationAccount { + pub fn new() -> EosAuthorizationAccount { + ::std::default::Default::default() + } + + // required uint32 weight = 2; + + pub fn weight(&self) -> u32 { + self.weight.unwrap_or(0) + } + + pub fn clear_weight(&mut self) { + self.weight = ::std::option::Option::None; + } + + pub fn has_weight(&self) -> bool { + self.weight.is_some() + } + + // Param is passed by value, moved + pub fn set_weight(&mut self, v: u32) { + self.weight = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosPermissionLevel>( + "account", + |m: &EosAuthorizationAccount| { &m.account }, + |m: &mut EosAuthorizationAccount| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "weight", + |m: &EosAuthorizationAccount| { &m.weight }, + |m: &mut EosAuthorizationAccount| { &mut m.weight }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosAuthorizationAccount", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosAuthorizationAccount { + const NAME: &'static str = "EosAuthorizationAccount"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + if self.weight.is_none() { + return false; + } + for v in &self.account { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.account)?; + }, + 16 => { + self.weight = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.weight { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.weight { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosAuthorizationAccount { + EosAuthorizationAccount::new() + } + + fn clear(&mut self) { + self.account.clear(); + self.weight = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosAuthorizationAccount { + static instance: EosAuthorizationAccount = EosAuthorizationAccount { + account: ::protobuf::MessageField::none(), + weight: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosAuthorizationAccount { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorizationAccount").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosAuthorizationAccount { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosAuthorizationAccount { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosAuthorizationWait { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait.wait_sec) + pub wait_sec: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait.weight) + pub weight: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosAuthorizationWait { + fn default() -> &'a EosAuthorizationWait { + ::default_instance() + } + } + + impl EosAuthorizationWait { + pub fn new() -> EosAuthorizationWait { + ::std::default::Default::default() + } + + // required uint32 wait_sec = 1; + + pub fn wait_sec(&self) -> u32 { + self.wait_sec.unwrap_or(0) + } + + pub fn clear_wait_sec(&mut self) { + self.wait_sec = ::std::option::Option::None; + } + + pub fn has_wait_sec(&self) -> bool { + self.wait_sec.is_some() + } + + // Param is passed by value, moved + pub fn set_wait_sec(&mut self, v: u32) { + self.wait_sec = ::std::option::Option::Some(v); + } + + // required uint32 weight = 2; + + pub fn weight(&self) -> u32 { + self.weight.unwrap_or(0) + } + + pub fn clear_weight(&mut self) { + self.weight = ::std::option::Option::None; + } + + pub fn has_weight(&self) -> bool { + self.weight.is_some() + } + + // Param is passed by value, moved + pub fn set_weight(&mut self, v: u32) { + self.weight = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "wait_sec", + |m: &EosAuthorizationWait| { &m.wait_sec }, + |m: &mut EosAuthorizationWait| { &mut m.wait_sec }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "weight", + |m: &EosAuthorizationWait| { &m.weight }, + |m: &mut EosAuthorizationWait| { &mut m.weight }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosAuthorizationWait", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosAuthorizationWait { + const NAME: &'static str = "EosAuthorizationWait"; + + fn is_initialized(&self) -> bool { + if self.wait_sec.is_none() { + return false; + } + if self.weight.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.wait_sec = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.weight = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.wait_sec { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.weight { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.wait_sec { + os.write_uint32(1, v)?; + } + if let Some(v) = self.weight { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosAuthorizationWait { + EosAuthorizationWait::new() + } + + fn clear(&mut self) { + self.wait_sec = ::std::option::Option::None; + self.weight = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosAuthorizationWait { + static instance: EosAuthorizationWait = EosAuthorizationWait { + wait_sec: ::std::option::Option::None, + weight: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosAuthorizationWait { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorizationWait").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosAuthorizationWait { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosAuthorizationWait { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosAuthorization { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.threshold) + pub threshold: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.keys) + pub keys: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.accounts) + pub accounts: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.waits) + pub waits: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosAuthorization { + fn default() -> &'a EosAuthorization { + ::default_instance() + } + } + + impl EosAuthorization { + pub fn new() -> EosAuthorization { + ::std::default::Default::default() + } + + // required uint32 threshold = 1; + + pub fn threshold(&self) -> u32 { + self.threshold.unwrap_or(0) + } + + pub fn clear_threshold(&mut self) { + self.threshold = ::std::option::Option::None; + } + + pub fn has_threshold(&self) -> bool { + self.threshold.is_some() + } + + // Param is passed by value, moved + pub fn set_threshold(&mut self, v: u32) { + self.threshold = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "threshold", + |m: &EosAuthorization| { &m.threshold }, + |m: &mut EosAuthorization| { &mut m.threshold }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "keys", + |m: &EosAuthorization| { &m.keys }, + |m: &mut EosAuthorization| { &mut m.keys }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "accounts", + |m: &EosAuthorization| { &m.accounts }, + |m: &mut EosAuthorization| { &mut m.accounts }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "waits", + |m: &EosAuthorization| { &m.waits }, + |m: &mut EosAuthorization| { &mut m.waits }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosAuthorization", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosAuthorization { + const NAME: &'static str = "EosAuthorization"; + + fn is_initialized(&self) -> bool { + if self.threshold.is_none() { + return false; + } + for v in &self.keys { + if !v.is_initialized() { + return false; + } + }; + for v in &self.accounts { + if !v.is_initialized() { + return false; + } + }; + for v in &self.waits { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.threshold = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.keys.push(is.read_message()?); + }, + 26 => { + self.accounts.push(is.read_message()?); + }, + 34 => { + self.waits.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.threshold { + my_size += ::protobuf::rt::uint32_size(1, v); + } + for value in &self.keys { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.accounts { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.waits { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.threshold { + os.write_uint32(1, v)?; + } + for v in &self.keys { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + }; + for v in &self.accounts { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + }; + for v in &self.waits { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosAuthorization { + EosAuthorization::new() + } + + fn clear(&mut self) { + self.threshold = ::std::option::Option::None; + self.keys.clear(); + self.accounts.clear(); + self.waits.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosAuthorization { + static instance: EosAuthorization = EosAuthorization { + threshold: ::std::option::Option::None, + keys: ::std::vec::Vec::new(), + accounts: ::std::vec::Vec::new(), + waits: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosAuthorization { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorization").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosAuthorization { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosAuthorization { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionCommon { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.name) + pub name: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.authorization) + pub authorization: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionCommon { + fn default() -> &'a EosActionCommon { + ::default_instance() + } + } + + impl EosActionCommon { + pub fn new() -> EosActionCommon { + ::std::default::Default::default() + } + + // required uint64 account = 1; + + pub fn account(&self) -> u64 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u64) { + self.account = ::std::option::Option::Some(v); + } + + // required uint64 name = 2; + + pub fn name(&self) -> u64 { + self.name.unwrap_or(0) + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: u64) { + self.name = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &EosActionCommon| { &m.account }, + |m: &mut EosActionCommon| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &EosActionCommon| { &m.name }, + |m: &mut EosActionCommon| { &mut m.name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "authorization", + |m: &EosActionCommon| { &m.authorization }, + |m: &mut EosActionCommon| { &mut m.authorization }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionCommon", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionCommon { + const NAME: &'static str = "EosActionCommon"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + if self.name.is_none() { + return false; + } + for v in &self.authorization { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.account = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.name = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + self.authorization.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.name { + my_size += ::protobuf::rt::uint64_size(2, v); + } + for value in &self.authorization { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account { + os.write_uint64(1, v)?; + } + if let Some(v) = self.name { + os.write_uint64(2, v)?; + } + for v in &self.authorization { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionCommon { + EosActionCommon::new() + } + + fn clear(&mut self) { + self.account = ::std::option::Option::None; + self.name = ::std::option::Option::None; + self.authorization.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionCommon { + static instance: EosActionCommon = EosActionCommon { + account: ::std::option::Option::None, + name: ::std::option::Option::None, + authorization: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionCommon { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionCommon").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionCommon { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionCommon { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionTransfer { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.sender) + pub sender: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.receiver) + pub receiver: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.quantity) + pub quantity: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.memo) + pub memo: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionTransfer { + fn default() -> &'a EosActionTransfer { + ::default_instance() + } + } + + impl EosActionTransfer { + pub fn new() -> EosActionTransfer { + ::std::default::Default::default() + } + + // required uint64 sender = 1; + + pub fn sender(&self) -> u64 { + self.sender.unwrap_or(0) + } + + pub fn clear_sender(&mut self) { + self.sender = ::std::option::Option::None; + } + + pub fn has_sender(&self) -> bool { + self.sender.is_some() + } + + // Param is passed by value, moved + pub fn set_sender(&mut self, v: u64) { + self.sender = ::std::option::Option::Some(v); + } + + // required uint64 receiver = 2; + + pub fn receiver(&self) -> u64 { + self.receiver.unwrap_or(0) + } + + pub fn clear_receiver(&mut self) { + self.receiver = ::std::option::Option::None; + } + + pub fn has_receiver(&self) -> bool { + self.receiver.is_some() + } + + // Param is passed by value, moved + pub fn set_receiver(&mut self, v: u64) { + self.receiver = ::std::option::Option::Some(v); + } + + // required string memo = 4; + + pub fn memo(&self) -> &str { + match self.memo.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_memo(&mut self) { + self.memo = ::std::option::Option::None; + } + + pub fn has_memo(&self) -> bool { + self.memo.is_some() + } + + // Param is passed by value, moved + pub fn set_memo(&mut self, v: ::std::string::String) { + self.memo = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_memo(&mut self) -> &mut ::std::string::String { + if self.memo.is_none() { + self.memo = ::std::option::Option::Some(::std::string::String::new()); + } + self.memo.as_mut().unwrap() + } + + // Take field + pub fn take_memo(&mut self) -> ::std::string::String { + self.memo.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sender", + |m: &EosActionTransfer| { &m.sender }, + |m: &mut EosActionTransfer| { &mut m.sender }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "receiver", + |m: &EosActionTransfer| { &m.receiver }, + |m: &mut EosActionTransfer| { &mut m.receiver }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( + "quantity", + |m: &EosActionTransfer| { &m.quantity }, + |m: &mut EosActionTransfer| { &mut m.quantity }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memo", + |m: &EosActionTransfer| { &m.memo }, + |m: &mut EosActionTransfer| { &mut m.memo }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionTransfer", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionTransfer { + const NAME: &'static str = "EosActionTransfer"; + + fn is_initialized(&self) -> bool { + if self.sender.is_none() { + return false; + } + if self.receiver.is_none() { + return false; + } + if self.quantity.is_none() { + return false; + } + if self.memo.is_none() { + return false; + } + for v in &self.quantity { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.sender = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.receiver = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.quantity)?; + }, + 34 => { + self.memo = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.sender { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.receiver { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.quantity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.memo.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.sender { + os.write_uint64(1, v)?; + } + if let Some(v) = self.receiver { + os.write_uint64(2, v)?; + } + if let Some(v) = self.quantity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.memo.as_ref() { + os.write_string(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionTransfer { + EosActionTransfer::new() + } + + fn clear(&mut self) { + self.sender = ::std::option::Option::None; + self.receiver = ::std::option::Option::None; + self.quantity.clear(); + self.memo = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionTransfer { + static instance: EosActionTransfer = EosActionTransfer { + sender: ::std::option::Option::None, + receiver: ::std::option::Option::None, + quantity: ::protobuf::MessageField::none(), + memo: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionTransfer { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionTransfer").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionTransfer { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionTransfer { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionDelegate { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.sender) + pub sender: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.receiver) + pub receiver: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.net_quantity) + pub net_quantity: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.cpu_quantity) + pub cpu_quantity: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.transfer) + pub transfer: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionDelegate { + fn default() -> &'a EosActionDelegate { + ::default_instance() + } + } + + impl EosActionDelegate { + pub fn new() -> EosActionDelegate { + ::std::default::Default::default() + } + + // required uint64 sender = 1; + + pub fn sender(&self) -> u64 { + self.sender.unwrap_or(0) + } + + pub fn clear_sender(&mut self) { + self.sender = ::std::option::Option::None; + } + + pub fn has_sender(&self) -> bool { + self.sender.is_some() + } + + // Param is passed by value, moved + pub fn set_sender(&mut self, v: u64) { + self.sender = ::std::option::Option::Some(v); + } + + // required uint64 receiver = 2; + + pub fn receiver(&self) -> u64 { + self.receiver.unwrap_or(0) + } + + pub fn clear_receiver(&mut self) { + self.receiver = ::std::option::Option::None; + } + + pub fn has_receiver(&self) -> bool { + self.receiver.is_some() + } + + // Param is passed by value, moved + pub fn set_receiver(&mut self, v: u64) { + self.receiver = ::std::option::Option::Some(v); + } + + // required bool transfer = 5; + + pub fn transfer(&self) -> bool { + self.transfer.unwrap_or(false) + } + + pub fn clear_transfer(&mut self) { + self.transfer = ::std::option::Option::None; + } + + pub fn has_transfer(&self) -> bool { + self.transfer.is_some() + } + + // Param is passed by value, moved + pub fn set_transfer(&mut self, v: bool) { + self.transfer = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sender", + |m: &EosActionDelegate| { &m.sender }, + |m: &mut EosActionDelegate| { &mut m.sender }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "receiver", + |m: &EosActionDelegate| { &m.receiver }, + |m: &mut EosActionDelegate| { &mut m.receiver }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( + "net_quantity", + |m: &EosActionDelegate| { &m.net_quantity }, + |m: &mut EosActionDelegate| { &mut m.net_quantity }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( + "cpu_quantity", + |m: &EosActionDelegate| { &m.cpu_quantity }, + |m: &mut EosActionDelegate| { &mut m.cpu_quantity }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "transfer", + |m: &EosActionDelegate| { &m.transfer }, + |m: &mut EosActionDelegate| { &mut m.transfer }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionDelegate", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionDelegate { + const NAME: &'static str = "EosActionDelegate"; + + fn is_initialized(&self) -> bool { + if self.sender.is_none() { + return false; + } + if self.receiver.is_none() { + return false; + } + if self.net_quantity.is_none() { + return false; + } + if self.cpu_quantity.is_none() { + return false; + } + if self.transfer.is_none() { + return false; + } + for v in &self.net_quantity { + if !v.is_initialized() { + return false; + } + }; + for v in &self.cpu_quantity { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.sender = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.receiver = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.net_quantity)?; + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.cpu_quantity)?; + }, + 40 => { + self.transfer = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.sender { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.receiver { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.net_quantity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.cpu_quantity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.transfer { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.sender { + os.write_uint64(1, v)?; + } + if let Some(v) = self.receiver { + os.write_uint64(2, v)?; + } + if let Some(v) = self.net_quantity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.cpu_quantity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.transfer { + os.write_bool(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionDelegate { + EosActionDelegate::new() + } + + fn clear(&mut self) { + self.sender = ::std::option::Option::None; + self.receiver = ::std::option::Option::None; + self.net_quantity.clear(); + self.cpu_quantity.clear(); + self.transfer = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionDelegate { + static instance: EosActionDelegate = EosActionDelegate { + sender: ::std::option::Option::None, + receiver: ::std::option::Option::None, + net_quantity: ::protobuf::MessageField::none(), + cpu_quantity: ::protobuf::MessageField::none(), + transfer: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionDelegate { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionDelegate").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionDelegate { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionDelegate { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionUndelegate { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.sender) + pub sender: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.receiver) + pub receiver: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.net_quantity) + pub net_quantity: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.cpu_quantity) + pub cpu_quantity: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionUndelegate { + fn default() -> &'a EosActionUndelegate { + ::default_instance() + } + } + + impl EosActionUndelegate { + pub fn new() -> EosActionUndelegate { + ::std::default::Default::default() + } + + // required uint64 sender = 1; + + pub fn sender(&self) -> u64 { + self.sender.unwrap_or(0) + } + + pub fn clear_sender(&mut self) { + self.sender = ::std::option::Option::None; + } + + pub fn has_sender(&self) -> bool { + self.sender.is_some() + } + + // Param is passed by value, moved + pub fn set_sender(&mut self, v: u64) { + self.sender = ::std::option::Option::Some(v); + } + + // required uint64 receiver = 2; + + pub fn receiver(&self) -> u64 { + self.receiver.unwrap_or(0) + } + + pub fn clear_receiver(&mut self) { + self.receiver = ::std::option::Option::None; + } + + pub fn has_receiver(&self) -> bool { + self.receiver.is_some() + } + + // Param is passed by value, moved + pub fn set_receiver(&mut self, v: u64) { + self.receiver = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sender", + |m: &EosActionUndelegate| { &m.sender }, + |m: &mut EosActionUndelegate| { &mut m.sender }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "receiver", + |m: &EosActionUndelegate| { &m.receiver }, + |m: &mut EosActionUndelegate| { &mut m.receiver }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( + "net_quantity", + |m: &EosActionUndelegate| { &m.net_quantity }, + |m: &mut EosActionUndelegate| { &mut m.net_quantity }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( + "cpu_quantity", + |m: &EosActionUndelegate| { &m.cpu_quantity }, + |m: &mut EosActionUndelegate| { &mut m.cpu_quantity }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionUndelegate", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionUndelegate { + const NAME: &'static str = "EosActionUndelegate"; + + fn is_initialized(&self) -> bool { + if self.sender.is_none() { + return false; + } + if self.receiver.is_none() { + return false; + } + if self.net_quantity.is_none() { + return false; + } + if self.cpu_quantity.is_none() { + return false; + } + for v in &self.net_quantity { + if !v.is_initialized() { + return false; + } + }; + for v in &self.cpu_quantity { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.sender = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.receiver = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.net_quantity)?; + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.cpu_quantity)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.sender { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.receiver { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.net_quantity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.cpu_quantity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.sender { + os.write_uint64(1, v)?; + } + if let Some(v) = self.receiver { + os.write_uint64(2, v)?; + } + if let Some(v) = self.net_quantity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.cpu_quantity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionUndelegate { + EosActionUndelegate::new() + } + + fn clear(&mut self) { + self.sender = ::std::option::Option::None; + self.receiver = ::std::option::Option::None; + self.net_quantity.clear(); + self.cpu_quantity.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionUndelegate { + static instance: EosActionUndelegate = EosActionUndelegate { + sender: ::std::option::Option::None, + receiver: ::std::option::Option::None, + net_quantity: ::protobuf::MessageField::none(), + cpu_quantity: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionUndelegate { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUndelegate").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionUndelegate { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionUndelegate { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionRefund) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionRefund { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionRefund.owner) + pub owner: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionRefund.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionRefund { + fn default() -> &'a EosActionRefund { + ::default_instance() + } + } + + impl EosActionRefund { + pub fn new() -> EosActionRefund { + ::std::default::Default::default() + } + + // required uint64 owner = 1; + + pub fn owner(&self) -> u64 { + self.owner.unwrap_or(0) + } + + pub fn clear_owner(&mut self) { + self.owner = ::std::option::Option::None; + } + + pub fn has_owner(&self) -> bool { + self.owner.is_some() + } + + // Param is passed by value, moved + pub fn set_owner(&mut self, v: u64) { + self.owner = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "owner", + |m: &EosActionRefund| { &m.owner }, + |m: &mut EosActionRefund| { &mut m.owner }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionRefund", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionRefund { + const NAME: &'static str = "EosActionRefund"; + + fn is_initialized(&self) -> bool { + if self.owner.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.owner = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.owner { + my_size += ::protobuf::rt::uint64_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.owner { + os.write_uint64(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionRefund { + EosActionRefund::new() + } + + fn clear(&mut self) { + self.owner = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionRefund { + static instance: EosActionRefund = EosActionRefund { + owner: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionRefund { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionRefund").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionRefund { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionRefund { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionBuyRam { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.payer) + pub payer: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.receiver) + pub receiver: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.quantity) + pub quantity: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionBuyRam { + fn default() -> &'a EosActionBuyRam { + ::default_instance() + } + } + + impl EosActionBuyRam { + pub fn new() -> EosActionBuyRam { + ::std::default::Default::default() + } + + // required uint64 payer = 1; + + pub fn payer(&self) -> u64 { + self.payer.unwrap_or(0) + } + + pub fn clear_payer(&mut self) { + self.payer = ::std::option::Option::None; + } + + pub fn has_payer(&self) -> bool { + self.payer.is_some() + } + + // Param is passed by value, moved + pub fn set_payer(&mut self, v: u64) { + self.payer = ::std::option::Option::Some(v); + } + + // required uint64 receiver = 2; + + pub fn receiver(&self) -> u64 { + self.receiver.unwrap_or(0) + } + + pub fn clear_receiver(&mut self) { + self.receiver = ::std::option::Option::None; + } + + pub fn has_receiver(&self) -> bool { + self.receiver.is_some() + } + + // Param is passed by value, moved + pub fn set_receiver(&mut self, v: u64) { + self.receiver = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payer", + |m: &EosActionBuyRam| { &m.payer }, + |m: &mut EosActionBuyRam| { &mut m.payer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "receiver", + |m: &EosActionBuyRam| { &m.receiver }, + |m: &mut EosActionBuyRam| { &mut m.receiver }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( + "quantity", + |m: &EosActionBuyRam| { &m.quantity }, + |m: &mut EosActionBuyRam| { &mut m.quantity }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionBuyRam", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionBuyRam { + const NAME: &'static str = "EosActionBuyRam"; + + fn is_initialized(&self) -> bool { + if self.payer.is_none() { + return false; + } + if self.receiver.is_none() { + return false; + } + if self.quantity.is_none() { + return false; + } + for v in &self.quantity { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.payer = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.receiver = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.quantity)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payer { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.receiver { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.quantity.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.payer { + os.write_uint64(1, v)?; + } + if let Some(v) = self.receiver { + os.write_uint64(2, v)?; + } + if let Some(v) = self.quantity.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionBuyRam { + EosActionBuyRam::new() + } + + fn clear(&mut self) { + self.payer = ::std::option::Option::None; + self.receiver = ::std::option::Option::None; + self.quantity.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionBuyRam { + static instance: EosActionBuyRam = EosActionBuyRam { + payer: ::std::option::Option::None, + receiver: ::std::option::Option::None, + quantity: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionBuyRam { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionBuyRam").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionBuyRam { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionBuyRam { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionBuyRamBytes { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.payer) + pub payer: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.receiver) + pub receiver: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.bytes) + pub bytes: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionBuyRamBytes { + fn default() -> &'a EosActionBuyRamBytes { + ::default_instance() + } + } + + impl EosActionBuyRamBytes { + pub fn new() -> EosActionBuyRamBytes { + ::std::default::Default::default() + } + + // required uint64 payer = 1; + + pub fn payer(&self) -> u64 { + self.payer.unwrap_or(0) + } + + pub fn clear_payer(&mut self) { + self.payer = ::std::option::Option::None; + } + + pub fn has_payer(&self) -> bool { + self.payer.is_some() + } + + // Param is passed by value, moved + pub fn set_payer(&mut self, v: u64) { + self.payer = ::std::option::Option::Some(v); + } + + // required uint64 receiver = 2; + + pub fn receiver(&self) -> u64 { + self.receiver.unwrap_or(0) + } + + pub fn clear_receiver(&mut self) { + self.receiver = ::std::option::Option::None; + } + + pub fn has_receiver(&self) -> bool { + self.receiver.is_some() + } + + // Param is passed by value, moved + pub fn set_receiver(&mut self, v: u64) { + self.receiver = ::std::option::Option::Some(v); + } + + // required uint32 bytes = 3; + + pub fn bytes(&self) -> u32 { + self.bytes.unwrap_or(0) + } + + pub fn clear_bytes(&mut self) { + self.bytes = ::std::option::Option::None; + } + + pub fn has_bytes(&self) -> bool { + self.bytes.is_some() + } + + // Param is passed by value, moved + pub fn set_bytes(&mut self, v: u32) { + self.bytes = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payer", + |m: &EosActionBuyRamBytes| { &m.payer }, + |m: &mut EosActionBuyRamBytes| { &mut m.payer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "receiver", + |m: &EosActionBuyRamBytes| { &m.receiver }, + |m: &mut EosActionBuyRamBytes| { &mut m.receiver }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bytes", + |m: &EosActionBuyRamBytes| { &m.bytes }, + |m: &mut EosActionBuyRamBytes| { &mut m.bytes }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionBuyRamBytes", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionBuyRamBytes { + const NAME: &'static str = "EosActionBuyRamBytes"; + + fn is_initialized(&self) -> bool { + if self.payer.is_none() { + return false; + } + if self.receiver.is_none() { + return false; + } + if self.bytes.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.payer = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.receiver = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.bytes = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payer { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.receiver { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.bytes { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.payer { + os.write_uint64(1, v)?; + } + if let Some(v) = self.receiver { + os.write_uint64(2, v)?; + } + if let Some(v) = self.bytes { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionBuyRamBytes { + EosActionBuyRamBytes::new() + } + + fn clear(&mut self) { + self.payer = ::std::option::Option::None; + self.receiver = ::std::option::Option::None; + self.bytes = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionBuyRamBytes { + static instance: EosActionBuyRamBytes = EosActionBuyRamBytes { + payer: ::std::option::Option::None, + receiver: ::std::option::Option::None, + bytes: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionBuyRamBytes { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionBuyRamBytes").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionBuyRamBytes { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionBuyRamBytes { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionSellRam { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam.bytes) + pub bytes: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionSellRam { + fn default() -> &'a EosActionSellRam { + ::default_instance() + } + } + + impl EosActionSellRam { + pub fn new() -> EosActionSellRam { + ::std::default::Default::default() + } + + // required uint64 account = 1; + + pub fn account(&self) -> u64 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u64) { + self.account = ::std::option::Option::Some(v); + } + + // required uint64 bytes = 2; + + pub fn bytes(&self) -> u64 { + self.bytes.unwrap_or(0) + } + + pub fn clear_bytes(&mut self) { + self.bytes = ::std::option::Option::None; + } + + pub fn has_bytes(&self) -> bool { + self.bytes.is_some() + } + + // Param is passed by value, moved + pub fn set_bytes(&mut self, v: u64) { + self.bytes = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &EosActionSellRam| { &m.account }, + |m: &mut EosActionSellRam| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bytes", + |m: &EosActionSellRam| { &m.bytes }, + |m: &mut EosActionSellRam| { &mut m.bytes }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionSellRam", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionSellRam { + const NAME: &'static str = "EosActionSellRam"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + if self.bytes.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.account = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.bytes = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.bytes { + my_size += ::protobuf::rt::uint64_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account { + os.write_uint64(1, v)?; + } + if let Some(v) = self.bytes { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionSellRam { + EosActionSellRam::new() + } + + fn clear(&mut self) { + self.account = ::std::option::Option::None; + self.bytes = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionSellRam { + static instance: EosActionSellRam = EosActionSellRam { + account: ::std::option::Option::None, + bytes: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionSellRam { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionSellRam").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionSellRam { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionSellRam { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionVoteProducer { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.voter) + pub voter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.proxy) + pub proxy: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.producers) + pub producers: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionVoteProducer { + fn default() -> &'a EosActionVoteProducer { + ::default_instance() + } + } + + impl EosActionVoteProducer { + pub fn new() -> EosActionVoteProducer { + ::std::default::Default::default() + } + + // required uint64 voter = 1; + + pub fn voter(&self) -> u64 { + self.voter.unwrap_or(0) + } + + pub fn clear_voter(&mut self) { + self.voter = ::std::option::Option::None; + } + + pub fn has_voter(&self) -> bool { + self.voter.is_some() + } + + // Param is passed by value, moved + pub fn set_voter(&mut self, v: u64) { + self.voter = ::std::option::Option::Some(v); + } + + // required uint64 proxy = 2; + + pub fn proxy(&self) -> u64 { + self.proxy.unwrap_or(0) + } + + pub fn clear_proxy(&mut self) { + self.proxy = ::std::option::Option::None; + } + + pub fn has_proxy(&self) -> bool { + self.proxy.is_some() + } + + // Param is passed by value, moved + pub fn set_proxy(&mut self, v: u64) { + self.proxy = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "voter", + |m: &EosActionVoteProducer| { &m.voter }, + |m: &mut EosActionVoteProducer| { &mut m.voter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "proxy", + |m: &EosActionVoteProducer| { &m.proxy }, + |m: &mut EosActionVoteProducer| { &mut m.proxy }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "producers", + |m: &EosActionVoteProducer| { &m.producers }, + |m: &mut EosActionVoteProducer| { &mut m.producers }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionVoteProducer", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionVoteProducer { + const NAME: &'static str = "EosActionVoteProducer"; + + fn is_initialized(&self) -> bool { + if self.voter.is_none() { + return false; + } + if self.proxy.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.voter = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.proxy = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + is.read_repeated_packed_uint64_into(&mut self.producers)?; + }, + 24 => { + self.producers.push(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.voter { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.proxy { + my_size += ::protobuf::rt::uint64_size(2, v); + } + for value in &self.producers { + my_size += ::protobuf::rt::uint64_size(3, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.voter { + os.write_uint64(1, v)?; + } + if let Some(v) = self.proxy { + os.write_uint64(2, v)?; + } + for v in &self.producers { + os.write_uint64(3, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionVoteProducer { + EosActionVoteProducer::new() + } + + fn clear(&mut self) { + self.voter = ::std::option::Option::None; + self.proxy = ::std::option::Option::None; + self.producers.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionVoteProducer { + static instance: EosActionVoteProducer = EosActionVoteProducer { + voter: ::std::option::Option::None, + proxy: ::std::option::Option::None, + producers: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionVoteProducer { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionVoteProducer").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionVoteProducer { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionVoteProducer { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionUpdateAuth { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.permission) + pub permission: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.parent) + pub parent: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.auth) + pub auth: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionUpdateAuth { + fn default() -> &'a EosActionUpdateAuth { + ::default_instance() + } + } + + impl EosActionUpdateAuth { + pub fn new() -> EosActionUpdateAuth { + ::std::default::Default::default() + } + + // required uint64 account = 1; + + pub fn account(&self) -> u64 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u64) { + self.account = ::std::option::Option::Some(v); + } + + // required uint64 permission = 2; + + pub fn permission(&self) -> u64 { + self.permission.unwrap_or(0) + } + + pub fn clear_permission(&mut self) { + self.permission = ::std::option::Option::None; + } + + pub fn has_permission(&self) -> bool { + self.permission.is_some() + } + + // Param is passed by value, moved + pub fn set_permission(&mut self, v: u64) { + self.permission = ::std::option::Option::Some(v); + } + + // required uint64 parent = 3; + + pub fn parent(&self) -> u64 { + self.parent.unwrap_or(0) + } + + pub fn clear_parent(&mut self) { + self.parent = ::std::option::Option::None; + } + + pub fn has_parent(&self) -> bool { + self.parent.is_some() + } + + // Param is passed by value, moved + pub fn set_parent(&mut self, v: u64) { + self.parent = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &EosActionUpdateAuth| { &m.account }, + |m: &mut EosActionUpdateAuth| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "permission", + |m: &EosActionUpdateAuth| { &m.permission }, + |m: &mut EosActionUpdateAuth| { &mut m.permission }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "parent", + |m: &EosActionUpdateAuth| { &m.parent }, + |m: &mut EosActionUpdateAuth| { &mut m.parent }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAuthorization>( + "auth", + |m: &EosActionUpdateAuth| { &m.auth }, + |m: &mut EosActionUpdateAuth| { &mut m.auth }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionUpdateAuth", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionUpdateAuth { + const NAME: &'static str = "EosActionUpdateAuth"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + if self.permission.is_none() { + return false; + } + if self.parent.is_none() { + return false; + } + if self.auth.is_none() { + return false; + } + for v in &self.auth { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.account = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.permission = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.parent = ::std::option::Option::Some(is.read_uint64()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.auth)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.permission { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.parent { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.auth.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account { + os.write_uint64(1, v)?; + } + if let Some(v) = self.permission { + os.write_uint64(2, v)?; + } + if let Some(v) = self.parent { + os.write_uint64(3, v)?; + } + if let Some(v) = self.auth.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionUpdateAuth { + EosActionUpdateAuth::new() + } + + fn clear(&mut self) { + self.account = ::std::option::Option::None; + self.permission = ::std::option::Option::None; + self.parent = ::std::option::Option::None; + self.auth.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionUpdateAuth { + static instance: EosActionUpdateAuth = EosActionUpdateAuth { + account: ::std::option::Option::None, + permission: ::std::option::Option::None, + parent: ::std::option::Option::None, + auth: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionUpdateAuth { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUpdateAuth").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionUpdateAuth { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionUpdateAuth { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionDeleteAuth { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth.permission) + pub permission: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionDeleteAuth { + fn default() -> &'a EosActionDeleteAuth { + ::default_instance() + } + } + + impl EosActionDeleteAuth { + pub fn new() -> EosActionDeleteAuth { + ::std::default::Default::default() + } + + // required uint64 account = 1; + + pub fn account(&self) -> u64 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u64) { + self.account = ::std::option::Option::Some(v); + } + + // required uint64 permission = 2; + + pub fn permission(&self) -> u64 { + self.permission.unwrap_or(0) + } + + pub fn clear_permission(&mut self) { + self.permission = ::std::option::Option::None; + } + + pub fn has_permission(&self) -> bool { + self.permission.is_some() + } + + // Param is passed by value, moved + pub fn set_permission(&mut self, v: u64) { + self.permission = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &EosActionDeleteAuth| { &m.account }, + |m: &mut EosActionDeleteAuth| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "permission", + |m: &EosActionDeleteAuth| { &m.permission }, + |m: &mut EosActionDeleteAuth| { &mut m.permission }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionDeleteAuth", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionDeleteAuth { + const NAME: &'static str = "EosActionDeleteAuth"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + if self.permission.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.account = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.permission = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.permission { + my_size += ::protobuf::rt::uint64_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account { + os.write_uint64(1, v)?; + } + if let Some(v) = self.permission { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionDeleteAuth { + EosActionDeleteAuth::new() + } + + fn clear(&mut self) { + self.account = ::std::option::Option::None; + self.permission = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionDeleteAuth { + static instance: EosActionDeleteAuth = EosActionDeleteAuth { + account: ::std::option::Option::None, + permission: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionDeleteAuth { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionDeleteAuth").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionDeleteAuth { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionDeleteAuth { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionLinkAuth { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.code) + pub code: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.type) + pub type_: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.requirement) + pub requirement: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionLinkAuth { + fn default() -> &'a EosActionLinkAuth { + ::default_instance() + } + } + + impl EosActionLinkAuth { + pub fn new() -> EosActionLinkAuth { + ::std::default::Default::default() + } + + // required uint64 account = 1; + + pub fn account(&self) -> u64 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u64) { + self.account = ::std::option::Option::Some(v); + } + + // required uint64 code = 2; + + pub fn code(&self) -> u64 { + self.code.unwrap_or(0) + } + + pub fn clear_code(&mut self) { + self.code = ::std::option::Option::None; + } + + pub fn has_code(&self) -> bool { + self.code.is_some() + } + + // Param is passed by value, moved + pub fn set_code(&mut self, v: u64) { + self.code = ::std::option::Option::Some(v); + } + + // required uint64 type = 3; + + pub fn type_(&self) -> u64 { + self.type_.unwrap_or(0) + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: u64) { + self.type_ = ::std::option::Option::Some(v); + } + + // required uint64 requirement = 4; + + pub fn requirement(&self) -> u64 { + self.requirement.unwrap_or(0) + } + + pub fn clear_requirement(&mut self) { + self.requirement = ::std::option::Option::None; + } + + pub fn has_requirement(&self) -> bool { + self.requirement.is_some() + } + + // Param is passed by value, moved + pub fn set_requirement(&mut self, v: u64) { + self.requirement = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &EosActionLinkAuth| { &m.account }, + |m: &mut EosActionLinkAuth| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "code", + |m: &EosActionLinkAuth| { &m.code }, + |m: &mut EosActionLinkAuth| { &mut m.code }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &EosActionLinkAuth| { &m.type_ }, + |m: &mut EosActionLinkAuth| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "requirement", + |m: &EosActionLinkAuth| { &m.requirement }, + |m: &mut EosActionLinkAuth| { &mut m.requirement }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionLinkAuth", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionLinkAuth { + const NAME: &'static str = "EosActionLinkAuth"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + if self.code.is_none() { + return false; + } + if self.type_.is_none() { + return false; + } + if self.requirement.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.account = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.code = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.type_ = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.requirement = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.code { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.requirement { + my_size += ::protobuf::rt::uint64_size(4, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account { + os.write_uint64(1, v)?; + } + if let Some(v) = self.code { + os.write_uint64(2, v)?; + } + if let Some(v) = self.type_ { + os.write_uint64(3, v)?; + } + if let Some(v) = self.requirement { + os.write_uint64(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionLinkAuth { + EosActionLinkAuth::new() + } + + fn clear(&mut self) { + self.account = ::std::option::Option::None; + self.code = ::std::option::Option::None; + self.type_ = ::std::option::Option::None; + self.requirement = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionLinkAuth { + static instance: EosActionLinkAuth = EosActionLinkAuth { + account: ::std::option::Option::None, + code: ::std::option::Option::None, + type_: ::std::option::Option::None, + requirement: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionLinkAuth { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionLinkAuth").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionLinkAuth { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionLinkAuth { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionUnlinkAuth { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.code) + pub code: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.type) + pub type_: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionUnlinkAuth { + fn default() -> &'a EosActionUnlinkAuth { + ::default_instance() + } + } + + impl EosActionUnlinkAuth { + pub fn new() -> EosActionUnlinkAuth { + ::std::default::Default::default() + } + + // required uint64 account = 1; + + pub fn account(&self) -> u64 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u64) { + self.account = ::std::option::Option::Some(v); + } + + // required uint64 code = 2; + + pub fn code(&self) -> u64 { + self.code.unwrap_or(0) + } + + pub fn clear_code(&mut self) { + self.code = ::std::option::Option::None; + } + + pub fn has_code(&self) -> bool { + self.code.is_some() + } + + // Param is passed by value, moved + pub fn set_code(&mut self, v: u64) { + self.code = ::std::option::Option::Some(v); + } + + // required uint64 type = 3; + + pub fn type_(&self) -> u64 { + self.type_.unwrap_or(0) + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: u64) { + self.type_ = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &EosActionUnlinkAuth| { &m.account }, + |m: &mut EosActionUnlinkAuth| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "code", + |m: &EosActionUnlinkAuth| { &m.code }, + |m: &mut EosActionUnlinkAuth| { &mut m.code }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &EosActionUnlinkAuth| { &m.type_ }, + |m: &mut EosActionUnlinkAuth| { &mut m.type_ }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionUnlinkAuth", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionUnlinkAuth { + const NAME: &'static str = "EosActionUnlinkAuth"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + if self.code.is_none() { + return false; + } + if self.type_.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.account = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.code = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.type_ = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.code { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::uint64_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account { + os.write_uint64(1, v)?; + } + if let Some(v) = self.code { + os.write_uint64(2, v)?; + } + if let Some(v) = self.type_ { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionUnlinkAuth { + EosActionUnlinkAuth::new() + } + + fn clear(&mut self) { + self.account = ::std::option::Option::None; + self.code = ::std::option::Option::None; + self.type_ = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionUnlinkAuth { + static instance: EosActionUnlinkAuth = EosActionUnlinkAuth { + account: ::std::option::Option::None, + code: ::std::option::Option::None, + type_: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionUnlinkAuth { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUnlinkAuth").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionUnlinkAuth { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionUnlinkAuth { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionNewAccount { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.creator) + pub creator: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.name) + pub name: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.owner) + pub owner: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.active) + pub active: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionNewAccount { + fn default() -> &'a EosActionNewAccount { + ::default_instance() + } + } + + impl EosActionNewAccount { + pub fn new() -> EosActionNewAccount { + ::std::default::Default::default() + } + + // required uint64 creator = 1; + + pub fn creator(&self) -> u64 { + self.creator.unwrap_or(0) + } + + pub fn clear_creator(&mut self) { + self.creator = ::std::option::Option::None; + } + + pub fn has_creator(&self) -> bool { + self.creator.is_some() + } + + // Param is passed by value, moved + pub fn set_creator(&mut self, v: u64) { + self.creator = ::std::option::Option::Some(v); + } + + // required uint64 name = 2; + + pub fn name(&self) -> u64 { + self.name.unwrap_or(0) + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: u64) { + self.name = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "creator", + |m: &EosActionNewAccount| { &m.creator }, + |m: &mut EosActionNewAccount| { &mut m.creator }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &EosActionNewAccount| { &m.name }, + |m: &mut EosActionNewAccount| { &mut m.name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAuthorization>( + "owner", + |m: &EosActionNewAccount| { &m.owner }, + |m: &mut EosActionNewAccount| { &mut m.owner }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAuthorization>( + "active", + |m: &EosActionNewAccount| { &m.active }, + |m: &mut EosActionNewAccount| { &mut m.active }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionNewAccount", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionNewAccount { + const NAME: &'static str = "EosActionNewAccount"; + + fn is_initialized(&self) -> bool { + if self.creator.is_none() { + return false; + } + if self.name.is_none() { + return false; + } + if self.owner.is_none() { + return false; + } + if self.active.is_none() { + return false; + } + for v in &self.owner { + if !v.is_initialized() { + return false; + } + }; + for v in &self.active { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.creator = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.name = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.owner)?; + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.active)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.creator { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.name { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.owner.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.active.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.creator { + os.write_uint64(1, v)?; + } + if let Some(v) = self.name { + os.write_uint64(2, v)?; + } + if let Some(v) = self.owner.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.active.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionNewAccount { + EosActionNewAccount::new() + } + + fn clear(&mut self) { + self.creator = ::std::option::Option::None; + self.name = ::std::option::Option::None; + self.owner.clear(); + self.active.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionNewAccount { + static instance: EosActionNewAccount = EosActionNewAccount { + creator: ::std::option::Option::None, + name: ::std::option::Option::None, + owner: ::protobuf::MessageField::none(), + active: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionNewAccount { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionNewAccount").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionNewAccount { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionNewAccount { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EosActionUnknown { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown.data_size) + pub data_size: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown.data_chunk) + pub data_chunk: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EosActionUnknown { + fn default() -> &'a EosActionUnknown { + ::default_instance() + } + } + + impl EosActionUnknown { + pub fn new() -> EosActionUnknown { + ::std::default::Default::default() + } + + // required uint32 data_size = 1; + + pub fn data_size(&self) -> u32 { + self.data_size.unwrap_or(0) + } + + pub fn clear_data_size(&mut self) { + self.data_size = ::std::option::Option::None; + } + + pub fn has_data_size(&self) -> bool { + self.data_size.is_some() + } + + // Param is passed by value, moved + pub fn set_data_size(&mut self, v: u32) { + self.data_size = ::std::option::Option::Some(v); + } + + // required bytes data_chunk = 2; + + pub fn data_chunk(&self) -> &[u8] { + match self.data_chunk.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data_chunk(&mut self) { + self.data_chunk = ::std::option::Option::None; + } + + pub fn has_data_chunk(&self) -> bool { + self.data_chunk.is_some() + } + + // Param is passed by value, moved + pub fn set_data_chunk(&mut self, v: ::std::vec::Vec) { + self.data_chunk = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data_chunk(&mut self) -> &mut ::std::vec::Vec { + if self.data_chunk.is_none() { + self.data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data_chunk.as_mut().unwrap() + } + + // Take field + pub fn take_data_chunk(&mut self) -> ::std::vec::Vec { + self.data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_size", + |m: &EosActionUnknown| { &m.data_size }, + |m: &mut EosActionUnknown| { &mut m.data_size }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_chunk", + |m: &EosActionUnknown| { &m.data_chunk }, + |m: &mut EosActionUnknown| { &mut m.data_chunk }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosTxActionAck.EosActionUnknown", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EosActionUnknown { + const NAME: &'static str = "EosActionUnknown"; + + fn is_initialized(&self) -> bool { + if self.data_size.is_none() { + return false; + } + if self.data_chunk.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.data_size = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.data_chunk = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_size { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.data_chunk.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_size { + os.write_uint32(1, v)?; + } + if let Some(v) = self.data_chunk.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosActionUnknown { + EosActionUnknown::new() + } + + fn clear(&mut self) { + self.data_size = ::std::option::Option::None; + self.data_chunk = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosActionUnknown { + static instance: EosActionUnknown = EosActionUnknown { + data_size: ::std::option::Option::None, + data_chunk: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EosActionUnknown { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUnknown").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EosActionUnknown { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EosActionUnknown { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosSignedTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EosSignedTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignedTx.signature) + pub signature: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosSignedTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EosSignedTx { + fn default() -> &'a EosSignedTx { + ::default_instance() + } +} + +impl EosSignedTx { + pub fn new() -> EosSignedTx { + ::std::default::Default::default() + } + + // required string signature = 1; + + pub fn signature(&self) -> &str { + match self.signature.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::string::String) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::string::String { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::string::String::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::string::String { + self.signature.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &EosSignedTx| { &m.signature }, + |m: &mut EosSignedTx| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EosSignedTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EosSignedTx { + const NAME: &'static str = "EosSignedTx"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EosSignedTx { + EosSignedTx::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EosSignedTx { + static instance: EosSignedTx = EosSignedTx { + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EosSignedTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EosSignedTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EosSignedTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EosSignedTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x12messages-eos.proto\x12\x16hw.trezor.messages.eos\"m\n\x0fEosGetPub\ + licKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0csh\ + ow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\ + \x18\x03\x20\x01(\x08R\x08chunkify\"Z\n\x0cEosPublicKey\x12$\n\x0ewif_pu\ + blic_key\x18\x01\x20\x02(\tR\x0cwifPublicKey\x12$\n\x0eraw_public_key\ + \x18\x02\x20\x02(\x0cR\x0crawPublicKey\"\xba\x03\n\tEosSignTx\x12\x1b\n\ + \taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x19\n\x08chain_id\x18\ + \x02\x20\x02(\x0cR\x07chainId\x12E\n\x06header\x18\x03\x20\x02(\x0b2-.hw\ + .trezor.messages.eos.EosSignTx.EosTxHeaderR\x06header\x12\x1f\n\x0bnum_a\ + ctions\x18\x04\x20\x02(\rR\nnumActions\x12\x1a\n\x08chunkify\x18\x05\x20\ + \x01(\x08R\x08chunkify\x1a\xf0\x01\n\x0bEosTxHeader\x12\x1e\n\nexpiratio\ + n\x18\x01\x20\x02(\rR\nexpiration\x12\"\n\rref_block_num\x18\x02\x20\x02\ + (\rR\x0brefBlockNum\x12(\n\x10ref_block_prefix\x18\x03\x20\x02(\rR\x0ere\ + fBlockPrefix\x12-\n\x13max_net_usage_words\x18\x04\x20\x02(\rR\x10maxNet\ + UsageWords\x12'\n\x10max_cpu_usage_ms\x18\x05\x20\x02(\rR\rmaxCpuUsageMs\ + \x12\x1b\n\tdelay_sec\x18\x06\x20\x02(\rR\x08delaySec\"1\n\x12EosTxActio\ + nRequest\x12\x1b\n\tdata_size\x18\x01\x20\x01(\rR\x08dataSize\"\xe2\x20\ + \n\x0eEosTxActionAck\x12N\n\x06common\x18\x01\x20\x02(\x0b26.hw.trezor.m\ + essages.eos.EosTxActionAck.EosActionCommonR\x06common\x12T\n\x08transfer\ + \x18\x02\x20\x01(\x0b28.hw.trezor.messages.eos.EosTxActionAck.EosActionT\ + ransferR\x08transfer\x12T\n\x08delegate\x18\x03\x20\x01(\x0b28.hw.trezor\ + .messages.eos.EosTxActionAck.EosActionDelegateR\x08delegate\x12Z\n\nunde\ + legate\x18\x04\x20\x01(\x0b2:.hw.trezor.messages.eos.EosTxActionAck.EosA\ + ctionUndelegateR\nundelegate\x12N\n\x06refund\x18\x05\x20\x01(\x0b26.hw.\ + trezor.messages.eos.EosTxActionAck.EosActionRefundR\x06refund\x12O\n\x07\ + buy_ram\x18\x06\x20\x01(\x0b26.hw.trezor.messages.eos.EosTxActionAck.Eos\ + ActionBuyRamR\x06buyRam\x12_\n\rbuy_ram_bytes\x18\x07\x20\x01(\x0b2;.hw.\ + trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytesR\x0bbuyRamBytes\ + \x12R\n\x08sell_ram\x18\x08\x20\x01(\x0b27.hw.trezor.messages.eos.EosTxA\ + ctionAck.EosActionSellRamR\x07sellRam\x12a\n\rvote_producer\x18\t\x20\ + \x01(\x0b2<.hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducerR\ + \x0cvoteProducer\x12[\n\x0bupdate_auth\x18\n\x20\x01(\x0b2:.hw.trezor.me\ + ssages.eos.EosTxActionAck.EosActionUpdateAuthR\nupdateAuth\x12[\n\x0bdel\ + ete_auth\x18\x0b\x20\x01(\x0b2:.hw.trezor.messages.eos.EosTxActionAck.Eo\ + sActionDeleteAuthR\ndeleteAuth\x12U\n\tlink_auth\x18\x0c\x20\x01(\x0b28.\ + hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuthR\x08linkAuth\x12\ + [\n\x0bunlink_auth\x18\r\x20\x01(\x0b2:.hw.trezor.messages.eos.EosTxActi\ + onAck.EosActionUnlinkAuthR\nunlinkAuth\x12[\n\x0bnew_account\x18\x0e\x20\ + \x01(\x0b2:.hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccountR\n\ + newAccount\x12Q\n\x07unknown\x18\x0f\x20\x01(\x0b27.hw.trezor.messages.e\ + os.EosTxActionAck.EosActionUnknownR\x07unknown\x1a:\n\x08EosAsset\x12\ + \x16\n\x06amount\x18\x01\x20\x02(\x12R\x06amount\x12\x16\n\x06symbol\x18\ + \x02\x20\x02(\x04R\x06symbol\x1aJ\n\x12EosPermissionLevel\x12\x14\n\x05a\ + ctor\x18\x01\x20\x02(\x04R\x05actor\x12\x1e\n\npermission\x18\x02\x20\ + \x02(\x04R\npermission\x1ap\n\x13EosAuthorizationKey\x12\x12\n\x04type\ + \x18\x01\x20\x02(\rR\x04type\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03k\ + ey\x12\x1b\n\taddress_n\x18\x03\x20\x03(\rR\x08addressN\x12\x16\n\x06wei\ + ght\x18\x04\x20\x02(\rR\x06weight\x1a\x86\x01\n\x17EosAuthorizationAccou\ + nt\x12S\n\x07account\x18\x01\x20\x02(\x0b29.hw.trezor.messages.eos.EosTx\ + ActionAck.EosPermissionLevelR\x07account\x12\x16\n\x06weight\x18\x02\x20\ + \x02(\rR\x06weight\x1aI\n\x14EosAuthorizationWait\x12\x19\n\x08wait_sec\ + \x18\x01\x20\x02(\rR\x07waitSec\x12\x16\n\x06weight\x18\x02\x20\x02(\rR\ + \x06weight\x1a\xaf\x02\n\x10EosAuthorization\x12\x1c\n\tthreshold\x18\ + \x01\x20\x02(\rR\tthreshold\x12N\n\x04keys\x18\x02\x20\x03(\x0b2:.hw.tre\ + zor.messages.eos.EosTxActionAck.EosAuthorizationKeyR\x04keys\x12Z\n\x08a\ + ccounts\x18\x03\x20\x03(\x0b2>.hw.trezor.messages.eos.EosTxActionAck.Eos\ + AuthorizationAccountR\x08accounts\x12Q\n\x05waits\x18\x04\x20\x03(\x0b2;\ + .hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWaitR\x05waits\ + \x1a\xa0\x01\n\x0fEosActionCommon\x12\x18\n\x07account\x18\x01\x20\x02(\ + \x04R\x07account\x12\x12\n\x04name\x18\x02\x20\x02(\x04R\x04name\x12_\n\ + \rauthorization\x18\x03\x20\x03(\x0b29.hw.trezor.messages.eos.EosTxActio\ + nAck.EosPermissionLevelR\rauthorization\x1a\xa8\x01\n\x11EosActionTransf\ + er\x12\x16\n\x06sender\x18\x01\x20\x02(\x04R\x06sender\x12\x1a\n\x08rece\ + iver\x18\x02\x20\x02(\x04R\x08receiver\x12K\n\x08quantity\x18\x03\x20\ + \x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\x08quantity\ + \x12\x12\n\x04memo\x18\x04\x20\x02(\tR\x04memo\x1a\x8b\x02\n\x11EosActio\ + nDelegate\x12\x16\n\x06sender\x18\x01\x20\x02(\x04R\x06sender\x12\x1a\n\ + \x08receiver\x18\x02\x20\x02(\x04R\x08receiver\x12R\n\x0cnet_quantity\ + \x18\x03\x20\x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\ + \x0bnetQuantity\x12R\n\x0ccpu_quantity\x18\x04\x20\x02(\x0b2/.hw.trezor.\ + messages.eos.EosTxActionAck.EosAssetR\x0bcpuQuantity\x12\x1a\n\x08transf\ + er\x18\x05\x20\x02(\x08R\x08transfer\x1a\xf1\x01\n\x13EosActionUndelegat\ + e\x12\x16\n\x06sender\x18\x01\x20\x02(\x04R\x06sender\x12\x1a\n\x08recei\ + ver\x18\x02\x20\x02(\x04R\x08receiver\x12R\n\x0cnet_quantity\x18\x03\x20\ + \x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\x0bnetQuanti\ + ty\x12R\n\x0ccpu_quantity\x18\x04\x20\x02(\x0b2/.hw.trezor.messages.eos.\ + EosTxActionAck.EosAssetR\x0bcpuQuantity\x1a'\n\x0fEosActionRefund\x12\ + \x14\n\x05owner\x18\x01\x20\x02(\x04R\x05owner\x1a\x90\x01\n\x0fEosActio\ + nBuyRam\x12\x14\n\x05payer\x18\x01\x20\x02(\x04R\x05payer\x12\x1a\n\x08r\ + eceiver\x18\x02\x20\x02(\x04R\x08receiver\x12K\n\x08quantity\x18\x03\x20\ + \x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\x08quantity\ + \x1a^\n\x14EosActionBuyRamBytes\x12\x14\n\x05payer\x18\x01\x20\x02(\x04R\ + \x05payer\x12\x1a\n\x08receiver\x18\x02\x20\x02(\x04R\x08receiver\x12\ + \x14\n\x05bytes\x18\x03\x20\x02(\rR\x05bytes\x1aB\n\x10EosActionSellRam\ + \x12\x18\n\x07account\x18\x01\x20\x02(\x04R\x07account\x12\x14\n\x05byte\ + s\x18\x02\x20\x02(\x04R\x05bytes\x1aa\n\x15EosActionVoteProducer\x12\x14\ + \n\x05voter\x18\x01\x20\x02(\x04R\x05voter\x12\x14\n\x05proxy\x18\x02\ + \x20\x02(\x04R\x05proxy\x12\x1c\n\tproducers\x18\x03\x20\x03(\x04R\tprod\ + ucers\x1a\xb4\x01\n\x13EosActionUpdateAuth\x12\x18\n\x07account\x18\x01\ + \x20\x02(\x04R\x07account\x12\x1e\n\npermission\x18\x02\x20\x02(\x04R\np\ + ermission\x12\x16\n\x06parent\x18\x03\x20\x02(\x04R\x06parent\x12K\n\x04\ + auth\x18\x04\x20\x02(\x0b27.hw.trezor.messages.eos.EosTxActionAck.EosAut\ + horizationR\x04auth\x1aO\n\x13EosActionDeleteAuth\x12\x18\n\x07account\ + \x18\x01\x20\x02(\x04R\x07account\x12\x1e\n\npermission\x18\x02\x20\x02(\ + \x04R\npermission\x1aw\n\x11EosActionLinkAuth\x12\x18\n\x07account\x18\ + \x01\x20\x02(\x04R\x07account\x12\x12\n\x04code\x18\x02\x20\x02(\x04R\ + \x04code\x12\x12\n\x04type\x18\x03\x20\x02(\x04R\x04type\x12\x20\n\x0bre\ + quirement\x18\x04\x20\x02(\x04R\x0brequirement\x1aW\n\x13EosActionUnlink\ + Auth\x12\x18\n\x07account\x18\x01\x20\x02(\x04R\x07account\x12\x12\n\x04\ + code\x18\x02\x20\x02(\x04R\x04code\x12\x12\n\x04type\x18\x03\x20\x02(\ + \x04R\x04type\x1a\xe3\x01\n\x13EosActionNewAccount\x12\x18\n\x07creator\ + \x18\x01\x20\x02(\x04R\x07creator\x12\x12\n\x04name\x18\x02\x20\x02(\x04\ + R\x04name\x12M\n\x05owner\x18\x03\x20\x02(\x0b27.hw.trezor.messages.eos.\ + EosTxActionAck.EosAuthorizationR\x05owner\x12O\n\x06active\x18\x04\x20\ + \x02(\x0b27.hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationR\x06a\ + ctive\x1aN\n\x10EosActionUnknown\x12\x1b\n\tdata_size\x18\x01\x20\x02(\r\ + R\x08dataSize\x12\x1d\n\ndata_chunk\x18\x02\x20\x02(\x0cR\tdataChunk\"+\ + \n\x0bEosSignedTx\x12\x1c\n\tsignature\x18\x01\x20\x02(\tR\tsignatureB7\ + \n#com.satoshilabs.trezor.lib.protobufB\x10TrezorMessageEos\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(28); + messages.push(EosGetPublicKey::generated_message_descriptor_data()); + messages.push(EosPublicKey::generated_message_descriptor_data()); + messages.push(EosSignTx::generated_message_descriptor_data()); + messages.push(EosTxActionRequest::generated_message_descriptor_data()); + messages.push(EosTxActionAck::generated_message_descriptor_data()); + messages.push(EosSignedTx::generated_message_descriptor_data()); + messages.push(eos_sign_tx::EosTxHeader::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosAsset::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosPermissionLevel::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosAuthorizationKey::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosAuthorizationAccount::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosAuthorizationWait::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosAuthorization::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionCommon::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionTransfer::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionDelegate::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionUndelegate::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionRefund::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionBuyRam::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionBuyRamBytes::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionSellRam::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionVoteProducer::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionUpdateAuth::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionDeleteAuth::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionLinkAuth::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionUnlinkAuth::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionNewAccount::generated_message_descriptor_data()); + messages.push(eos_tx_action_ack::EosActionUnknown::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_ethereum.rs b/wallet/trezor-client/src/protos/generated/messages_ethereum.rs new file mode 100644 index 0000000000..701dda7126 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_ethereum.rs @@ -0,0 +1,4199 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-ethereum.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumGetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumGetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetPublicKey.show_display) + pub show_display: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumGetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumGetPublicKey { + fn default() -> &'a EthereumGetPublicKey { + ::default_instance() + } +} + +impl EthereumGetPublicKey { + pub fn new() -> EthereumGetPublicKey { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EthereumGetPublicKey| { &m.address_n }, + |m: &mut EthereumGetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &EthereumGetPublicKey| { &m.show_display }, + |m: &mut EthereumGetPublicKey| { &mut m.show_display }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumGetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumGetPublicKey { + const NAME: &'static str = "EthereumGetPublicKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumGetPublicKey { + EthereumGetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumGetPublicKey { + static instance: EthereumGetPublicKey = EthereumGetPublicKey { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumGetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumGetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumGetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumGetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumPublicKey.node) + pub node: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumPublicKey.xpub) + pub xpub: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumPublicKey { + fn default() -> &'a EthereumPublicKey { + ::default_instance() + } +} + +impl EthereumPublicKey { + pub fn new() -> EthereumPublicKey { + ::std::default::Default::default() + } + + // required string xpub = 2; + + pub fn xpub(&self) -> &str { + match self.xpub.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_xpub(&mut self) { + self.xpub = ::std::option::Option::None; + } + + pub fn has_xpub(&self) -> bool { + self.xpub.is_some() + } + + // Param is passed by value, moved + pub fn set_xpub(&mut self, v: ::std::string::String) { + self.xpub = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_xpub(&mut self) -> &mut ::std::string::String { + if self.xpub.is_none() { + self.xpub = ::std::option::Option::Some(::std::string::String::new()); + } + self.xpub.as_mut().unwrap() + } + + // Take field + pub fn take_xpub(&mut self) -> ::std::string::String { + self.xpub.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( + "node", + |m: &EthereumPublicKey| { &m.node }, + |m: &mut EthereumPublicKey| { &mut m.node }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "xpub", + |m: &EthereumPublicKey| { &m.xpub }, + |m: &mut EthereumPublicKey| { &mut m.xpub }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumPublicKey { + const NAME: &'static str = "EthereumPublicKey"; + + fn is_initialized(&self) -> bool { + if self.node.is_none() { + return false; + } + if self.xpub.is_none() { + return false; + } + for v in &self.node { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; + }, + 18 => { + self.xpub = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.node.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.xpub.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.node.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.xpub.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumPublicKey { + EthereumPublicKey::new() + } + + fn clear(&mut self) { + self.node.clear(); + self.xpub = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumPublicKey { + static instance: EthereumPublicKey = EthereumPublicKey { + node: ::protobuf::MessageField::none(), + xpub: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.encoded_network) + pub encoded_network: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumGetAddress { + fn default() -> &'a EthereumGetAddress { + ::default_instance() + } +} + +impl EthereumGetAddress { + pub fn new() -> EthereumGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bytes encoded_network = 3; + + pub fn encoded_network(&self) -> &[u8] { + match self.encoded_network.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_encoded_network(&mut self) { + self.encoded_network = ::std::option::Option::None; + } + + pub fn has_encoded_network(&self) -> bool { + self.encoded_network.is_some() + } + + // Param is passed by value, moved + pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { + self.encoded_network = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { + if self.encoded_network.is_none() { + self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.encoded_network.as_mut().unwrap() + } + + // Take field + pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { + self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool chunkify = 4; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EthereumGetAddress| { &m.address_n }, + |m: &mut EthereumGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &EthereumGetAddress| { &m.show_display }, + |m: &mut EthereumGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "encoded_network", + |m: &EthereumGetAddress| { &m.encoded_network }, + |m: &mut EthereumGetAddress| { &mut m.encoded_network }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &EthereumGetAddress| { &m.chunkify }, + |m: &mut EthereumGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumGetAddress { + const NAME: &'static str = "EthereumGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 26 => { + self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); + }, + 32 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.encoded_network.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.encoded_network.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumGetAddress { + EthereumGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.encoded_network = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumGetAddress { + static instance: EthereumGetAddress = EthereumGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + encoded_network: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumAddress._old_address) + pub _old_address: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumAddress { + fn default() -> &'a EthereumAddress { + ::default_instance() + } +} + +impl EthereumAddress { + pub fn new() -> EthereumAddress { + ::std::default::Default::default() + } + + // optional bytes _old_address = 1; + + pub fn _old_address(&self) -> &[u8] { + match self._old_address.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear__old_address(&mut self) { + self._old_address = ::std::option::Option::None; + } + + pub fn has__old_address(&self) -> bool { + self._old_address.is_some() + } + + // Param is passed by value, moved + pub fn set__old_address(&mut self, v: ::std::vec::Vec) { + self._old_address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut__old_address(&mut self) -> &mut ::std::vec::Vec { + if self._old_address.is_none() { + self._old_address = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self._old_address.as_mut().unwrap() + } + + // Take field + pub fn take__old_address(&mut self) -> ::std::vec::Vec { + self._old_address.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string address = 2; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "_old_address", + |m: &EthereumAddress| { &m._old_address }, + |m: &mut EthereumAddress| { &mut m._old_address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &EthereumAddress| { &m.address }, + |m: &mut EthereumAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumAddress { + const NAME: &'static str = "EthereumAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self._old_address = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self._old_address.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self._old_address.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.address.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumAddress { + EthereumAddress::new() + } + + fn clear(&mut self) { + self._old_address = ::std::option::Option::None; + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumAddress { + static instance: EthereumAddress = EthereumAddress { + _old_address: ::std::option::Option::None, + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.nonce) + pub nonce: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.gas_price) + pub gas_price: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.gas_limit) + pub gas_limit: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.to) + pub to: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.value) + pub value: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.data_initial_chunk) + pub data_initial_chunk: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.data_length) + pub data_length: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.chain_id) + pub chain_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.tx_type) + pub tx_type: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.definitions) + pub definitions: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumSignTx { + fn default() -> &'a EthereumSignTx { + ::default_instance() + } +} + +impl EthereumSignTx { + pub fn new() -> EthereumSignTx { + ::std::default::Default::default() + } + + // optional bytes nonce = 2; + + pub fn nonce(&self) -> &[u8] { + match self.nonce.as_ref() { + Some(v) => v, + None => b"", + } + } + + pub fn clear_nonce(&mut self) { + self.nonce = ::std::option::Option::None; + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: ::std::vec::Vec) { + self.nonce = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { + if self.nonce.is_none() { + self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.nonce.as_mut().unwrap() + } + + // Take field + pub fn take_nonce(&mut self) -> ::std::vec::Vec { + self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes gas_price = 3; + + pub fn gas_price(&self) -> &[u8] { + match self.gas_price.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_gas_price(&mut self) { + self.gas_price = ::std::option::Option::None; + } + + pub fn has_gas_price(&self) -> bool { + self.gas_price.is_some() + } + + // Param is passed by value, moved + pub fn set_gas_price(&mut self, v: ::std::vec::Vec) { + self.gas_price = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_gas_price(&mut self) -> &mut ::std::vec::Vec { + if self.gas_price.is_none() { + self.gas_price = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.gas_price.as_mut().unwrap() + } + + // Take field + pub fn take_gas_price(&mut self) -> ::std::vec::Vec { + self.gas_price.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes gas_limit = 4; + + pub fn gas_limit(&self) -> &[u8] { + match self.gas_limit.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_gas_limit(&mut self) { + self.gas_limit = ::std::option::Option::None; + } + + pub fn has_gas_limit(&self) -> bool { + self.gas_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_gas_limit(&mut self, v: ::std::vec::Vec) { + self.gas_limit = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_gas_limit(&mut self) -> &mut ::std::vec::Vec { + if self.gas_limit.is_none() { + self.gas_limit = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.gas_limit.as_mut().unwrap() + } + + // Take field + pub fn take_gas_limit(&mut self) -> ::std::vec::Vec { + self.gas_limit.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string to = 11; + + pub fn to(&self) -> &str { + match self.to.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_to(&mut self) { + self.to = ::std::option::Option::None; + } + + pub fn has_to(&self) -> bool { + self.to.is_some() + } + + // Param is passed by value, moved + pub fn set_to(&mut self, v: ::std::string::String) { + self.to = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_to(&mut self) -> &mut ::std::string::String { + if self.to.is_none() { + self.to = ::std::option::Option::Some(::std::string::String::new()); + } + self.to.as_mut().unwrap() + } + + // Take field + pub fn take_to(&mut self) -> ::std::string::String { + self.to.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes value = 6; + + pub fn value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => v, + None => b"", + } + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes data_initial_chunk = 7; + + pub fn data_initial_chunk(&self) -> &[u8] { + match self.data_initial_chunk.as_ref() { + Some(v) => v, + None => b"", + } + } + + pub fn clear_data_initial_chunk(&mut self) { + self.data_initial_chunk = ::std::option::Option::None; + } + + pub fn has_data_initial_chunk(&self) -> bool { + self.data_initial_chunk.is_some() + } + + // Param is passed by value, moved + pub fn set_data_initial_chunk(&mut self, v: ::std::vec::Vec) { + self.data_initial_chunk = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data_initial_chunk(&mut self) -> &mut ::std::vec::Vec { + if self.data_initial_chunk.is_none() { + self.data_initial_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data_initial_chunk.as_mut().unwrap() + } + + // Take field + pub fn take_data_initial_chunk(&mut self) -> ::std::vec::Vec { + self.data_initial_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 data_length = 8; + + pub fn data_length(&self) -> u32 { + self.data_length.unwrap_or(0u32) + } + + pub fn clear_data_length(&mut self) { + self.data_length = ::std::option::Option::None; + } + + pub fn has_data_length(&self) -> bool { + self.data_length.is_some() + } + + // Param is passed by value, moved + pub fn set_data_length(&mut self, v: u32) { + self.data_length = ::std::option::Option::Some(v); + } + + // required uint64 chain_id = 9; + + pub fn chain_id(&self) -> u64 { + self.chain_id.unwrap_or(0) + } + + pub fn clear_chain_id(&mut self) { + self.chain_id = ::std::option::Option::None; + } + + pub fn has_chain_id(&self) -> bool { + self.chain_id.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_id(&mut self, v: u64) { + self.chain_id = ::std::option::Option::Some(v); + } + + // optional uint32 tx_type = 10; + + pub fn tx_type(&self) -> u32 { + self.tx_type.unwrap_or(0) + } + + pub fn clear_tx_type(&mut self) { + self.tx_type = ::std::option::Option::None; + } + + pub fn has_tx_type(&self) -> bool { + self.tx_type.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_type(&mut self, v: u32) { + self.tx_type = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 13; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(12); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EthereumSignTx| { &m.address_n }, + |m: &mut EthereumSignTx| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce", + |m: &EthereumSignTx| { &m.nonce }, + |m: &mut EthereumSignTx| { &mut m.nonce }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "gas_price", + |m: &EthereumSignTx| { &m.gas_price }, + |m: &mut EthereumSignTx| { &mut m.gas_price }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "gas_limit", + |m: &EthereumSignTx| { &m.gas_limit }, + |m: &mut EthereumSignTx| { &mut m.gas_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "to", + |m: &EthereumSignTx| { &m.to }, + |m: &mut EthereumSignTx| { &mut m.to }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &EthereumSignTx| { &m.value }, + |m: &mut EthereumSignTx| { &mut m.value }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_initial_chunk", + |m: &EthereumSignTx| { &m.data_initial_chunk }, + |m: &mut EthereumSignTx| { &mut m.data_initial_chunk }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_length", + |m: &EthereumSignTx| { &m.data_length }, + |m: &mut EthereumSignTx| { &mut m.data_length }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_id", + |m: &EthereumSignTx| { &m.chain_id }, + |m: &mut EthereumSignTx| { &mut m.chain_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_type", + |m: &EthereumSignTx| { &m.tx_type }, + |m: &mut EthereumSignTx| { &mut m.tx_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( + "definitions", + |m: &EthereumSignTx| { &m.definitions }, + |m: &mut EthereumSignTx| { &mut m.definitions }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &EthereumSignTx| { &m.chunkify }, + |m: &mut EthereumSignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumSignTx { + const NAME: &'static str = "EthereumSignTx"; + + fn is_initialized(&self) -> bool { + if self.gas_price.is_none() { + return false; + } + if self.gas_limit.is_none() { + return false; + } + if self.chain_id.is_none() { + return false; + } + for v in &self.definitions { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.nonce = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.gas_price = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.gas_limit = ::std::option::Option::Some(is.read_bytes()?); + }, + 90 => { + self.to = ::std::option::Option::Some(is.read_string()?); + }, + 50 => { + self.value = ::std::option::Option::Some(is.read_bytes()?); + }, + 58 => { + self.data_initial_chunk = ::std::option::Option::Some(is.read_bytes()?); + }, + 64 => { + self.data_length = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.chain_id = ::std::option::Option::Some(is.read_uint64()?); + }, + 80 => { + self.tx_type = ::std::option::Option::Some(is.read_uint32()?); + }, + 98 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.definitions)?; + }, + 104 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.nonce.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.gas_price.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.gas_limit.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.to.as_ref() { + my_size += ::protobuf::rt::string_size(11, &v); + } + if let Some(v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.data_initial_chunk.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + if let Some(v) = self.data_length { + my_size += ::protobuf::rt::uint32_size(8, v); + } + if let Some(v) = self.chain_id { + my_size += ::protobuf::rt::uint64_size(9, v); + } + if let Some(v) = self.tx_type { + my_size += ::protobuf::rt::uint32_size(10, v); + } + if let Some(v) = self.definitions.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.nonce.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.gas_price.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.gas_limit.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.to.as_ref() { + os.write_string(11, v)?; + } + if let Some(v) = self.value.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.data_initial_chunk.as_ref() { + os.write_bytes(7, v)?; + } + if let Some(v) = self.data_length { + os.write_uint32(8, v)?; + } + if let Some(v) = self.chain_id { + os.write_uint64(9, v)?; + } + if let Some(v) = self.tx_type { + os.write_uint32(10, v)?; + } + if let Some(v) = self.definitions.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; + } + if let Some(v) = self.chunkify { + os.write_bool(13, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumSignTx { + EthereumSignTx::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.nonce = ::std::option::Option::None; + self.gas_price = ::std::option::Option::None; + self.gas_limit = ::std::option::Option::None; + self.to = ::std::option::Option::None; + self.value = ::std::option::Option::None; + self.data_initial_chunk = ::std::option::Option::None; + self.data_length = ::std::option::Option::None; + self.chain_id = ::std::option::Option::None; + self.tx_type = ::std::option::Option::None; + self.definitions.clear(); + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumSignTx { + static instance: EthereumSignTx = EthereumSignTx { + address_n: ::std::vec::Vec::new(), + nonce: ::std::option::Option::None, + gas_price: ::std::option::Option::None, + gas_limit: ::std::option::Option::None, + to: ::std::option::Option::None, + value: ::std::option::Option::None, + data_initial_chunk: ::std::option::Option::None, + data_length: ::std::option::Option::None, + chain_id: ::std::option::Option::None, + tx_type: ::std::option::Option::None, + definitions: ::protobuf::MessageField::none(), + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTxEIP1559) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumSignTxEIP1559 { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.nonce) + pub nonce: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.max_gas_fee) + pub max_gas_fee: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.max_priority_fee) + pub max_priority_fee: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.gas_limit) + pub gas_limit: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.to) + pub to: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.value) + pub value: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.data_initial_chunk) + pub data_initial_chunk: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.data_length) + pub data_length: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.chain_id) + pub chain_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.access_list) + pub access_list: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.definitions) + pub definitions: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumSignTxEIP1559 { + fn default() -> &'a EthereumSignTxEIP1559 { + ::default_instance() + } +} + +impl EthereumSignTxEIP1559 { + pub fn new() -> EthereumSignTxEIP1559 { + ::std::default::Default::default() + } + + // required bytes nonce = 2; + + pub fn nonce(&self) -> &[u8] { + match self.nonce.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_nonce(&mut self) { + self.nonce = ::std::option::Option::None; + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: ::std::vec::Vec) { + self.nonce = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { + if self.nonce.is_none() { + self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.nonce.as_mut().unwrap() + } + + // Take field + pub fn take_nonce(&mut self) -> ::std::vec::Vec { + self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes max_gas_fee = 3; + + pub fn max_gas_fee(&self) -> &[u8] { + match self.max_gas_fee.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_max_gas_fee(&mut self) { + self.max_gas_fee = ::std::option::Option::None; + } + + pub fn has_max_gas_fee(&self) -> bool { + self.max_gas_fee.is_some() + } + + // Param is passed by value, moved + pub fn set_max_gas_fee(&mut self, v: ::std::vec::Vec) { + self.max_gas_fee = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_max_gas_fee(&mut self) -> &mut ::std::vec::Vec { + if self.max_gas_fee.is_none() { + self.max_gas_fee = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.max_gas_fee.as_mut().unwrap() + } + + // Take field + pub fn take_max_gas_fee(&mut self) -> ::std::vec::Vec { + self.max_gas_fee.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes max_priority_fee = 4; + + pub fn max_priority_fee(&self) -> &[u8] { + match self.max_priority_fee.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_max_priority_fee(&mut self) { + self.max_priority_fee = ::std::option::Option::None; + } + + pub fn has_max_priority_fee(&self) -> bool { + self.max_priority_fee.is_some() + } + + // Param is passed by value, moved + pub fn set_max_priority_fee(&mut self, v: ::std::vec::Vec) { + self.max_priority_fee = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_max_priority_fee(&mut self) -> &mut ::std::vec::Vec { + if self.max_priority_fee.is_none() { + self.max_priority_fee = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.max_priority_fee.as_mut().unwrap() + } + + // Take field + pub fn take_max_priority_fee(&mut self) -> ::std::vec::Vec { + self.max_priority_fee.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes gas_limit = 5; + + pub fn gas_limit(&self) -> &[u8] { + match self.gas_limit.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_gas_limit(&mut self) { + self.gas_limit = ::std::option::Option::None; + } + + pub fn has_gas_limit(&self) -> bool { + self.gas_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_gas_limit(&mut self, v: ::std::vec::Vec) { + self.gas_limit = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_gas_limit(&mut self) -> &mut ::std::vec::Vec { + if self.gas_limit.is_none() { + self.gas_limit = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.gas_limit.as_mut().unwrap() + } + + // Take field + pub fn take_gas_limit(&mut self) -> ::std::vec::Vec { + self.gas_limit.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string to = 6; + + pub fn to(&self) -> &str { + match self.to.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_to(&mut self) { + self.to = ::std::option::Option::None; + } + + pub fn has_to(&self) -> bool { + self.to.is_some() + } + + // Param is passed by value, moved + pub fn set_to(&mut self, v: ::std::string::String) { + self.to = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_to(&mut self) -> &mut ::std::string::String { + if self.to.is_none() { + self.to = ::std::option::Option::Some(::std::string::String::new()); + } + self.to.as_mut().unwrap() + } + + // Take field + pub fn take_to(&mut self) -> ::std::string::String { + self.to.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes value = 7; + + pub fn value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes data_initial_chunk = 8; + + pub fn data_initial_chunk(&self) -> &[u8] { + match self.data_initial_chunk.as_ref() { + Some(v) => v, + None => b"", + } + } + + pub fn clear_data_initial_chunk(&mut self) { + self.data_initial_chunk = ::std::option::Option::None; + } + + pub fn has_data_initial_chunk(&self) -> bool { + self.data_initial_chunk.is_some() + } + + // Param is passed by value, moved + pub fn set_data_initial_chunk(&mut self, v: ::std::vec::Vec) { + self.data_initial_chunk = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data_initial_chunk(&mut self) -> &mut ::std::vec::Vec { + if self.data_initial_chunk.is_none() { + self.data_initial_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data_initial_chunk.as_mut().unwrap() + } + + // Take field + pub fn take_data_initial_chunk(&mut self) -> ::std::vec::Vec { + self.data_initial_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 data_length = 9; + + pub fn data_length(&self) -> u32 { + self.data_length.unwrap_or(0) + } + + pub fn clear_data_length(&mut self) { + self.data_length = ::std::option::Option::None; + } + + pub fn has_data_length(&self) -> bool { + self.data_length.is_some() + } + + // Param is passed by value, moved + pub fn set_data_length(&mut self, v: u32) { + self.data_length = ::std::option::Option::Some(v); + } + + // required uint64 chain_id = 10; + + pub fn chain_id(&self) -> u64 { + self.chain_id.unwrap_or(0) + } + + pub fn clear_chain_id(&mut self) { + self.chain_id = ::std::option::Option::None; + } + + pub fn has_chain_id(&self) -> bool { + self.chain_id.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_id(&mut self, v: u64) { + self.chain_id = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 13; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(13); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EthereumSignTxEIP1559| { &m.address_n }, + |m: &mut EthereumSignTxEIP1559| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce", + |m: &EthereumSignTxEIP1559| { &m.nonce }, + |m: &mut EthereumSignTxEIP1559| { &mut m.nonce }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "max_gas_fee", + |m: &EthereumSignTxEIP1559| { &m.max_gas_fee }, + |m: &mut EthereumSignTxEIP1559| { &mut m.max_gas_fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "max_priority_fee", + |m: &EthereumSignTxEIP1559| { &m.max_priority_fee }, + |m: &mut EthereumSignTxEIP1559| { &mut m.max_priority_fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "gas_limit", + |m: &EthereumSignTxEIP1559| { &m.gas_limit }, + |m: &mut EthereumSignTxEIP1559| { &mut m.gas_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "to", + |m: &EthereumSignTxEIP1559| { &m.to }, + |m: &mut EthereumSignTxEIP1559| { &mut m.to }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &EthereumSignTxEIP1559| { &m.value }, + |m: &mut EthereumSignTxEIP1559| { &mut m.value }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_initial_chunk", + |m: &EthereumSignTxEIP1559| { &m.data_initial_chunk }, + |m: &mut EthereumSignTxEIP1559| { &mut m.data_initial_chunk }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_length", + |m: &EthereumSignTxEIP1559| { &m.data_length }, + |m: &mut EthereumSignTxEIP1559| { &mut m.data_length }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_id", + |m: &EthereumSignTxEIP1559| { &m.chain_id }, + |m: &mut EthereumSignTxEIP1559| { &mut m.chain_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "access_list", + |m: &EthereumSignTxEIP1559| { &m.access_list }, + |m: &mut EthereumSignTxEIP1559| { &mut m.access_list }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( + "definitions", + |m: &EthereumSignTxEIP1559| { &m.definitions }, + |m: &mut EthereumSignTxEIP1559| { &mut m.definitions }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &EthereumSignTxEIP1559| { &m.chunkify }, + |m: &mut EthereumSignTxEIP1559| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumSignTxEIP1559", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumSignTxEIP1559 { + const NAME: &'static str = "EthereumSignTxEIP1559"; + + fn is_initialized(&self) -> bool { + if self.nonce.is_none() { + return false; + } + if self.max_gas_fee.is_none() { + return false; + } + if self.max_priority_fee.is_none() { + return false; + } + if self.gas_limit.is_none() { + return false; + } + if self.value.is_none() { + return false; + } + if self.data_length.is_none() { + return false; + } + if self.chain_id.is_none() { + return false; + } + for v in &self.access_list { + if !v.is_initialized() { + return false; + } + }; + for v in &self.definitions { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.nonce = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.max_gas_fee = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.max_priority_fee = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.gas_limit = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.to = ::std::option::Option::Some(is.read_string()?); + }, + 58 => { + self.value = ::std::option::Option::Some(is.read_bytes()?); + }, + 66 => { + self.data_initial_chunk = ::std::option::Option::Some(is.read_bytes()?); + }, + 72 => { + self.data_length = ::std::option::Option::Some(is.read_uint32()?); + }, + 80 => { + self.chain_id = ::std::option::Option::Some(is.read_uint64()?); + }, + 90 => { + self.access_list.push(is.read_message()?); + }, + 98 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.definitions)?; + }, + 104 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.nonce.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.max_gas_fee.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.max_priority_fee.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.gas_limit.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.to.as_ref() { + my_size += ::protobuf::rt::string_size(6, &v); + } + if let Some(v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + if let Some(v) = self.data_initial_chunk.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + if let Some(v) = self.data_length { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.chain_id { + my_size += ::protobuf::rt::uint64_size(10, v); + } + for value in &self.access_list { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.definitions.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.nonce.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.max_gas_fee.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.max_priority_fee.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.gas_limit.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.to.as_ref() { + os.write_string(6, v)?; + } + if let Some(v) = self.value.as_ref() { + os.write_bytes(7, v)?; + } + if let Some(v) = self.data_initial_chunk.as_ref() { + os.write_bytes(8, v)?; + } + if let Some(v) = self.data_length { + os.write_uint32(9, v)?; + } + if let Some(v) = self.chain_id { + os.write_uint64(10, v)?; + } + for v in &self.access_list { + ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; + }; + if let Some(v) = self.definitions.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; + } + if let Some(v) = self.chunkify { + os.write_bool(13, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumSignTxEIP1559 { + EthereumSignTxEIP1559::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.nonce = ::std::option::Option::None; + self.max_gas_fee = ::std::option::Option::None; + self.max_priority_fee = ::std::option::Option::None; + self.gas_limit = ::std::option::Option::None; + self.to = ::std::option::Option::None; + self.value = ::std::option::Option::None; + self.data_initial_chunk = ::std::option::Option::None; + self.data_length = ::std::option::Option::None; + self.chain_id = ::std::option::Option::None; + self.access_list.clear(); + self.definitions.clear(); + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumSignTxEIP1559 { + static instance: EthereumSignTxEIP1559 = EthereumSignTxEIP1559 { + address_n: ::std::vec::Vec::new(), + nonce: ::std::option::Option::None, + max_gas_fee: ::std::option::Option::None, + max_priority_fee: ::std::option::Option::None, + gas_limit: ::std::option::Option::None, + to: ::std::option::Option::None, + value: ::std::option::Option::None, + data_initial_chunk: ::std::option::Option::None, + data_length: ::std::option::Option::None, + chain_id: ::std::option::Option::None, + access_list: ::std::vec::Vec::new(), + definitions: ::protobuf::MessageField::none(), + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumSignTxEIP1559 { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTxEIP1559").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumSignTxEIP1559 { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumSignTxEIP1559 { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `EthereumSignTxEIP1559` +pub mod ethereum_sign_tx_eip1559 { + // @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EthereumAccessList { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList.storage_keys) + pub storage_keys: ::std::vec::Vec<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EthereumAccessList { + fn default() -> &'a EthereumAccessList { + ::default_instance() + } + } + + impl EthereumAccessList { + pub fn new() -> EthereumAccessList { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &EthereumAccessList| { &m.address }, + |m: &mut EthereumAccessList| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "storage_keys", + |m: &EthereumAccessList| { &m.storage_keys }, + |m: &mut EthereumAccessList| { &mut m.storage_keys }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumSignTxEIP1559.EthereumAccessList", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EthereumAccessList { + const NAME: &'static str = "EthereumAccessList"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.storage_keys.push(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + for value in &self.storage_keys { + my_size += ::protobuf::rt::bytes_size(2, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + for v in &self.storage_keys { + os.write_bytes(2, &v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumAccessList { + EthereumAccessList::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.storage_keys.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumAccessList { + static instance: EthereumAccessList = EthereumAccessList { + address: ::std::option::Option::None, + storage_keys: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EthereumAccessList { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EthereumSignTxEIP1559.EthereumAccessList").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EthereumAccessList { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EthereumAccessList { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumTxRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTxRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.data_length) + pub data_length: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.signature_v) + pub signature_v: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.signature_r) + pub signature_r: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.signature_s) + pub signature_s: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTxRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTxRequest { + fn default() -> &'a EthereumTxRequest { + ::default_instance() + } +} + +impl EthereumTxRequest { + pub fn new() -> EthereumTxRequest { + ::std::default::Default::default() + } + + // optional uint32 data_length = 1; + + pub fn data_length(&self) -> u32 { + self.data_length.unwrap_or(0) + } + + pub fn clear_data_length(&mut self) { + self.data_length = ::std::option::Option::None; + } + + pub fn has_data_length(&self) -> bool { + self.data_length.is_some() + } + + // Param is passed by value, moved + pub fn set_data_length(&mut self, v: u32) { + self.data_length = ::std::option::Option::Some(v); + } + + // optional uint32 signature_v = 2; + + pub fn signature_v(&self) -> u32 { + self.signature_v.unwrap_or(0) + } + + pub fn clear_signature_v(&mut self) { + self.signature_v = ::std::option::Option::None; + } + + pub fn has_signature_v(&self) -> bool { + self.signature_v.is_some() + } + + // Param is passed by value, moved + pub fn set_signature_v(&mut self, v: u32) { + self.signature_v = ::std::option::Option::Some(v); + } + + // optional bytes signature_r = 3; + + pub fn signature_r(&self) -> &[u8] { + match self.signature_r.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature_r(&mut self) { + self.signature_r = ::std::option::Option::None; + } + + pub fn has_signature_r(&self) -> bool { + self.signature_r.is_some() + } + + // Param is passed by value, moved + pub fn set_signature_r(&mut self, v: ::std::vec::Vec) { + self.signature_r = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature_r(&mut self) -> &mut ::std::vec::Vec { + if self.signature_r.is_none() { + self.signature_r = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature_r.as_mut().unwrap() + } + + // Take field + pub fn take_signature_r(&mut self) -> ::std::vec::Vec { + self.signature_r.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes signature_s = 4; + + pub fn signature_s(&self) -> &[u8] { + match self.signature_s.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature_s(&mut self) { + self.signature_s = ::std::option::Option::None; + } + + pub fn has_signature_s(&self) -> bool { + self.signature_s.is_some() + } + + // Param is passed by value, moved + pub fn set_signature_s(&mut self, v: ::std::vec::Vec) { + self.signature_s = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature_s(&mut self) -> &mut ::std::vec::Vec { + if self.signature_s.is_none() { + self.signature_s = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature_s.as_mut().unwrap() + } + + // Take field + pub fn take_signature_s(&mut self) -> ::std::vec::Vec { + self.signature_s.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_length", + |m: &EthereumTxRequest| { &m.data_length }, + |m: &mut EthereumTxRequest| { &mut m.data_length }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature_v", + |m: &EthereumTxRequest| { &m.signature_v }, + |m: &mut EthereumTxRequest| { &mut m.signature_v }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature_r", + |m: &EthereumTxRequest| { &m.signature_r }, + |m: &mut EthereumTxRequest| { &mut m.signature_r }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature_s", + |m: &EthereumTxRequest| { &m.signature_s }, + |m: &mut EthereumTxRequest| { &mut m.signature_s }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTxRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTxRequest { + const NAME: &'static str = "EthereumTxRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.data_length = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.signature_v = ::std::option::Option::Some(is.read_uint32()?); + }, + 26 => { + self.signature_r = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.signature_s = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_length { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.signature_v { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.signature_r.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.signature_s.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_length { + os.write_uint32(1, v)?; + } + if let Some(v) = self.signature_v { + os.write_uint32(2, v)?; + } + if let Some(v) = self.signature_r.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.signature_s.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTxRequest { + EthereumTxRequest::new() + } + + fn clear(&mut self) { + self.data_length = ::std::option::Option::None; + self.signature_v = ::std::option::Option::None; + self.signature_r = ::std::option::Option::None; + self.signature_s = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTxRequest { + static instance: EthereumTxRequest = EthereumTxRequest { + data_length: ::std::option::Option::None, + signature_v: ::std::option::Option::None, + signature_r: ::std::option::Option::None, + signature_s: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTxRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTxRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTxRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTxRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumTxAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTxAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxAck.data_chunk) + pub data_chunk: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTxAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTxAck { + fn default() -> &'a EthereumTxAck { + ::default_instance() + } +} + +impl EthereumTxAck { + pub fn new() -> EthereumTxAck { + ::std::default::Default::default() + } + + // required bytes data_chunk = 1; + + pub fn data_chunk(&self) -> &[u8] { + match self.data_chunk.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data_chunk(&mut self) { + self.data_chunk = ::std::option::Option::None; + } + + pub fn has_data_chunk(&self) -> bool { + self.data_chunk.is_some() + } + + // Param is passed by value, moved + pub fn set_data_chunk(&mut self, v: ::std::vec::Vec) { + self.data_chunk = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data_chunk(&mut self) -> &mut ::std::vec::Vec { + if self.data_chunk.is_none() { + self.data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data_chunk.as_mut().unwrap() + } + + // Take field + pub fn take_data_chunk(&mut self) -> ::std::vec::Vec { + self.data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_chunk", + |m: &EthereumTxAck| { &m.data_chunk }, + |m: &mut EthereumTxAck| { &mut m.data_chunk }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTxAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTxAck { + const NAME: &'static str = "EthereumTxAck"; + + fn is_initialized(&self) -> bool { + if self.data_chunk.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.data_chunk = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_chunk.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_chunk.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTxAck { + EthereumTxAck::new() + } + + fn clear(&mut self) { + self.data_chunk = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTxAck { + static instance: EthereumTxAck = EthereumTxAck { + data_chunk: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTxAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTxAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTxAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTxAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignMessage) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumSignMessage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.message) + pub message: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.encoded_network) + pub encoded_network: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumSignMessage { + fn default() -> &'a EthereumSignMessage { + ::default_instance() + } +} + +impl EthereumSignMessage { + pub fn new() -> EthereumSignMessage { + ::std::default::Default::default() + } + + // required bytes message = 2; + + pub fn message(&self) -> &[u8] { + match self.message.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::vec::Vec) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::vec::Vec { + self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes encoded_network = 3; + + pub fn encoded_network(&self) -> &[u8] { + match self.encoded_network.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_encoded_network(&mut self) { + self.encoded_network = ::std::option::Option::None; + } + + pub fn has_encoded_network(&self) -> bool { + self.encoded_network.is_some() + } + + // Param is passed by value, moved + pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { + self.encoded_network = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { + if self.encoded_network.is_none() { + self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.encoded_network.as_mut().unwrap() + } + + // Take field + pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { + self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool chunkify = 4; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EthereumSignMessage| { &m.address_n }, + |m: &mut EthereumSignMessage| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &EthereumSignMessage| { &m.message }, + |m: &mut EthereumSignMessage| { &mut m.message }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "encoded_network", + |m: &EthereumSignMessage| { &m.encoded_network }, + |m: &mut EthereumSignMessage| { &mut m.encoded_network }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &EthereumSignMessage| { &m.chunkify }, + |m: &mut EthereumSignMessage| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumSignMessage", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumSignMessage { + const NAME: &'static str = "EthereumSignMessage"; + + fn is_initialized(&self) -> bool { + if self.message.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.message = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); + }, + 32 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.encoded_network.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.message.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.encoded_network.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumSignMessage { + EthereumSignMessage::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.message = ::std::option::Option::None; + self.encoded_network = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumSignMessage { + static instance: EthereumSignMessage = EthereumSignMessage { + address_n: ::std::vec::Vec::new(), + message: ::std::option::Option::None, + encoded_network: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumSignMessage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignMessage").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumSignMessage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumSignMessage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumMessageSignature) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumMessageSignature { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumMessageSignature.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumMessageSignature.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumMessageSignature.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumMessageSignature { + fn default() -> &'a EthereumMessageSignature { + ::default_instance() + } +} + +impl EthereumMessageSignature { + pub fn new() -> EthereumMessageSignature { + ::std::default::Default::default() + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string address = 3; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &EthereumMessageSignature| { &m.signature }, + |m: &mut EthereumMessageSignature| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &EthereumMessageSignature| { &m.address }, + |m: &mut EthereumMessageSignature| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumMessageSignature", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumMessageSignature { + const NAME: &'static str = "EthereumMessageSignature"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.address.as_ref() { + os.write_string(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumMessageSignature { + EthereumMessageSignature::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumMessageSignature { + static instance: EthereumMessageSignature = EthereumMessageSignature { + signature: ::std::option::Option::None, + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumMessageSignature { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumMessageSignature").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumMessageSignature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumMessageSignature { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumVerifyMessage) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumVerifyMessage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.message) + pub message: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumVerifyMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumVerifyMessage { + fn default() -> &'a EthereumVerifyMessage { + ::default_instance() + } +} + +impl EthereumVerifyMessage { + pub fn new() -> EthereumVerifyMessage { + ::std::default::Default::default() + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes message = 3; + + pub fn message(&self) -> &[u8] { + match self.message.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::vec::Vec) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::vec::Vec { + self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string address = 4; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool chunkify = 5; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &EthereumVerifyMessage| { &m.signature }, + |m: &mut EthereumVerifyMessage| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &EthereumVerifyMessage| { &m.message }, + |m: &mut EthereumVerifyMessage| { &mut m.message }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &EthereumVerifyMessage| { &m.address }, + |m: &mut EthereumVerifyMessage| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &EthereumVerifyMessage| { &m.chunkify }, + |m: &mut EthereumVerifyMessage| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumVerifyMessage", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumVerifyMessage { + const NAME: &'static str = "EthereumVerifyMessage"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + if self.message.is_none() { + return false; + } + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.message = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 40 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.message.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.address.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumVerifyMessage { + EthereumVerifyMessage::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.message = ::std::option::Option::None; + self.address = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumVerifyMessage { + static instance: EthereumVerifyMessage = EthereumVerifyMessage { + signature: ::std::option::Option::None, + message: ::std::option::Option::None, + address: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumVerifyMessage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumVerifyMessage").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumVerifyMessage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumVerifyMessage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTypedHash) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumSignTypedHash { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.domain_separator_hash) + pub domain_separator_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.message_hash) + pub message_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.encoded_network) + pub encoded_network: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTypedHash.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumSignTypedHash { + fn default() -> &'a EthereumSignTypedHash { + ::default_instance() + } +} + +impl EthereumSignTypedHash { + pub fn new() -> EthereumSignTypedHash { + ::std::default::Default::default() + } + + // required bytes domain_separator_hash = 2; + + pub fn domain_separator_hash(&self) -> &[u8] { + match self.domain_separator_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_domain_separator_hash(&mut self) { + self.domain_separator_hash = ::std::option::Option::None; + } + + pub fn has_domain_separator_hash(&self) -> bool { + self.domain_separator_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_domain_separator_hash(&mut self, v: ::std::vec::Vec) { + self.domain_separator_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_domain_separator_hash(&mut self) -> &mut ::std::vec::Vec { + if self.domain_separator_hash.is_none() { + self.domain_separator_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.domain_separator_hash.as_mut().unwrap() + } + + // Take field + pub fn take_domain_separator_hash(&mut self) -> ::std::vec::Vec { + self.domain_separator_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes message_hash = 3; + + pub fn message_hash(&self) -> &[u8] { + match self.message_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_message_hash(&mut self) { + self.message_hash = ::std::option::Option::None; + } + + pub fn has_message_hash(&self) -> bool { + self.message_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_message_hash(&mut self, v: ::std::vec::Vec) { + self.message_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message_hash(&mut self) -> &mut ::std::vec::Vec { + if self.message_hash.is_none() { + self.message_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.message_hash.as_mut().unwrap() + } + + // Take field + pub fn take_message_hash(&mut self) -> ::std::vec::Vec { + self.message_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes encoded_network = 4; + + pub fn encoded_network(&self) -> &[u8] { + match self.encoded_network.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_encoded_network(&mut self) { + self.encoded_network = ::std::option::Option::None; + } + + pub fn has_encoded_network(&self) -> bool { + self.encoded_network.is_some() + } + + // Param is passed by value, moved + pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { + self.encoded_network = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { + if self.encoded_network.is_none() { + self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.encoded_network.as_mut().unwrap() + } + + // Take field + pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { + self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EthereumSignTypedHash| { &m.address_n }, + |m: &mut EthereumSignTypedHash| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "domain_separator_hash", + |m: &EthereumSignTypedHash| { &m.domain_separator_hash }, + |m: &mut EthereumSignTypedHash| { &mut m.domain_separator_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message_hash", + |m: &EthereumSignTypedHash| { &m.message_hash }, + |m: &mut EthereumSignTypedHash| { &mut m.message_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "encoded_network", + |m: &EthereumSignTypedHash| { &m.encoded_network }, + |m: &mut EthereumSignTypedHash| { &mut m.encoded_network }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumSignTypedHash", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumSignTypedHash { + const NAME: &'static str = "EthereumSignTypedHash"; + + fn is_initialized(&self) -> bool { + if self.domain_separator_hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.domain_separator_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.message_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.domain_separator_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.message_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.encoded_network.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.domain_separator_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.message_hash.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.encoded_network.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumSignTypedHash { + EthereumSignTypedHash::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.domain_separator_hash = ::std::option::Option::None; + self.message_hash = ::std::option::Option::None; + self.encoded_network = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumSignTypedHash { + static instance: EthereumSignTypedHash = EthereumSignTypedHash { + address_n: ::std::vec::Vec::new(), + domain_separator_hash: ::std::option::Option::None, + message_hash: ::std::option::Option::None, + encoded_network: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumSignTypedHash { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTypedHash").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumSignTypedHash { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumSignTypedHash { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumTypedDataSignature) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTypedDataSignature { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTypedDataSignature.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTypedDataSignature.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTypedDataSignature.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTypedDataSignature { + fn default() -> &'a EthereumTypedDataSignature { + ::default_instance() + } +} + +impl EthereumTypedDataSignature { + pub fn new() -> EthereumTypedDataSignature { + ::std::default::Default::default() + } + + // required bytes signature = 1; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string address = 2; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &EthereumTypedDataSignature| { &m.signature }, + |m: &mut EthereumTypedDataSignature| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &EthereumTypedDataSignature| { &m.address }, + |m: &mut EthereumTypedDataSignature| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTypedDataSignature", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTypedDataSignature { + const NAME: &'static str = "EthereumTypedDataSignature"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.address.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTypedDataSignature { + EthereumTypedDataSignature::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTypedDataSignature { + static instance: EthereumTypedDataSignature = EthereumTypedDataSignature { + signature: ::std::option::Option::None, + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTypedDataSignature { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataSignature").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTypedDataSignature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataSignature { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x17messages-ethereum.proto\x12\x1bhw.trezor.messages.ethereum\x1a\x15\ + messages-common.proto\x1a#messages-ethereum-definitions.proto\"V\n\x14Et\ + hereumGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ + \x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"b\n\x11Eth\ + ereumPublicKey\x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trezor.messages.\ + common.HDNodeTypeR\x04node\x12\x12\n\x04xpub\x18\x02\x20\x02(\tR\x04xpub\ + \"\x99\x01\n\x12EthereumGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\ + \rR\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisp\ + lay\x12'\n\x0fencoded_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\ + \x12\x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\x08chunkify\"Q\n\x0fEthereu\ + mAddress\x12$\n\x0c_old_address\x18\x01\x20\x01(\x0cR\nOldAddressB\x02\ + \x18\x01\x12\x18\n\x07address\x18\x02\x20\x01(\tR\x07address\"\xad\x03\n\ + \x0eEthereumSignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ + \x12\x16\n\x05nonce\x18\x02\x20\x01(\x0c:\0R\x05nonce\x12\x1b\n\tgas_pri\ + ce\x18\x03\x20\x02(\x0cR\x08gasPrice\x12\x1b\n\tgas_limit\x18\x04\x20\ + \x02(\x0cR\x08gasLimit\x12\x10\n\x02to\x18\x0b\x20\x01(\t:\0R\x02to\x12\ + \x16\n\x05value\x18\x06\x20\x01(\x0c:\0R\x05value\x12.\n\x12data_initial\ + _chunk\x18\x07\x20\x01(\x0c:\0R\x10dataInitialChunk\x12\"\n\x0bdata_leng\ + th\x18\x08\x20\x01(\r:\x010R\ndataLength\x12\x19\n\x08chain_id\x18\t\x20\ + \x02(\x04R\x07chainId\x12\x17\n\x07tx_type\x18\n\x20\x01(\rR\x06txType\ + \x12^\n\x0bdefinitions\x18\x0c\x20\x01(\x0b2<.hw.trezor.messages.ethereu\ + m_definitions.EthereumDefinitionsR\x0bdefinitions\x12\x1a\n\x08chunkify\ + \x18\r\x20\x01(\x08R\x08chunkify\"\xfc\x04\n\x15EthereumSignTxEIP1559\ + \x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x14\n\x05nonce\ + \x18\x02\x20\x02(\x0cR\x05nonce\x12\x1e\n\x0bmax_gas_fee\x18\x03\x20\x02\ + (\x0cR\tmaxGasFee\x12(\n\x10max_priority_fee\x18\x04\x20\x02(\x0cR\x0ema\ + xPriorityFee\x12\x1b\n\tgas_limit\x18\x05\x20\x02(\x0cR\x08gasLimit\x12\ + \x10\n\x02to\x18\x06\x20\x01(\t:\0R\x02to\x12\x14\n\x05value\x18\x07\x20\ + \x02(\x0cR\x05value\x12.\n\x12data_initial_chunk\x18\x08\x20\x01(\x0c:\0\ + R\x10dataInitialChunk\x12\x1f\n\x0bdata_length\x18\t\x20\x02(\rR\ndataLe\ + ngth\x12\x19\n\x08chain_id\x18\n\x20\x02(\x04R\x07chainId\x12f\n\x0bacce\ + ss_list\x18\x0b\x20\x03(\x0b2E.hw.trezor.messages.ethereum.EthereumSignT\ + xEIP1559.EthereumAccessListR\naccessList\x12^\n\x0bdefinitions\x18\x0c\ + \x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions.EthereumDefiniti\ + onsR\x0bdefinitions\x12\x1a\n\x08chunkify\x18\r\x20\x01(\x08R\x08chunkif\ + y\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ + \x07address\x12!\n\x0cstorage_keys\x18\x02\x20\x03(\x0cR\x0bstorageKeys\ + \"\x97\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\ + \x01(\rR\ndataLength\x12\x1f\n\x0bsignature_v\x18\x02\x20\x01(\rR\nsigna\ + tureV\x12\x1f\n\x0bsignature_r\x18\x03\x20\x01(\x0cR\nsignatureR\x12\x1f\ + \n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\".\n\rEthereumTxAck\ + \x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\x91\x01\n\x13E\ + thereumSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ + \x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07message\x12'\n\x0fencoded\ + _network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\ + \x18\x04\x20\x01(\x08R\x08chunkify\"R\n\x18EthereumMessageSignature\x12\ + \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\ + \x18\x03\x20\x02(\tR\x07address\"\x85\x01\n\x15EthereumVerifyMessage\x12\ + \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\ + \x18\x03\x20\x02(\x0cR\x07message\x12\x18\n\x07address\x18\x04\x20\x02(\ + \tR\x07address\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\ + \xb4\x01\n\x15EthereumSignTypedHash\x12\x1b\n\taddress_n\x18\x01\x20\x03\ + (\rR\x08addressN\x122\n\x15domain_separator_hash\x18\x02\x20\x02(\x0cR\ + \x13domainSeparatorHash\x12!\n\x0cmessage_hash\x18\x03\x20\x01(\x0cR\x0b\ + messageHash\x12'\n\x0fencoded_network\x18\x04\x20\x01(\x0cR\x0eencodedNe\ + twork\"T\n\x1aEthereumTypedDataSignature\x12\x1c\n\tsignature\x18\x01\ + \x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07ad\ + dressB<\n#com.satoshilabs.trezor.lib.protobufB\x15TrezorMessageEthereum\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(2); + deps.push(super::messages_common::file_descriptor().clone()); + deps.push(super::messages_ethereum_definitions::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(14); + messages.push(EthereumGetPublicKey::generated_message_descriptor_data()); + messages.push(EthereumPublicKey::generated_message_descriptor_data()); + messages.push(EthereumGetAddress::generated_message_descriptor_data()); + messages.push(EthereumAddress::generated_message_descriptor_data()); + messages.push(EthereumSignTx::generated_message_descriptor_data()); + messages.push(EthereumSignTxEIP1559::generated_message_descriptor_data()); + messages.push(EthereumTxRequest::generated_message_descriptor_data()); + messages.push(EthereumTxAck::generated_message_descriptor_data()); + messages.push(EthereumSignMessage::generated_message_descriptor_data()); + messages.push(EthereumMessageSignature::generated_message_descriptor_data()); + messages.push(EthereumVerifyMessage::generated_message_descriptor_data()); + messages.push(EthereumSignTypedHash::generated_message_descriptor_data()); + messages.push(EthereumTypedDataSignature::generated_message_descriptor_data()); + messages.push(ethereum_sign_tx_eip1559::EthereumAccessList::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs b/wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs new file mode 100644 index 0000000000..a212384667 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs @@ -0,0 +1,1001 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-ethereum-definitions.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumNetworkInfo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.chain_id) + pub chain_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.symbol) + pub symbol: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.slip44) + pub slip44: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.name) + pub name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumNetworkInfo { + fn default() -> &'a EthereumNetworkInfo { + ::default_instance() + } +} + +impl EthereumNetworkInfo { + pub fn new() -> EthereumNetworkInfo { + ::std::default::Default::default() + } + + // required uint64 chain_id = 1; + + pub fn chain_id(&self) -> u64 { + self.chain_id.unwrap_or(0) + } + + pub fn clear_chain_id(&mut self) { + self.chain_id = ::std::option::Option::None; + } + + pub fn has_chain_id(&self) -> bool { + self.chain_id.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_id(&mut self, v: u64) { + self.chain_id = ::std::option::Option::Some(v); + } + + // required string symbol = 2; + + pub fn symbol(&self) -> &str { + match self.symbol.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_symbol(&mut self) { + self.symbol = ::std::option::Option::None; + } + + pub fn has_symbol(&self) -> bool { + self.symbol.is_some() + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + if self.symbol.is_none() { + self.symbol = ::std::option::Option::Some(::std::string::String::new()); + } + self.symbol.as_mut().unwrap() + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint32 slip44 = 3; + + pub fn slip44(&self) -> u32 { + self.slip44.unwrap_or(0) + } + + pub fn clear_slip44(&mut self) { + self.slip44 = ::std::option::Option::None; + } + + pub fn has_slip44(&self) -> bool { + self.slip44.is_some() + } + + // Param is passed by value, moved + pub fn set_slip44(&mut self, v: u32) { + self.slip44 = ::std::option::Option::Some(v); + } + + // required string name = 4; + + pub fn name(&self) -> &str { + match self.name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name = ::std::option::Option::Some(::std::string::String::new()); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_id", + |m: &EthereumNetworkInfo| { &m.chain_id }, + |m: &mut EthereumNetworkInfo| { &mut m.chain_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "symbol", + |m: &EthereumNetworkInfo| { &m.symbol }, + |m: &mut EthereumNetworkInfo| { &mut m.symbol }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "slip44", + |m: &EthereumNetworkInfo| { &m.slip44 }, + |m: &mut EthereumNetworkInfo| { &mut m.slip44 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &EthereumNetworkInfo| { &m.name }, + |m: &mut EthereumNetworkInfo| { &mut m.name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumNetworkInfo", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumNetworkInfo { + const NAME: &'static str = "EthereumNetworkInfo"; + + fn is_initialized(&self) -> bool { + if self.chain_id.is_none() { + return false; + } + if self.symbol.is_none() { + return false; + } + if self.slip44.is_none() { + return false; + } + if self.name.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.chain_id = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + self.symbol = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.slip44 = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.chain_id { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.symbol.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.slip44 { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.chain_id { + os.write_uint64(1, v)?; + } + if let Some(v) = self.symbol.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.slip44 { + os.write_uint32(3, v)?; + } + if let Some(v) = self.name.as_ref() { + os.write_string(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumNetworkInfo { + EthereumNetworkInfo::new() + } + + fn clear(&mut self) { + self.chain_id = ::std::option::Option::None; + self.symbol = ::std::option::Option::None; + self.slip44 = ::std::option::Option::None; + self.name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumNetworkInfo { + static instance: EthereumNetworkInfo = EthereumNetworkInfo { + chain_id: ::std::option::Option::None, + symbol: ::std::option::Option::None, + slip44: ::std::option::Option::None, + name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumNetworkInfo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumNetworkInfo").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumNetworkInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumNetworkInfo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTokenInfo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.address) + pub address: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.chain_id) + pub chain_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.symbol) + pub symbol: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.decimals) + pub decimals: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.name) + pub name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTokenInfo { + fn default() -> &'a EthereumTokenInfo { + ::default_instance() + } +} + +impl EthereumTokenInfo { + pub fn new() -> EthereumTokenInfo { + ::std::default::Default::default() + } + + // required bytes address = 1; + + pub fn address(&self) -> &[u8] { + match self.address.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::vec::Vec) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::vec::Vec { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::vec::Vec { + self.address.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 chain_id = 2; + + pub fn chain_id(&self) -> u64 { + self.chain_id.unwrap_or(0) + } + + pub fn clear_chain_id(&mut self) { + self.chain_id = ::std::option::Option::None; + } + + pub fn has_chain_id(&self) -> bool { + self.chain_id.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_id(&mut self, v: u64) { + self.chain_id = ::std::option::Option::Some(v); + } + + // required string symbol = 3; + + pub fn symbol(&self) -> &str { + match self.symbol.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_symbol(&mut self) { + self.symbol = ::std::option::Option::None; + } + + pub fn has_symbol(&self) -> bool { + self.symbol.is_some() + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + if self.symbol.is_none() { + self.symbol = ::std::option::Option::Some(::std::string::String::new()); + } + self.symbol.as_mut().unwrap() + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint32 decimals = 4; + + pub fn decimals(&self) -> u32 { + self.decimals.unwrap_or(0) + } + + pub fn clear_decimals(&mut self) { + self.decimals = ::std::option::Option::None; + } + + pub fn has_decimals(&self) -> bool { + self.decimals.is_some() + } + + // Param is passed by value, moved + pub fn set_decimals(&mut self, v: u32) { + self.decimals = ::std::option::Option::Some(v); + } + + // required string name = 5; + + pub fn name(&self) -> &str { + match self.name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name = ::std::option::Option::Some(::std::string::String::new()); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &EthereumTokenInfo| { &m.address }, + |m: &mut EthereumTokenInfo| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_id", + |m: &EthereumTokenInfo| { &m.chain_id }, + |m: &mut EthereumTokenInfo| { &mut m.chain_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "symbol", + |m: &EthereumTokenInfo| { &m.symbol }, + |m: &mut EthereumTokenInfo| { &mut m.symbol }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decimals", + |m: &EthereumTokenInfo| { &m.decimals }, + |m: &mut EthereumTokenInfo| { &mut m.decimals }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &EthereumTokenInfo| { &m.name }, + |m: &mut EthereumTokenInfo| { &mut m.name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTokenInfo", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTokenInfo { + const NAME: &'static str = "EthereumTokenInfo"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + if self.chain_id.is_none() { + return false; + } + if self.symbol.is_none() { + return false; + } + if self.decimals.is_none() { + return false; + } + if self.name.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.chain_id = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + self.symbol = ::std::option::Option::Some(is.read_string()?); + }, + 32 => { + self.decimals = ::std::option::Option::Some(is.read_uint32()?); + }, + 42 => { + self.name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.chain_id { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.symbol.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.decimals { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.chain_id { + os.write_uint64(2, v)?; + } + if let Some(v) = self.symbol.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.decimals { + os.write_uint32(4, v)?; + } + if let Some(v) = self.name.as_ref() { + os.write_string(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTokenInfo { + EthereumTokenInfo::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.chain_id = ::std::option::Option::None; + self.symbol = ::std::option::Option::None; + self.decimals = ::std::option::Option::None; + self.name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTokenInfo { + static instance: EthereumTokenInfo = EthereumTokenInfo { + address: ::std::option::Option::None, + chain_id: ::std::option::Option::None, + symbol: ::std::option::Option::None, + decimals: ::std::option::Option::None, + name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTokenInfo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTokenInfo").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTokenInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTokenInfo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumDefinitions) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumDefinitions { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_network) + pub encoded_network: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_token) + pub encoded_token: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumDefinitions { + fn default() -> &'a EthereumDefinitions { + ::default_instance() + } +} + +impl EthereumDefinitions { + pub fn new() -> EthereumDefinitions { + ::std::default::Default::default() + } + + // optional bytes encoded_network = 1; + + pub fn encoded_network(&self) -> &[u8] { + match self.encoded_network.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_encoded_network(&mut self) { + self.encoded_network = ::std::option::Option::None; + } + + pub fn has_encoded_network(&self) -> bool { + self.encoded_network.is_some() + } + + // Param is passed by value, moved + pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { + self.encoded_network = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { + if self.encoded_network.is_none() { + self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.encoded_network.as_mut().unwrap() + } + + // Take field + pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { + self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes encoded_token = 2; + + pub fn encoded_token(&self) -> &[u8] { + match self.encoded_token.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_encoded_token(&mut self) { + self.encoded_token = ::std::option::Option::None; + } + + pub fn has_encoded_token(&self) -> bool { + self.encoded_token.is_some() + } + + // Param is passed by value, moved + pub fn set_encoded_token(&mut self, v: ::std::vec::Vec) { + self.encoded_token = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_encoded_token(&mut self) -> &mut ::std::vec::Vec { + if self.encoded_token.is_none() { + self.encoded_token = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.encoded_token.as_mut().unwrap() + } + + // Take field + pub fn take_encoded_token(&mut self) -> ::std::vec::Vec { + self.encoded_token.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "encoded_network", + |m: &EthereumDefinitions| { &m.encoded_network }, + |m: &mut EthereumDefinitions| { &mut m.encoded_network }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "encoded_token", + |m: &EthereumDefinitions| { &m.encoded_token }, + |m: &mut EthereumDefinitions| { &mut m.encoded_token }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumDefinitions", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumDefinitions { + const NAME: &'static str = "EthereumDefinitions"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.encoded_token = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.encoded_network.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.encoded_token.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.encoded_network.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.encoded_token.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumDefinitions { + EthereumDefinitions::new() + } + + fn clear(&mut self) { + self.encoded_network = ::std::option::Option::None; + self.encoded_token = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumDefinitions { + static instance: EthereumDefinitions = EthereumDefinitions { + encoded_network: ::std::option::Option::None, + encoded_token: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumDefinitions { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumDefinitions").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumDefinitions { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumDefinitions { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType) +pub enum EthereumDefinitionType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.NETWORK) + NETWORK = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.TOKEN) + TOKEN = 1, +} + +impl ::protobuf::Enum for EthereumDefinitionType { + const NAME: &'static str = "EthereumDefinitionType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(EthereumDefinitionType::NETWORK), + 1 => ::std::option::Option::Some(EthereumDefinitionType::TOKEN), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "NETWORK" => ::std::option::Option::Some(EthereumDefinitionType::NETWORK), + "TOKEN" => ::std::option::Option::Some(EthereumDefinitionType::TOKEN), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [EthereumDefinitionType] = &[ + EthereumDefinitionType::NETWORK, + EthereumDefinitionType::TOKEN, + ]; +} + +impl ::protobuf::EnumFull for EthereumDefinitionType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("EthereumDefinitionType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for EthereumDefinitionType { + fn default() -> Self { + EthereumDefinitionType::NETWORK + } +} + +impl EthereumDefinitionType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("EthereumDefinitionType") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n#messages-ethereum-definitions.proto\x12'hw.trezor.messages.ethereum_d\ + efinitions\"t\n\x13EthereumNetworkInfo\x12\x19\n\x08chain_id\x18\x01\x20\ + \x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06symbol\ + \x12\x16\n\x06slip44\x18\x03\x20\x02(\rR\x06slip44\x12\x12\n\x04name\x18\ + \x04\x20\x02(\tR\x04name\"\x90\x01\n\x11EthereumTokenInfo\x12\x18\n\x07a\ + ddress\x18\x01\x20\x02(\x0cR\x07address\x12\x19\n\x08chain_id\x18\x02\ + \x20\x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x03\x20\x02(\tR\x06sym\ + bol\x12\x1a\n\x08decimals\x18\x04\x20\x02(\rR\x08decimals\x12\x12\n\x04n\ + ame\x18\x05\x20\x02(\tR\x04name\"c\n\x13EthereumDefinitions\x12'\n\x0fen\ + coded_network\x18\x01\x20\x01(\x0cR\x0eencodedNetwork\x12#\n\rencoded_to\ + ken\x18\x02\x20\x01(\x0cR\x0cencodedToken*0\n\x16EthereumDefinitionType\ + \x12\x0b\n\x07NETWORK\x10\0\x12\t\n\x05TOKEN\x10\x01BG\n#com.satoshilabs\ + .trezor.lib.protobufB\x20TrezorMessageEthereumDefinitions\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(3); + messages.push(EthereumNetworkInfo::generated_message_descriptor_data()); + messages.push(EthereumTokenInfo::generated_message_descriptor_data()); + messages.push(EthereumDefinitions::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(1); + enums.push(EthereumDefinitionType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs b/wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs new file mode 100644 index 0000000000..6e982994fb --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs @@ -0,0 +1,1465 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-ethereum-eip712.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumSignTypedData { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.primary_type) + pub primary_type: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.metamask_v4_compat) + pub metamask_v4_compat: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.definitions) + pub definitions: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumSignTypedData { + fn default() -> &'a EthereumSignTypedData { + ::default_instance() + } +} + +impl EthereumSignTypedData { + pub fn new() -> EthereumSignTypedData { + ::std::default::Default::default() + } + + // required string primary_type = 2; + + pub fn primary_type(&self) -> &str { + match self.primary_type.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_primary_type(&mut self) { + self.primary_type = ::std::option::Option::None; + } + + pub fn has_primary_type(&self) -> bool { + self.primary_type.is_some() + } + + // Param is passed by value, moved + pub fn set_primary_type(&mut self, v: ::std::string::String) { + self.primary_type = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_primary_type(&mut self) -> &mut ::std::string::String { + if self.primary_type.is_none() { + self.primary_type = ::std::option::Option::Some(::std::string::String::new()); + } + self.primary_type.as_mut().unwrap() + } + + // Take field + pub fn take_primary_type(&mut self) -> ::std::string::String { + self.primary_type.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool metamask_v4_compat = 3; + + pub fn metamask_v4_compat(&self) -> bool { + self.metamask_v4_compat.unwrap_or(true) + } + + pub fn clear_metamask_v4_compat(&mut self) { + self.metamask_v4_compat = ::std::option::Option::None; + } + + pub fn has_metamask_v4_compat(&self) -> bool { + self.metamask_v4_compat.is_some() + } + + // Param is passed by value, moved + pub fn set_metamask_v4_compat(&mut self, v: bool) { + self.metamask_v4_compat = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &EthereumSignTypedData| { &m.address_n }, + |m: &mut EthereumSignTypedData| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "primary_type", + |m: &EthereumSignTypedData| { &m.primary_type }, + |m: &mut EthereumSignTypedData| { &mut m.primary_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "metamask_v4_compat", + |m: &EthereumSignTypedData| { &m.metamask_v4_compat }, + |m: &mut EthereumSignTypedData| { &mut m.metamask_v4_compat }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( + "definitions", + |m: &EthereumSignTypedData| { &m.definitions }, + |m: &mut EthereumSignTypedData| { &mut m.definitions }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumSignTypedData", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumSignTypedData { + const NAME: &'static str = "EthereumSignTypedData"; + + fn is_initialized(&self) -> bool { + if self.primary_type.is_none() { + return false; + } + for v in &self.definitions { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.primary_type = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.metamask_v4_compat = ::std::option::Option::Some(is.read_bool()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.definitions)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.primary_type.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.metamask_v4_compat { + my_size += 1 + 1; + } + if let Some(v) = self.definitions.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.primary_type.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.metamask_v4_compat { + os.write_bool(3, v)?; + } + if let Some(v) = self.definitions.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumSignTypedData { + EthereumSignTypedData::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.primary_type = ::std::option::Option::None; + self.metamask_v4_compat = ::std::option::Option::None; + self.definitions.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumSignTypedData { + static instance: EthereumSignTypedData = EthereumSignTypedData { + address_n: ::std::vec::Vec::new(), + primary_type: ::std::option::Option::None, + metamask_v4_compat: ::std::option::Option::None, + definitions: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumSignTypedData { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTypedData").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumSignTypedData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumSignTypedData { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTypedDataStructRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructRequest.name) + pub name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTypedDataStructRequest { + fn default() -> &'a EthereumTypedDataStructRequest { + ::default_instance() + } +} + +impl EthereumTypedDataStructRequest { + pub fn new() -> EthereumTypedDataStructRequest { + ::std::default::Default::default() + } + + // required string name = 1; + + pub fn name(&self) -> &str { + match self.name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name = ::std::option::Option::Some(::std::string::String::new()); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &EthereumTypedDataStructRequest| { &m.name }, + |m: &mut EthereumTypedDataStructRequest| { &mut m.name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTypedDataStructRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTypedDataStructRequest { + const NAME: &'static str = "EthereumTypedDataStructRequest"; + + fn is_initialized(&self) -> bool { + if self.name.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.name.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTypedDataStructRequest { + EthereumTypedDataStructRequest::new() + } + + fn clear(&mut self) { + self.name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTypedDataStructRequest { + static instance: EthereumTypedDataStructRequest = EthereumTypedDataStructRequest { + name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTypedDataStructRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataStructRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTypedDataStructRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataStructRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTypedDataStructAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.members) + pub members: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTypedDataStructAck { + fn default() -> &'a EthereumTypedDataStructAck { + ::default_instance() + } +} + +impl EthereumTypedDataStructAck { + pub fn new() -> EthereumTypedDataStructAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "members", + |m: &EthereumTypedDataStructAck| { &m.members }, + |m: &mut EthereumTypedDataStructAck| { &mut m.members }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTypedDataStructAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTypedDataStructAck { + const NAME: &'static str = "EthereumTypedDataStructAck"; + + fn is_initialized(&self) -> bool { + for v in &self.members { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.members.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.members { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.members { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTypedDataStructAck { + EthereumTypedDataStructAck::new() + } + + fn clear(&mut self) { + self.members.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTypedDataStructAck { + static instance: EthereumTypedDataStructAck = EthereumTypedDataStructAck { + members: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTypedDataStructAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataStructAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTypedDataStructAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataStructAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `EthereumTypedDataStructAck` +pub mod ethereum_typed_data_struct_ack { + // @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EthereumStructMember { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember.type) + pub type_: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember.name) + pub name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EthereumStructMember { + fn default() -> &'a EthereumStructMember { + ::default_instance() + } + } + + impl EthereumStructMember { + pub fn new() -> EthereumStructMember { + ::std::default::Default::default() + } + + // required string name = 2; + + pub fn name(&self) -> &str { + match self.name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name = ::std::option::Option::Some(::std::string::String::new()); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumFieldType>( + "type", + |m: &EthereumStructMember| { &m.type_ }, + |m: &mut EthereumStructMember| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &EthereumStructMember| { &m.name }, + |m: &mut EthereumStructMember| { &mut m.name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTypedDataStructAck.EthereumStructMember", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EthereumStructMember { + const NAME: &'static str = "EthereumStructMember"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + if self.name.is_none() { + return false; + } + for v in &self.type_ { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.type_)?; + }, + 18 => { + self.name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.name.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumStructMember { + EthereumStructMember::new() + } + + fn clear(&mut self) { + self.type_.clear(); + self.name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumStructMember { + static instance: EthereumStructMember = EthereumStructMember { + type_: ::protobuf::MessageField::none(), + name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EthereumStructMember { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EthereumTypedDataStructAck.EthereumStructMember").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EthereumStructMember { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EthereumStructMember { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct EthereumFieldType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.data_type) + pub data_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.size) + pub size: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.entry_type) + pub entry_type: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.struct_name) + pub struct_name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a EthereumFieldType { + fn default() -> &'a EthereumFieldType { + ::default_instance() + } + } + + impl EthereumFieldType { + pub fn new() -> EthereumFieldType { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType data_type = 1; + + pub fn data_type(&self) -> EthereumDataType { + match self.data_type { + Some(e) => e.enum_value_or(EthereumDataType::UINT), + None => EthereumDataType::UINT, + } + } + + pub fn clear_data_type(&mut self) { + self.data_type = ::std::option::Option::None; + } + + pub fn has_data_type(&self) -> bool { + self.data_type.is_some() + } + + // Param is passed by value, moved + pub fn set_data_type(&mut self, v: EthereumDataType) { + self.data_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint32 size = 2; + + pub fn size(&self) -> u32 { + self.size.unwrap_or(0) + } + + pub fn clear_size(&mut self) { + self.size = ::std::option::Option::None; + } + + pub fn has_size(&self) -> bool { + self.size.is_some() + } + + // Param is passed by value, moved + pub fn set_size(&mut self, v: u32) { + self.size = ::std::option::Option::Some(v); + } + + // optional string struct_name = 4; + + pub fn struct_name(&self) -> &str { + match self.struct_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_struct_name(&mut self) { + self.struct_name = ::std::option::Option::None; + } + + pub fn has_struct_name(&self) -> bool { + self.struct_name.is_some() + } + + // Param is passed by value, moved + pub fn set_struct_name(&mut self, v: ::std::string::String) { + self.struct_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_struct_name(&mut self) -> &mut ::std::string::String { + if self.struct_name.is_none() { + self.struct_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.struct_name.as_mut().unwrap() + } + + // Take field + pub fn take_struct_name(&mut self) -> ::std::string::String { + self.struct_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_type", + |m: &EthereumFieldType| { &m.data_type }, + |m: &mut EthereumFieldType| { &mut m.data_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "size", + |m: &EthereumFieldType| { &m.size }, + |m: &mut EthereumFieldType| { &mut m.size }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumFieldType>( + "entry_type", + |m: &EthereumFieldType| { &m.entry_type }, + |m: &mut EthereumFieldType| { &mut m.entry_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "struct_name", + |m: &EthereumFieldType| { &m.struct_name }, + |m: &mut EthereumFieldType| { &mut m.struct_name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTypedDataStructAck.EthereumFieldType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for EthereumFieldType { + const NAME: &'static str = "EthereumFieldType"; + + fn is_initialized(&self) -> bool { + if self.data_type.is_none() { + return false; + } + for v in &self.entry_type { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.data_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 16 => { + self.size = ::std::option::Option::Some(is.read_uint32()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.entry_type)?; + }, + 34 => { + self.struct_name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_type { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.size { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.entry_type.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.struct_name.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_type { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.size { + os.write_uint32(2, v)?; + } + if let Some(v) = self.entry_type.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.struct_name.as_ref() { + os.write_string(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumFieldType { + EthereumFieldType::new() + } + + fn clear(&mut self) { + self.data_type = ::std::option::Option::None; + self.size = ::std::option::Option::None; + self.entry_type.clear(); + self.struct_name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumFieldType { + static instance: EthereumFieldType = EthereumFieldType { + data_type: ::std::option::Option::None, + size: ::std::option::Option::None, + entry_type: ::protobuf::MessageField::none(), + struct_name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for EthereumFieldType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EthereumTypedDataStructAck.EthereumFieldType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for EthereumFieldType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for EthereumFieldType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType) + pub enum EthereumDataType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.UINT) + UINT = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.INT) + INT = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.BYTES) + BYTES = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.STRING) + STRING = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.BOOL) + BOOL = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.ADDRESS) + ADDRESS = 6, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.ARRAY) + ARRAY = 7, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.STRUCT) + STRUCT = 8, + } + + impl ::protobuf::Enum for EthereumDataType { + const NAME: &'static str = "EthereumDataType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(EthereumDataType::UINT), + 2 => ::std::option::Option::Some(EthereumDataType::INT), + 3 => ::std::option::Option::Some(EthereumDataType::BYTES), + 4 => ::std::option::Option::Some(EthereumDataType::STRING), + 5 => ::std::option::Option::Some(EthereumDataType::BOOL), + 6 => ::std::option::Option::Some(EthereumDataType::ADDRESS), + 7 => ::std::option::Option::Some(EthereumDataType::ARRAY), + 8 => ::std::option::Option::Some(EthereumDataType::STRUCT), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "UINT" => ::std::option::Option::Some(EthereumDataType::UINT), + "INT" => ::std::option::Option::Some(EthereumDataType::INT), + "BYTES" => ::std::option::Option::Some(EthereumDataType::BYTES), + "STRING" => ::std::option::Option::Some(EthereumDataType::STRING), + "BOOL" => ::std::option::Option::Some(EthereumDataType::BOOL), + "ADDRESS" => ::std::option::Option::Some(EthereumDataType::ADDRESS), + "ARRAY" => ::std::option::Option::Some(EthereumDataType::ARRAY), + "STRUCT" => ::std::option::Option::Some(EthereumDataType::STRUCT), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [EthereumDataType] = &[ + EthereumDataType::UINT, + EthereumDataType::INT, + EthereumDataType::BYTES, + EthereumDataType::STRING, + EthereumDataType::BOOL, + EthereumDataType::ADDRESS, + EthereumDataType::ARRAY, + EthereumDataType::STRUCT, + ]; + } + + impl ::protobuf::EnumFull for EthereumDataType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("EthereumTypedDataStructAck.EthereumDataType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + EthereumDataType::UINT => 0, + EthereumDataType::INT => 1, + EthereumDataType::BYTES => 2, + EthereumDataType::STRING => 3, + EthereumDataType::BOOL => 4, + EthereumDataType::ADDRESS => 5, + EthereumDataType::ARRAY => 6, + EthereumDataType::STRUCT => 7, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for EthereumDataType { + fn default() -> Self { + EthereumDataType::UINT + } + } + + impl EthereumDataType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("EthereumTypedDataStructAck.EthereumDataType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTypedDataValueRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueRequest.member_path) + pub member_path: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTypedDataValueRequest { + fn default() -> &'a EthereumTypedDataValueRequest { + ::default_instance() + } +} + +impl EthereumTypedDataValueRequest { + pub fn new() -> EthereumTypedDataValueRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "member_path", + |m: &EthereumTypedDataValueRequest| { &m.member_path }, + |m: &mut EthereumTypedDataValueRequest| { &mut m.member_path }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTypedDataValueRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTypedDataValueRequest { + const NAME: &'static str = "EthereumTypedDataValueRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.member_path)?; + }, + 8 => { + self.member_path.push(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.member_path { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.member_path { + os.write_uint32(1, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTypedDataValueRequest { + EthereumTypedDataValueRequest::new() + } + + fn clear(&mut self) { + self.member_path.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTypedDataValueRequest { + static instance: EthereumTypedDataValueRequest = EthereumTypedDataValueRequest { + member_path: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTypedDataValueRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataValueRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTypedDataValueRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataValueRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EthereumTypedDataValueAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueAck.value) + pub value: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EthereumTypedDataValueAck { + fn default() -> &'a EthereumTypedDataValueAck { + ::default_instance() + } +} + +impl EthereumTypedDataValueAck { + pub fn new() -> EthereumTypedDataValueAck { + ::std::default::Default::default() + } + + // required bytes value = 1; + + pub fn value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &EthereumTypedDataValueAck| { &m.value }, + |m: &mut EthereumTypedDataValueAck| { &mut m.value }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EthereumTypedDataValueAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EthereumTypedDataValueAck { + const NAME: &'static str = "EthereumTypedDataValueAck"; + + fn is_initialized(&self) -> bool { + if self.value.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.value = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.value.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EthereumTypedDataValueAck { + EthereumTypedDataValueAck::new() + } + + fn clear(&mut self) { + self.value = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EthereumTypedDataValueAck { + static instance: EthereumTypedDataValueAck = EthereumTypedDataValueAck { + value: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EthereumTypedDataValueAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataValueAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EthereumTypedDataValueAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataValueAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1emessages-ethereum-eip712.proto\x12\"hw.trezor.messages.ethereum_ei\ + p712\x1a#messages-ethereum-definitions.proto\"\xeb\x01\n\x15EthereumSign\ + TypedData\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ + \x0cprimary_type\x18\x02\x20\x02(\tR\x0bprimaryType\x122\n\x12metamask_v\ + 4_compat\x18\x03\x20\x01(\x08:\x04trueR\x10metamaskV4Compat\x12^\n\x0bde\ + finitions\x18\x04\x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions\ + .EthereumDefinitionsR\x0bdefinitions\"4\n\x1eEthereumTypedDataStructRequ\ + est\x12\x12\n\x04name\x18\x01\x20\x02(\tR\x04name\"\xb4\x05\n\x1aEthereu\ + mTypedDataStructAck\x12m\n\x07members\x18\x01\x20\x03(\x0b2S.hw.trezor.m\ + essages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMemberR\ + \x07members\x1a\x90\x01\n\x14EthereumStructMember\x12d\n\x04type\x18\x01\ + \x20\x02(\x0b2P.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\ + ctAck.EthereumFieldTypeR\x04type\x12\x12\n\x04name\x18\x02\x20\x02(\tR\ + \x04name\x1a\xa7\x02\n\x11EthereumFieldType\x12l\n\tdata_type\x18\x01\ + \x20\x02(\x0e2O.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\ + ctAck.EthereumDataTypeR\x08dataType\x12\x12\n\x04size\x18\x02\x20\x01(\r\ + R\x04size\x12o\n\nentry_type\x18\x03\x20\x01(\x0b2P.hw.trezor.messages.e\ + thereum_eip712.EthereumTypedDataStructAck.EthereumFieldTypeR\tentryType\ + \x12\x1f\n\x0bstruct_name\x18\x04\x20\x01(\tR\nstructName\"j\n\x10Ethere\ + umDataType\x12\x08\n\x04UINT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\t\n\ + \x05BYTES\x10\x03\x12\n\n\x06STRING\x10\x04\x12\x08\n\x04BOOL\x10\x05\ + \x12\x0b\n\x07ADDRESS\x10\x06\x12\t\n\x05ARRAY\x10\x07\x12\n\n\x06STRUCT\ + \x10\x08\"@\n\x1dEthereumTypedDataValueRequest\x12\x1f\n\x0bmember_path\ + \x18\x01\x20\x03(\rR\nmemberPath\"1\n\x19EthereumTypedDataValueAck\x12\ + \x14\n\x05value\x18\x01\x20\x02(\x0cR\x05valueBB\n#com.satoshilabs.trezo\ + r.lib.protobufB\x1bTrezorMessageEthereumEIP712\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(super::messages_ethereum_definitions::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(7); + messages.push(EthereumSignTypedData::generated_message_descriptor_data()); + messages.push(EthereumTypedDataStructRequest::generated_message_descriptor_data()); + messages.push(EthereumTypedDataStructAck::generated_message_descriptor_data()); + messages.push(EthereumTypedDataValueRequest::generated_message_descriptor_data()); + messages.push(EthereumTypedDataValueAck::generated_message_descriptor_data()); + messages.push(ethereum_typed_data_struct_ack::EthereumStructMember::generated_message_descriptor_data()); + messages.push(ethereum_typed_data_struct_ack::EthereumFieldType::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(1); + enums.push(ethereum_typed_data_struct_ack::EthereumDataType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_management.rs b/wallet/trezor-client/src/protos/generated/messages_management.rs new file mode 100644 index 0000000000..8a9b86eb3b --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_management.rs @@ -0,0 +1,10842 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-management.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.management.Initialize) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Initialize { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.Initialize.session_id) + pub session_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Initialize._skip_passphrase) + pub _skip_passphrase: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Initialize.derive_cardano) + pub derive_cardano: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Initialize.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Initialize { + fn default() -> &'a Initialize { + ::default_instance() + } +} + +impl Initialize { + pub fn new() -> Initialize { + ::std::default::Default::default() + } + + // optional bytes session_id = 1; + + pub fn session_id(&self) -> &[u8] { + match self.session_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_session_id(&mut self) { + self.session_id = ::std::option::Option::None; + } + + pub fn has_session_id(&self) -> bool { + self.session_id.is_some() + } + + // Param is passed by value, moved + pub fn set_session_id(&mut self, v: ::std::vec::Vec) { + self.session_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_session_id(&mut self) -> &mut ::std::vec::Vec { + if self.session_id.is_none() { + self.session_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.session_id.as_mut().unwrap() + } + + // Take field + pub fn take_session_id(&mut self) -> ::std::vec::Vec { + self.session_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool _skip_passphrase = 2; + + pub fn _skip_passphrase(&self) -> bool { + self._skip_passphrase.unwrap_or(false) + } + + pub fn clear__skip_passphrase(&mut self) { + self._skip_passphrase = ::std::option::Option::None; + } + + pub fn has__skip_passphrase(&self) -> bool { + self._skip_passphrase.is_some() + } + + // Param is passed by value, moved + pub fn set__skip_passphrase(&mut self, v: bool) { + self._skip_passphrase = ::std::option::Option::Some(v); + } + + // optional bool derive_cardano = 3; + + pub fn derive_cardano(&self) -> bool { + self.derive_cardano.unwrap_or(false) + } + + pub fn clear_derive_cardano(&mut self) { + self.derive_cardano = ::std::option::Option::None; + } + + pub fn has_derive_cardano(&self) -> bool { + self.derive_cardano.is_some() + } + + // Param is passed by value, moved + pub fn set_derive_cardano(&mut self, v: bool) { + self.derive_cardano = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "session_id", + |m: &Initialize| { &m.session_id }, + |m: &mut Initialize| { &mut m.session_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "_skip_passphrase", + |m: &Initialize| { &m._skip_passphrase }, + |m: &mut Initialize| { &mut m._skip_passphrase }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "derive_cardano", + |m: &Initialize| { &m.derive_cardano }, + |m: &mut Initialize| { &mut m.derive_cardano }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Initialize", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Initialize { + const NAME: &'static str = "Initialize"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.session_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self._skip_passphrase = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.derive_cardano = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.session_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self._skip_passphrase { + my_size += 1 + 1; + } + if let Some(v) = self.derive_cardano { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.session_id.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self._skip_passphrase { + os.write_bool(2, v)?; + } + if let Some(v) = self.derive_cardano { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Initialize { + Initialize::new() + } + + fn clear(&mut self) { + self.session_id = ::std::option::Option::None; + self._skip_passphrase = ::std::option::Option::None; + self.derive_cardano = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Initialize { + static instance: Initialize = Initialize { + session_id: ::std::option::Option::None, + _skip_passphrase: ::std::option::Option::None, + derive_cardano: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Initialize { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Initialize").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Initialize { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Initialize { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.GetFeatures) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetFeatures { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetFeatures.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetFeatures { + fn default() -> &'a GetFeatures { + ::default_instance() + } +} + +impl GetFeatures { + pub fn new() -> GetFeatures { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetFeatures", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetFeatures { + const NAME: &'static str = "GetFeatures"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetFeatures { + GetFeatures::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetFeatures { + static instance: GetFeatures = GetFeatures { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetFeatures { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetFeatures").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetFeatures { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetFeatures { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.Features) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Features { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.vendor) + pub vendor: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.major_version) + pub major_version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.minor_version) + pub minor_version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.patch_version) + pub patch_version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.bootloader_mode) + pub bootloader_mode: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.device_id) + pub device_id: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.pin_protection) + pub pin_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.passphrase_protection) + pub passphrase_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.language) + pub language: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.label) + pub label: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.initialized) + pub initialized: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.revision) + pub revision: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.bootloader_hash) + pub bootloader_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.imported) + pub imported: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unlocked) + pub unlocked: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features._passphrase_cached) + pub _passphrase_cached: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.firmware_present) + pub firmware_present: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.needs_backup) + pub needs_backup: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.flags) + pub flags: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.model) + pub model: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_major) + pub fw_major: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_minor) + pub fw_minor: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_patch) + pub fw_patch: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_vendor) + pub fw_vendor: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unfinished_backup) + pub unfinished_backup: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.no_backup) + pub no_backup: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.recovery_mode) + pub recovery_mode: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.capabilities) + pub capabilities: ::std::vec::Vec<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.backup_type) + pub backup_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.sd_card_present) + pub sd_card_present: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.sd_protection) + pub sd_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.wipe_code_protection) + pub wipe_code_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.session_id) + pub session_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.passphrase_always_on_device) + pub passphrase_always_on_device: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.safety_checks) + pub safety_checks: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.auto_lock_delay_ms) + pub auto_lock_delay_ms: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.display_rotation) + pub display_rotation: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.experimental_features) + pub experimental_features: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.busy) + pub busy: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.homescreen_format) + pub homescreen_format: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.hide_passphrase_from_host) + pub hide_passphrase_from_host: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.internal_model) + pub internal_model: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unit_color) + pub unit_color: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unit_btconly) + pub unit_btconly: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.homescreen_width) + pub homescreen_width: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.homescreen_height) + pub homescreen_height: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.bootloader_locked) + pub bootloader_locked: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.language_version_matches) + pub language_version_matches: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unit_packaging) + pub unit_packaging: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Features.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Features { + fn default() -> &'a Features { + ::default_instance() + } +} + +impl Features { + pub fn new() -> Features { + ::std::default::Default::default() + } + + // optional string vendor = 1; + + pub fn vendor(&self) -> &str { + match self.vendor.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_vendor(&mut self) { + self.vendor = ::std::option::Option::None; + } + + pub fn has_vendor(&self) -> bool { + self.vendor.is_some() + } + + // Param is passed by value, moved + pub fn set_vendor(&mut self, v: ::std::string::String) { + self.vendor = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vendor(&mut self) -> &mut ::std::string::String { + if self.vendor.is_none() { + self.vendor = ::std::option::Option::Some(::std::string::String::new()); + } + self.vendor.as_mut().unwrap() + } + + // Take field + pub fn take_vendor(&mut self) -> ::std::string::String { + self.vendor.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint32 major_version = 2; + + pub fn major_version(&self) -> u32 { + self.major_version.unwrap_or(0) + } + + pub fn clear_major_version(&mut self) { + self.major_version = ::std::option::Option::None; + } + + pub fn has_major_version(&self) -> bool { + self.major_version.is_some() + } + + // Param is passed by value, moved + pub fn set_major_version(&mut self, v: u32) { + self.major_version = ::std::option::Option::Some(v); + } + + // required uint32 minor_version = 3; + + pub fn minor_version(&self) -> u32 { + self.minor_version.unwrap_or(0) + } + + pub fn clear_minor_version(&mut self) { + self.minor_version = ::std::option::Option::None; + } + + pub fn has_minor_version(&self) -> bool { + self.minor_version.is_some() + } + + // Param is passed by value, moved + pub fn set_minor_version(&mut self, v: u32) { + self.minor_version = ::std::option::Option::Some(v); + } + + // required uint32 patch_version = 4; + + pub fn patch_version(&self) -> u32 { + self.patch_version.unwrap_or(0) + } + + pub fn clear_patch_version(&mut self) { + self.patch_version = ::std::option::Option::None; + } + + pub fn has_patch_version(&self) -> bool { + self.patch_version.is_some() + } + + // Param is passed by value, moved + pub fn set_patch_version(&mut self, v: u32) { + self.patch_version = ::std::option::Option::Some(v); + } + + // optional bool bootloader_mode = 5; + + pub fn bootloader_mode(&self) -> bool { + self.bootloader_mode.unwrap_or(false) + } + + pub fn clear_bootloader_mode(&mut self) { + self.bootloader_mode = ::std::option::Option::None; + } + + pub fn has_bootloader_mode(&self) -> bool { + self.bootloader_mode.is_some() + } + + // Param is passed by value, moved + pub fn set_bootloader_mode(&mut self, v: bool) { + self.bootloader_mode = ::std::option::Option::Some(v); + } + + // optional string device_id = 6; + + pub fn device_id(&self) -> &str { + match self.device_id.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_device_id(&mut self) { + self.device_id = ::std::option::Option::None; + } + + pub fn has_device_id(&self) -> bool { + self.device_id.is_some() + } + + // Param is passed by value, moved + pub fn set_device_id(&mut self, v: ::std::string::String) { + self.device_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_device_id(&mut self) -> &mut ::std::string::String { + if self.device_id.is_none() { + self.device_id = ::std::option::Option::Some(::std::string::String::new()); + } + self.device_id.as_mut().unwrap() + } + + // Take field + pub fn take_device_id(&mut self) -> ::std::string::String { + self.device_id.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool pin_protection = 7; + + pub fn pin_protection(&self) -> bool { + self.pin_protection.unwrap_or(false) + } + + pub fn clear_pin_protection(&mut self) { + self.pin_protection = ::std::option::Option::None; + } + + pub fn has_pin_protection(&self) -> bool { + self.pin_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_pin_protection(&mut self, v: bool) { + self.pin_protection = ::std::option::Option::Some(v); + } + + // optional bool passphrase_protection = 8; + + pub fn passphrase_protection(&self) -> bool { + self.passphrase_protection.unwrap_or(false) + } + + pub fn clear_passphrase_protection(&mut self) { + self.passphrase_protection = ::std::option::Option::None; + } + + pub fn has_passphrase_protection(&self) -> bool { + self.passphrase_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase_protection(&mut self, v: bool) { + self.passphrase_protection = ::std::option::Option::Some(v); + } + + // optional string language = 9; + + pub fn language(&self) -> &str { + match self.language.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_language(&mut self) { + self.language = ::std::option::Option::None; + } + + pub fn has_language(&self) -> bool { + self.language.is_some() + } + + // Param is passed by value, moved + pub fn set_language(&mut self, v: ::std::string::String) { + self.language = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_language(&mut self) -> &mut ::std::string::String { + if self.language.is_none() { + self.language = ::std::option::Option::Some(::std::string::String::new()); + } + self.language.as_mut().unwrap() + } + + // Take field + pub fn take_language(&mut self) -> ::std::string::String { + self.language.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string label = 10; + + pub fn label(&self) -> &str { + match self.label.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_label(&mut self) { + self.label = ::std::option::Option::None; + } + + pub fn has_label(&self) -> bool { + self.label.is_some() + } + + // Param is passed by value, moved + pub fn set_label(&mut self, v: ::std::string::String) { + self.label = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_label(&mut self) -> &mut ::std::string::String { + if self.label.is_none() { + self.label = ::std::option::Option::Some(::std::string::String::new()); + } + self.label.as_mut().unwrap() + } + + // Take field + pub fn take_label(&mut self) -> ::std::string::String { + self.label.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool initialized = 12; + + pub fn initialized(&self) -> bool { + self.initialized.unwrap_or(false) + } + + pub fn clear_initialized(&mut self) { + self.initialized = ::std::option::Option::None; + } + + pub fn has_initialized(&self) -> bool { + self.initialized.is_some() + } + + // Param is passed by value, moved + pub fn set_initialized(&mut self, v: bool) { + self.initialized = ::std::option::Option::Some(v); + } + + // optional bytes revision = 13; + + pub fn revision(&self) -> &[u8] { + match self.revision.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_revision(&mut self) { + self.revision = ::std::option::Option::None; + } + + pub fn has_revision(&self) -> bool { + self.revision.is_some() + } + + // Param is passed by value, moved + pub fn set_revision(&mut self, v: ::std::vec::Vec) { + self.revision = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_revision(&mut self) -> &mut ::std::vec::Vec { + if self.revision.is_none() { + self.revision = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.revision.as_mut().unwrap() + } + + // Take field + pub fn take_revision(&mut self) -> ::std::vec::Vec { + self.revision.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes bootloader_hash = 14; + + pub fn bootloader_hash(&self) -> &[u8] { + match self.bootloader_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_bootloader_hash(&mut self) { + self.bootloader_hash = ::std::option::Option::None; + } + + pub fn has_bootloader_hash(&self) -> bool { + self.bootloader_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_bootloader_hash(&mut self, v: ::std::vec::Vec) { + self.bootloader_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_bootloader_hash(&mut self) -> &mut ::std::vec::Vec { + if self.bootloader_hash.is_none() { + self.bootloader_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.bootloader_hash.as_mut().unwrap() + } + + // Take field + pub fn take_bootloader_hash(&mut self) -> ::std::vec::Vec { + self.bootloader_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool imported = 15; + + pub fn imported(&self) -> bool { + self.imported.unwrap_or(false) + } + + pub fn clear_imported(&mut self) { + self.imported = ::std::option::Option::None; + } + + pub fn has_imported(&self) -> bool { + self.imported.is_some() + } + + // Param is passed by value, moved + pub fn set_imported(&mut self, v: bool) { + self.imported = ::std::option::Option::Some(v); + } + + // optional bool unlocked = 16; + + pub fn unlocked(&self) -> bool { + self.unlocked.unwrap_or(false) + } + + pub fn clear_unlocked(&mut self) { + self.unlocked = ::std::option::Option::None; + } + + pub fn has_unlocked(&self) -> bool { + self.unlocked.is_some() + } + + // Param is passed by value, moved + pub fn set_unlocked(&mut self, v: bool) { + self.unlocked = ::std::option::Option::Some(v); + } + + // optional bool _passphrase_cached = 17; + + pub fn _passphrase_cached(&self) -> bool { + self._passphrase_cached.unwrap_or(false) + } + + pub fn clear__passphrase_cached(&mut self) { + self._passphrase_cached = ::std::option::Option::None; + } + + pub fn has__passphrase_cached(&self) -> bool { + self._passphrase_cached.is_some() + } + + // Param is passed by value, moved + pub fn set__passphrase_cached(&mut self, v: bool) { + self._passphrase_cached = ::std::option::Option::Some(v); + } + + // optional bool firmware_present = 18; + + pub fn firmware_present(&self) -> bool { + self.firmware_present.unwrap_or(false) + } + + pub fn clear_firmware_present(&mut self) { + self.firmware_present = ::std::option::Option::None; + } + + pub fn has_firmware_present(&self) -> bool { + self.firmware_present.is_some() + } + + // Param is passed by value, moved + pub fn set_firmware_present(&mut self, v: bool) { + self.firmware_present = ::std::option::Option::Some(v); + } + + // optional bool needs_backup = 19; + + pub fn needs_backup(&self) -> bool { + self.needs_backup.unwrap_or(false) + } + + pub fn clear_needs_backup(&mut self) { + self.needs_backup = ::std::option::Option::None; + } + + pub fn has_needs_backup(&self) -> bool { + self.needs_backup.is_some() + } + + // Param is passed by value, moved + pub fn set_needs_backup(&mut self, v: bool) { + self.needs_backup = ::std::option::Option::Some(v); + } + + // optional uint32 flags = 20; + + pub fn flags(&self) -> u32 { + self.flags.unwrap_or(0) + } + + pub fn clear_flags(&mut self) { + self.flags = ::std::option::Option::None; + } + + pub fn has_flags(&self) -> bool { + self.flags.is_some() + } + + // Param is passed by value, moved + pub fn set_flags(&mut self, v: u32) { + self.flags = ::std::option::Option::Some(v); + } + + // optional string model = 21; + + pub fn model(&self) -> &str { + match self.model.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_model(&mut self) { + self.model = ::std::option::Option::None; + } + + pub fn has_model(&self) -> bool { + self.model.is_some() + } + + // Param is passed by value, moved + pub fn set_model(&mut self, v: ::std::string::String) { + self.model = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_model(&mut self) -> &mut ::std::string::String { + if self.model.is_none() { + self.model = ::std::option::Option::Some(::std::string::String::new()); + } + self.model.as_mut().unwrap() + } + + // Take field + pub fn take_model(&mut self) -> ::std::string::String { + self.model.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 fw_major = 22; + + pub fn fw_major(&self) -> u32 { + self.fw_major.unwrap_or(0) + } + + pub fn clear_fw_major(&mut self) { + self.fw_major = ::std::option::Option::None; + } + + pub fn has_fw_major(&self) -> bool { + self.fw_major.is_some() + } + + // Param is passed by value, moved + pub fn set_fw_major(&mut self, v: u32) { + self.fw_major = ::std::option::Option::Some(v); + } + + // optional uint32 fw_minor = 23; + + pub fn fw_minor(&self) -> u32 { + self.fw_minor.unwrap_or(0) + } + + pub fn clear_fw_minor(&mut self) { + self.fw_minor = ::std::option::Option::None; + } + + pub fn has_fw_minor(&self) -> bool { + self.fw_minor.is_some() + } + + // Param is passed by value, moved + pub fn set_fw_minor(&mut self, v: u32) { + self.fw_minor = ::std::option::Option::Some(v); + } + + // optional uint32 fw_patch = 24; + + pub fn fw_patch(&self) -> u32 { + self.fw_patch.unwrap_or(0) + } + + pub fn clear_fw_patch(&mut self) { + self.fw_patch = ::std::option::Option::None; + } + + pub fn has_fw_patch(&self) -> bool { + self.fw_patch.is_some() + } + + // Param is passed by value, moved + pub fn set_fw_patch(&mut self, v: u32) { + self.fw_patch = ::std::option::Option::Some(v); + } + + // optional string fw_vendor = 25; + + pub fn fw_vendor(&self) -> &str { + match self.fw_vendor.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_fw_vendor(&mut self) { + self.fw_vendor = ::std::option::Option::None; + } + + pub fn has_fw_vendor(&self) -> bool { + self.fw_vendor.is_some() + } + + // Param is passed by value, moved + pub fn set_fw_vendor(&mut self, v: ::std::string::String) { + self.fw_vendor = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_fw_vendor(&mut self) -> &mut ::std::string::String { + if self.fw_vendor.is_none() { + self.fw_vendor = ::std::option::Option::Some(::std::string::String::new()); + } + self.fw_vendor.as_mut().unwrap() + } + + // Take field + pub fn take_fw_vendor(&mut self) -> ::std::string::String { + self.fw_vendor.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool unfinished_backup = 27; + + pub fn unfinished_backup(&self) -> bool { + self.unfinished_backup.unwrap_or(false) + } + + pub fn clear_unfinished_backup(&mut self) { + self.unfinished_backup = ::std::option::Option::None; + } + + pub fn has_unfinished_backup(&self) -> bool { + self.unfinished_backup.is_some() + } + + // Param is passed by value, moved + pub fn set_unfinished_backup(&mut self, v: bool) { + self.unfinished_backup = ::std::option::Option::Some(v); + } + + // optional bool no_backup = 28; + + pub fn no_backup(&self) -> bool { + self.no_backup.unwrap_or(false) + } + + pub fn clear_no_backup(&mut self) { + self.no_backup = ::std::option::Option::None; + } + + pub fn has_no_backup(&self) -> bool { + self.no_backup.is_some() + } + + // Param is passed by value, moved + pub fn set_no_backup(&mut self, v: bool) { + self.no_backup = ::std::option::Option::Some(v); + } + + // optional bool recovery_mode = 29; + + pub fn recovery_mode(&self) -> bool { + self.recovery_mode.unwrap_or(false) + } + + pub fn clear_recovery_mode(&mut self) { + self.recovery_mode = ::std::option::Option::None; + } + + pub fn has_recovery_mode(&self) -> bool { + self.recovery_mode.is_some() + } + + // Param is passed by value, moved + pub fn set_recovery_mode(&mut self, v: bool) { + self.recovery_mode = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.management.BackupType backup_type = 31; + + pub fn backup_type(&self) -> BackupType { + match self.backup_type { + Some(e) => e.enum_value_or(BackupType::Bip39), + None => BackupType::Bip39, + } + } + + pub fn clear_backup_type(&mut self) { + self.backup_type = ::std::option::Option::None; + } + + pub fn has_backup_type(&self) -> bool { + self.backup_type.is_some() + } + + // Param is passed by value, moved + pub fn set_backup_type(&mut self, v: BackupType) { + self.backup_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool sd_card_present = 32; + + pub fn sd_card_present(&self) -> bool { + self.sd_card_present.unwrap_or(false) + } + + pub fn clear_sd_card_present(&mut self) { + self.sd_card_present = ::std::option::Option::None; + } + + pub fn has_sd_card_present(&self) -> bool { + self.sd_card_present.is_some() + } + + // Param is passed by value, moved + pub fn set_sd_card_present(&mut self, v: bool) { + self.sd_card_present = ::std::option::Option::Some(v); + } + + // optional bool sd_protection = 33; + + pub fn sd_protection(&self) -> bool { + self.sd_protection.unwrap_or(false) + } + + pub fn clear_sd_protection(&mut self) { + self.sd_protection = ::std::option::Option::None; + } + + pub fn has_sd_protection(&self) -> bool { + self.sd_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_sd_protection(&mut self, v: bool) { + self.sd_protection = ::std::option::Option::Some(v); + } + + // optional bool wipe_code_protection = 34; + + pub fn wipe_code_protection(&self) -> bool { + self.wipe_code_protection.unwrap_or(false) + } + + pub fn clear_wipe_code_protection(&mut self) { + self.wipe_code_protection = ::std::option::Option::None; + } + + pub fn has_wipe_code_protection(&self) -> bool { + self.wipe_code_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_wipe_code_protection(&mut self, v: bool) { + self.wipe_code_protection = ::std::option::Option::Some(v); + } + + // optional bytes session_id = 35; + + pub fn session_id(&self) -> &[u8] { + match self.session_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_session_id(&mut self) { + self.session_id = ::std::option::Option::None; + } + + pub fn has_session_id(&self) -> bool { + self.session_id.is_some() + } + + // Param is passed by value, moved + pub fn set_session_id(&mut self, v: ::std::vec::Vec) { + self.session_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_session_id(&mut self) -> &mut ::std::vec::Vec { + if self.session_id.is_none() { + self.session_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.session_id.as_mut().unwrap() + } + + // Take field + pub fn take_session_id(&mut self) -> ::std::vec::Vec { + self.session_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool passphrase_always_on_device = 36; + + pub fn passphrase_always_on_device(&self) -> bool { + self.passphrase_always_on_device.unwrap_or(false) + } + + pub fn clear_passphrase_always_on_device(&mut self) { + self.passphrase_always_on_device = ::std::option::Option::None; + } + + pub fn has_passphrase_always_on_device(&self) -> bool { + self.passphrase_always_on_device.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase_always_on_device(&mut self, v: bool) { + self.passphrase_always_on_device = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.management.SafetyCheckLevel safety_checks = 37; + + pub fn safety_checks(&self) -> SafetyCheckLevel { + match self.safety_checks { + Some(e) => e.enum_value_or(SafetyCheckLevel::Strict), + None => SafetyCheckLevel::Strict, + } + } + + pub fn clear_safety_checks(&mut self) { + self.safety_checks = ::std::option::Option::None; + } + + pub fn has_safety_checks(&self) -> bool { + self.safety_checks.is_some() + } + + // Param is passed by value, moved + pub fn set_safety_checks(&mut self, v: SafetyCheckLevel) { + self.safety_checks = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint32 auto_lock_delay_ms = 38; + + pub fn auto_lock_delay_ms(&self) -> u32 { + self.auto_lock_delay_ms.unwrap_or(0) + } + + pub fn clear_auto_lock_delay_ms(&mut self) { + self.auto_lock_delay_ms = ::std::option::Option::None; + } + + pub fn has_auto_lock_delay_ms(&self) -> bool { + self.auto_lock_delay_ms.is_some() + } + + // Param is passed by value, moved + pub fn set_auto_lock_delay_ms(&mut self, v: u32) { + self.auto_lock_delay_ms = ::std::option::Option::Some(v); + } + + // optional uint32 display_rotation = 39; + + pub fn display_rotation(&self) -> u32 { + self.display_rotation.unwrap_or(0) + } + + pub fn clear_display_rotation(&mut self) { + self.display_rotation = ::std::option::Option::None; + } + + pub fn has_display_rotation(&self) -> bool { + self.display_rotation.is_some() + } + + // Param is passed by value, moved + pub fn set_display_rotation(&mut self, v: u32) { + self.display_rotation = ::std::option::Option::Some(v); + } + + // optional bool experimental_features = 40; + + pub fn experimental_features(&self) -> bool { + self.experimental_features.unwrap_or(false) + } + + pub fn clear_experimental_features(&mut self) { + self.experimental_features = ::std::option::Option::None; + } + + pub fn has_experimental_features(&self) -> bool { + self.experimental_features.is_some() + } + + // Param is passed by value, moved + pub fn set_experimental_features(&mut self, v: bool) { + self.experimental_features = ::std::option::Option::Some(v); + } + + // optional bool busy = 41; + + pub fn busy(&self) -> bool { + self.busy.unwrap_or(false) + } + + pub fn clear_busy(&mut self) { + self.busy = ::std::option::Option::None; + } + + pub fn has_busy(&self) -> bool { + self.busy.is_some() + } + + // Param is passed by value, moved + pub fn set_busy(&mut self, v: bool) { + self.busy = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.management.HomescreenFormat homescreen_format = 42; + + pub fn homescreen_format(&self) -> HomescreenFormat { + match self.homescreen_format { + Some(e) => e.enum_value_or(HomescreenFormat::Toif), + None => HomescreenFormat::Toif, + } + } + + pub fn clear_homescreen_format(&mut self) { + self.homescreen_format = ::std::option::Option::None; + } + + pub fn has_homescreen_format(&self) -> bool { + self.homescreen_format.is_some() + } + + // Param is passed by value, moved + pub fn set_homescreen_format(&mut self, v: HomescreenFormat) { + self.homescreen_format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool hide_passphrase_from_host = 43; + + pub fn hide_passphrase_from_host(&self) -> bool { + self.hide_passphrase_from_host.unwrap_or(false) + } + + pub fn clear_hide_passphrase_from_host(&mut self) { + self.hide_passphrase_from_host = ::std::option::Option::None; + } + + pub fn has_hide_passphrase_from_host(&self) -> bool { + self.hide_passphrase_from_host.is_some() + } + + // Param is passed by value, moved + pub fn set_hide_passphrase_from_host(&mut self, v: bool) { + self.hide_passphrase_from_host = ::std::option::Option::Some(v); + } + + // optional string internal_model = 44; + + pub fn internal_model(&self) -> &str { + match self.internal_model.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_internal_model(&mut self) { + self.internal_model = ::std::option::Option::None; + } + + pub fn has_internal_model(&self) -> bool { + self.internal_model.is_some() + } + + // Param is passed by value, moved + pub fn set_internal_model(&mut self, v: ::std::string::String) { + self.internal_model = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_internal_model(&mut self) -> &mut ::std::string::String { + if self.internal_model.is_none() { + self.internal_model = ::std::option::Option::Some(::std::string::String::new()); + } + self.internal_model.as_mut().unwrap() + } + + // Take field + pub fn take_internal_model(&mut self) -> ::std::string::String { + self.internal_model.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 unit_color = 45; + + pub fn unit_color(&self) -> u32 { + self.unit_color.unwrap_or(0) + } + + pub fn clear_unit_color(&mut self) { + self.unit_color = ::std::option::Option::None; + } + + pub fn has_unit_color(&self) -> bool { + self.unit_color.is_some() + } + + // Param is passed by value, moved + pub fn set_unit_color(&mut self, v: u32) { + self.unit_color = ::std::option::Option::Some(v); + } + + // optional bool unit_btconly = 46; + + pub fn unit_btconly(&self) -> bool { + self.unit_btconly.unwrap_or(false) + } + + pub fn clear_unit_btconly(&mut self) { + self.unit_btconly = ::std::option::Option::None; + } + + pub fn has_unit_btconly(&self) -> bool { + self.unit_btconly.is_some() + } + + // Param is passed by value, moved + pub fn set_unit_btconly(&mut self, v: bool) { + self.unit_btconly = ::std::option::Option::Some(v); + } + + // optional uint32 homescreen_width = 47; + + pub fn homescreen_width(&self) -> u32 { + self.homescreen_width.unwrap_or(0) + } + + pub fn clear_homescreen_width(&mut self) { + self.homescreen_width = ::std::option::Option::None; + } + + pub fn has_homescreen_width(&self) -> bool { + self.homescreen_width.is_some() + } + + // Param is passed by value, moved + pub fn set_homescreen_width(&mut self, v: u32) { + self.homescreen_width = ::std::option::Option::Some(v); + } + + // optional uint32 homescreen_height = 48; + + pub fn homescreen_height(&self) -> u32 { + self.homescreen_height.unwrap_or(0) + } + + pub fn clear_homescreen_height(&mut self) { + self.homescreen_height = ::std::option::Option::None; + } + + pub fn has_homescreen_height(&self) -> bool { + self.homescreen_height.is_some() + } + + // Param is passed by value, moved + pub fn set_homescreen_height(&mut self, v: u32) { + self.homescreen_height = ::std::option::Option::Some(v); + } + + // optional bool bootloader_locked = 49; + + pub fn bootloader_locked(&self) -> bool { + self.bootloader_locked.unwrap_or(false) + } + + pub fn clear_bootloader_locked(&mut self) { + self.bootloader_locked = ::std::option::Option::None; + } + + pub fn has_bootloader_locked(&self) -> bool { + self.bootloader_locked.is_some() + } + + // Param is passed by value, moved + pub fn set_bootloader_locked(&mut self, v: bool) { + self.bootloader_locked = ::std::option::Option::Some(v); + } + + // optional bool language_version_matches = 50; + + pub fn language_version_matches(&self) -> bool { + self.language_version_matches.unwrap_or(true) + } + + pub fn clear_language_version_matches(&mut self) { + self.language_version_matches = ::std::option::Option::None; + } + + pub fn has_language_version_matches(&self) -> bool { + self.language_version_matches.is_some() + } + + // Param is passed by value, moved + pub fn set_language_version_matches(&mut self, v: bool) { + self.language_version_matches = ::std::option::Option::Some(v); + } + + // optional uint32 unit_packaging = 51; + + pub fn unit_packaging(&self) -> u32 { + self.unit_packaging.unwrap_or(0) + } + + pub fn clear_unit_packaging(&mut self) { + self.unit_packaging = ::std::option::Option::None; + } + + pub fn has_unit_packaging(&self) -> bool { + self.unit_packaging.is_some() + } + + // Param is passed by value, moved + pub fn set_unit_packaging(&mut self, v: u32) { + self.unit_packaging = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(49); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vendor", + |m: &Features| { &m.vendor }, + |m: &mut Features| { &mut m.vendor }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "major_version", + |m: &Features| { &m.major_version }, + |m: &mut Features| { &mut m.major_version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "minor_version", + |m: &Features| { &m.minor_version }, + |m: &mut Features| { &mut m.minor_version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "patch_version", + |m: &Features| { &m.patch_version }, + |m: &mut Features| { &mut m.patch_version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bootloader_mode", + |m: &Features| { &m.bootloader_mode }, + |m: &mut Features| { &mut m.bootloader_mode }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "device_id", + |m: &Features| { &m.device_id }, + |m: &mut Features| { &mut m.device_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pin_protection", + |m: &Features| { &m.pin_protection }, + |m: &mut Features| { &mut m.pin_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase_protection", + |m: &Features| { &m.passphrase_protection }, + |m: &mut Features| { &mut m.passphrase_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "language", + |m: &Features| { &m.language }, + |m: &mut Features| { &mut m.language }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "label", + |m: &Features| { &m.label }, + |m: &mut Features| { &mut m.label }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "initialized", + |m: &Features| { &m.initialized }, + |m: &mut Features| { &mut m.initialized }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "revision", + |m: &Features| { &m.revision }, + |m: &mut Features| { &mut m.revision }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bootloader_hash", + |m: &Features| { &m.bootloader_hash }, + |m: &mut Features| { &mut m.bootloader_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "imported", + |m: &Features| { &m.imported }, + |m: &mut Features| { &mut m.imported }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "unlocked", + |m: &Features| { &m.unlocked }, + |m: &mut Features| { &mut m.unlocked }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "_passphrase_cached", + |m: &Features| { &m._passphrase_cached }, + |m: &mut Features| { &mut m._passphrase_cached }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "firmware_present", + |m: &Features| { &m.firmware_present }, + |m: &mut Features| { &mut m.firmware_present }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "needs_backup", + |m: &Features| { &m.needs_backup }, + |m: &mut Features| { &mut m.needs_backup }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "flags", + |m: &Features| { &m.flags }, + |m: &mut Features| { &mut m.flags }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "model", + |m: &Features| { &m.model }, + |m: &mut Features| { &mut m.model }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fw_major", + |m: &Features| { &m.fw_major }, + |m: &mut Features| { &mut m.fw_major }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fw_minor", + |m: &Features| { &m.fw_minor }, + |m: &mut Features| { &mut m.fw_minor }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fw_patch", + |m: &Features| { &m.fw_patch }, + |m: &mut Features| { &mut m.fw_patch }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fw_vendor", + |m: &Features| { &m.fw_vendor }, + |m: &mut Features| { &mut m.fw_vendor }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "unfinished_backup", + |m: &Features| { &m.unfinished_backup }, + |m: &mut Features| { &mut m.unfinished_backup }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "no_backup", + |m: &Features| { &m.no_backup }, + |m: &mut Features| { &mut m.no_backup }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "recovery_mode", + |m: &Features| { &m.recovery_mode }, + |m: &mut Features| { &mut m.recovery_mode }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "capabilities", + |m: &Features| { &m.capabilities }, + |m: &mut Features| { &mut m.capabilities }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "backup_type", + |m: &Features| { &m.backup_type }, + |m: &mut Features| { &mut m.backup_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sd_card_present", + |m: &Features| { &m.sd_card_present }, + |m: &mut Features| { &mut m.sd_card_present }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sd_protection", + |m: &Features| { &m.sd_protection }, + |m: &mut Features| { &mut m.sd_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "wipe_code_protection", + |m: &Features| { &m.wipe_code_protection }, + |m: &mut Features| { &mut m.wipe_code_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "session_id", + |m: &Features| { &m.session_id }, + |m: &mut Features| { &mut m.session_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase_always_on_device", + |m: &Features| { &m.passphrase_always_on_device }, + |m: &mut Features| { &mut m.passphrase_always_on_device }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "safety_checks", + |m: &Features| { &m.safety_checks }, + |m: &mut Features| { &mut m.safety_checks }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "auto_lock_delay_ms", + |m: &Features| { &m.auto_lock_delay_ms }, + |m: &mut Features| { &mut m.auto_lock_delay_ms }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "display_rotation", + |m: &Features| { &m.display_rotation }, + |m: &mut Features| { &mut m.display_rotation }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "experimental_features", + |m: &Features| { &m.experimental_features }, + |m: &mut Features| { &mut m.experimental_features }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "busy", + |m: &Features| { &m.busy }, + |m: &mut Features| { &mut m.busy }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "homescreen_format", + |m: &Features| { &m.homescreen_format }, + |m: &mut Features| { &mut m.homescreen_format }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hide_passphrase_from_host", + |m: &Features| { &m.hide_passphrase_from_host }, + |m: &mut Features| { &mut m.hide_passphrase_from_host }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "internal_model", + |m: &Features| { &m.internal_model }, + |m: &mut Features| { &mut m.internal_model }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "unit_color", + |m: &Features| { &m.unit_color }, + |m: &mut Features| { &mut m.unit_color }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "unit_btconly", + |m: &Features| { &m.unit_btconly }, + |m: &mut Features| { &mut m.unit_btconly }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "homescreen_width", + |m: &Features| { &m.homescreen_width }, + |m: &mut Features| { &mut m.homescreen_width }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "homescreen_height", + |m: &Features| { &m.homescreen_height }, + |m: &mut Features| { &mut m.homescreen_height }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bootloader_locked", + |m: &Features| { &m.bootloader_locked }, + |m: &mut Features| { &mut m.bootloader_locked }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "language_version_matches", + |m: &Features| { &m.language_version_matches }, + |m: &mut Features| { &mut m.language_version_matches }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "unit_packaging", + |m: &Features| { &m.unit_packaging }, + |m: &mut Features| { &mut m.unit_packaging }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Features", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Features { + const NAME: &'static str = "Features"; + + fn is_initialized(&self) -> bool { + if self.major_version.is_none() { + return false; + } + if self.minor_version.is_none() { + return false; + } + if self.patch_version.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.vendor = ::std::option::Option::Some(is.read_string()?); + }, + 16 => { + self.major_version = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.minor_version = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.patch_version = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.bootloader_mode = ::std::option::Option::Some(is.read_bool()?); + }, + 50 => { + self.device_id = ::std::option::Option::Some(is.read_string()?); + }, + 56 => { + self.pin_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 64 => { + self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 74 => { + self.language = ::std::option::Option::Some(is.read_string()?); + }, + 82 => { + self.label = ::std::option::Option::Some(is.read_string()?); + }, + 96 => { + self.initialized = ::std::option::Option::Some(is.read_bool()?); + }, + 106 => { + self.revision = ::std::option::Option::Some(is.read_bytes()?); + }, + 114 => { + self.bootloader_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 120 => { + self.imported = ::std::option::Option::Some(is.read_bool()?); + }, + 128 => { + self.unlocked = ::std::option::Option::Some(is.read_bool()?); + }, + 136 => { + self._passphrase_cached = ::std::option::Option::Some(is.read_bool()?); + }, + 144 => { + self.firmware_present = ::std::option::Option::Some(is.read_bool()?); + }, + 152 => { + self.needs_backup = ::std::option::Option::Some(is.read_bool()?); + }, + 160 => { + self.flags = ::std::option::Option::Some(is.read_uint32()?); + }, + 170 => { + self.model = ::std::option::Option::Some(is.read_string()?); + }, + 176 => { + self.fw_major = ::std::option::Option::Some(is.read_uint32()?); + }, + 184 => { + self.fw_minor = ::std::option::Option::Some(is.read_uint32()?); + }, + 192 => { + self.fw_patch = ::std::option::Option::Some(is.read_uint32()?); + }, + 202 => { + self.fw_vendor = ::std::option::Option::Some(is.read_string()?); + }, + 216 => { + self.unfinished_backup = ::std::option::Option::Some(is.read_bool()?); + }, + 224 => { + self.no_backup = ::std::option::Option::Some(is.read_bool()?); + }, + 232 => { + self.recovery_mode = ::std::option::Option::Some(is.read_bool()?); + }, + 240 => { + self.capabilities.push(is.read_enum_or_unknown()?); + }, + 242 => { + ::protobuf::rt::read_repeated_packed_enum_or_unknown_into(is, &mut self.capabilities)? + }, + 248 => { + self.backup_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 256 => { + self.sd_card_present = ::std::option::Option::Some(is.read_bool()?); + }, + 264 => { + self.sd_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 272 => { + self.wipe_code_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 282 => { + self.session_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 288 => { + self.passphrase_always_on_device = ::std::option::Option::Some(is.read_bool()?); + }, + 296 => { + self.safety_checks = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 304 => { + self.auto_lock_delay_ms = ::std::option::Option::Some(is.read_uint32()?); + }, + 312 => { + self.display_rotation = ::std::option::Option::Some(is.read_uint32()?); + }, + 320 => { + self.experimental_features = ::std::option::Option::Some(is.read_bool()?); + }, + 328 => { + self.busy = ::std::option::Option::Some(is.read_bool()?); + }, + 336 => { + self.homescreen_format = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 344 => { + self.hide_passphrase_from_host = ::std::option::Option::Some(is.read_bool()?); + }, + 354 => { + self.internal_model = ::std::option::Option::Some(is.read_string()?); + }, + 360 => { + self.unit_color = ::std::option::Option::Some(is.read_uint32()?); + }, + 368 => { + self.unit_btconly = ::std::option::Option::Some(is.read_bool()?); + }, + 376 => { + self.homescreen_width = ::std::option::Option::Some(is.read_uint32()?); + }, + 384 => { + self.homescreen_height = ::std::option::Option::Some(is.read_uint32()?); + }, + 392 => { + self.bootloader_locked = ::std::option::Option::Some(is.read_bool()?); + }, + 400 => { + self.language_version_matches = ::std::option::Option::Some(is.read_bool()?); + }, + 408 => { + self.unit_packaging = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.vendor.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.major_version { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.minor_version { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.patch_version { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.bootloader_mode { + my_size += 1 + 1; + } + if let Some(v) = self.device_id.as_ref() { + my_size += ::protobuf::rt::string_size(6, &v); + } + if let Some(v) = self.pin_protection { + my_size += 1 + 1; + } + if let Some(v) = self.passphrase_protection { + my_size += 1 + 1; + } + if let Some(v) = self.language.as_ref() { + my_size += ::protobuf::rt::string_size(9, &v); + } + if let Some(v) = self.label.as_ref() { + my_size += ::protobuf::rt::string_size(10, &v); + } + if let Some(v) = self.initialized { + my_size += 1 + 1; + } + if let Some(v) = self.revision.as_ref() { + my_size += ::protobuf::rt::bytes_size(13, &v); + } + if let Some(v) = self.bootloader_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(14, &v); + } + if let Some(v) = self.imported { + my_size += 1 + 1; + } + if let Some(v) = self.unlocked { + my_size += 2 + 1; + } + if let Some(v) = self._passphrase_cached { + my_size += 2 + 1; + } + if let Some(v) = self.firmware_present { + my_size += 2 + 1; + } + if let Some(v) = self.needs_backup { + my_size += 2 + 1; + } + if let Some(v) = self.flags { + my_size += ::protobuf::rt::uint32_size(20, v); + } + if let Some(v) = self.model.as_ref() { + my_size += ::protobuf::rt::string_size(21, &v); + } + if let Some(v) = self.fw_major { + my_size += ::protobuf::rt::uint32_size(22, v); + } + if let Some(v) = self.fw_minor { + my_size += ::protobuf::rt::uint32_size(23, v); + } + if let Some(v) = self.fw_patch { + my_size += ::protobuf::rt::uint32_size(24, v); + } + if let Some(v) = self.fw_vendor.as_ref() { + my_size += ::protobuf::rt::string_size(25, &v); + } + if let Some(v) = self.unfinished_backup { + my_size += 2 + 1; + } + if let Some(v) = self.no_backup { + my_size += 2 + 1; + } + if let Some(v) = self.recovery_mode { + my_size += 2 + 1; + } + for value in &self.capabilities { + my_size += ::protobuf::rt::int32_size(30, value.value()); + }; + if let Some(v) = self.backup_type { + my_size += ::protobuf::rt::int32_size(31, v.value()); + } + if let Some(v) = self.sd_card_present { + my_size += 2 + 1; + } + if let Some(v) = self.sd_protection { + my_size += 2 + 1; + } + if let Some(v) = self.wipe_code_protection { + my_size += 2 + 1; + } + if let Some(v) = self.session_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(35, &v); + } + if let Some(v) = self.passphrase_always_on_device { + my_size += 2 + 1; + } + if let Some(v) = self.safety_checks { + my_size += ::protobuf::rt::int32_size(37, v.value()); + } + if let Some(v) = self.auto_lock_delay_ms { + my_size += ::protobuf::rt::uint32_size(38, v); + } + if let Some(v) = self.display_rotation { + my_size += ::protobuf::rt::uint32_size(39, v); + } + if let Some(v) = self.experimental_features { + my_size += 2 + 1; + } + if let Some(v) = self.busy { + my_size += 2 + 1; + } + if let Some(v) = self.homescreen_format { + my_size += ::protobuf::rt::int32_size(42, v.value()); + } + if let Some(v) = self.hide_passphrase_from_host { + my_size += 2 + 1; + } + if let Some(v) = self.internal_model.as_ref() { + my_size += ::protobuf::rt::string_size(44, &v); + } + if let Some(v) = self.unit_color { + my_size += ::protobuf::rt::uint32_size(45, v); + } + if let Some(v) = self.unit_btconly { + my_size += 2 + 1; + } + if let Some(v) = self.homescreen_width { + my_size += ::protobuf::rt::uint32_size(47, v); + } + if let Some(v) = self.homescreen_height { + my_size += ::protobuf::rt::uint32_size(48, v); + } + if let Some(v) = self.bootloader_locked { + my_size += 2 + 1; + } + if let Some(v) = self.language_version_matches { + my_size += 2 + 1; + } + if let Some(v) = self.unit_packaging { + my_size += ::protobuf::rt::uint32_size(51, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.vendor.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.major_version { + os.write_uint32(2, v)?; + } + if let Some(v) = self.minor_version { + os.write_uint32(3, v)?; + } + if let Some(v) = self.patch_version { + os.write_uint32(4, v)?; + } + if let Some(v) = self.bootloader_mode { + os.write_bool(5, v)?; + } + if let Some(v) = self.device_id.as_ref() { + os.write_string(6, v)?; + } + if let Some(v) = self.pin_protection { + os.write_bool(7, v)?; + } + if let Some(v) = self.passphrase_protection { + os.write_bool(8, v)?; + } + if let Some(v) = self.language.as_ref() { + os.write_string(9, v)?; + } + if let Some(v) = self.label.as_ref() { + os.write_string(10, v)?; + } + if let Some(v) = self.initialized { + os.write_bool(12, v)?; + } + if let Some(v) = self.revision.as_ref() { + os.write_bytes(13, v)?; + } + if let Some(v) = self.bootloader_hash.as_ref() { + os.write_bytes(14, v)?; + } + if let Some(v) = self.imported { + os.write_bool(15, v)?; + } + if let Some(v) = self.unlocked { + os.write_bool(16, v)?; + } + if let Some(v) = self._passphrase_cached { + os.write_bool(17, v)?; + } + if let Some(v) = self.firmware_present { + os.write_bool(18, v)?; + } + if let Some(v) = self.needs_backup { + os.write_bool(19, v)?; + } + if let Some(v) = self.flags { + os.write_uint32(20, v)?; + } + if let Some(v) = self.model.as_ref() { + os.write_string(21, v)?; + } + if let Some(v) = self.fw_major { + os.write_uint32(22, v)?; + } + if let Some(v) = self.fw_minor { + os.write_uint32(23, v)?; + } + if let Some(v) = self.fw_patch { + os.write_uint32(24, v)?; + } + if let Some(v) = self.fw_vendor.as_ref() { + os.write_string(25, v)?; + } + if let Some(v) = self.unfinished_backup { + os.write_bool(27, v)?; + } + if let Some(v) = self.no_backup { + os.write_bool(28, v)?; + } + if let Some(v) = self.recovery_mode { + os.write_bool(29, v)?; + } + for v in &self.capabilities { + os.write_enum(30, ::protobuf::EnumOrUnknown::value(v))?; + }; + if let Some(v) = self.backup_type { + os.write_enum(31, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.sd_card_present { + os.write_bool(32, v)?; + } + if let Some(v) = self.sd_protection { + os.write_bool(33, v)?; + } + if let Some(v) = self.wipe_code_protection { + os.write_bool(34, v)?; + } + if let Some(v) = self.session_id.as_ref() { + os.write_bytes(35, v)?; + } + if let Some(v) = self.passphrase_always_on_device { + os.write_bool(36, v)?; + } + if let Some(v) = self.safety_checks { + os.write_enum(37, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.auto_lock_delay_ms { + os.write_uint32(38, v)?; + } + if let Some(v) = self.display_rotation { + os.write_uint32(39, v)?; + } + if let Some(v) = self.experimental_features { + os.write_bool(40, v)?; + } + if let Some(v) = self.busy { + os.write_bool(41, v)?; + } + if let Some(v) = self.homescreen_format { + os.write_enum(42, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.hide_passphrase_from_host { + os.write_bool(43, v)?; + } + if let Some(v) = self.internal_model.as_ref() { + os.write_string(44, v)?; + } + if let Some(v) = self.unit_color { + os.write_uint32(45, v)?; + } + if let Some(v) = self.unit_btconly { + os.write_bool(46, v)?; + } + if let Some(v) = self.homescreen_width { + os.write_uint32(47, v)?; + } + if let Some(v) = self.homescreen_height { + os.write_uint32(48, v)?; + } + if let Some(v) = self.bootloader_locked { + os.write_bool(49, v)?; + } + if let Some(v) = self.language_version_matches { + os.write_bool(50, v)?; + } + if let Some(v) = self.unit_packaging { + os.write_uint32(51, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Features { + Features::new() + } + + fn clear(&mut self) { + self.vendor = ::std::option::Option::None; + self.major_version = ::std::option::Option::None; + self.minor_version = ::std::option::Option::None; + self.patch_version = ::std::option::Option::None; + self.bootloader_mode = ::std::option::Option::None; + self.device_id = ::std::option::Option::None; + self.pin_protection = ::std::option::Option::None; + self.passphrase_protection = ::std::option::Option::None; + self.language = ::std::option::Option::None; + self.label = ::std::option::Option::None; + self.initialized = ::std::option::Option::None; + self.revision = ::std::option::Option::None; + self.bootloader_hash = ::std::option::Option::None; + self.imported = ::std::option::Option::None; + self.unlocked = ::std::option::Option::None; + self._passphrase_cached = ::std::option::Option::None; + self.firmware_present = ::std::option::Option::None; + self.needs_backup = ::std::option::Option::None; + self.flags = ::std::option::Option::None; + self.model = ::std::option::Option::None; + self.fw_major = ::std::option::Option::None; + self.fw_minor = ::std::option::Option::None; + self.fw_patch = ::std::option::Option::None; + self.fw_vendor = ::std::option::Option::None; + self.unfinished_backup = ::std::option::Option::None; + self.no_backup = ::std::option::Option::None; + self.recovery_mode = ::std::option::Option::None; + self.capabilities.clear(); + self.backup_type = ::std::option::Option::None; + self.sd_card_present = ::std::option::Option::None; + self.sd_protection = ::std::option::Option::None; + self.wipe_code_protection = ::std::option::Option::None; + self.session_id = ::std::option::Option::None; + self.passphrase_always_on_device = ::std::option::Option::None; + self.safety_checks = ::std::option::Option::None; + self.auto_lock_delay_ms = ::std::option::Option::None; + self.display_rotation = ::std::option::Option::None; + self.experimental_features = ::std::option::Option::None; + self.busy = ::std::option::Option::None; + self.homescreen_format = ::std::option::Option::None; + self.hide_passphrase_from_host = ::std::option::Option::None; + self.internal_model = ::std::option::Option::None; + self.unit_color = ::std::option::Option::None; + self.unit_btconly = ::std::option::Option::None; + self.homescreen_width = ::std::option::Option::None; + self.homescreen_height = ::std::option::Option::None; + self.bootloader_locked = ::std::option::Option::None; + self.language_version_matches = ::std::option::Option::None; + self.unit_packaging = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Features { + static instance: Features = Features { + vendor: ::std::option::Option::None, + major_version: ::std::option::Option::None, + minor_version: ::std::option::Option::None, + patch_version: ::std::option::Option::None, + bootloader_mode: ::std::option::Option::None, + device_id: ::std::option::Option::None, + pin_protection: ::std::option::Option::None, + passphrase_protection: ::std::option::Option::None, + language: ::std::option::Option::None, + label: ::std::option::Option::None, + initialized: ::std::option::Option::None, + revision: ::std::option::Option::None, + bootloader_hash: ::std::option::Option::None, + imported: ::std::option::Option::None, + unlocked: ::std::option::Option::None, + _passphrase_cached: ::std::option::Option::None, + firmware_present: ::std::option::Option::None, + needs_backup: ::std::option::Option::None, + flags: ::std::option::Option::None, + model: ::std::option::Option::None, + fw_major: ::std::option::Option::None, + fw_minor: ::std::option::Option::None, + fw_patch: ::std::option::Option::None, + fw_vendor: ::std::option::Option::None, + unfinished_backup: ::std::option::Option::None, + no_backup: ::std::option::Option::None, + recovery_mode: ::std::option::Option::None, + capabilities: ::std::vec::Vec::new(), + backup_type: ::std::option::Option::None, + sd_card_present: ::std::option::Option::None, + sd_protection: ::std::option::Option::None, + wipe_code_protection: ::std::option::Option::None, + session_id: ::std::option::Option::None, + passphrase_always_on_device: ::std::option::Option::None, + safety_checks: ::std::option::Option::None, + auto_lock_delay_ms: ::std::option::Option::None, + display_rotation: ::std::option::Option::None, + experimental_features: ::std::option::Option::None, + busy: ::std::option::Option::None, + homescreen_format: ::std::option::Option::None, + hide_passphrase_from_host: ::std::option::Option::None, + internal_model: ::std::option::Option::None, + unit_color: ::std::option::Option::None, + unit_btconly: ::std::option::Option::None, + homescreen_width: ::std::option::Option::None, + homescreen_height: ::std::option::Option::None, + bootloader_locked: ::std::option::Option::None, + language_version_matches: ::std::option::Option::None, + unit_packaging: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Features { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Features").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Features { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Features { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `Features` +pub mod features { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.management.Features.Capability) + pub enum Capability { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Bitcoin) + Capability_Bitcoin = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Bitcoin_like) + Capability_Bitcoin_like = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Binance) + Capability_Binance = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Cardano) + Capability_Cardano = 4, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Crypto) + Capability_Crypto = 5, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_EOS) + Capability_EOS = 6, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Ethereum) + Capability_Ethereum = 7, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Lisk) + Capability_Lisk = 8, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Monero) + Capability_Monero = 9, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_NEM) + Capability_NEM = 10, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Ripple) + Capability_Ripple = 11, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Stellar) + Capability_Stellar = 12, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Tezos) + Capability_Tezos = 13, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_U2F) + Capability_U2F = 14, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Shamir) + Capability_Shamir = 15, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_ShamirGroups) + Capability_ShamirGroups = 16, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_PassphraseEntry) + Capability_PassphraseEntry = 17, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Solana) + Capability_Solana = 18, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Translations) + Capability_Translations = 19, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Mintlayer) + Capability_Mintlayer = 20, + } + + impl ::protobuf::Enum for Capability { + const NAME: &'static str = "Capability"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(Capability::Capability_Bitcoin), + 2 => ::std::option::Option::Some(Capability::Capability_Bitcoin_like), + 3 => ::std::option::Option::Some(Capability::Capability_Binance), + 4 => ::std::option::Option::Some(Capability::Capability_Cardano), + 5 => ::std::option::Option::Some(Capability::Capability_Crypto), + 6 => ::std::option::Option::Some(Capability::Capability_EOS), + 7 => ::std::option::Option::Some(Capability::Capability_Ethereum), + 8 => ::std::option::Option::Some(Capability::Capability_Lisk), + 9 => ::std::option::Option::Some(Capability::Capability_Monero), + 10 => ::std::option::Option::Some(Capability::Capability_NEM), + 11 => ::std::option::Option::Some(Capability::Capability_Ripple), + 12 => ::std::option::Option::Some(Capability::Capability_Stellar), + 13 => ::std::option::Option::Some(Capability::Capability_Tezos), + 14 => ::std::option::Option::Some(Capability::Capability_U2F), + 15 => ::std::option::Option::Some(Capability::Capability_Shamir), + 16 => ::std::option::Option::Some(Capability::Capability_ShamirGroups), + 17 => ::std::option::Option::Some(Capability::Capability_PassphraseEntry), + 18 => ::std::option::Option::Some(Capability::Capability_Solana), + 19 => ::std::option::Option::Some(Capability::Capability_Translations), + 20 => ::std::option::Option::Some(Capability::Capability_Mintlayer), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Capability_Bitcoin" => ::std::option::Option::Some(Capability::Capability_Bitcoin), + "Capability_Bitcoin_like" => ::std::option::Option::Some(Capability::Capability_Bitcoin_like), + "Capability_Binance" => ::std::option::Option::Some(Capability::Capability_Binance), + "Capability_Cardano" => ::std::option::Option::Some(Capability::Capability_Cardano), + "Capability_Crypto" => ::std::option::Option::Some(Capability::Capability_Crypto), + "Capability_EOS" => ::std::option::Option::Some(Capability::Capability_EOS), + "Capability_Ethereum" => ::std::option::Option::Some(Capability::Capability_Ethereum), + "Capability_Lisk" => ::std::option::Option::Some(Capability::Capability_Lisk), + "Capability_Monero" => ::std::option::Option::Some(Capability::Capability_Monero), + "Capability_NEM" => ::std::option::Option::Some(Capability::Capability_NEM), + "Capability_Ripple" => ::std::option::Option::Some(Capability::Capability_Ripple), + "Capability_Stellar" => ::std::option::Option::Some(Capability::Capability_Stellar), + "Capability_Tezos" => ::std::option::Option::Some(Capability::Capability_Tezos), + "Capability_U2F" => ::std::option::Option::Some(Capability::Capability_U2F), + "Capability_Shamir" => ::std::option::Option::Some(Capability::Capability_Shamir), + "Capability_ShamirGroups" => ::std::option::Option::Some(Capability::Capability_ShamirGroups), + "Capability_PassphraseEntry" => ::std::option::Option::Some(Capability::Capability_PassphraseEntry), + "Capability_Solana" => ::std::option::Option::Some(Capability::Capability_Solana), + "Capability_Translations" => ::std::option::Option::Some(Capability::Capability_Translations), + "Capability_Mintlayer" => ::std::option::Option::Some(Capability::Capability_Mintlayer), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [Capability] = &[ + Capability::Capability_Bitcoin, + Capability::Capability_Bitcoin_like, + Capability::Capability_Binance, + Capability::Capability_Cardano, + Capability::Capability_Crypto, + Capability::Capability_EOS, + Capability::Capability_Ethereum, + Capability::Capability_Lisk, + Capability::Capability_Monero, + Capability::Capability_NEM, + Capability::Capability_Ripple, + Capability::Capability_Stellar, + Capability::Capability_Tezos, + Capability::Capability_U2F, + Capability::Capability_Shamir, + Capability::Capability_ShamirGroups, + Capability::Capability_PassphraseEntry, + Capability::Capability_Solana, + Capability::Capability_Translations, + Capability::Capability_Mintlayer, + ]; + } + + impl ::protobuf::EnumFull for Capability { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Features.Capability").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + Capability::Capability_Bitcoin => 0, + Capability::Capability_Bitcoin_like => 1, + Capability::Capability_Binance => 2, + Capability::Capability_Cardano => 3, + Capability::Capability_Crypto => 4, + Capability::Capability_EOS => 5, + Capability::Capability_Ethereum => 6, + Capability::Capability_Lisk => 7, + Capability::Capability_Monero => 8, + Capability::Capability_NEM => 9, + Capability::Capability_Ripple => 10, + Capability::Capability_Stellar => 11, + Capability::Capability_Tezos => 12, + Capability::Capability_U2F => 13, + Capability::Capability_Shamir => 14, + Capability::Capability_ShamirGroups => 15, + Capability::Capability_PassphraseEntry => 16, + Capability::Capability_Solana => 17, + Capability::Capability_Translations => 18, + Capability::Capability_Mintlayer => 19, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for Capability { + fn default() -> Self { + Capability::Capability_Bitcoin + } + } + + impl Capability { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Features.Capability") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.LockDevice) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct LockDevice { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.LockDevice.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a LockDevice { + fn default() -> &'a LockDevice { + ::default_instance() + } +} + +impl LockDevice { + pub fn new() -> LockDevice { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "LockDevice", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for LockDevice { + const NAME: &'static str = "LockDevice"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> LockDevice { + LockDevice::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static LockDevice { + static instance: LockDevice = LockDevice { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for LockDevice { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("LockDevice").unwrap()).clone() + } +} + +impl ::std::fmt::Display for LockDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LockDevice { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.SetBusy) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SetBusy { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.SetBusy.expiry_ms) + pub expiry_ms: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.SetBusy.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SetBusy { + fn default() -> &'a SetBusy { + ::default_instance() + } +} + +impl SetBusy { + pub fn new() -> SetBusy { + ::std::default::Default::default() + } + + // optional uint32 expiry_ms = 1; + + pub fn expiry_ms(&self) -> u32 { + self.expiry_ms.unwrap_or(0) + } + + pub fn clear_expiry_ms(&mut self) { + self.expiry_ms = ::std::option::Option::None; + } + + pub fn has_expiry_ms(&self) -> bool { + self.expiry_ms.is_some() + } + + // Param is passed by value, moved + pub fn set_expiry_ms(&mut self, v: u32) { + self.expiry_ms = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "expiry_ms", + |m: &SetBusy| { &m.expiry_ms }, + |m: &mut SetBusy| { &mut m.expiry_ms }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SetBusy", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SetBusy { + const NAME: &'static str = "SetBusy"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.expiry_ms = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.expiry_ms { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.expiry_ms { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SetBusy { + SetBusy::new() + } + + fn clear(&mut self) { + self.expiry_ms = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SetBusy { + static instance: SetBusy = SetBusy { + expiry_ms: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SetBusy { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SetBusy").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SetBusy { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SetBusy { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.EndSession) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EndSession { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.EndSession.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EndSession { + fn default() -> &'a EndSession { + ::default_instance() + } +} + +impl EndSession { + pub fn new() -> EndSession { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EndSession", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EndSession { + const NAME: &'static str = "EndSession"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EndSession { + EndSession::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static EndSession { + static instance: EndSession = EndSession { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EndSession { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EndSession").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EndSession { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EndSession { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.ApplySettings) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ApplySettings { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.language) + pub language: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.label) + pub label: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.use_passphrase) + pub use_passphrase: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.homescreen) + pub homescreen: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings._passphrase_source) + pub _passphrase_source: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.auto_lock_delay_ms) + pub auto_lock_delay_ms: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.display_rotation) + pub display_rotation: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.passphrase_always_on_device) + pub passphrase_always_on_device: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.safety_checks) + pub safety_checks: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.experimental_features) + pub experimental_features: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.hide_passphrase_from_host) + pub hide_passphrase_from_host: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ApplySettings.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ApplySettings { + fn default() -> &'a ApplySettings { + ::default_instance() + } +} + +impl ApplySettings { + pub fn new() -> ApplySettings { + ::std::default::Default::default() + } + + // optional string language = 1; + + pub fn language(&self) -> &str { + match self.language.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_language(&mut self) { + self.language = ::std::option::Option::None; + } + + pub fn has_language(&self) -> bool { + self.language.is_some() + } + + // Param is passed by value, moved + pub fn set_language(&mut self, v: ::std::string::String) { + self.language = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_language(&mut self) -> &mut ::std::string::String { + if self.language.is_none() { + self.language = ::std::option::Option::Some(::std::string::String::new()); + } + self.language.as_mut().unwrap() + } + + // Take field + pub fn take_language(&mut self) -> ::std::string::String { + self.language.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string label = 2; + + pub fn label(&self) -> &str { + match self.label.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_label(&mut self) { + self.label = ::std::option::Option::None; + } + + pub fn has_label(&self) -> bool { + self.label.is_some() + } + + // Param is passed by value, moved + pub fn set_label(&mut self, v: ::std::string::String) { + self.label = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_label(&mut self) -> &mut ::std::string::String { + if self.label.is_none() { + self.label = ::std::option::Option::Some(::std::string::String::new()); + } + self.label.as_mut().unwrap() + } + + // Take field + pub fn take_label(&mut self) -> ::std::string::String { + self.label.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool use_passphrase = 3; + + pub fn use_passphrase(&self) -> bool { + self.use_passphrase.unwrap_or(false) + } + + pub fn clear_use_passphrase(&mut self) { + self.use_passphrase = ::std::option::Option::None; + } + + pub fn has_use_passphrase(&self) -> bool { + self.use_passphrase.is_some() + } + + // Param is passed by value, moved + pub fn set_use_passphrase(&mut self, v: bool) { + self.use_passphrase = ::std::option::Option::Some(v); + } + + // optional bytes homescreen = 4; + + pub fn homescreen(&self) -> &[u8] { + match self.homescreen.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_homescreen(&mut self) { + self.homescreen = ::std::option::Option::None; + } + + pub fn has_homescreen(&self) -> bool { + self.homescreen.is_some() + } + + // Param is passed by value, moved + pub fn set_homescreen(&mut self, v: ::std::vec::Vec) { + self.homescreen = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_homescreen(&mut self) -> &mut ::std::vec::Vec { + if self.homescreen.is_none() { + self.homescreen = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.homescreen.as_mut().unwrap() + } + + // Take field + pub fn take_homescreen(&mut self) -> ::std::vec::Vec { + self.homescreen.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 _passphrase_source = 5; + + pub fn _passphrase_source(&self) -> u32 { + self._passphrase_source.unwrap_or(0) + } + + pub fn clear__passphrase_source(&mut self) { + self._passphrase_source = ::std::option::Option::None; + } + + pub fn has__passphrase_source(&self) -> bool { + self._passphrase_source.is_some() + } + + // Param is passed by value, moved + pub fn set__passphrase_source(&mut self, v: u32) { + self._passphrase_source = ::std::option::Option::Some(v); + } + + // optional uint32 auto_lock_delay_ms = 6; + + pub fn auto_lock_delay_ms(&self) -> u32 { + self.auto_lock_delay_ms.unwrap_or(0) + } + + pub fn clear_auto_lock_delay_ms(&mut self) { + self.auto_lock_delay_ms = ::std::option::Option::None; + } + + pub fn has_auto_lock_delay_ms(&self) -> bool { + self.auto_lock_delay_ms.is_some() + } + + // Param is passed by value, moved + pub fn set_auto_lock_delay_ms(&mut self, v: u32) { + self.auto_lock_delay_ms = ::std::option::Option::Some(v); + } + + // optional uint32 display_rotation = 7; + + pub fn display_rotation(&self) -> u32 { + self.display_rotation.unwrap_or(0) + } + + pub fn clear_display_rotation(&mut self) { + self.display_rotation = ::std::option::Option::None; + } + + pub fn has_display_rotation(&self) -> bool { + self.display_rotation.is_some() + } + + // Param is passed by value, moved + pub fn set_display_rotation(&mut self, v: u32) { + self.display_rotation = ::std::option::Option::Some(v); + } + + // optional bool passphrase_always_on_device = 8; + + pub fn passphrase_always_on_device(&self) -> bool { + self.passphrase_always_on_device.unwrap_or(false) + } + + pub fn clear_passphrase_always_on_device(&mut self) { + self.passphrase_always_on_device = ::std::option::Option::None; + } + + pub fn has_passphrase_always_on_device(&self) -> bool { + self.passphrase_always_on_device.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase_always_on_device(&mut self, v: bool) { + self.passphrase_always_on_device = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.management.SafetyCheckLevel safety_checks = 9; + + pub fn safety_checks(&self) -> SafetyCheckLevel { + match self.safety_checks { + Some(e) => e.enum_value_or(SafetyCheckLevel::Strict), + None => SafetyCheckLevel::Strict, + } + } + + pub fn clear_safety_checks(&mut self) { + self.safety_checks = ::std::option::Option::None; + } + + pub fn has_safety_checks(&self) -> bool { + self.safety_checks.is_some() + } + + // Param is passed by value, moved + pub fn set_safety_checks(&mut self, v: SafetyCheckLevel) { + self.safety_checks = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bool experimental_features = 10; + + pub fn experimental_features(&self) -> bool { + self.experimental_features.unwrap_or(false) + } + + pub fn clear_experimental_features(&mut self) { + self.experimental_features = ::std::option::Option::None; + } + + pub fn has_experimental_features(&self) -> bool { + self.experimental_features.is_some() + } + + // Param is passed by value, moved + pub fn set_experimental_features(&mut self, v: bool) { + self.experimental_features = ::std::option::Option::Some(v); + } + + // optional bool hide_passphrase_from_host = 11; + + pub fn hide_passphrase_from_host(&self) -> bool { + self.hide_passphrase_from_host.unwrap_or(false) + } + + pub fn clear_hide_passphrase_from_host(&mut self) { + self.hide_passphrase_from_host = ::std::option::Option::None; + } + + pub fn has_hide_passphrase_from_host(&self) -> bool { + self.hide_passphrase_from_host.is_some() + } + + // Param is passed by value, moved + pub fn set_hide_passphrase_from_host(&mut self, v: bool) { + self.hide_passphrase_from_host = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(11); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "language", + |m: &ApplySettings| { &m.language }, + |m: &mut ApplySettings| { &mut m.language }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "label", + |m: &ApplySettings| { &m.label }, + |m: &mut ApplySettings| { &mut m.label }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "use_passphrase", + |m: &ApplySettings| { &m.use_passphrase }, + |m: &mut ApplySettings| { &mut m.use_passphrase }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "homescreen", + |m: &ApplySettings| { &m.homescreen }, + |m: &mut ApplySettings| { &mut m.homescreen }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "_passphrase_source", + |m: &ApplySettings| { &m._passphrase_source }, + |m: &mut ApplySettings| { &mut m._passphrase_source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "auto_lock_delay_ms", + |m: &ApplySettings| { &m.auto_lock_delay_ms }, + |m: &mut ApplySettings| { &mut m.auto_lock_delay_ms }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "display_rotation", + |m: &ApplySettings| { &m.display_rotation }, + |m: &mut ApplySettings| { &mut m.display_rotation }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase_always_on_device", + |m: &ApplySettings| { &m.passphrase_always_on_device }, + |m: &mut ApplySettings| { &mut m.passphrase_always_on_device }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "safety_checks", + |m: &ApplySettings| { &m.safety_checks }, + |m: &mut ApplySettings| { &mut m.safety_checks }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "experimental_features", + |m: &ApplySettings| { &m.experimental_features }, + |m: &mut ApplySettings| { &mut m.experimental_features }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hide_passphrase_from_host", + |m: &ApplySettings| { &m.hide_passphrase_from_host }, + |m: &mut ApplySettings| { &mut m.hide_passphrase_from_host }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ApplySettings", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ApplySettings { + const NAME: &'static str = "ApplySettings"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.language = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.label = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.use_passphrase = ::std::option::Option::Some(is.read_bool()?); + }, + 34 => { + self.homescreen = ::std::option::Option::Some(is.read_bytes()?); + }, + 40 => { + self._passphrase_source = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.auto_lock_delay_ms = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.display_rotation = ::std::option::Option::Some(is.read_uint32()?); + }, + 64 => { + self.passphrase_always_on_device = ::std::option::Option::Some(is.read_bool()?); + }, + 72 => { + self.safety_checks = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 80 => { + self.experimental_features = ::std::option::Option::Some(is.read_bool()?); + }, + 88 => { + self.hide_passphrase_from_host = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.language.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.label.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.use_passphrase { + my_size += 1 + 1; + } + if let Some(v) = self.homescreen.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self._passphrase_source { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.auto_lock_delay_ms { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.display_rotation { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.passphrase_always_on_device { + my_size += 1 + 1; + } + if let Some(v) = self.safety_checks { + my_size += ::protobuf::rt::int32_size(9, v.value()); + } + if let Some(v) = self.experimental_features { + my_size += 1 + 1; + } + if let Some(v) = self.hide_passphrase_from_host { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.language.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.label.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.use_passphrase { + os.write_bool(3, v)?; + } + if let Some(v) = self.homescreen.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self._passphrase_source { + os.write_uint32(5, v)?; + } + if let Some(v) = self.auto_lock_delay_ms { + os.write_uint32(6, v)?; + } + if let Some(v) = self.display_rotation { + os.write_uint32(7, v)?; + } + if let Some(v) = self.passphrase_always_on_device { + os.write_bool(8, v)?; + } + if let Some(v) = self.safety_checks { + os.write_enum(9, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.experimental_features { + os.write_bool(10, v)?; + } + if let Some(v) = self.hide_passphrase_from_host { + os.write_bool(11, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ApplySettings { + ApplySettings::new() + } + + fn clear(&mut self) { + self.language = ::std::option::Option::None; + self.label = ::std::option::Option::None; + self.use_passphrase = ::std::option::Option::None; + self.homescreen = ::std::option::Option::None; + self._passphrase_source = ::std::option::Option::None; + self.auto_lock_delay_ms = ::std::option::Option::None; + self.display_rotation = ::std::option::Option::None; + self.passphrase_always_on_device = ::std::option::Option::None; + self.safety_checks = ::std::option::Option::None; + self.experimental_features = ::std::option::Option::None; + self.hide_passphrase_from_host = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ApplySettings { + static instance: ApplySettings = ApplySettings { + language: ::std::option::Option::None, + label: ::std::option::Option::None, + use_passphrase: ::std::option::Option::None, + homescreen: ::std::option::Option::None, + _passphrase_source: ::std::option::Option::None, + auto_lock_delay_ms: ::std::option::Option::None, + display_rotation: ::std::option::Option::None, + passphrase_always_on_device: ::std::option::Option::None, + safety_checks: ::std::option::Option::None, + experimental_features: ::std::option::Option::None, + hide_passphrase_from_host: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ApplySettings { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ApplySettings").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ApplySettings { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ApplySettings { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.ChangeLanguage) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ChangeLanguage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangeLanguage.data_length) + pub data_length: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangeLanguage.show_display) + pub show_display: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ChangeLanguage.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ChangeLanguage { + fn default() -> &'a ChangeLanguage { + ::default_instance() + } +} + +impl ChangeLanguage { + pub fn new() -> ChangeLanguage { + ::std::default::Default::default() + } + + // required uint32 data_length = 1; + + pub fn data_length(&self) -> u32 { + self.data_length.unwrap_or(0) + } + + pub fn clear_data_length(&mut self) { + self.data_length = ::std::option::Option::None; + } + + pub fn has_data_length(&self) -> bool { + self.data_length.is_some() + } + + // Param is passed by value, moved + pub fn set_data_length(&mut self, v: u32) { + self.data_length = ::std::option::Option::Some(v); + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_length", + |m: &ChangeLanguage| { &m.data_length }, + |m: &mut ChangeLanguage| { &mut m.data_length }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &ChangeLanguage| { &m.show_display }, + |m: &mut ChangeLanguage| { &mut m.show_display }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ChangeLanguage", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ChangeLanguage { + const NAME: &'static str = "ChangeLanguage"; + + fn is_initialized(&self) -> bool { + if self.data_length.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.data_length = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_length { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_length { + os.write_uint32(1, v)?; + } + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ChangeLanguage { + ChangeLanguage::new() + } + + fn clear(&mut self) { + self.data_length = ::std::option::Option::None; + self.show_display = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ChangeLanguage { + static instance: ChangeLanguage = ChangeLanguage { + data_length: ::std::option::Option::None, + show_display: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ChangeLanguage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ChangeLanguage").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ChangeLanguage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ChangeLanguage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.TranslationDataRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TranslationDataRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.TranslationDataRequest.data_length) + pub data_length: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.TranslationDataRequest.data_offset) + pub data_offset: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.TranslationDataRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TranslationDataRequest { + fn default() -> &'a TranslationDataRequest { + ::default_instance() + } +} + +impl TranslationDataRequest { + pub fn new() -> TranslationDataRequest { + ::std::default::Default::default() + } + + // required uint32 data_length = 1; + + pub fn data_length(&self) -> u32 { + self.data_length.unwrap_or(0) + } + + pub fn clear_data_length(&mut self) { + self.data_length = ::std::option::Option::None; + } + + pub fn has_data_length(&self) -> bool { + self.data_length.is_some() + } + + // Param is passed by value, moved + pub fn set_data_length(&mut self, v: u32) { + self.data_length = ::std::option::Option::Some(v); + } + + // required uint32 data_offset = 2; + + pub fn data_offset(&self) -> u32 { + self.data_offset.unwrap_or(0) + } + + pub fn clear_data_offset(&mut self) { + self.data_offset = ::std::option::Option::None; + } + + pub fn has_data_offset(&self) -> bool { + self.data_offset.is_some() + } + + // Param is passed by value, moved + pub fn set_data_offset(&mut self, v: u32) { + self.data_offset = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_length", + |m: &TranslationDataRequest| { &m.data_length }, + |m: &mut TranslationDataRequest| { &mut m.data_length }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_offset", + |m: &TranslationDataRequest| { &m.data_offset }, + |m: &mut TranslationDataRequest| { &mut m.data_offset }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TranslationDataRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TranslationDataRequest { + const NAME: &'static str = "TranslationDataRequest"; + + fn is_initialized(&self) -> bool { + if self.data_length.is_none() { + return false; + } + if self.data_offset.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.data_length = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.data_offset = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_length { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.data_offset { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_length { + os.write_uint32(1, v)?; + } + if let Some(v) = self.data_offset { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TranslationDataRequest { + TranslationDataRequest::new() + } + + fn clear(&mut self) { + self.data_length = ::std::option::Option::None; + self.data_offset = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TranslationDataRequest { + static instance: TranslationDataRequest = TranslationDataRequest { + data_length: ::std::option::Option::None, + data_offset: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TranslationDataRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TranslationDataRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TranslationDataRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TranslationDataRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.TranslationDataAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TranslationDataAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.TranslationDataAck.data_chunk) + pub data_chunk: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.TranslationDataAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TranslationDataAck { + fn default() -> &'a TranslationDataAck { + ::default_instance() + } +} + +impl TranslationDataAck { + pub fn new() -> TranslationDataAck { + ::std::default::Default::default() + } + + // required bytes data_chunk = 1; + + pub fn data_chunk(&self) -> &[u8] { + match self.data_chunk.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data_chunk(&mut self) { + self.data_chunk = ::std::option::Option::None; + } + + pub fn has_data_chunk(&self) -> bool { + self.data_chunk.is_some() + } + + // Param is passed by value, moved + pub fn set_data_chunk(&mut self, v: ::std::vec::Vec) { + self.data_chunk = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data_chunk(&mut self) -> &mut ::std::vec::Vec { + if self.data_chunk.is_none() { + self.data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data_chunk.as_mut().unwrap() + } + + // Take field + pub fn take_data_chunk(&mut self) -> ::std::vec::Vec { + self.data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data_chunk", + |m: &TranslationDataAck| { &m.data_chunk }, + |m: &mut TranslationDataAck| { &mut m.data_chunk }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TranslationDataAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TranslationDataAck { + const NAME: &'static str = "TranslationDataAck"; + + fn is_initialized(&self) -> bool { + if self.data_chunk.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.data_chunk = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data_chunk.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data_chunk.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TranslationDataAck { + TranslationDataAck::new() + } + + fn clear(&mut self) { + self.data_chunk = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TranslationDataAck { + static instance: TranslationDataAck = TranslationDataAck { + data_chunk: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TranslationDataAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TranslationDataAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TranslationDataAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TranslationDataAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.ApplyFlags) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ApplyFlags { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplyFlags.flags) + pub flags: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ApplyFlags.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ApplyFlags { + fn default() -> &'a ApplyFlags { + ::default_instance() + } +} + +impl ApplyFlags { + pub fn new() -> ApplyFlags { + ::std::default::Default::default() + } + + // required uint32 flags = 1; + + pub fn flags(&self) -> u32 { + self.flags.unwrap_or(0) + } + + pub fn clear_flags(&mut self) { + self.flags = ::std::option::Option::None; + } + + pub fn has_flags(&self) -> bool { + self.flags.is_some() + } + + // Param is passed by value, moved + pub fn set_flags(&mut self, v: u32) { + self.flags = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "flags", + |m: &ApplyFlags| { &m.flags }, + |m: &mut ApplyFlags| { &mut m.flags }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ApplyFlags", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ApplyFlags { + const NAME: &'static str = "ApplyFlags"; + + fn is_initialized(&self) -> bool { + if self.flags.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.flags = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.flags { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.flags { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ApplyFlags { + ApplyFlags::new() + } + + fn clear(&mut self) { + self.flags = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ApplyFlags { + static instance: ApplyFlags = ApplyFlags { + flags: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ApplyFlags { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ApplyFlags").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ApplyFlags { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ApplyFlags { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.ChangePin) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ChangePin { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangePin.remove) + pub remove: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ChangePin.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ChangePin { + fn default() -> &'a ChangePin { + ::default_instance() + } +} + +impl ChangePin { + pub fn new() -> ChangePin { + ::std::default::Default::default() + } + + // optional bool remove = 1; + + pub fn remove(&self) -> bool { + self.remove.unwrap_or(false) + } + + pub fn clear_remove(&mut self) { + self.remove = ::std::option::Option::None; + } + + pub fn has_remove(&self) -> bool { + self.remove.is_some() + } + + // Param is passed by value, moved + pub fn set_remove(&mut self, v: bool) { + self.remove = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "remove", + |m: &ChangePin| { &m.remove }, + |m: &mut ChangePin| { &mut m.remove }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ChangePin", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ChangePin { + const NAME: &'static str = "ChangePin"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.remove = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.remove { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.remove { + os.write_bool(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ChangePin { + ChangePin::new() + } + + fn clear(&mut self) { + self.remove = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ChangePin { + static instance: ChangePin = ChangePin { + remove: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ChangePin { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ChangePin").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ChangePin { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ChangePin { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.ChangeWipeCode) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ChangeWipeCode { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangeWipeCode.remove) + pub remove: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ChangeWipeCode.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ChangeWipeCode { + fn default() -> &'a ChangeWipeCode { + ::default_instance() + } +} + +impl ChangeWipeCode { + pub fn new() -> ChangeWipeCode { + ::std::default::Default::default() + } + + // optional bool remove = 1; + + pub fn remove(&self) -> bool { + self.remove.unwrap_or(false) + } + + pub fn clear_remove(&mut self) { + self.remove = ::std::option::Option::None; + } + + pub fn has_remove(&self) -> bool { + self.remove.is_some() + } + + // Param is passed by value, moved + pub fn set_remove(&mut self, v: bool) { + self.remove = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "remove", + |m: &ChangeWipeCode| { &m.remove }, + |m: &mut ChangeWipeCode| { &mut m.remove }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ChangeWipeCode", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ChangeWipeCode { + const NAME: &'static str = "ChangeWipeCode"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.remove = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.remove { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.remove { + os.write_bool(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ChangeWipeCode { + ChangeWipeCode::new() + } + + fn clear(&mut self) { + self.remove = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ChangeWipeCode { + static instance: ChangeWipeCode = ChangeWipeCode { + remove: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ChangeWipeCode { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ChangeWipeCode").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ChangeWipeCode { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ChangeWipeCode { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.SdProtect) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SdProtect { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.SdProtect.operation) + pub operation: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.SdProtect.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SdProtect { + fn default() -> &'a SdProtect { + ::default_instance() + } +} + +impl SdProtect { + pub fn new() -> SdProtect { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.management.SdProtect.SdProtectOperationType operation = 1; + + pub fn operation(&self) -> sd_protect::SdProtectOperationType { + match self.operation { + Some(e) => e.enum_value_or(sd_protect::SdProtectOperationType::DISABLE), + None => sd_protect::SdProtectOperationType::DISABLE, + } + } + + pub fn clear_operation(&mut self) { + self.operation = ::std::option::Option::None; + } + + pub fn has_operation(&self) -> bool { + self.operation.is_some() + } + + // Param is passed by value, moved + pub fn set_operation(&mut self, v: sd_protect::SdProtectOperationType) { + self.operation = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "operation", + |m: &SdProtect| { &m.operation }, + |m: &mut SdProtect| { &mut m.operation }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SdProtect", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SdProtect { + const NAME: &'static str = "SdProtect"; + + fn is_initialized(&self) -> bool { + if self.operation.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.operation = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.operation { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.operation { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SdProtect { + SdProtect::new() + } + + fn clear(&mut self) { + self.operation = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SdProtect { + static instance: SdProtect = SdProtect { + operation: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SdProtect { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SdProtect").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SdProtect { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SdProtect { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `SdProtect` +pub mod sd_protect { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.management.SdProtect.SdProtectOperationType) + pub enum SdProtectOperationType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdProtect.SdProtectOperationType.DISABLE) + DISABLE = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdProtect.SdProtectOperationType.ENABLE) + ENABLE = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdProtect.SdProtectOperationType.REFRESH) + REFRESH = 2, + } + + impl ::protobuf::Enum for SdProtectOperationType { + const NAME: &'static str = "SdProtectOperationType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(SdProtectOperationType::DISABLE), + 1 => ::std::option::Option::Some(SdProtectOperationType::ENABLE), + 2 => ::std::option::Option::Some(SdProtectOperationType::REFRESH), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "DISABLE" => ::std::option::Option::Some(SdProtectOperationType::DISABLE), + "ENABLE" => ::std::option::Option::Some(SdProtectOperationType::ENABLE), + "REFRESH" => ::std::option::Option::Some(SdProtectOperationType::REFRESH), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [SdProtectOperationType] = &[ + SdProtectOperationType::DISABLE, + SdProtectOperationType::ENABLE, + SdProtectOperationType::REFRESH, + ]; + } + + impl ::protobuf::EnumFull for SdProtectOperationType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("SdProtect.SdProtectOperationType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for SdProtectOperationType { + fn default() -> Self { + SdProtectOperationType::DISABLE + } + } + + impl SdProtectOperationType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("SdProtect.SdProtectOperationType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.Ping) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Ping { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.Ping.message) + pub message: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.Ping.button_protection) + pub button_protection: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Ping.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Ping { + fn default() -> &'a Ping { + ::default_instance() + } +} + +impl Ping { + pub fn new() -> Ping { + ::std::default::Default::default() + } + + // optional string message = 1; + + pub fn message(&self) -> &str { + match self.message.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::string::String) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::string::String { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::string::String::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::string::String { + self.message.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool button_protection = 2; + + pub fn button_protection(&self) -> bool { + self.button_protection.unwrap_or(false) + } + + pub fn clear_button_protection(&mut self) { + self.button_protection = ::std::option::Option::None; + } + + pub fn has_button_protection(&self) -> bool { + self.button_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_button_protection(&mut self, v: bool) { + self.button_protection = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &Ping| { &m.message }, + |m: &mut Ping| { &mut m.message }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "button_protection", + |m: &Ping| { &m.button_protection }, + |m: &mut Ping| { &mut m.button_protection }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Ping", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Ping { + const NAME: &'static str = "Ping"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.message = ::std::option::Option::Some(is.read_string()?); + }, + 16 => { + self.button_protection = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.button_protection { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.message.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.button_protection { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Ping { + Ping::new() + } + + fn clear(&mut self) { + self.message = ::std::option::Option::None; + self.button_protection = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Ping { + static instance: Ping = Ping { + message: ::std::option::Option::None, + button_protection: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Ping { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Ping").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Ping { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Ping { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.Cancel) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Cancel { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Cancel.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Cancel { + fn default() -> &'a Cancel { + ::default_instance() + } +} + +impl Cancel { + pub fn new() -> Cancel { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Cancel", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Cancel { + const NAME: &'static str = "Cancel"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Cancel { + Cancel::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static Cancel { + static instance: Cancel = Cancel { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Cancel { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Cancel").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Cancel { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Cancel { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.GetEntropy) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetEntropy { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.GetEntropy.size) + pub size: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetEntropy.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetEntropy { + fn default() -> &'a GetEntropy { + ::default_instance() + } +} + +impl GetEntropy { + pub fn new() -> GetEntropy { + ::std::default::Default::default() + } + + // required uint32 size = 1; + + pub fn size(&self) -> u32 { + self.size.unwrap_or(0) + } + + pub fn clear_size(&mut self) { + self.size = ::std::option::Option::None; + } + + pub fn has_size(&self) -> bool { + self.size.is_some() + } + + // Param is passed by value, moved + pub fn set_size(&mut self, v: u32) { + self.size = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "size", + |m: &GetEntropy| { &m.size }, + |m: &mut GetEntropy| { &mut m.size }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetEntropy", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetEntropy { + const NAME: &'static str = "GetEntropy"; + + fn is_initialized(&self) -> bool { + if self.size.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.size = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.size { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.size { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetEntropy { + GetEntropy::new() + } + + fn clear(&mut self) { + self.size = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetEntropy { + static instance: GetEntropy = GetEntropy { + size: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetEntropy { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetEntropy").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetEntropy { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetEntropy { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.Entropy) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Entropy { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.Entropy.entropy) + pub entropy: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Entropy.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Entropy { + fn default() -> &'a Entropy { + ::default_instance() + } +} + +impl Entropy { + pub fn new() -> Entropy { + ::std::default::Default::default() + } + + // required bytes entropy = 1; + + pub fn entropy(&self) -> &[u8] { + match self.entropy.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_entropy(&mut self) { + self.entropy = ::std::option::Option::None; + } + + pub fn has_entropy(&self) -> bool { + self.entropy.is_some() + } + + // Param is passed by value, moved + pub fn set_entropy(&mut self, v: ::std::vec::Vec) { + self.entropy = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_entropy(&mut self) -> &mut ::std::vec::Vec { + if self.entropy.is_none() { + self.entropy = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.entropy.as_mut().unwrap() + } + + // Take field + pub fn take_entropy(&mut self) -> ::std::vec::Vec { + self.entropy.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "entropy", + |m: &Entropy| { &m.entropy }, + |m: &mut Entropy| { &mut m.entropy }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Entropy", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Entropy { + const NAME: &'static str = "Entropy"; + + fn is_initialized(&self) -> bool { + if self.entropy.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.entropy = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.entropy.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.entropy.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Entropy { + Entropy::new() + } + + fn clear(&mut self) { + self.entropy = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Entropy { + static instance: Entropy = Entropy { + entropy: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Entropy { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Entropy").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Entropy { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Entropy { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.GetFirmwareHash) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetFirmwareHash { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.GetFirmwareHash.challenge) + pub challenge: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetFirmwareHash.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetFirmwareHash { + fn default() -> &'a GetFirmwareHash { + ::default_instance() + } +} + +impl GetFirmwareHash { + pub fn new() -> GetFirmwareHash { + ::std::default::Default::default() + } + + // optional bytes challenge = 1; + + pub fn challenge(&self) -> &[u8] { + match self.challenge.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_challenge(&mut self) { + self.challenge = ::std::option::Option::None; + } + + pub fn has_challenge(&self) -> bool { + self.challenge.is_some() + } + + // Param is passed by value, moved + pub fn set_challenge(&mut self, v: ::std::vec::Vec) { + self.challenge = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_challenge(&mut self) -> &mut ::std::vec::Vec { + if self.challenge.is_none() { + self.challenge = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.challenge.as_mut().unwrap() + } + + // Take field + pub fn take_challenge(&mut self) -> ::std::vec::Vec { + self.challenge.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "challenge", + |m: &GetFirmwareHash| { &m.challenge }, + |m: &mut GetFirmwareHash| { &mut m.challenge }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetFirmwareHash", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetFirmwareHash { + const NAME: &'static str = "GetFirmwareHash"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.challenge = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.challenge.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.challenge.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetFirmwareHash { + GetFirmwareHash::new() + } + + fn clear(&mut self) { + self.challenge = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetFirmwareHash { + static instance: GetFirmwareHash = GetFirmwareHash { + challenge: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetFirmwareHash { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetFirmwareHash").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetFirmwareHash { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetFirmwareHash { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.FirmwareHash) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct FirmwareHash { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.FirmwareHash.hash) + pub hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.FirmwareHash.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a FirmwareHash { + fn default() -> &'a FirmwareHash { + ::default_instance() + } +} + +impl FirmwareHash { + pub fn new() -> FirmwareHash { + ::std::default::Default::default() + } + + // required bytes hash = 1; + + pub fn hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hash", + |m: &FirmwareHash| { &m.hash }, + |m: &mut FirmwareHash| { &mut m.hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "FirmwareHash", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for FirmwareHash { + const NAME: &'static str = "FirmwareHash"; + + fn is_initialized(&self) -> bool { + if self.hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.hash.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> FirmwareHash { + FirmwareHash::new() + } + + fn clear(&mut self) { + self.hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static FirmwareHash { + static instance: FirmwareHash = FirmwareHash { + hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for FirmwareHash { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareHash").unwrap()).clone() + } +} + +impl ::std::fmt::Display for FirmwareHash { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FirmwareHash { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.AuthenticateDevice) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct AuthenticateDevice { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.AuthenticateDevice.challenge) + pub challenge: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.AuthenticateDevice.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a AuthenticateDevice { + fn default() -> &'a AuthenticateDevice { + ::default_instance() + } +} + +impl AuthenticateDevice { + pub fn new() -> AuthenticateDevice { + ::std::default::Default::default() + } + + // required bytes challenge = 1; + + pub fn challenge(&self) -> &[u8] { + match self.challenge.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_challenge(&mut self) { + self.challenge = ::std::option::Option::None; + } + + pub fn has_challenge(&self) -> bool { + self.challenge.is_some() + } + + // Param is passed by value, moved + pub fn set_challenge(&mut self, v: ::std::vec::Vec) { + self.challenge = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_challenge(&mut self) -> &mut ::std::vec::Vec { + if self.challenge.is_none() { + self.challenge = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.challenge.as_mut().unwrap() + } + + // Take field + pub fn take_challenge(&mut self) -> ::std::vec::Vec { + self.challenge.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "challenge", + |m: &AuthenticateDevice| { &m.challenge }, + |m: &mut AuthenticateDevice| { &mut m.challenge }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "AuthenticateDevice", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for AuthenticateDevice { + const NAME: &'static str = "AuthenticateDevice"; + + fn is_initialized(&self) -> bool { + if self.challenge.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.challenge = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.challenge.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.challenge.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> AuthenticateDevice { + AuthenticateDevice::new() + } + + fn clear(&mut self) { + self.challenge = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static AuthenticateDevice { + static instance: AuthenticateDevice = AuthenticateDevice { + challenge: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for AuthenticateDevice { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("AuthenticateDevice").unwrap()).clone() + } +} + +impl ::std::fmt::Display for AuthenticateDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AuthenticateDevice { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.AuthenticityProof) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct AuthenticityProof { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.AuthenticityProof.certificates) + pub certificates: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.AuthenticityProof.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.AuthenticityProof.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a AuthenticityProof { + fn default() -> &'a AuthenticityProof { + ::default_instance() + } +} + +impl AuthenticityProof { + pub fn new() -> AuthenticityProof { + ::std::default::Default::default() + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "certificates", + |m: &AuthenticityProof| { &m.certificates }, + |m: &mut AuthenticityProof| { &mut m.certificates }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &AuthenticityProof| { &m.signature }, + |m: &mut AuthenticityProof| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "AuthenticityProof", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for AuthenticityProof { + const NAME: &'static str = "AuthenticityProof"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.certificates.push(is.read_bytes()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.certificates { + my_size += ::protobuf::rt::bytes_size(1, &value); + }; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.certificates { + os.write_bytes(1, &v)?; + }; + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> AuthenticityProof { + AuthenticityProof::new() + } + + fn clear(&mut self) { + self.certificates.clear(); + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static AuthenticityProof { + static instance: AuthenticityProof = AuthenticityProof { + certificates: ::std::vec::Vec::new(), + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for AuthenticityProof { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("AuthenticityProof").unwrap()).clone() + } +} + +impl ::std::fmt::Display for AuthenticityProof { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AuthenticityProof { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.WipeDevice) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct WipeDevice { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.WipeDevice.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a WipeDevice { + fn default() -> &'a WipeDevice { + ::default_instance() + } +} + +impl WipeDevice { + pub fn new() -> WipeDevice { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WipeDevice", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for WipeDevice { + const NAME: &'static str = "WipeDevice"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WipeDevice { + WipeDevice::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static WipeDevice { + static instance: WipeDevice = WipeDevice { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for WipeDevice { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("WipeDevice").unwrap()).clone() + } +} + +impl ::std::fmt::Display for WipeDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WipeDevice { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.LoadDevice) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct LoadDevice { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.mnemonics) + pub mnemonics: ::std::vec::Vec<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.pin) + pub pin: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.passphrase_protection) + pub passphrase_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.language) + pub language: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.label) + pub label: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.skip_checksum) + pub skip_checksum: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.u2f_counter) + pub u2f_counter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.needs_backup) + pub needs_backup: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.no_backup) + pub no_backup: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.LoadDevice.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a LoadDevice { + fn default() -> &'a LoadDevice { + ::default_instance() + } +} + +impl LoadDevice { + pub fn new() -> LoadDevice { + ::std::default::Default::default() + } + + // optional string pin = 3; + + pub fn pin(&self) -> &str { + match self.pin.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_pin(&mut self) { + self.pin = ::std::option::Option::None; + } + + pub fn has_pin(&self) -> bool { + self.pin.is_some() + } + + // Param is passed by value, moved + pub fn set_pin(&mut self, v: ::std::string::String) { + self.pin = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pin(&mut self) -> &mut ::std::string::String { + if self.pin.is_none() { + self.pin = ::std::option::Option::Some(::std::string::String::new()); + } + self.pin.as_mut().unwrap() + } + + // Take field + pub fn take_pin(&mut self) -> ::std::string::String { + self.pin.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool passphrase_protection = 4; + + pub fn passphrase_protection(&self) -> bool { + self.passphrase_protection.unwrap_or(false) + } + + pub fn clear_passphrase_protection(&mut self) { + self.passphrase_protection = ::std::option::Option::None; + } + + pub fn has_passphrase_protection(&self) -> bool { + self.passphrase_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase_protection(&mut self, v: bool) { + self.passphrase_protection = ::std::option::Option::Some(v); + } + + // optional string language = 5; + + pub fn language(&self) -> &str { + match self.language.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_language(&mut self) { + self.language = ::std::option::Option::None; + } + + pub fn has_language(&self) -> bool { + self.language.is_some() + } + + // Param is passed by value, moved + pub fn set_language(&mut self, v: ::std::string::String) { + self.language = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_language(&mut self) -> &mut ::std::string::String { + if self.language.is_none() { + self.language = ::std::option::Option::Some(::std::string::String::new()); + } + self.language.as_mut().unwrap() + } + + // Take field + pub fn take_language(&mut self) -> ::std::string::String { + self.language.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string label = 6; + + pub fn label(&self) -> &str { + match self.label.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_label(&mut self) { + self.label = ::std::option::Option::None; + } + + pub fn has_label(&self) -> bool { + self.label.is_some() + } + + // Param is passed by value, moved + pub fn set_label(&mut self, v: ::std::string::String) { + self.label = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_label(&mut self) -> &mut ::std::string::String { + if self.label.is_none() { + self.label = ::std::option::Option::Some(::std::string::String::new()); + } + self.label.as_mut().unwrap() + } + + // Take field + pub fn take_label(&mut self) -> ::std::string::String { + self.label.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool skip_checksum = 7; + + pub fn skip_checksum(&self) -> bool { + self.skip_checksum.unwrap_or(false) + } + + pub fn clear_skip_checksum(&mut self) { + self.skip_checksum = ::std::option::Option::None; + } + + pub fn has_skip_checksum(&self) -> bool { + self.skip_checksum.is_some() + } + + // Param is passed by value, moved + pub fn set_skip_checksum(&mut self, v: bool) { + self.skip_checksum = ::std::option::Option::Some(v); + } + + // optional uint32 u2f_counter = 8; + + pub fn u2f_counter(&self) -> u32 { + self.u2f_counter.unwrap_or(0) + } + + pub fn clear_u2f_counter(&mut self) { + self.u2f_counter = ::std::option::Option::None; + } + + pub fn has_u2f_counter(&self) -> bool { + self.u2f_counter.is_some() + } + + // Param is passed by value, moved + pub fn set_u2f_counter(&mut self, v: u32) { + self.u2f_counter = ::std::option::Option::Some(v); + } + + // optional bool needs_backup = 9; + + pub fn needs_backup(&self) -> bool { + self.needs_backup.unwrap_or(false) + } + + pub fn clear_needs_backup(&mut self) { + self.needs_backup = ::std::option::Option::None; + } + + pub fn has_needs_backup(&self) -> bool { + self.needs_backup.is_some() + } + + // Param is passed by value, moved + pub fn set_needs_backup(&mut self, v: bool) { + self.needs_backup = ::std::option::Option::Some(v); + } + + // optional bool no_backup = 10; + + pub fn no_backup(&self) -> bool { + self.no_backup.unwrap_or(false) + } + + pub fn clear_no_backup(&mut self) { + self.no_backup = ::std::option::Option::None; + } + + pub fn has_no_backup(&self) -> bool { + self.no_backup.is_some() + } + + // Param is passed by value, moved + pub fn set_no_backup(&mut self, v: bool) { + self.no_backup = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "mnemonics", + |m: &LoadDevice| { &m.mnemonics }, + |m: &mut LoadDevice| { &mut m.mnemonics }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pin", + |m: &LoadDevice| { &m.pin }, + |m: &mut LoadDevice| { &mut m.pin }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase_protection", + |m: &LoadDevice| { &m.passphrase_protection }, + |m: &mut LoadDevice| { &mut m.passphrase_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "language", + |m: &LoadDevice| { &m.language }, + |m: &mut LoadDevice| { &mut m.language }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "label", + |m: &LoadDevice| { &m.label }, + |m: &mut LoadDevice| { &mut m.label }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "skip_checksum", + |m: &LoadDevice| { &m.skip_checksum }, + |m: &mut LoadDevice| { &mut m.skip_checksum }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "u2f_counter", + |m: &LoadDevice| { &m.u2f_counter }, + |m: &mut LoadDevice| { &mut m.u2f_counter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "needs_backup", + |m: &LoadDevice| { &m.needs_backup }, + |m: &mut LoadDevice| { &mut m.needs_backup }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "no_backup", + |m: &LoadDevice| { &m.no_backup }, + |m: &mut LoadDevice| { &mut m.no_backup }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "LoadDevice", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for LoadDevice { + const NAME: &'static str = "LoadDevice"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.mnemonics.push(is.read_string()?); + }, + 26 => { + self.pin = ::std::option::Option::Some(is.read_string()?); + }, + 32 => { + self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 42 => { + self.language = ::std::option::Option::Some(is.read_string()?); + }, + 50 => { + self.label = ::std::option::Option::Some(is.read_string()?); + }, + 56 => { + self.skip_checksum = ::std::option::Option::Some(is.read_bool()?); + }, + 64 => { + self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.needs_backup = ::std::option::Option::Some(is.read_bool()?); + }, + 80 => { + self.no_backup = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.mnemonics { + my_size += ::protobuf::rt::string_size(1, &value); + }; + if let Some(v) = self.pin.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.passphrase_protection { + my_size += 1 + 1; + } + if let Some(v) = self.language.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.label.as_ref() { + my_size += ::protobuf::rt::string_size(6, &v); + } + if let Some(v) = self.skip_checksum { + my_size += 1 + 1; + } + if let Some(v) = self.u2f_counter { + my_size += ::protobuf::rt::uint32_size(8, v); + } + if let Some(v) = self.needs_backup { + my_size += 1 + 1; + } + if let Some(v) = self.no_backup { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.mnemonics { + os.write_string(1, &v)?; + }; + if let Some(v) = self.pin.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.passphrase_protection { + os.write_bool(4, v)?; + } + if let Some(v) = self.language.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.label.as_ref() { + os.write_string(6, v)?; + } + if let Some(v) = self.skip_checksum { + os.write_bool(7, v)?; + } + if let Some(v) = self.u2f_counter { + os.write_uint32(8, v)?; + } + if let Some(v) = self.needs_backup { + os.write_bool(9, v)?; + } + if let Some(v) = self.no_backup { + os.write_bool(10, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> LoadDevice { + LoadDevice::new() + } + + fn clear(&mut self) { + self.mnemonics.clear(); + self.pin = ::std::option::Option::None; + self.passphrase_protection = ::std::option::Option::None; + self.language = ::std::option::Option::None; + self.label = ::std::option::Option::None; + self.skip_checksum = ::std::option::Option::None; + self.u2f_counter = ::std::option::Option::None; + self.needs_backup = ::std::option::Option::None; + self.no_backup = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static LoadDevice { + static instance: LoadDevice = LoadDevice { + mnemonics: ::std::vec::Vec::new(), + pin: ::std::option::Option::None, + passphrase_protection: ::std::option::Option::None, + language: ::std::option::Option::None, + label: ::std::option::Option::None, + skip_checksum: ::std::option::Option::None, + u2f_counter: ::std::option::Option::None, + needs_backup: ::std::option::Option::None, + no_backup: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for LoadDevice { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("LoadDevice").unwrap()).clone() + } +} + +impl ::std::fmt::Display for LoadDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LoadDevice { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.ResetDevice) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ResetDevice { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.display_random) + pub display_random: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.strength) + pub strength: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.passphrase_protection) + pub passphrase_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.pin_protection) + pub pin_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.language) + pub language: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.label) + pub label: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.u2f_counter) + pub u2f_counter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.skip_backup) + pub skip_backup: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.no_backup) + pub no_backup: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.backup_type) + pub backup_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ResetDevice.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ResetDevice { + fn default() -> &'a ResetDevice { + ::default_instance() + } +} + +impl ResetDevice { + pub fn new() -> ResetDevice { + ::std::default::Default::default() + } + + // optional bool display_random = 1; + + pub fn display_random(&self) -> bool { + self.display_random.unwrap_or(false) + } + + pub fn clear_display_random(&mut self) { + self.display_random = ::std::option::Option::None; + } + + pub fn has_display_random(&self) -> bool { + self.display_random.is_some() + } + + // Param is passed by value, moved + pub fn set_display_random(&mut self, v: bool) { + self.display_random = ::std::option::Option::Some(v); + } + + // optional uint32 strength = 2; + + pub fn strength(&self) -> u32 { + self.strength.unwrap_or(256u32) + } + + pub fn clear_strength(&mut self) { + self.strength = ::std::option::Option::None; + } + + pub fn has_strength(&self) -> bool { + self.strength.is_some() + } + + // Param is passed by value, moved + pub fn set_strength(&mut self, v: u32) { + self.strength = ::std::option::Option::Some(v); + } + + // optional bool passphrase_protection = 3; + + pub fn passphrase_protection(&self) -> bool { + self.passphrase_protection.unwrap_or(false) + } + + pub fn clear_passphrase_protection(&mut self) { + self.passphrase_protection = ::std::option::Option::None; + } + + pub fn has_passphrase_protection(&self) -> bool { + self.passphrase_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase_protection(&mut self, v: bool) { + self.passphrase_protection = ::std::option::Option::Some(v); + } + + // optional bool pin_protection = 4; + + pub fn pin_protection(&self) -> bool { + self.pin_protection.unwrap_or(false) + } + + pub fn clear_pin_protection(&mut self) { + self.pin_protection = ::std::option::Option::None; + } + + pub fn has_pin_protection(&self) -> bool { + self.pin_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_pin_protection(&mut self, v: bool) { + self.pin_protection = ::std::option::Option::Some(v); + } + + // optional string language = 5; + + pub fn language(&self) -> &str { + match self.language.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_language(&mut self) { + self.language = ::std::option::Option::None; + } + + pub fn has_language(&self) -> bool { + self.language.is_some() + } + + // Param is passed by value, moved + pub fn set_language(&mut self, v: ::std::string::String) { + self.language = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_language(&mut self) -> &mut ::std::string::String { + if self.language.is_none() { + self.language = ::std::option::Option::Some(::std::string::String::new()); + } + self.language.as_mut().unwrap() + } + + // Take field + pub fn take_language(&mut self) -> ::std::string::String { + self.language.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string label = 6; + + pub fn label(&self) -> &str { + match self.label.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_label(&mut self) { + self.label = ::std::option::Option::None; + } + + pub fn has_label(&self) -> bool { + self.label.is_some() + } + + // Param is passed by value, moved + pub fn set_label(&mut self, v: ::std::string::String) { + self.label = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_label(&mut self) -> &mut ::std::string::String { + if self.label.is_none() { + self.label = ::std::option::Option::Some(::std::string::String::new()); + } + self.label.as_mut().unwrap() + } + + // Take field + pub fn take_label(&mut self) -> ::std::string::String { + self.label.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 u2f_counter = 7; + + pub fn u2f_counter(&self) -> u32 { + self.u2f_counter.unwrap_or(0) + } + + pub fn clear_u2f_counter(&mut self) { + self.u2f_counter = ::std::option::Option::None; + } + + pub fn has_u2f_counter(&self) -> bool { + self.u2f_counter.is_some() + } + + // Param is passed by value, moved + pub fn set_u2f_counter(&mut self, v: u32) { + self.u2f_counter = ::std::option::Option::Some(v); + } + + // optional bool skip_backup = 8; + + pub fn skip_backup(&self) -> bool { + self.skip_backup.unwrap_or(false) + } + + pub fn clear_skip_backup(&mut self) { + self.skip_backup = ::std::option::Option::None; + } + + pub fn has_skip_backup(&self) -> bool { + self.skip_backup.is_some() + } + + // Param is passed by value, moved + pub fn set_skip_backup(&mut self, v: bool) { + self.skip_backup = ::std::option::Option::Some(v); + } + + // optional bool no_backup = 9; + + pub fn no_backup(&self) -> bool { + self.no_backup.unwrap_or(false) + } + + pub fn clear_no_backup(&mut self) { + self.no_backup = ::std::option::Option::None; + } + + pub fn has_no_backup(&self) -> bool { + self.no_backup.is_some() + } + + // Param is passed by value, moved + pub fn set_no_backup(&mut self, v: bool) { + self.no_backup = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.management.BackupType backup_type = 10; + + pub fn backup_type(&self) -> BackupType { + match self.backup_type { + Some(e) => e.enum_value_or(BackupType::Bip39), + None => BackupType::Bip39, + } + } + + pub fn clear_backup_type(&mut self) { + self.backup_type = ::std::option::Option::None; + } + + pub fn has_backup_type(&self) -> bool { + self.backup_type.is_some() + } + + // Param is passed by value, moved + pub fn set_backup_type(&mut self, v: BackupType) { + self.backup_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(10); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "display_random", + |m: &ResetDevice| { &m.display_random }, + |m: &mut ResetDevice| { &mut m.display_random }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "strength", + |m: &ResetDevice| { &m.strength }, + |m: &mut ResetDevice| { &mut m.strength }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase_protection", + |m: &ResetDevice| { &m.passphrase_protection }, + |m: &mut ResetDevice| { &mut m.passphrase_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pin_protection", + |m: &ResetDevice| { &m.pin_protection }, + |m: &mut ResetDevice| { &mut m.pin_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "language", + |m: &ResetDevice| { &m.language }, + |m: &mut ResetDevice| { &mut m.language }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "label", + |m: &ResetDevice| { &m.label }, + |m: &mut ResetDevice| { &mut m.label }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "u2f_counter", + |m: &ResetDevice| { &m.u2f_counter }, + |m: &mut ResetDevice| { &mut m.u2f_counter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "skip_backup", + |m: &ResetDevice| { &m.skip_backup }, + |m: &mut ResetDevice| { &mut m.skip_backup }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "no_backup", + |m: &ResetDevice| { &m.no_backup }, + |m: &mut ResetDevice| { &mut m.no_backup }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "backup_type", + |m: &ResetDevice| { &m.backup_type }, + |m: &mut ResetDevice| { &mut m.backup_type }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ResetDevice", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ResetDevice { + const NAME: &'static str = "ResetDevice"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.display_random = ::std::option::Option::Some(is.read_bool()?); + }, + 16 => { + self.strength = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 32 => { + self.pin_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 42 => { + self.language = ::std::option::Option::Some(is.read_string()?); + }, + 50 => { + self.label = ::std::option::Option::Some(is.read_string()?); + }, + 56 => { + self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); + }, + 64 => { + self.skip_backup = ::std::option::Option::Some(is.read_bool()?); + }, + 72 => { + self.no_backup = ::std::option::Option::Some(is.read_bool()?); + }, + 80 => { + self.backup_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.display_random { + my_size += 1 + 1; + } + if let Some(v) = self.strength { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.passphrase_protection { + my_size += 1 + 1; + } + if let Some(v) = self.pin_protection { + my_size += 1 + 1; + } + if let Some(v) = self.language.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.label.as_ref() { + my_size += ::protobuf::rt::string_size(6, &v); + } + if let Some(v) = self.u2f_counter { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.skip_backup { + my_size += 1 + 1; + } + if let Some(v) = self.no_backup { + my_size += 1 + 1; + } + if let Some(v) = self.backup_type { + my_size += ::protobuf::rt::int32_size(10, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.display_random { + os.write_bool(1, v)?; + } + if let Some(v) = self.strength { + os.write_uint32(2, v)?; + } + if let Some(v) = self.passphrase_protection { + os.write_bool(3, v)?; + } + if let Some(v) = self.pin_protection { + os.write_bool(4, v)?; + } + if let Some(v) = self.language.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.label.as_ref() { + os.write_string(6, v)?; + } + if let Some(v) = self.u2f_counter { + os.write_uint32(7, v)?; + } + if let Some(v) = self.skip_backup { + os.write_bool(8, v)?; + } + if let Some(v) = self.no_backup { + os.write_bool(9, v)?; + } + if let Some(v) = self.backup_type { + os.write_enum(10, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ResetDevice { + ResetDevice::new() + } + + fn clear(&mut self) { + self.display_random = ::std::option::Option::None; + self.strength = ::std::option::Option::None; + self.passphrase_protection = ::std::option::Option::None; + self.pin_protection = ::std::option::Option::None; + self.language = ::std::option::Option::None; + self.label = ::std::option::Option::None; + self.u2f_counter = ::std::option::Option::None; + self.skip_backup = ::std::option::Option::None; + self.no_backup = ::std::option::Option::None; + self.backup_type = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ResetDevice { + static instance: ResetDevice = ResetDevice { + display_random: ::std::option::Option::None, + strength: ::std::option::Option::None, + passphrase_protection: ::std::option::Option::None, + pin_protection: ::std::option::Option::None, + language: ::std::option::Option::None, + label: ::std::option::Option::None, + u2f_counter: ::std::option::Option::None, + skip_backup: ::std::option::Option::None, + no_backup: ::std::option::Option::None, + backup_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ResetDevice { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ResetDevice").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ResetDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ResetDevice { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.BackupDevice) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BackupDevice { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.group_threshold) + pub group_threshold: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.groups) + pub groups: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.BackupDevice.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BackupDevice { + fn default() -> &'a BackupDevice { + ::default_instance() + } +} + +impl BackupDevice { + pub fn new() -> BackupDevice { + ::std::default::Default::default() + } + + // optional uint32 group_threshold = 1; + + pub fn group_threshold(&self) -> u32 { + self.group_threshold.unwrap_or(0) + } + + pub fn clear_group_threshold(&mut self) { + self.group_threshold = ::std::option::Option::None; + } + + pub fn has_group_threshold(&self) -> bool { + self.group_threshold.is_some() + } + + // Param is passed by value, moved + pub fn set_group_threshold(&mut self, v: u32) { + self.group_threshold = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "group_threshold", + |m: &BackupDevice| { &m.group_threshold }, + |m: &mut BackupDevice| { &mut m.group_threshold }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "groups", + |m: &BackupDevice| { &m.groups }, + |m: &mut BackupDevice| { &mut m.groups }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BackupDevice", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BackupDevice { + const NAME: &'static str = "BackupDevice"; + + fn is_initialized(&self) -> bool { + for v in &self.groups { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.group_threshold = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.groups.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.group_threshold { + my_size += ::protobuf::rt::uint32_size(1, v); + } + for value in &self.groups { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.group_threshold { + os.write_uint32(1, v)?; + } + for v in &self.groups { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BackupDevice { + BackupDevice::new() + } + + fn clear(&mut self) { + self.group_threshold = ::std::option::Option::None; + self.groups.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static BackupDevice { + static instance: BackupDevice = BackupDevice { + group_threshold: ::std::option::Option::None, + groups: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BackupDevice { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BackupDevice").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BackupDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BackupDevice { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `BackupDevice` +pub mod backup_device { + // @@protoc_insertion_point(message:hw.trezor.messages.management.BackupDevice.Slip39Group) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct Slip39Group { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.Slip39Group.member_threshold) + pub member_threshold: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.Slip39Group.member_count) + pub member_count: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.BackupDevice.Slip39Group.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a Slip39Group { + fn default() -> &'a Slip39Group { + ::default_instance() + } + } + + impl Slip39Group { + pub fn new() -> Slip39Group { + ::std::default::Default::default() + } + + // required uint32 member_threshold = 1; + + pub fn member_threshold(&self) -> u32 { + self.member_threshold.unwrap_or(0) + } + + pub fn clear_member_threshold(&mut self) { + self.member_threshold = ::std::option::Option::None; + } + + pub fn has_member_threshold(&self) -> bool { + self.member_threshold.is_some() + } + + // Param is passed by value, moved + pub fn set_member_threshold(&mut self, v: u32) { + self.member_threshold = ::std::option::Option::Some(v); + } + + // required uint32 member_count = 2; + + pub fn member_count(&self) -> u32 { + self.member_count.unwrap_or(0) + } + + pub fn clear_member_count(&mut self) { + self.member_count = ::std::option::Option::None; + } + + pub fn has_member_count(&self) -> bool { + self.member_count.is_some() + } + + // Param is passed by value, moved + pub fn set_member_count(&mut self, v: u32) { + self.member_count = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "member_threshold", + |m: &Slip39Group| { &m.member_threshold }, + |m: &mut Slip39Group| { &mut m.member_threshold }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "member_count", + |m: &Slip39Group| { &m.member_count }, + |m: &mut Slip39Group| { &mut m.member_count }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BackupDevice.Slip39Group", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for Slip39Group { + const NAME: &'static str = "Slip39Group"; + + fn is_initialized(&self) -> bool { + if self.member_threshold.is_none() { + return false; + } + if self.member_count.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.member_threshold = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.member_count = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.member_threshold { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.member_count { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.member_threshold { + os.write_uint32(1, v)?; + } + if let Some(v) = self.member_count { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Slip39Group { + Slip39Group::new() + } + + fn clear(&mut self) { + self.member_threshold = ::std::option::Option::None; + self.member_count = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Slip39Group { + static instance: Slip39Group = Slip39Group { + member_threshold: ::std::option::Option::None, + member_count: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for Slip39Group { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BackupDevice.Slip39Group").unwrap()).clone() + } + } + + impl ::std::fmt::Display for Slip39Group { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for Slip39Group { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.EntropyRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EntropyRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.EntropyRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EntropyRequest { + fn default() -> &'a EntropyRequest { + ::default_instance() + } +} + +impl EntropyRequest { + pub fn new() -> EntropyRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EntropyRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EntropyRequest { + const NAME: &'static str = "EntropyRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EntropyRequest { + EntropyRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static EntropyRequest { + static instance: EntropyRequest = EntropyRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EntropyRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EntropyRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EntropyRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EntropyRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.EntropyAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct EntropyAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.EntropyAck.entropy) + pub entropy: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.EntropyAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EntropyAck { + fn default() -> &'a EntropyAck { + ::default_instance() + } +} + +impl EntropyAck { + pub fn new() -> EntropyAck { + ::std::default::Default::default() + } + + // required bytes entropy = 1; + + pub fn entropy(&self) -> &[u8] { + match self.entropy.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_entropy(&mut self) { + self.entropy = ::std::option::Option::None; + } + + pub fn has_entropy(&self) -> bool { + self.entropy.is_some() + } + + // Param is passed by value, moved + pub fn set_entropy(&mut self, v: ::std::vec::Vec) { + self.entropy = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_entropy(&mut self) -> &mut ::std::vec::Vec { + if self.entropy.is_none() { + self.entropy = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.entropy.as_mut().unwrap() + } + + // Take field + pub fn take_entropy(&mut self) -> ::std::vec::Vec { + self.entropy.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "entropy", + |m: &EntropyAck| { &m.entropy }, + |m: &mut EntropyAck| { &mut m.entropy }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "EntropyAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for EntropyAck { + const NAME: &'static str = "EntropyAck"; + + fn is_initialized(&self) -> bool { + if self.entropy.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.entropy = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.entropy.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.entropy.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> EntropyAck { + EntropyAck::new() + } + + fn clear(&mut self) { + self.entropy = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static EntropyAck { + static instance: EntropyAck = EntropyAck { + entropy: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for EntropyAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EntropyAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EntropyAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EntropyAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.RecoveryDevice) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct RecoveryDevice { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.word_count) + pub word_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.passphrase_protection) + pub passphrase_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.pin_protection) + pub pin_protection: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.language) + pub language: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.label) + pub label: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.enforce_wordlist) + pub enforce_wordlist: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.u2f_counter) + pub u2f_counter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.dry_run) + pub dry_run: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.RecoveryDevice.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RecoveryDevice { + fn default() -> &'a RecoveryDevice { + ::default_instance() + } +} + +impl RecoveryDevice { + pub fn new() -> RecoveryDevice { + ::std::default::Default::default() + } + + // optional uint32 word_count = 1; + + pub fn word_count(&self) -> u32 { + self.word_count.unwrap_or(0) + } + + pub fn clear_word_count(&mut self) { + self.word_count = ::std::option::Option::None; + } + + pub fn has_word_count(&self) -> bool { + self.word_count.is_some() + } + + // Param is passed by value, moved + pub fn set_word_count(&mut self, v: u32) { + self.word_count = ::std::option::Option::Some(v); + } + + // optional bool passphrase_protection = 2; + + pub fn passphrase_protection(&self) -> bool { + self.passphrase_protection.unwrap_or(false) + } + + pub fn clear_passphrase_protection(&mut self) { + self.passphrase_protection = ::std::option::Option::None; + } + + pub fn has_passphrase_protection(&self) -> bool { + self.passphrase_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_passphrase_protection(&mut self, v: bool) { + self.passphrase_protection = ::std::option::Option::Some(v); + } + + // optional bool pin_protection = 3; + + pub fn pin_protection(&self) -> bool { + self.pin_protection.unwrap_or(false) + } + + pub fn clear_pin_protection(&mut self) { + self.pin_protection = ::std::option::Option::None; + } + + pub fn has_pin_protection(&self) -> bool { + self.pin_protection.is_some() + } + + // Param is passed by value, moved + pub fn set_pin_protection(&mut self, v: bool) { + self.pin_protection = ::std::option::Option::Some(v); + } + + // optional string language = 4; + + pub fn language(&self) -> &str { + match self.language.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_language(&mut self) { + self.language = ::std::option::Option::None; + } + + pub fn has_language(&self) -> bool { + self.language.is_some() + } + + // Param is passed by value, moved + pub fn set_language(&mut self, v: ::std::string::String) { + self.language = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_language(&mut self) -> &mut ::std::string::String { + if self.language.is_none() { + self.language = ::std::option::Option::Some(::std::string::String::new()); + } + self.language.as_mut().unwrap() + } + + // Take field + pub fn take_language(&mut self) -> ::std::string::String { + self.language.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string label = 5; + + pub fn label(&self) -> &str { + match self.label.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_label(&mut self) { + self.label = ::std::option::Option::None; + } + + pub fn has_label(&self) -> bool { + self.label.is_some() + } + + // Param is passed by value, moved + pub fn set_label(&mut self, v: ::std::string::String) { + self.label = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_label(&mut self) -> &mut ::std::string::String { + if self.label.is_none() { + self.label = ::std::option::Option::Some(::std::string::String::new()); + } + self.label.as_mut().unwrap() + } + + // Take field + pub fn take_label(&mut self) -> ::std::string::String { + self.label.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool enforce_wordlist = 6; + + pub fn enforce_wordlist(&self) -> bool { + self.enforce_wordlist.unwrap_or(false) + } + + pub fn clear_enforce_wordlist(&mut self) { + self.enforce_wordlist = ::std::option::Option::None; + } + + pub fn has_enforce_wordlist(&self) -> bool { + self.enforce_wordlist.is_some() + } + + // Param is passed by value, moved + pub fn set_enforce_wordlist(&mut self, v: bool) { + self.enforce_wordlist = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType type = 8; + + pub fn type_(&self) -> recovery_device::RecoveryDeviceType { + match self.type_ { + Some(e) => e.enum_value_or(recovery_device::RecoveryDeviceType::RecoveryDeviceType_ScrambledWords), + None => recovery_device::RecoveryDeviceType::RecoveryDeviceType_ScrambledWords, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: recovery_device::RecoveryDeviceType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint32 u2f_counter = 9; + + pub fn u2f_counter(&self) -> u32 { + self.u2f_counter.unwrap_or(0) + } + + pub fn clear_u2f_counter(&mut self) { + self.u2f_counter = ::std::option::Option::None; + } + + pub fn has_u2f_counter(&self) -> bool { + self.u2f_counter.is_some() + } + + // Param is passed by value, moved + pub fn set_u2f_counter(&mut self, v: u32) { + self.u2f_counter = ::std::option::Option::Some(v); + } + + // optional bool dry_run = 10; + + pub fn dry_run(&self) -> bool { + self.dry_run.unwrap_or(false) + } + + pub fn clear_dry_run(&mut self) { + self.dry_run = ::std::option::Option::None; + } + + pub fn has_dry_run(&self) -> bool { + self.dry_run.is_some() + } + + // Param is passed by value, moved + pub fn set_dry_run(&mut self, v: bool) { + self.dry_run = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "word_count", + |m: &RecoveryDevice| { &m.word_count }, + |m: &mut RecoveryDevice| { &mut m.word_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "passphrase_protection", + |m: &RecoveryDevice| { &m.passphrase_protection }, + |m: &mut RecoveryDevice| { &mut m.passphrase_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pin_protection", + |m: &RecoveryDevice| { &m.pin_protection }, + |m: &mut RecoveryDevice| { &mut m.pin_protection }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "language", + |m: &RecoveryDevice| { &m.language }, + |m: &mut RecoveryDevice| { &mut m.language }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "label", + |m: &RecoveryDevice| { &m.label }, + |m: &mut RecoveryDevice| { &mut m.label }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "enforce_wordlist", + |m: &RecoveryDevice| { &m.enforce_wordlist }, + |m: &mut RecoveryDevice| { &mut m.enforce_wordlist }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &RecoveryDevice| { &m.type_ }, + |m: &mut RecoveryDevice| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "u2f_counter", + |m: &RecoveryDevice| { &m.u2f_counter }, + |m: &mut RecoveryDevice| { &mut m.u2f_counter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "dry_run", + |m: &RecoveryDevice| { &m.dry_run }, + |m: &mut RecoveryDevice| { &mut m.dry_run }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "RecoveryDevice", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for RecoveryDevice { + const NAME: &'static str = "RecoveryDevice"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.word_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.pin_protection = ::std::option::Option::Some(is.read_bool()?); + }, + 34 => { + self.language = ::std::option::Option::Some(is.read_string()?); + }, + 42 => { + self.label = ::std::option::Option::Some(is.read_string()?); + }, + 48 => { + self.enforce_wordlist = ::std::option::Option::Some(is.read_bool()?); + }, + 64 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 72 => { + self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); + }, + 80 => { + self.dry_run = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.word_count { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.passphrase_protection { + my_size += 1 + 1; + } + if let Some(v) = self.pin_protection { + my_size += 1 + 1; + } + if let Some(v) = self.language.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.label.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.enforce_wordlist { + my_size += 1 + 1; + } + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(8, v.value()); + } + if let Some(v) = self.u2f_counter { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.dry_run { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.word_count { + os.write_uint32(1, v)?; + } + if let Some(v) = self.passphrase_protection { + os.write_bool(2, v)?; + } + if let Some(v) = self.pin_protection { + os.write_bool(3, v)?; + } + if let Some(v) = self.language.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.label.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.enforce_wordlist { + os.write_bool(6, v)?; + } + if let Some(v) = self.type_ { + os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.u2f_counter { + os.write_uint32(9, v)?; + } + if let Some(v) = self.dry_run { + os.write_bool(10, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RecoveryDevice { + RecoveryDevice::new() + } + + fn clear(&mut self) { + self.word_count = ::std::option::Option::None; + self.passphrase_protection = ::std::option::Option::None; + self.pin_protection = ::std::option::Option::None; + self.language = ::std::option::Option::None; + self.label = ::std::option::Option::None; + self.enforce_wordlist = ::std::option::Option::None; + self.type_ = ::std::option::Option::None; + self.u2f_counter = ::std::option::Option::None; + self.dry_run = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RecoveryDevice { + static instance: RecoveryDevice = RecoveryDevice { + word_count: ::std::option::Option::None, + passphrase_protection: ::std::option::Option::None, + pin_protection: ::std::option::Option::None, + language: ::std::option::Option::None, + label: ::std::option::Option::None, + enforce_wordlist: ::std::option::Option::None, + type_: ::std::option::Option::None, + u2f_counter: ::std::option::Option::None, + dry_run: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for RecoveryDevice { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RecoveryDevice").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RecoveryDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RecoveryDevice { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `RecoveryDevice` +pub mod recovery_device { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType) + pub enum RecoveryDeviceType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType.RecoveryDeviceType_ScrambledWords) + RecoveryDeviceType_ScrambledWords = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType.RecoveryDeviceType_Matrix) + RecoveryDeviceType_Matrix = 1, + } + + impl ::protobuf::Enum for RecoveryDeviceType { + const NAME: &'static str = "RecoveryDeviceType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_ScrambledWords), + 1 => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_Matrix), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "RecoveryDeviceType_ScrambledWords" => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_ScrambledWords), + "RecoveryDeviceType_Matrix" => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_Matrix), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [RecoveryDeviceType] = &[ + RecoveryDeviceType::RecoveryDeviceType_ScrambledWords, + RecoveryDeviceType::RecoveryDeviceType_Matrix, + ]; + } + + impl ::protobuf::EnumFull for RecoveryDeviceType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("RecoveryDevice.RecoveryDeviceType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for RecoveryDeviceType { + fn default() -> Self { + RecoveryDeviceType::RecoveryDeviceType_ScrambledWords + } + } + + impl RecoveryDeviceType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("RecoveryDevice.RecoveryDeviceType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.WordRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct WordRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.WordRequest.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.WordRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a WordRequest { + fn default() -> &'a WordRequest { + ::default_instance() + } +} + +impl WordRequest { + pub fn new() -> WordRequest { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.management.WordRequest.WordRequestType type = 1; + + pub fn type_(&self) -> word_request::WordRequestType { + match self.type_ { + Some(e) => e.enum_value_or(word_request::WordRequestType::WordRequestType_Plain), + None => word_request::WordRequestType::WordRequestType_Plain, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: word_request::WordRequestType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &WordRequest| { &m.type_ }, + |m: &mut WordRequest| { &mut m.type_ }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WordRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for WordRequest { + const NAME: &'static str = "WordRequest"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WordRequest { + WordRequest::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static WordRequest { + static instance: WordRequest = WordRequest { + type_: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for WordRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("WordRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for WordRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WordRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `WordRequest` +pub mod word_request { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.management.WordRequest.WordRequestType) + pub enum WordRequestType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.WordRequest.WordRequestType.WordRequestType_Plain) + WordRequestType_Plain = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.WordRequest.WordRequestType.WordRequestType_Matrix9) + WordRequestType_Matrix9 = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.WordRequest.WordRequestType.WordRequestType_Matrix6) + WordRequestType_Matrix6 = 2, + } + + impl ::protobuf::Enum for WordRequestType { + const NAME: &'static str = "WordRequestType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(WordRequestType::WordRequestType_Plain), + 1 => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix9), + 2 => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix6), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "WordRequestType_Plain" => ::std::option::Option::Some(WordRequestType::WordRequestType_Plain), + "WordRequestType_Matrix9" => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix9), + "WordRequestType_Matrix6" => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix6), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [WordRequestType] = &[ + WordRequestType::WordRequestType_Plain, + WordRequestType::WordRequestType_Matrix9, + WordRequestType::WordRequestType_Matrix6, + ]; + } + + impl ::protobuf::EnumFull for WordRequestType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("WordRequest.WordRequestType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for WordRequestType { + fn default() -> Self { + WordRequestType::WordRequestType_Plain + } + } + + impl WordRequestType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("WordRequest.WordRequestType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.WordAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct WordAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.WordAck.word) + pub word: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.WordAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a WordAck { + fn default() -> &'a WordAck { + ::default_instance() + } +} + +impl WordAck { + pub fn new() -> WordAck { + ::std::default::Default::default() + } + + // required string word = 1; + + pub fn word(&self) -> &str { + match self.word.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_word(&mut self) { + self.word = ::std::option::Option::None; + } + + pub fn has_word(&self) -> bool { + self.word.is_some() + } + + // Param is passed by value, moved + pub fn set_word(&mut self, v: ::std::string::String) { + self.word = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_word(&mut self) -> &mut ::std::string::String { + if self.word.is_none() { + self.word = ::std::option::Option::Some(::std::string::String::new()); + } + self.word.as_mut().unwrap() + } + + // Take field + pub fn take_word(&mut self) -> ::std::string::String { + self.word.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "word", + |m: &WordAck| { &m.word }, + |m: &mut WordAck| { &mut m.word }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WordAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for WordAck { + const NAME: &'static str = "WordAck"; + + fn is_initialized(&self) -> bool { + if self.word.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.word = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.word.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.word.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WordAck { + WordAck::new() + } + + fn clear(&mut self) { + self.word = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static WordAck { + static instance: WordAck = WordAck { + word: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for WordAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("WordAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for WordAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WordAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.SetU2FCounter) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SetU2FCounter { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.SetU2FCounter.u2f_counter) + pub u2f_counter: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.SetU2FCounter.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SetU2FCounter { + fn default() -> &'a SetU2FCounter { + ::default_instance() + } +} + +impl SetU2FCounter { + pub fn new() -> SetU2FCounter { + ::std::default::Default::default() + } + + // required uint32 u2f_counter = 1; + + pub fn u2f_counter(&self) -> u32 { + self.u2f_counter.unwrap_or(0) + } + + pub fn clear_u2f_counter(&mut self) { + self.u2f_counter = ::std::option::Option::None; + } + + pub fn has_u2f_counter(&self) -> bool { + self.u2f_counter.is_some() + } + + // Param is passed by value, moved + pub fn set_u2f_counter(&mut self, v: u32) { + self.u2f_counter = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "u2f_counter", + |m: &SetU2FCounter| { &m.u2f_counter }, + |m: &mut SetU2FCounter| { &mut m.u2f_counter }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SetU2FCounter", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SetU2FCounter { + const NAME: &'static str = "SetU2FCounter"; + + fn is_initialized(&self) -> bool { + if self.u2f_counter.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.u2f_counter { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.u2f_counter { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SetU2FCounter { + SetU2FCounter::new() + } + + fn clear(&mut self) { + self.u2f_counter = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SetU2FCounter { + static instance: SetU2FCounter = SetU2FCounter { + u2f_counter: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SetU2FCounter { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SetU2FCounter").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SetU2FCounter { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SetU2FCounter { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.GetNextU2FCounter) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetNextU2FCounter { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetNextU2FCounter.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetNextU2FCounter { + fn default() -> &'a GetNextU2FCounter { + ::default_instance() + } +} + +impl GetNextU2FCounter { + pub fn new() -> GetNextU2FCounter { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetNextU2FCounter", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetNextU2FCounter { + const NAME: &'static str = "GetNextU2FCounter"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetNextU2FCounter { + GetNextU2FCounter::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetNextU2FCounter { + static instance: GetNextU2FCounter = GetNextU2FCounter { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetNextU2FCounter { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetNextU2FCounter").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetNextU2FCounter { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetNextU2FCounter { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.NextU2FCounter) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NextU2FCounter { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.NextU2FCounter.u2f_counter) + pub u2f_counter: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.NextU2FCounter.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NextU2FCounter { + fn default() -> &'a NextU2FCounter { + ::default_instance() + } +} + +impl NextU2FCounter { + pub fn new() -> NextU2FCounter { + ::std::default::Default::default() + } + + // required uint32 u2f_counter = 1; + + pub fn u2f_counter(&self) -> u32 { + self.u2f_counter.unwrap_or(0) + } + + pub fn clear_u2f_counter(&mut self) { + self.u2f_counter = ::std::option::Option::None; + } + + pub fn has_u2f_counter(&self) -> bool { + self.u2f_counter.is_some() + } + + // Param is passed by value, moved + pub fn set_u2f_counter(&mut self, v: u32) { + self.u2f_counter = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "u2f_counter", + |m: &NextU2FCounter| { &m.u2f_counter }, + |m: &mut NextU2FCounter| { &mut m.u2f_counter }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NextU2FCounter", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NextU2FCounter { + const NAME: &'static str = "NextU2FCounter"; + + fn is_initialized(&self) -> bool { + if self.u2f_counter.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.u2f_counter { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.u2f_counter { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NextU2FCounter { + NextU2FCounter::new() + } + + fn clear(&mut self) { + self.u2f_counter = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NextU2FCounter { + static instance: NextU2FCounter = NextU2FCounter { + u2f_counter: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NextU2FCounter { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NextU2FCounter").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NextU2FCounter { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NextU2FCounter { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.DoPreauthorized) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DoPreauthorized { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.DoPreauthorized.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DoPreauthorized { + fn default() -> &'a DoPreauthorized { + ::default_instance() + } +} + +impl DoPreauthorized { + pub fn new() -> DoPreauthorized { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DoPreauthorized", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DoPreauthorized { + const NAME: &'static str = "DoPreauthorized"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DoPreauthorized { + DoPreauthorized::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static DoPreauthorized { + static instance: DoPreauthorized = DoPreauthorized { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DoPreauthorized { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DoPreauthorized").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DoPreauthorized { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DoPreauthorized { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.PreauthorizedRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct PreauthorizedRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.PreauthorizedRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PreauthorizedRequest { + fn default() -> &'a PreauthorizedRequest { + ::default_instance() + } +} + +impl PreauthorizedRequest { + pub fn new() -> PreauthorizedRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "PreauthorizedRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for PreauthorizedRequest { + const NAME: &'static str = "PreauthorizedRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> PreauthorizedRequest { + PreauthorizedRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static PreauthorizedRequest { + static instance: PreauthorizedRequest = PreauthorizedRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for PreauthorizedRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PreauthorizedRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PreauthorizedRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PreauthorizedRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.CancelAuthorization) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct CancelAuthorization { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.CancelAuthorization.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CancelAuthorization { + fn default() -> &'a CancelAuthorization { + ::default_instance() + } +} + +impl CancelAuthorization { + pub fn new() -> CancelAuthorization { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "CancelAuthorization", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for CancelAuthorization { + const NAME: &'static str = "CancelAuthorization"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> CancelAuthorization { + CancelAuthorization::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static CancelAuthorization { + static instance: CancelAuthorization = CancelAuthorization { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for CancelAuthorization { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CancelAuthorization").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CancelAuthorization { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CancelAuthorization { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.RebootToBootloader) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct RebootToBootloader { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.RebootToBootloader.boot_command) + pub boot_command: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RebootToBootloader.firmware_header) + pub firmware_header: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.management.RebootToBootloader.language_data_length) + pub language_data_length: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.RebootToBootloader.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RebootToBootloader { + fn default() -> &'a RebootToBootloader { + ::default_instance() + } +} + +impl RebootToBootloader { + pub fn new() -> RebootToBootloader { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.management.RebootToBootloader.BootCommand boot_command = 1; + + pub fn boot_command(&self) -> reboot_to_bootloader::BootCommand { + match self.boot_command { + Some(e) => e.enum_value_or(reboot_to_bootloader::BootCommand::STOP_AND_WAIT), + None => reboot_to_bootloader::BootCommand::STOP_AND_WAIT, + } + } + + pub fn clear_boot_command(&mut self) { + self.boot_command = ::std::option::Option::None; + } + + pub fn has_boot_command(&self) -> bool { + self.boot_command.is_some() + } + + // Param is passed by value, moved + pub fn set_boot_command(&mut self, v: reboot_to_bootloader::BootCommand) { + self.boot_command = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes firmware_header = 2; + + pub fn firmware_header(&self) -> &[u8] { + match self.firmware_header.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_firmware_header(&mut self) { + self.firmware_header = ::std::option::Option::None; + } + + pub fn has_firmware_header(&self) -> bool { + self.firmware_header.is_some() + } + + // Param is passed by value, moved + pub fn set_firmware_header(&mut self, v: ::std::vec::Vec) { + self.firmware_header = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_firmware_header(&mut self) -> &mut ::std::vec::Vec { + if self.firmware_header.is_none() { + self.firmware_header = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.firmware_header.as_mut().unwrap() + } + + // Take field + pub fn take_firmware_header(&mut self) -> ::std::vec::Vec { + self.firmware_header.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 language_data_length = 3; + + pub fn language_data_length(&self) -> u32 { + self.language_data_length.unwrap_or(0u32) + } + + pub fn clear_language_data_length(&mut self) { + self.language_data_length = ::std::option::Option::None; + } + + pub fn has_language_data_length(&self) -> bool { + self.language_data_length.is_some() + } + + // Param is passed by value, moved + pub fn set_language_data_length(&mut self, v: u32) { + self.language_data_length = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "boot_command", + |m: &RebootToBootloader| { &m.boot_command }, + |m: &mut RebootToBootloader| { &mut m.boot_command }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "firmware_header", + |m: &RebootToBootloader| { &m.firmware_header }, + |m: &mut RebootToBootloader| { &mut m.firmware_header }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "language_data_length", + |m: &RebootToBootloader| { &m.language_data_length }, + |m: &mut RebootToBootloader| { &mut m.language_data_length }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "RebootToBootloader", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for RebootToBootloader { + const NAME: &'static str = "RebootToBootloader"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.boot_command = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.firmware_header = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.language_data_length = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.boot_command { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.firmware_header.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.language_data_length { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.boot_command { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.firmware_header.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.language_data_length { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RebootToBootloader { + RebootToBootloader::new() + } + + fn clear(&mut self) { + self.boot_command = ::std::option::Option::None; + self.firmware_header = ::std::option::Option::None; + self.language_data_length = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RebootToBootloader { + static instance: RebootToBootloader = RebootToBootloader { + boot_command: ::std::option::Option::None, + firmware_header: ::std::option::Option::None, + language_data_length: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for RebootToBootloader { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RebootToBootloader").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RebootToBootloader { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RebootToBootloader { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `RebootToBootloader` +pub mod reboot_to_bootloader { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.management.RebootToBootloader.BootCommand) + pub enum BootCommand { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RebootToBootloader.BootCommand.STOP_AND_WAIT) + STOP_AND_WAIT = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RebootToBootloader.BootCommand.INSTALL_UPGRADE) + INSTALL_UPGRADE = 1, + } + + impl ::protobuf::Enum for BootCommand { + const NAME: &'static str = "BootCommand"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(BootCommand::STOP_AND_WAIT), + 1 => ::std::option::Option::Some(BootCommand::INSTALL_UPGRADE), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "STOP_AND_WAIT" => ::std::option::Option::Some(BootCommand::STOP_AND_WAIT), + "INSTALL_UPGRADE" => ::std::option::Option::Some(BootCommand::INSTALL_UPGRADE), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [BootCommand] = &[ + BootCommand::STOP_AND_WAIT, + BootCommand::INSTALL_UPGRADE, + ]; + } + + impl ::protobuf::EnumFull for BootCommand { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("RebootToBootloader.BootCommand").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for BootCommand { + fn default() -> Self { + BootCommand::STOP_AND_WAIT + } + } + + impl BootCommand { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("RebootToBootloader.BootCommand") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.GetNonce) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct GetNonce { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetNonce.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a GetNonce { + fn default() -> &'a GetNonce { + ::default_instance() + } +} + +impl GetNonce { + pub fn new() -> GetNonce { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "GetNonce", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for GetNonce { + const NAME: &'static str = "GetNonce"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> GetNonce { + GetNonce::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static GetNonce { + static instance: GetNonce = GetNonce { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for GetNonce { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("GetNonce").unwrap()).clone() + } +} + +impl ::std::fmt::Display for GetNonce { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetNonce { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.Nonce) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Nonce { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.Nonce.nonce) + pub nonce: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Nonce.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Nonce { + fn default() -> &'a Nonce { + ::default_instance() + } +} + +impl Nonce { + pub fn new() -> Nonce { + ::std::default::Default::default() + } + + // required bytes nonce = 1; + + pub fn nonce(&self) -> &[u8] { + match self.nonce.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_nonce(&mut self) { + self.nonce = ::std::option::Option::None; + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: ::std::vec::Vec) { + self.nonce = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { + if self.nonce.is_none() { + self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.nonce.as_mut().unwrap() + } + + // Take field + pub fn take_nonce(&mut self) -> ::std::vec::Vec { + self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce", + |m: &Nonce| { &m.nonce }, + |m: &mut Nonce| { &mut m.nonce }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "Nonce", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for Nonce { + const NAME: &'static str = "Nonce"; + + fn is_initialized(&self) -> bool { + if self.nonce.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.nonce = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.nonce.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.nonce.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> Nonce { + Nonce::new() + } + + fn clear(&mut self) { + self.nonce = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Nonce { + static instance: Nonce = Nonce { + nonce: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for Nonce { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Nonce").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Nonce { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Nonce { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.UnlockPath) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct UnlockPath { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.UnlockPath.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.management.UnlockPath.mac) + pub mac: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.UnlockPath.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a UnlockPath { + fn default() -> &'a UnlockPath { + ::default_instance() + } +} + +impl UnlockPath { + pub fn new() -> UnlockPath { + ::std::default::Default::default() + } + + // optional bytes mac = 2; + + pub fn mac(&self) -> &[u8] { + match self.mac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mac(&mut self) { + self.mac = ::std::option::Option::None; + } + + pub fn has_mac(&self) -> bool { + self.mac.is_some() + } + + // Param is passed by value, moved + pub fn set_mac(&mut self, v: ::std::vec::Vec) { + self.mac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { + if self.mac.is_none() { + self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mac.as_mut().unwrap() + } + + // Take field + pub fn take_mac(&mut self) -> ::std::vec::Vec { + self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &UnlockPath| { &m.address_n }, + |m: &mut UnlockPath| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mac", + |m: &UnlockPath| { &m.mac }, + |m: &mut UnlockPath| { &mut m.mac }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "UnlockPath", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for UnlockPath { + const NAME: &'static str = "UnlockPath"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.mac = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.mac.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.mac.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> UnlockPath { + UnlockPath::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.mac = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static UnlockPath { + static instance: UnlockPath = UnlockPath { + address_n: ::std::vec::Vec::new(), + mac: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for UnlockPath { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("UnlockPath").unwrap()).clone() + } +} + +impl ::std::fmt::Display for UnlockPath { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UnlockPath { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.UnlockedPathRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct UnlockedPathRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.management.UnlockedPathRequest.mac) + pub mac: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.UnlockedPathRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a UnlockedPathRequest { + fn default() -> &'a UnlockedPathRequest { + ::default_instance() + } +} + +impl UnlockedPathRequest { + pub fn new() -> UnlockedPathRequest { + ::std::default::Default::default() + } + + // optional bytes mac = 1; + + pub fn mac(&self) -> &[u8] { + match self.mac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mac(&mut self) { + self.mac = ::std::option::Option::None; + } + + pub fn has_mac(&self) -> bool { + self.mac.is_some() + } + + // Param is passed by value, moved + pub fn set_mac(&mut self, v: ::std::vec::Vec) { + self.mac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { + if self.mac.is_none() { + self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mac.as_mut().unwrap() + } + + // Take field + pub fn take_mac(&mut self) -> ::std::vec::Vec { + self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mac", + |m: &UnlockedPathRequest| { &m.mac }, + |m: &mut UnlockedPathRequest| { &mut m.mac }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "UnlockedPathRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for UnlockedPathRequest { + const NAME: &'static str = "UnlockedPathRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.mac = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.mac.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.mac.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> UnlockedPathRequest { + UnlockedPathRequest::new() + } + + fn clear(&mut self) { + self.mac = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static UnlockedPathRequest { + static instance: UnlockedPathRequest = UnlockedPathRequest { + mac: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for UnlockedPathRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("UnlockedPathRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for UnlockedPathRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UnlockedPathRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.ShowDeviceTutorial) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct ShowDeviceTutorial { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ShowDeviceTutorial.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ShowDeviceTutorial { + fn default() -> &'a ShowDeviceTutorial { + ::default_instance() + } +} + +impl ShowDeviceTutorial { + pub fn new() -> ShowDeviceTutorial { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "ShowDeviceTutorial", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for ShowDeviceTutorial { + const NAME: &'static str = "ShowDeviceTutorial"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> ShowDeviceTutorial { + ShowDeviceTutorial::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static ShowDeviceTutorial { + static instance: ShowDeviceTutorial = ShowDeviceTutorial { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for ShowDeviceTutorial { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ShowDeviceTutorial").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ShowDeviceTutorial { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ShowDeviceTutorial { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.management.UnlockBootloader) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct UnlockBootloader { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.management.UnlockBootloader.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a UnlockBootloader { + fn default() -> &'a UnlockBootloader { + ::default_instance() + } +} + +impl UnlockBootloader { + pub fn new() -> UnlockBootloader { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "UnlockBootloader", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for UnlockBootloader { + const NAME: &'static str = "UnlockBootloader"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> UnlockBootloader { + UnlockBootloader::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static UnlockBootloader { + static instance: UnlockBootloader = UnlockBootloader { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for UnlockBootloader { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("UnlockBootloader").unwrap()).clone() + } +} + +impl ::std::fmt::Display for UnlockBootloader { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UnlockBootloader { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.management.BackupType) +pub enum BackupType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.BackupType.Bip39) + Bip39 = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.BackupType.Slip39_Basic) + Slip39_Basic = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.BackupType.Slip39_Advanced) + Slip39_Advanced = 2, +} + +impl ::protobuf::Enum for BackupType { + const NAME: &'static str = "BackupType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(BackupType::Bip39), + 1 => ::std::option::Option::Some(BackupType::Slip39_Basic), + 2 => ::std::option::Option::Some(BackupType::Slip39_Advanced), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Bip39" => ::std::option::Option::Some(BackupType::Bip39), + "Slip39_Basic" => ::std::option::Option::Some(BackupType::Slip39_Basic), + "Slip39_Advanced" => ::std::option::Option::Some(BackupType::Slip39_Advanced), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [BackupType] = &[ + BackupType::Bip39, + BackupType::Slip39_Basic, + BackupType::Slip39_Advanced, + ]; +} + +impl ::protobuf::EnumFull for BackupType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("BackupType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for BackupType { + fn default() -> Self { + BackupType::Bip39 + } +} + +impl BackupType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BackupType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.management.SafetyCheckLevel) +pub enum SafetyCheckLevel { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SafetyCheckLevel.Strict) + Strict = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SafetyCheckLevel.PromptAlways) + PromptAlways = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SafetyCheckLevel.PromptTemporarily) + PromptTemporarily = 2, +} + +impl ::protobuf::Enum for SafetyCheckLevel { + const NAME: &'static str = "SafetyCheckLevel"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(SafetyCheckLevel::Strict), + 1 => ::std::option::Option::Some(SafetyCheckLevel::PromptAlways), + 2 => ::std::option::Option::Some(SafetyCheckLevel::PromptTemporarily), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Strict" => ::std::option::Option::Some(SafetyCheckLevel::Strict), + "PromptAlways" => ::std::option::Option::Some(SafetyCheckLevel::PromptAlways), + "PromptTemporarily" => ::std::option::Option::Some(SafetyCheckLevel::PromptTemporarily), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [SafetyCheckLevel] = &[ + SafetyCheckLevel::Strict, + SafetyCheckLevel::PromptAlways, + SafetyCheckLevel::PromptTemporarily, + ]; +} + +impl ::protobuf::EnumFull for SafetyCheckLevel { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("SafetyCheckLevel").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for SafetyCheckLevel { + fn default() -> Self { + SafetyCheckLevel::Strict + } +} + +impl SafetyCheckLevel { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("SafetyCheckLevel") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.management.HomescreenFormat) +pub enum HomescreenFormat { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.HomescreenFormat.Toif) + Toif = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.HomescreenFormat.Jpeg) + Jpeg = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.HomescreenFormat.ToiG) + ToiG = 3, +} + +impl ::protobuf::Enum for HomescreenFormat { + const NAME: &'static str = "HomescreenFormat"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(HomescreenFormat::Toif), + 2 => ::std::option::Option::Some(HomescreenFormat::Jpeg), + 3 => ::std::option::Option::Some(HomescreenFormat::ToiG), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Toif" => ::std::option::Option::Some(HomescreenFormat::Toif), + "Jpeg" => ::std::option::Option::Some(HomescreenFormat::Jpeg), + "ToiG" => ::std::option::Option::Some(HomescreenFormat::ToiG), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [HomescreenFormat] = &[ + HomescreenFormat::Toif, + HomescreenFormat::Jpeg, + HomescreenFormat::ToiG, + ]; +} + +impl ::protobuf::EnumFull for HomescreenFormat { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("HomescreenFormat").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + HomescreenFormat::Toif => 0, + HomescreenFormat::Jpeg => 1, + HomescreenFormat::ToiG => 2, + }; + Self::enum_descriptor().value_by_index(index) + } +} + +// Note, `Default` is implemented although default value is not 0 +impl ::std::default::Default for HomescreenFormat { + fn default() -> Self { + HomescreenFormat::Toif + } +} + +impl HomescreenFormat { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("HomescreenFormat") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x19messages-management.proto\x12\x1dhw.trezor.messages.management\x1a\ + \x0emessages.proto\"\x80\x01\n\nInitialize\x12\x1d\n\nsession_id\x18\x01\ + \x20\x01(\x0cR\tsessionId\x12,\n\x10_skip_passphrase\x18\x02\x20\x01(\ + \x08R\x0eSkipPassphraseB\x02\x18\x01\x12%\n\x0ederive_cardano\x18\x03\ + \x20\x01(\x08R\rderiveCardano\"\r\n\x0bGetFeatures\"\x94\x14\n\x08Featur\ + es\x12\x16\n\x06vendor\x18\x01\x20\x01(\tR\x06vendor\x12#\n\rmajor_versi\ + on\x18\x02\x20\x02(\rR\x0cmajorVersion\x12#\n\rminor_version\x18\x03\x20\ + \x02(\rR\x0cminorVersion\x12#\n\rpatch_version\x18\x04\x20\x02(\rR\x0cpa\ + tchVersion\x12'\n\x0fbootloader_mode\x18\x05\x20\x01(\x08R\x0ebootloader\ + Mode\x12\x1b\n\tdevice_id\x18\x06\x20\x01(\tR\x08deviceId\x12%\n\x0epin_\ + protection\x18\x07\x20\x01(\x08R\rpinProtection\x123\n\x15passphrase_pro\ + tection\x18\x08\x20\x01(\x08R\x14passphraseProtection\x12\x1a\n\x08langu\ + age\x18\t\x20\x01(\tR\x08language\x12\x14\n\x05label\x18\n\x20\x01(\tR\ + \x05label\x12\x20\n\x0binitialized\x18\x0c\x20\x01(\x08R\x0binitialized\ + \x12\x1a\n\x08revision\x18\r\x20\x01(\x0cR\x08revision\x12'\n\x0fbootloa\ + der_hash\x18\x0e\x20\x01(\x0cR\x0ebootloaderHash\x12\x1a\n\x08imported\ + \x18\x0f\x20\x01(\x08R\x08imported\x12\x1a\n\x08unlocked\x18\x10\x20\x01\ + (\x08R\x08unlocked\x120\n\x12_passphrase_cached\x18\x11\x20\x01(\x08R\ + \x10PassphraseCachedB\x02\x18\x01\x12)\n\x10firmware_present\x18\x12\x20\ + \x01(\x08R\x0ffirmwarePresent\x12!\n\x0cneeds_backup\x18\x13\x20\x01(\ + \x08R\x0bneedsBackup\x12\x14\n\x05flags\x18\x14\x20\x01(\rR\x05flags\x12\ + \x14\n\x05model\x18\x15\x20\x01(\tR\x05model\x12\x19\n\x08fw_major\x18\ + \x16\x20\x01(\rR\x07fwMajor\x12\x19\n\x08fw_minor\x18\x17\x20\x01(\rR\ + \x07fwMinor\x12\x19\n\x08fw_patch\x18\x18\x20\x01(\rR\x07fwPatch\x12\x1b\ + \n\tfw_vendor\x18\x19\x20\x01(\tR\x08fwVendor\x12+\n\x11unfinished_backu\ + p\x18\x1b\x20\x01(\x08R\x10unfinishedBackup\x12\x1b\n\tno_backup\x18\x1c\ + \x20\x01(\x08R\x08noBackup\x12#\n\rrecovery_mode\x18\x1d\x20\x01(\x08R\ + \x0crecoveryMode\x12V\n\x0ccapabilities\x18\x1e\x20\x03(\x0e22.hw.trezor\ + .messages.management.Features.CapabilityR\x0ccapabilities\x12J\n\x0bback\ + up_type\x18\x1f\x20\x01(\x0e2).hw.trezor.messages.management.BackupTypeR\ + \nbackupType\x12&\n\x0fsd_card_present\x18\x20\x20\x01(\x08R\rsdCardPres\ + ent\x12#\n\rsd_protection\x18!\x20\x01(\x08R\x0csdProtection\x120\n\x14w\ + ipe_code_protection\x18\"\x20\x01(\x08R\x12wipeCodeProtection\x12\x1d\n\ + \nsession_id\x18#\x20\x01(\x0cR\tsessionId\x12=\n\x1bpassphrase_always_o\ + n_device\x18$\x20\x01(\x08R\x18passphraseAlwaysOnDevice\x12T\n\rsafety_c\ + hecks\x18%\x20\x01(\x0e2/.hw.trezor.messages.management.SafetyCheckLevel\ + R\x0csafetyChecks\x12+\n\x12auto_lock_delay_ms\x18&\x20\x01(\rR\x0fautoL\ + ockDelayMs\x12)\n\x10display_rotation\x18'\x20\x01(\rR\x0fdisplayRotatio\ + n\x123\n\x15experimental_features\x18(\x20\x01(\x08R\x14experimentalFeat\ + ures\x12\x12\n\x04busy\x18)\x20\x01(\x08R\x04busy\x12\\\n\x11homescreen_\ + format\x18*\x20\x01(\x0e2/.hw.trezor.messages.management.HomescreenForma\ + tR\x10homescreenFormat\x129\n\x19hide_passphrase_from_host\x18+\x20\x01(\ + \x08R\x16hidePassphraseFromHost\x12%\n\x0einternal_model\x18,\x20\x01(\t\ + R\rinternalModel\x12\x1d\n\nunit_color\x18-\x20\x01(\rR\tunitColor\x12!\ + \n\x0cunit_btconly\x18.\x20\x01(\x08R\x0bunitBtconly\x12)\n\x10homescree\ + n_width\x18/\x20\x01(\rR\x0fhomescreenWidth\x12+\n\x11homescreen_height\ + \x180\x20\x01(\rR\x10homescreenHeight\x12+\n\x11bootloader_locked\x181\ + \x20\x01(\x08R\x10bootloaderLocked\x12>\n\x18language_version_matches\ + \x182\x20\x01(\x08:\x04trueR\x16languageVersionMatches\x12%\n\x0eunit_pa\ + ckaging\x183\x20\x01(\rR\runitPackaging\"\x9e\x04\n\nCapability\x12\x1c\ + \n\x12Capability_Bitcoin\x10\x01\x1a\x04\x80\xa6\x1d\x01\x12\x1b\n\x17Ca\ + pability_Bitcoin_like\x10\x02\x12\x16\n\x12Capability_Binance\x10\x03\ + \x12\x16\n\x12Capability_Cardano\x10\x04\x12\x1b\n\x11Capability_Crypto\ + \x10\x05\x1a\x04\x80\xa6\x1d\x01\x12\x12\n\x0eCapability_EOS\x10\x06\x12\ + \x17\n\x13Capability_Ethereum\x10\x07\x12\x17\n\x0fCapability_Lisk\x10\ + \x08\x1a\x02\x08\x01\x12\x15\n\x11Capability_Monero\x10\t\x12\x12\n\x0eC\ + apability_NEM\x10\n\x12\x15\n\x11Capability_Ripple\x10\x0b\x12\x16\n\x12\ + Capability_Stellar\x10\x0c\x12\x14\n\x10Capability_Tezos\x10\r\x12\x12\n\ + \x0eCapability_U2F\x10\x0e\x12\x1b\n\x11Capability_Shamir\x10\x0f\x1a\ + \x04\x80\xa6\x1d\x01\x12!\n\x17Capability_ShamirGroups\x10\x10\x1a\x04\ + \x80\xa6\x1d\x01\x12$\n\x1aCapability_PassphraseEntry\x10\x11\x1a\x04\ + \x80\xa6\x1d\x01\x12\x15\n\x11Capability_Solana\x10\x12\x12!\n\x17Capabi\ + lity_Translations\x10\x13\x1a\x04\x80\xa6\x1d\x01\x12\x18\n\x14Capabilit\ + y_Mintlayer\x10\x14\x1a\x04\xc8\xf3\x18\x01\"\x0c\n\nLockDevice\"&\n\x07\ + SetBusy\x12\x1b\n\texpiry_ms\x18\x01\x20\x01(\rR\x08expiryMs\"\x0c\n\nEn\ + dSession\"\x9b\x04\n\rApplySettings\x12\x1e\n\x08language\x18\x01\x20\ + \x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x02\x20\x01(\tR\ + \x05label\x12%\n\x0euse_passphrase\x18\x03\x20\x01(\x08R\rusePassphrase\ + \x12\x1e\n\nhomescreen\x18\x04\x20\x01(\x0cR\nhomescreen\x120\n\x12_pass\ + phrase_source\x18\x05\x20\x01(\rR\x10PassphraseSourceB\x02\x18\x01\x12+\ + \n\x12auto_lock_delay_ms\x18\x06\x20\x01(\rR\x0fautoLockDelayMs\x12)\n\ + \x10display_rotation\x18\x07\x20\x01(\rR\x0fdisplayRotation\x12=\n\x1bpa\ + ssphrase_always_on_device\x18\x08\x20\x01(\x08R\x18passphraseAlwaysOnDev\ + ice\x12T\n\rsafety_checks\x18\t\x20\x01(\x0e2/.hw.trezor.messages.manage\ + ment.SafetyCheckLevelR\x0csafetyChecks\x123\n\x15experimental_features\ + \x18\n\x20\x01(\x08R\x14experimentalFeatures\x129\n\x19hide_passphrase_f\ + rom_host\x18\x0b\x20\x01(\x08R\x16hidePassphraseFromHost\"T\n\x0eChangeL\ + anguage\x12\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndataLength\x12!\n\ + \x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"Z\n\x16Translatio\ + nDataRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndataLength\ + \x12\x1f\n\x0bdata_offset\x18\x02\x20\x02(\rR\ndataOffset\"3\n\x12Transl\ + ationDataAck\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\"\ + \n\nApplyFlags\x12\x14\n\x05flags\x18\x01\x20\x02(\rR\x05flags\"#\n\tCha\ + ngePin\x12\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\"(\n\x0eChang\ + eWipeCode\x12\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\"\xaa\x01\ + \n\tSdProtect\x12]\n\toperation\x18\x01\x20\x02(\x0e2?.hw.trezor.message\ + s.management.SdProtect.SdProtectOperationTypeR\toperation\">\n\x16SdProt\ + ectOperationType\x12\x0b\n\x07DISABLE\x10\0\x12\n\n\x06ENABLE\x10\x01\ + \x12\x0b\n\x07REFRESH\x10\x02\"O\n\x04Ping\x12\x1a\n\x07message\x18\x01\ + \x20\x01(\t:\0R\x07message\x12+\n\x11button_protection\x18\x02\x20\x01(\ + \x08R\x10buttonProtection\"\x08\n\x06Cancel\"\x20\n\nGetEntropy\x12\x12\ + \n\x04size\x18\x01\x20\x02(\rR\x04size\"#\n\x07Entropy\x12\x18\n\x07entr\ + opy\x18\x01\x20\x02(\x0cR\x07entropy\"/\n\x0fGetFirmwareHash\x12\x1c\n\t\ + challenge\x18\x01\x20\x01(\x0cR\tchallenge\"\"\n\x0cFirmwareHash\x12\x12\ + \n\x04hash\x18\x01\x20\x02(\x0cR\x04hash\"2\n\x12AuthenticateDevice\x12\ + \x1c\n\tchallenge\x18\x01\x20\x02(\x0cR\tchallenge\"U\n\x11AuthenticityP\ + roof\x12\"\n\x0ccertificates\x18\x01\x20\x03(\x0cR\x0ccertificates\x12\ + \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\"\x0c\n\nWipeDevice\"\ + \xad\x02\n\nLoadDevice\x12\x1c\n\tmnemonics\x18\x01\x20\x03(\tR\tmnemoni\ + cs\x12\x10\n\x03pin\x18\x03\x20\x01(\tR\x03pin\x123\n\x15passphrase_prot\ + ection\x18\x04\x20\x01(\x08R\x14passphraseProtection\x12\x1e\n\x08langua\ + ge\x18\x05\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\ + \x06\x20\x01(\tR\x05label\x12#\n\rskip_checksum\x18\x07\x20\x01(\x08R\ + \x0cskipChecksum\x12\x1f\n\x0bu2f_counter\x18\x08\x20\x01(\rR\nu2fCounte\ + r\x12!\n\x0cneeds_backup\x18\t\x20\x01(\x08R\x0bneedsBackup\x12\x1b\n\tn\ + o_backup\x18\n\x20\x01(\x08R\x08noBackup\"\x99\x03\n\x0bResetDevice\x12%\ + \n\x0edisplay_random\x18\x01\x20\x01(\x08R\rdisplayRandom\x12\x1f\n\x08s\ + trength\x18\x02\x20\x01(\r:\x03256R\x08strength\x123\n\x15passphrase_pro\ + tection\x18\x03\x20\x01(\x08R\x14passphraseProtection\x12%\n\x0epin_prot\ + ection\x18\x04\x20\x01(\x08R\rpinProtection\x12\x1e\n\x08language\x18\ + \x05\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x06\x20\ + \x01(\tR\x05label\x12\x1f\n\x0bu2f_counter\x18\x07\x20\x01(\rR\nu2fCount\ + er\x12\x1f\n\x0bskip_backup\x18\x08\x20\x01(\x08R\nskipBackup\x12\x1b\n\ + \tno_backup\x18\t\x20\x01(\x08R\x08noBackup\x12Q\n\x0bbackup_type\x18\n\ + \x20\x01(\x0e2).hw.trezor.messages.management.BackupType:\x05Bip39R\nbac\ + kupType\"\xe5\x01\n\x0cBackupDevice\x12'\n\x0fgroup_threshold\x18\x01\ + \x20\x01(\rR\x0egroupThreshold\x12O\n\x06groups\x18\x02\x20\x03(\x0b27.h\ + w.trezor.messages.management.BackupDevice.Slip39GroupR\x06groups\x1a[\n\ + \x0bSlip39Group\x12)\n\x10member_threshold\x18\x01\x20\x02(\rR\x0fmember\ + Threshold\x12!\n\x0cmember_count\x18\x02\x20\x02(\rR\x0bmemberCount\"\ + \x10\n\x0eEntropyRequest\"&\n\nEntropyAck\x12\x18\n\x07entropy\x18\x01\ + \x20\x02(\x0cR\x07entropy\"\xd8\x03\n\x0eRecoveryDevice\x12\x1d\n\nword_\ + count\x18\x01\x20\x01(\rR\twordCount\x123\n\x15passphrase_protection\x18\ + \x02\x20\x01(\x08R\x14passphraseProtection\x12%\n\x0epin_protection\x18\ + \x03\x20\x01(\x08R\rpinProtection\x12\x1e\n\x08language\x18\x04\x20\x01(\ + \tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x05\x20\x01(\tR\x05l\ + abel\x12)\n\x10enforce_wordlist\x18\x06\x20\x01(\x08R\x0fenforceWordlist\ + \x12T\n\x04type\x18\x08\x20\x01(\x0e2@.hw.trezor.messages.management.Rec\ + overyDevice.RecoveryDeviceTypeR\x04type\x12\x1f\n\x0bu2f_counter\x18\t\ + \x20\x01(\rR\nu2fCounter\x12\x17\n\x07dry_run\x18\n\x20\x01(\x08R\x06dry\ + Run\"Z\n\x12RecoveryDeviceType\x12%\n!RecoveryDeviceType_ScrambledWords\ + \x10\0\x12\x1d\n\x19RecoveryDeviceType_Matrix\x10\x01\"\xc5\x01\n\x0bWor\ + dRequest\x12N\n\x04type\x18\x01\x20\x02(\x0e2:.hw.trezor.messages.manage\ + ment.WordRequest.WordRequestTypeR\x04type\"f\n\x0fWordRequestType\x12\ + \x19\n\x15WordRequestType_Plain\x10\0\x12\x1b\n\x17WordRequestType_Matri\ + x9\x10\x01\x12\x1b\n\x17WordRequestType_Matrix6\x10\x02\"\x1d\n\x07WordA\ + ck\x12\x12\n\x04word\x18\x01\x20\x02(\tR\x04word\"0\n\rSetU2FCounter\x12\ + \x1f\n\x0bu2f_counter\x18\x01\x20\x02(\rR\nu2fCounter\"\x13\n\x11GetNext\ + U2FCounter\"1\n\x0eNextU2FCounter\x12\x1f\n\x0bu2f_counter\x18\x01\x20\ + \x02(\rR\nu2fCounter\"\x11\n\x0fDoPreauthorized\"\x16\n\x14Preauthorized\ + Request\"\x15\n\x13CancelAuthorization\"\x9a\x02\n\x12RebootToBootloader\ + \x12o\n\x0cboot_command\x18\x01\x20\x01(\x0e2=.hw.trezor.messages.manage\ + ment.RebootToBootloader.BootCommand:\rSTOP_AND_WAITR\x0bbootCommand\x12'\ + \n\x0ffirmware_header\x18\x02\x20\x01(\x0cR\x0efirmwareHeader\x123\n\x14\ + language_data_length\x18\x03\x20\x01(\r:\x010R\x12languageDataLength\"5\ + \n\x0bBootCommand\x12\x11\n\rSTOP_AND_WAIT\x10\0\x12\x13\n\x0fINSTALL_UP\ + GRADE\x10\x01\"\x10\n\x08GetNonce:\x04\x88\xb2\x19\x01\"#\n\x05Nonce\x12\ + \x14\n\x05nonce\x18\x01\x20\x02(\x0cR\x05nonce:\x04\x88\xb2\x19\x01\";\n\ + \nUnlockPath\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\ + \x10\n\x03mac\x18\x02\x20\x01(\x0cR\x03mac\"'\n\x13UnlockedPathRequest\ + \x12\x10\n\x03mac\x18\x01\x20\x01(\x0cR\x03mac\"\x14\n\x12ShowDeviceTuto\ + rial\"\x12\n\x10UnlockBootloader*>\n\nBackupType\x12\t\n\x05Bip39\x10\0\ + \x12\x10\n\x0cSlip39_Basic\x10\x01\x12\x13\n\x0fSlip39_Advanced\x10\x02*\ + G\n\x10SafetyCheckLevel\x12\n\n\x06Strict\x10\0\x12\x10\n\x0cPromptAlway\ + s\x10\x01\x12\x15\n\x11PromptTemporarily\x10\x02*0\n\x10HomescreenFormat\ + \x12\x08\n\x04Toif\x10\x01\x12\x08\n\x04Jpeg\x10\x02\x12\x08\n\x04ToiG\ + \x10\x03BB\n#com.satoshilabs.trezor.lib.protobufB\x17TrezorMessageManage\ + ment\x80\xa6\x1d\x01\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(super::messages::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(45); + messages.push(Initialize::generated_message_descriptor_data()); + messages.push(GetFeatures::generated_message_descriptor_data()); + messages.push(Features::generated_message_descriptor_data()); + messages.push(LockDevice::generated_message_descriptor_data()); + messages.push(SetBusy::generated_message_descriptor_data()); + messages.push(EndSession::generated_message_descriptor_data()); + messages.push(ApplySettings::generated_message_descriptor_data()); + messages.push(ChangeLanguage::generated_message_descriptor_data()); + messages.push(TranslationDataRequest::generated_message_descriptor_data()); + messages.push(TranslationDataAck::generated_message_descriptor_data()); + messages.push(ApplyFlags::generated_message_descriptor_data()); + messages.push(ChangePin::generated_message_descriptor_data()); + messages.push(ChangeWipeCode::generated_message_descriptor_data()); + messages.push(SdProtect::generated_message_descriptor_data()); + messages.push(Ping::generated_message_descriptor_data()); + messages.push(Cancel::generated_message_descriptor_data()); + messages.push(GetEntropy::generated_message_descriptor_data()); + messages.push(Entropy::generated_message_descriptor_data()); + messages.push(GetFirmwareHash::generated_message_descriptor_data()); + messages.push(FirmwareHash::generated_message_descriptor_data()); + messages.push(AuthenticateDevice::generated_message_descriptor_data()); + messages.push(AuthenticityProof::generated_message_descriptor_data()); + messages.push(WipeDevice::generated_message_descriptor_data()); + messages.push(LoadDevice::generated_message_descriptor_data()); + messages.push(ResetDevice::generated_message_descriptor_data()); + messages.push(BackupDevice::generated_message_descriptor_data()); + messages.push(EntropyRequest::generated_message_descriptor_data()); + messages.push(EntropyAck::generated_message_descriptor_data()); + messages.push(RecoveryDevice::generated_message_descriptor_data()); + messages.push(WordRequest::generated_message_descriptor_data()); + messages.push(WordAck::generated_message_descriptor_data()); + messages.push(SetU2FCounter::generated_message_descriptor_data()); + messages.push(GetNextU2FCounter::generated_message_descriptor_data()); + messages.push(NextU2FCounter::generated_message_descriptor_data()); + messages.push(DoPreauthorized::generated_message_descriptor_data()); + messages.push(PreauthorizedRequest::generated_message_descriptor_data()); + messages.push(CancelAuthorization::generated_message_descriptor_data()); + messages.push(RebootToBootloader::generated_message_descriptor_data()); + messages.push(GetNonce::generated_message_descriptor_data()); + messages.push(Nonce::generated_message_descriptor_data()); + messages.push(UnlockPath::generated_message_descriptor_data()); + messages.push(UnlockedPathRequest::generated_message_descriptor_data()); + messages.push(ShowDeviceTutorial::generated_message_descriptor_data()); + messages.push(UnlockBootloader::generated_message_descriptor_data()); + messages.push(backup_device::Slip39Group::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(8); + enums.push(BackupType::generated_enum_descriptor_data()); + enums.push(SafetyCheckLevel::generated_enum_descriptor_data()); + enums.push(HomescreenFormat::generated_enum_descriptor_data()); + enums.push(features::Capability::generated_enum_descriptor_data()); + enums.push(sd_protect::SdProtectOperationType::generated_enum_descriptor_data()); + enums.push(recovery_device::RecoveryDeviceType::generated_enum_descriptor_data()); + enums.push(word_request::WordRequestType::generated_enum_descriptor_data()); + enums.push(reboot_to_bootloader::BootCommand::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs b/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs new file mode 100644 index 0000000000..3ea293f348 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs @@ -0,0 +1,3772 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-mintlayer.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerGetAddress { + fn default() -> &'a MintlayerGetAddress { + ::default_instance() + } +} + +impl MintlayerGetAddress { + pub fn new() -> MintlayerGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerGetAddress| { &m.address_n }, + |m: &mut MintlayerGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &MintlayerGetAddress| { &m.show_display }, + |m: &mut MintlayerGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &MintlayerGetAddress| { &m.chunkify }, + |m: &mut MintlayerGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerGetAddress { + const NAME: &'static str = "MintlayerGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerGetAddress { + MintlayerGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerGetAddress { + static instance: MintlayerGetAddress = MintlayerGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerAddress { + fn default() -> &'a MintlayerAddress { + ::default_instance() + } +} + +impl MintlayerAddress { + pub fn new() -> MintlayerAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MintlayerAddress| { &m.address }, + |m: &mut MintlayerAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerAddress { + const NAME: &'static str = "MintlayerAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerAddress { + MintlayerAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerAddress { + static instance: MintlayerAddress = MintlayerAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerGetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerGetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetPublicKey.show_display) + pub show_display: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerGetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerGetPublicKey { + fn default() -> &'a MintlayerGetPublicKey { + ::default_instance() + } +} + +impl MintlayerGetPublicKey { + pub fn new() -> MintlayerGetPublicKey { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerGetPublicKey| { &m.address_n }, + |m: &mut MintlayerGetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &MintlayerGetPublicKey| { &m.show_display }, + |m: &mut MintlayerGetPublicKey| { &mut m.show_display }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerGetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerGetPublicKey { + const NAME: &'static str = "MintlayerGetPublicKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerGetPublicKey { + MintlayerGetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerGetPublicKey { + static instance: MintlayerGetPublicKey = MintlayerGetPublicKey { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerGetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerGetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerGetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerGetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPublicKey.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPublicKey.chain_code) + pub chain_code: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerPublicKey { + fn default() -> &'a MintlayerPublicKey { + ::default_instance() + } +} + +impl MintlayerPublicKey { + pub fn new() -> MintlayerPublicKey { + ::std::default::Default::default() + } + + // required bytes public_key = 1; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes chain_code = 2; + + pub fn chain_code(&self) -> &[u8] { + match self.chain_code.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_chain_code(&mut self) { + self.chain_code = ::std::option::Option::None; + } + + pub fn has_chain_code(&self) -> bool { + self.chain_code.is_some() + } + + // Param is passed by value, moved + pub fn set_chain_code(&mut self, v: ::std::vec::Vec) { + self.chain_code = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_chain_code(&mut self) -> &mut ::std::vec::Vec { + if self.chain_code.is_none() { + self.chain_code = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.chain_code.as_mut().unwrap() + } + + // Take field + pub fn take_chain_code(&mut self) -> ::std::vec::Vec { + self.chain_code.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &MintlayerPublicKey| { &m.public_key }, + |m: &mut MintlayerPublicKey| { &mut m.public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chain_code", + |m: &MintlayerPublicKey| { &m.chain_code }, + |m: &mut MintlayerPublicKey| { &mut m.chain_code }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerPublicKey { + const NAME: &'static str = "MintlayerPublicKey"; + + fn is_initialized(&self) -> bool { + if self.public_key.is_none() { + return false; + } + if self.chain_code.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.chain_code = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.chain_code.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.chain_code.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerPublicKey { + MintlayerPublicKey::new() + } + + fn clear(&mut self) { + self.public_key = ::std::option::Option::None; + self.chain_code = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerPublicKey { + static instance: MintlayerPublicKey = MintlayerPublicKey { + public_key: ::std::option::Option::None, + chain_code: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerVerifySig) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerVerifySig { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerVerifySig.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerVerifySig.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerVerifySig.message) + pub message: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerVerifySig.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerVerifySig { + fn default() -> &'a MintlayerVerifySig { + ::default_instance() + } +} + +impl MintlayerVerifySig { + pub fn new() -> MintlayerVerifySig { + ::std::default::Default::default() + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes message = 3; + + pub fn message(&self) -> &[u8] { + match self.message.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::vec::Vec) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::vec::Vec { + self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerVerifySig| { &m.address_n }, + |m: &mut MintlayerVerifySig| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &MintlayerVerifySig| { &m.signature }, + |m: &mut MintlayerVerifySig| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &MintlayerVerifySig| { &m.message }, + |m: &mut MintlayerVerifySig| { &mut m.message }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerVerifySig", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerVerifySig { + const NAME: &'static str = "MintlayerVerifySig"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + if self.message.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.message = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.message.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerVerifySig { + MintlayerVerifySig::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.signature = ::std::option::Option::None; + self.message = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerVerifySig { + static instance: MintlayerVerifySig = MintlayerVerifySig { + address_n: ::std::vec::Vec::new(), + signature: ::std::option::Option::None, + message: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerVerifySig { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerVerifySig").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerVerifySig { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerVerifySig { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.outputs_count) + pub outputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.inputs_count) + pub inputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.version) + pub version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.serialize) + pub serialize: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerSignTx { + fn default() -> &'a MintlayerSignTx { + ::default_instance() + } +} + +impl MintlayerSignTx { + pub fn new() -> MintlayerSignTx { + ::std::default::Default::default() + } + + // required uint32 outputs_count = 1; + + pub fn outputs_count(&self) -> u32 { + self.outputs_count.unwrap_or(0) + } + + pub fn clear_outputs_count(&mut self) { + self.outputs_count = ::std::option::Option::None; + } + + pub fn has_outputs_count(&self) -> bool { + self.outputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_outputs_count(&mut self, v: u32) { + self.outputs_count = ::std::option::Option::Some(v); + } + + // required uint32 inputs_count = 2; + + pub fn inputs_count(&self) -> u32 { + self.inputs_count.unwrap_or(0) + } + + pub fn clear_inputs_count(&mut self) { + self.inputs_count = ::std::option::Option::None; + } + + pub fn has_inputs_count(&self) -> bool { + self.inputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_inputs_count(&mut self, v: u32) { + self.inputs_count = ::std::option::Option::Some(v); + } + + // optional uint32 version = 3; + + pub fn version(&self) -> u32 { + self.version.unwrap_or(1u32) + } + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u32) { + self.version = ::std::option::Option::Some(v); + } + + // optional bool serialize = 4; + + pub fn serialize(&self) -> bool { + self.serialize.unwrap_or(true) + } + + pub fn clear_serialize(&mut self) { + self.serialize = ::std::option::Option::None; + } + + pub fn has_serialize(&self) -> bool { + self.serialize.is_some() + } + + // Param is passed by value, moved + pub fn set_serialize(&mut self, v: bool) { + self.serialize = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 5; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "outputs_count", + |m: &MintlayerSignTx| { &m.outputs_count }, + |m: &mut MintlayerSignTx| { &mut m.outputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inputs_count", + |m: &MintlayerSignTx| { &m.inputs_count }, + |m: &mut MintlayerSignTx| { &mut m.inputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version", + |m: &MintlayerSignTx| { &m.version }, + |m: &mut MintlayerSignTx| { &mut m.version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "serialize", + |m: &MintlayerSignTx| { &m.serialize }, + |m: &mut MintlayerSignTx| { &mut m.serialize }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &MintlayerSignTx| { &m.chunkify }, + |m: &mut MintlayerSignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerSignTx { + const NAME: &'static str = "MintlayerSignTx"; + + fn is_initialized(&self) -> bool { + if self.outputs_count.is_none() { + return false; + } + if self.inputs_count.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.version = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.serialize = ::std::option::Option::Some(is.read_bool()?); + }, + 40 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.outputs_count { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.inputs_count { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.version { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.serialize { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.outputs_count { + os.write_uint32(1, v)?; + } + if let Some(v) = self.inputs_count { + os.write_uint32(2, v)?; + } + if let Some(v) = self.version { + os.write_uint32(3, v)?; + } + if let Some(v) = self.serialize { + os.write_bool(4, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerSignTx { + MintlayerSignTx::new() + } + + fn clear(&mut self) { + self.outputs_count = ::std::option::Option::None; + self.inputs_count = ::std::option::Option::None; + self.version = ::std::option::Option::None; + self.serialize = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerSignTx { + static instance: MintlayerSignTx = MintlayerSignTx { + outputs_count: ::std::option::Option::None, + inputs_count: ::std::option::Option::None, + version: ::std::option::Option::None, + serialize: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTxRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.request_type) + pub request_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.details) + pub details: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.serialized) + pub serialized: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTxRequest { + fn default() -> &'a MintlayerTxRequest { + ::default_instance() + } +} + +impl MintlayerTxRequest { + pub fn new() -> MintlayerTxRequest { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType request_type = 1; + + pub fn request_type(&self) -> mintlayer_tx_request::MintlayerRequestType { + match self.request_type { + Some(e) => e.enum_value_or(mintlayer_tx_request::MintlayerRequestType::TXINPUT), + None => mintlayer_tx_request::MintlayerRequestType::TXINPUT, + } + } + + pub fn clear_request_type(&mut self) { + self.request_type = ::std::option::Option::None; + } + + pub fn has_request_type(&self) -> bool { + self.request_type.is_some() + } + + // Param is passed by value, moved + pub fn set_request_type(&mut self, v: mintlayer_tx_request::MintlayerRequestType) { + self.request_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "request_type", + |m: &MintlayerTxRequest| { &m.request_type }, + |m: &mut MintlayerTxRequest| { &mut m.request_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_request::MintlayerTxRequestDetailsType>( + "details", + |m: &MintlayerTxRequest| { &m.details }, + |m: &mut MintlayerTxRequest| { &mut m.details }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "serialized", + |m: &MintlayerTxRequest| { &m.serialized }, + |m: &mut MintlayerTxRequest| { &mut m.serialized }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTxRequest { + const NAME: &'static str = "MintlayerTxRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.request_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.details)?; + }, + 26 => { + self.serialized.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.request_type { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.details.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + for value in &self.serialized { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.request_type { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.details.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + for v in &self.serialized { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxRequest { + MintlayerTxRequest::new() + } + + fn clear(&mut self) { + self.request_type = ::std::option::Option::None; + self.details.clear(); + self.serialized.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxRequest { + static instance: MintlayerTxRequest = MintlayerTxRequest { + request_type: ::std::option::Option::None, + details: ::protobuf::MessageField::none(), + serialized: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTxRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTxRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTxRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MintlayerTxRequest` +pub mod mintlayer_tx_request { + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MintlayerTxRequestDetailsType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType.request_index) + pub request_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType.tx_hash) + pub tx_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MintlayerTxRequestDetailsType { + fn default() -> &'a MintlayerTxRequestDetailsType { + ::default_instance() + } + } + + impl MintlayerTxRequestDetailsType { + pub fn new() -> MintlayerTxRequestDetailsType { + ::std::default::Default::default() + } + + // optional uint32 request_index = 1; + + pub fn request_index(&self) -> u32 { + self.request_index.unwrap_or(0) + } + + pub fn clear_request_index(&mut self) { + self.request_index = ::std::option::Option::None; + } + + pub fn has_request_index(&self) -> bool { + self.request_index.is_some() + } + + // Param is passed by value, moved + pub fn set_request_index(&mut self, v: u32) { + self.request_index = ::std::option::Option::Some(v); + } + + // optional bytes tx_hash = 2; + + pub fn tx_hash(&self) -> &[u8] { + match self.tx_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_hash(&mut self) { + self.tx_hash = ::std::option::Option::None; + } + + pub fn has_tx_hash(&self) -> bool { + self.tx_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_hash(&mut self, v: ::std::vec::Vec) { + self.tx_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_hash(&mut self) -> &mut ::std::vec::Vec { + if self.tx_hash.is_none() { + self.tx_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_hash.as_mut().unwrap() + } + + // Take field + pub fn take_tx_hash(&mut self) -> ::std::vec::Vec { + self.tx_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "request_index", + |m: &MintlayerTxRequestDetailsType| { &m.request_index }, + |m: &mut MintlayerTxRequestDetailsType| { &mut m.request_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_hash", + |m: &MintlayerTxRequestDetailsType| { &m.tx_hash }, + |m: &mut MintlayerTxRequestDetailsType| { &mut m.tx_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxRequest.MintlayerTxRequestDetailsType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MintlayerTxRequestDetailsType { + const NAME: &'static str = "MintlayerTxRequestDetailsType"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.request_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.tx_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.request_index { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.tx_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.request_index { + os.write_uint32(1, v)?; + } + if let Some(v) = self.tx_hash.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxRequestDetailsType { + MintlayerTxRequestDetailsType::new() + } + + fn clear(&mut self) { + self.request_index = ::std::option::Option::None; + self.tx_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxRequestDetailsType { + static instance: MintlayerTxRequestDetailsType = MintlayerTxRequestDetailsType { + request_index: ::std::option::Option::None, + tx_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MintlayerTxRequestDetailsType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxRequest.MintlayerTxRequestDetailsType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MintlayerTxRequestDetailsType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MintlayerTxRequestDetailsType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MintlayerTxRequestSerializedType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signature_index) + pub signature_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.serialized_tx) + pub serialized_tx: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MintlayerTxRequestSerializedType { + fn default() -> &'a MintlayerTxRequestSerializedType { + ::default_instance() + } + } + + impl MintlayerTxRequestSerializedType { + pub fn new() -> MintlayerTxRequestSerializedType { + ::std::default::Default::default() + } + + // optional uint32 signature_index = 1; + + pub fn signature_index(&self) -> u32 { + self.signature_index.unwrap_or(0) + } + + pub fn clear_signature_index(&mut self) { + self.signature_index = ::std::option::Option::None; + } + + pub fn has_signature_index(&self) -> bool { + self.signature_index.is_some() + } + + // Param is passed by value, moved + pub fn set_signature_index(&mut self, v: u32) { + self.signature_index = ::std::option::Option::Some(v); + } + + // optional bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes serialized_tx = 3; + + pub fn serialized_tx(&self) -> &[u8] { + match self.serialized_tx.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_serialized_tx(&mut self) { + self.serialized_tx = ::std::option::Option::None; + } + + pub fn has_serialized_tx(&self) -> bool { + self.serialized_tx.is_some() + } + + // Param is passed by value, moved + pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { + self.serialized_tx = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { + if self.serialized_tx.is_none() { + self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.serialized_tx.as_mut().unwrap() + } + + // Take field + pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { + self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature_index", + |m: &MintlayerTxRequestSerializedType| { &m.signature_index }, + |m: &mut MintlayerTxRequestSerializedType| { &mut m.signature_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &MintlayerTxRequestSerializedType| { &m.signature }, + |m: &mut MintlayerTxRequestSerializedType| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "serialized_tx", + |m: &MintlayerTxRequestSerializedType| { &m.serialized_tx }, + |m: &mut MintlayerTxRequestSerializedType| { &mut m.serialized_tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxRequest.MintlayerTxRequestSerializedType", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MintlayerTxRequestSerializedType { + const NAME: &'static str = "MintlayerTxRequestSerializedType"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.signature_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature_index { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.serialized_tx.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature_index { + os.write_uint32(1, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.serialized_tx.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxRequestSerializedType { + MintlayerTxRequestSerializedType::new() + } + + fn clear(&mut self) { + self.signature_index = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.serialized_tx = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxRequestSerializedType { + static instance: MintlayerTxRequestSerializedType = MintlayerTxRequestSerializedType { + signature_index: ::std::option::Option::None, + signature: ::std::option::Option::None, + serialized_tx: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MintlayerTxRequestSerializedType { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxRequest.MintlayerTxRequestSerializedType").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MintlayerTxRequestSerializedType { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MintlayerTxRequestSerializedType { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType) + pub enum MintlayerRequestType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXINPUT) + TXINPUT = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXOUTPUT) + TXOUTPUT = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXMETA) + TXMETA = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXFINISHED) + TXFINISHED = 3, + } + + impl ::protobuf::Enum for MintlayerRequestType { + const NAME: &'static str = "MintlayerRequestType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(MintlayerRequestType::TXINPUT), + 1 => ::std::option::Option::Some(MintlayerRequestType::TXOUTPUT), + 2 => ::std::option::Option::Some(MintlayerRequestType::TXMETA), + 3 => ::std::option::Option::Some(MintlayerRequestType::TXFINISHED), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "TXINPUT" => ::std::option::Option::Some(MintlayerRequestType::TXINPUT), + "TXOUTPUT" => ::std::option::Option::Some(MintlayerRequestType::TXOUTPUT), + "TXMETA" => ::std::option::Option::Some(MintlayerRequestType::TXMETA), + "TXFINISHED" => ::std::option::Option::Some(MintlayerRequestType::TXFINISHED), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [MintlayerRequestType] = &[ + MintlayerRequestType::TXINPUT, + MintlayerRequestType::TXOUTPUT, + MintlayerRequestType::TXMETA, + MintlayerRequestType::TXFINISHED, + ]; + } + + impl ::protobuf::EnumFull for MintlayerRequestType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("MintlayerTxRequest.MintlayerRequestType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for MintlayerRequestType { + fn default() -> Self { + MintlayerRequestType::TXINPUT + } + } + + impl MintlayerRequestType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MintlayerTxRequest.MintlayerRequestType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerUtxoTxInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.prev_index) + pub prev_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.amount) + pub amount: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerUtxoTxInput { + fn default() -> &'a MintlayerUtxoTxInput { + ::default_instance() + } +} + +impl MintlayerUtxoTxInput { + pub fn new() -> MintlayerUtxoTxInput { + ::std::default::Default::default() + } + + // required bytes prev_hash = 2; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 3; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + // optional uint32 sequence = 4; + + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(4294967295u32) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); + } + + // required bytes amount = 5; + + pub fn amount(&self) -> &[u8] { + match self.amount.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: ::std::vec::Vec) { + self.amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { + if self.amount.is_none() { + self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.amount.as_mut().unwrap() + } + + // Take field + pub fn take_amount(&mut self) -> ::std::vec::Vec { + self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerUtxoTxInput| { &m.address_n }, + |m: &mut MintlayerUtxoTxInput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &MintlayerUtxoTxInput| { &m.prev_hash }, + |m: &mut MintlayerUtxoTxInput| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &MintlayerUtxoTxInput| { &m.prev_index }, + |m: &mut MintlayerUtxoTxInput| { &mut m.prev_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &MintlayerUtxoTxInput| { &m.sequence }, + |m: &mut MintlayerUtxoTxInput| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MintlayerUtxoTxInput| { &m.amount }, + |m: &mut MintlayerUtxoTxInput| { &mut m.amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerUtxoTxInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerUtxoTxInput { + const NAME: &'static str = "MintlayerUtxoTxInput"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 42 => { + self.amount = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.amount.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(3, v)?; + } + if let Some(v) = self.sequence { + os.write_uint32(4, v)?; + } + if let Some(v) = self.amount.as_ref() { + os.write_bytes(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerUtxoTxInput { + MintlayerUtxoTxInput::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerUtxoTxInput { + static instance: MintlayerUtxoTxInput = MintlayerUtxoTxInput { + address_n: ::std::vec::Vec::new(), + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + sequence: ::std::option::Option::None, + amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerUtxoTxInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUtxoTxInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerUtxoTxInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerUtxoTxInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTransferTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.amount) + pub amount: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTransferTxOutput { + fn default() -> &'a MintlayerTransferTxOutput { + ::default_instance() + } +} + +impl MintlayerTransferTxOutput { + pub fn new() -> MintlayerTransferTxOutput { + ::std::default::Default::default() + } + + // optional string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes amount = 3; + + pub fn amount(&self) -> &[u8] { + match self.amount.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: ::std::vec::Vec) { + self.amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { + if self.amount.is_none() { + self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.amount.as_mut().unwrap() + } + + // Take field + pub fn take_amount(&mut self) -> ::std::vec::Vec { + self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MintlayerTransferTxOutput| { &m.address }, + |m: &mut MintlayerTransferTxOutput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerTransferTxOutput| { &m.address_n }, + |m: &mut MintlayerTransferTxOutput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MintlayerTransferTxOutput| { &m.amount }, + |m: &mut MintlayerTransferTxOutput| { &mut m.amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTransferTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTransferTxOutput { + const NAME: &'static str = "MintlayerTransferTxOutput"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 26 => { + self.amount = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.amount.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.amount.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTransferTxOutput { + MintlayerTransferTxOutput::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.address_n.clear(); + self.amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTransferTxOutput { + static instance: MintlayerTransferTxOutput = MintlayerTransferTxOutput { + address: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTransferTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTransferTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTransferTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTransferTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerPrevTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.version) + pub version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.inputs_count) + pub inputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.outputs_count) + pub outputs_count: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerPrevTx { + fn default() -> &'a MintlayerPrevTx { + ::default_instance() + } +} + +impl MintlayerPrevTx { + pub fn new() -> MintlayerPrevTx { + ::std::default::Default::default() + } + + // required uint32 version = 1; + + pub fn version(&self) -> u32 { + self.version.unwrap_or(0) + } + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u32) { + self.version = ::std::option::Option::Some(v); + } + + // required uint32 inputs_count = 6; + + pub fn inputs_count(&self) -> u32 { + self.inputs_count.unwrap_or(0) + } + + pub fn clear_inputs_count(&mut self) { + self.inputs_count = ::std::option::Option::None; + } + + pub fn has_inputs_count(&self) -> bool { + self.inputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_inputs_count(&mut self, v: u32) { + self.inputs_count = ::std::option::Option::Some(v); + } + + // required uint32 outputs_count = 7; + + pub fn outputs_count(&self) -> u32 { + self.outputs_count.unwrap_or(0) + } + + pub fn clear_outputs_count(&mut self) { + self.outputs_count = ::std::option::Option::None; + } + + pub fn has_outputs_count(&self) -> bool { + self.outputs_count.is_some() + } + + // Param is passed by value, moved + pub fn set_outputs_count(&mut self, v: u32) { + self.outputs_count = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version", + |m: &MintlayerPrevTx| { &m.version }, + |m: &mut MintlayerPrevTx| { &mut m.version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inputs_count", + |m: &MintlayerPrevTx| { &m.inputs_count }, + |m: &mut MintlayerPrevTx| { &mut m.inputs_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "outputs_count", + |m: &MintlayerPrevTx| { &m.outputs_count }, + |m: &mut MintlayerPrevTx| { &mut m.outputs_count }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerPrevTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerPrevTx { + const NAME: &'static str = "MintlayerPrevTx"; + + fn is_initialized(&self) -> bool { + if self.version.is_none() { + return false; + } + if self.inputs_count.is_none() { + return false; + } + if self.outputs_count.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.version = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.version { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.inputs_count { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.outputs_count { + my_size += ::protobuf::rt::uint32_size(7, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.version { + os.write_uint32(1, v)?; + } + if let Some(v) = self.inputs_count { + os.write_uint32(6, v)?; + } + if let Some(v) = self.outputs_count { + os.write_uint32(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerPrevTx { + MintlayerPrevTx::new() + } + + fn clear(&mut self) { + self.version = ::std::option::Option::None; + self.inputs_count = ::std::option::Option::None; + self.outputs_count = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerPrevTx { + static instance: MintlayerPrevTx = MintlayerPrevTx { + version: ::std::option::Option::None, + inputs_count: ::std::option::Option::None, + outputs_count: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerPrevTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerPrevTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerPrevTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerPrevInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevInput.prev_hash) + pub prev_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevInput.prev_index) + pub prev_index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerPrevInput { + fn default() -> &'a MintlayerPrevInput { + ::default_instance() + } +} + +impl MintlayerPrevInput { + pub fn new() -> MintlayerPrevInput { + ::std::default::Default::default() + } + + // required bytes prev_hash = 2; + + pub fn prev_hash(&self) -> &[u8] { + match self.prev_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_prev_hash(&mut self) { + self.prev_hash = ::std::option::Option::None; + } + + pub fn has_prev_hash(&self) -> bool { + self.prev_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { + self.prev_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { + if self.prev_hash.is_none() { + self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.prev_hash.as_mut().unwrap() + } + + // Take field + pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { + self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 prev_index = 3; + + pub fn prev_index(&self) -> u32 { + self.prev_index.unwrap_or(0) + } + + pub fn clear_prev_index(&mut self) { + self.prev_index = ::std::option::Option::None; + } + + pub fn has_prev_index(&self) -> bool { + self.prev_index.is_some() + } + + // Param is passed by value, moved + pub fn set_prev_index(&mut self, v: u32) { + self.prev_index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_hash", + |m: &MintlayerPrevInput| { &m.prev_hash }, + |m: &mut MintlayerPrevInput| { &mut m.prev_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "prev_index", + |m: &MintlayerPrevInput| { &m.prev_index }, + |m: &mut MintlayerPrevInput| { &mut m.prev_index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerPrevInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerPrevInput { + const NAME: &'static str = "MintlayerPrevInput"; + + fn is_initialized(&self) -> bool { + if self.prev_hash.is_none() { + return false; + } + if self.prev_index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.prev_index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.prev_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.prev_index { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.prev_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerPrevInput { + MintlayerPrevInput::new() + } + + fn clear(&mut self) { + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerPrevInput { + static instance: MintlayerPrevInput = MintlayerPrevInput { + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerPrevInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerPrevInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerPrevInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerPrevTransferOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.amount) + pub amount: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerPrevTransferOutput { + fn default() -> &'a MintlayerPrevTransferOutput { + ::default_instance() + } +} + +impl MintlayerPrevTransferOutput { + pub fn new() -> MintlayerPrevTransferOutput { + ::std::default::Default::default() + } + + // required bytes amount = 1; + + pub fn amount(&self) -> &[u8] { + match self.amount.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: ::std::vec::Vec) { + self.amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { + if self.amount.is_none() { + self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.amount.as_mut().unwrap() + } + + // Take field + pub fn take_amount(&mut self) -> ::std::vec::Vec { + self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MintlayerPrevTransferOutput| { &m.amount }, + |m: &mut MintlayerPrevTransferOutput| { &mut m.amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerPrevTransferOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerPrevTransferOutput { + const NAME: &'static str = "MintlayerPrevTransferOutput"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.amount = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerPrevTransferOutput { + MintlayerPrevTransferOutput::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerPrevTransferOutput { + static instance: MintlayerPrevTransferOutput = MintlayerPrevTransferOutput { + amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerPrevTransferOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevTransferOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerPrevTransferOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerPrevTransferOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTxAckUtxoInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTxAckUtxoInput { + fn default() -> &'a MintlayerTxAckUtxoInput { + ::default_instance() + } +} + +impl MintlayerTxAckUtxoInput { + pub fn new() -> MintlayerTxAckUtxoInput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper>( + "tx", + |m: &MintlayerTxAckUtxoInput| { &m.tx }, + |m: &mut MintlayerTxAckUtxoInput| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxAckUtxoInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTxAckUtxoInput { + const NAME: &'static str = "MintlayerTxAckUtxoInput"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxAckUtxoInput { + MintlayerTxAckUtxoInput::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxAckUtxoInput { + static instance: MintlayerTxAckUtxoInput = MintlayerTxAckUtxoInput { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTxAckUtxoInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxAckUtxoInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTxAckUtxoInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckUtxoInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MintlayerTxAckUtxoInput` +pub mod mintlayer_tx_ack_utxo_input { + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MintlayerTxAckInputWrapper { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper.input) + pub input: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MintlayerTxAckInputWrapper { + fn default() -> &'a MintlayerTxAckInputWrapper { + ::default_instance() + } + } + + impl MintlayerTxAckInputWrapper { + pub fn new() -> MintlayerTxAckInputWrapper { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerUtxoTxInput>( + "input", + |m: &MintlayerTxAckInputWrapper| { &m.input }, + |m: &mut MintlayerTxAckInputWrapper| { &mut m.input }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MintlayerTxAckInputWrapper { + const NAME: &'static str = "MintlayerTxAckInputWrapper"; + + fn is_initialized(&self) -> bool { + if self.input.is_none() { + return false; + } + for v in &self.input { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.input)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.input.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.input.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxAckInputWrapper { + MintlayerTxAckInputWrapper::new() + } + + fn clear(&mut self) { + self.input.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxAckInputWrapper { + static instance: MintlayerTxAckInputWrapper = MintlayerTxAckInputWrapper { + input: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MintlayerTxAckInputWrapper { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MintlayerTxAckInputWrapper { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckInputWrapper { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTxAckOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.tx) + pub tx: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTxAckOutput { + fn default() -> &'a MintlayerTxAckOutput { + ::default_instance() + } +} + +impl MintlayerTxAckOutput { + pub fn new() -> MintlayerTxAckOutput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper>( + "tx", + |m: &MintlayerTxAckOutput| { &m.tx }, + |m: &mut MintlayerTxAckOutput| { &mut m.tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxAckOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTxAckOutput { + const NAME: &'static str = "MintlayerTxAckOutput"; + + fn is_initialized(&self) -> bool { + if self.tx.is_none() { + return false; + } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxAckOutput { + MintlayerTxAckOutput::new() + } + + fn clear(&mut self) { + self.tx.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxAckOutput { + static instance: MintlayerTxAckOutput = MintlayerTxAckOutput { + tx: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTxAckOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxAckOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTxAckOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MintlayerTxAckOutput` +pub mod mintlayer_tx_ack_output { + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MintlayerTxAckOutputWrapper { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper.output) + pub output: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MintlayerTxAckOutputWrapper { + fn default() -> &'a MintlayerTxAckOutputWrapper { + ::default_instance() + } + } + + impl MintlayerTxAckOutputWrapper { + pub fn new() -> MintlayerTxAckOutputWrapper { + ::std::default::Default::default() + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerTransferTxOutput>( + "output", + |m: &MintlayerTxAckOutputWrapper| { &m.output }, + |m: &mut MintlayerTxAckOutputWrapper| { &mut m.output }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxAckOutput.MintlayerTxAckOutputWrapper", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MintlayerTxAckOutputWrapper { + const NAME: &'static str = "MintlayerTxAckOutputWrapper"; + + fn is_initialized(&self) -> bool { + if self.output.is_none() { + return false; + } + for v in &self.output { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.output)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.output.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.output.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxAckOutputWrapper { + MintlayerTxAckOutputWrapper::new() + } + + fn clear(&mut self) { + self.output.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxAckOutputWrapper { + static instance: MintlayerTxAckOutputWrapper = MintlayerTxAckOutputWrapper { + output: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MintlayerTxAckOutputWrapper { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxAckOutput.MintlayerTxAckOutputWrapper").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MintlayerTxAckOutputWrapper { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckOutputWrapper { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x18messages-mintlayer.proto\x12\x1chw.trezor.messages.mintlayer\"q\n\ + \x13MintlayerGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addr\ + essN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\ + \n\x08chunkify\x18\x03\x20\x01(\x08R\x08chunkify\",\n\x10MintlayerAddres\ + s\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"W\n\x15MintlayerG\ + etPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ + \x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"R\n\x12MintlayerP\ + ublicKey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\x12\x1d\ + \n\nchain_code\x18\x02\x20\x02(\x0cR\tchainCode\"i\n\x12MintlayerVerifyS\ + ig\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1c\n\tsigna\ + ture\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\x18\x03\x20\ + \x02(\x0cR\x07message\"\xb6\x01\n\x0fMintlayerSignTx\x12#\n\routputs_cou\ + nt\x18\x01\x20\x02(\rR\x0coutputsCount\x12!\n\x0cinputs_count\x18\x02\ + \x20\x02(\rR\x0binputsCount\x12\x1b\n\x07version\x18\x03\x20\x01(\r:\x01\ + 1R\x07version\x12\"\n\tserialize\x18\x04\x20\x01(\x08:\x04trueR\tseriali\ + ze\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\x9a\x05\n\ + \x12MintlayerTxRequest\x12h\n\x0crequest_type\x18\x01\x20\x01(\x0e2E.hw.\ + trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestTypeR\x0bre\ + questType\x12h\n\x07details\x18\x02\x20\x01(\x0b2N.hw.trezor.messages.mi\ + ntlayer.MintlayerTxRequest.MintlayerTxRequestDetailsTypeR\x07details\x12\ + q\n\nserialized\x18\x03\x20\x03(\x0b2Q.hw.trezor.messages.mintlayer.Mint\ + layerTxRequest.MintlayerTxRequestSerializedTypeR\nserialized\x1a]\n\x1dM\ + intlayerTxRequestDetailsType\x12#\n\rrequest_index\x18\x01\x20\x01(\rR\ + \x0crequestIndex\x12\x17\n\x07tx_hash\x18\x02\x20\x01(\x0cR\x06txHash\ + \x1a\x8e\x01\n\x20MintlayerTxRequestSerializedType\x12'\n\x0fsignature_i\ + ndex\x18\x01\x20\x01(\rR\x0esignatureIndex\x12\x1c\n\tsignature\x18\x02\ + \x20\x01(\x0cR\tsignature\x12#\n\rserialized_tx\x18\x03\x20\x01(\x0cR\ + \x0cserializedTx\"M\n\x14MintlayerRequestType\x12\x0b\n\x07TXINPUT\x10\0\ + \x12\x0c\n\x08TXOUTPUT\x10\x01\x12\n\n\x06TXMETA\x10\x02\x12\x0e\n\nTXFI\ + NISHED\x10\x03\"\xaf\x01\n\x14MintlayerUtxoTxInput\x12\x1b\n\taddress_n\ + \x18\x01\x20\x03(\rR\x08addressN\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\ + \x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndex\ + \x12&\n\x08sequence\x18\x04\x20\x01(\r:\n4294967295R\x08sequence\x12\x16\ + \n\x06amount\x18\x05\x20\x02(\x0cR\x06amount\"j\n\x19MintlayerTransferTx\ + Output\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12\x1b\n\tad\ + dress_n\x18\x02\x20\x03(\rR\x08addressN\x12\x16\n\x06amount\x18\x03\x20\ + \x02(\x0cR\x06amount\"s\n\x0fMintlayerPrevTx\x12\x18\n\x07version\x18\ + \x01\x20\x02(\rR\x07version\x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\ + \x0binputsCount\x12#\n\routputs_count\x18\x07\x20\x02(\rR\x0coutputsCoun\ + t\"b\n\x12MintlayerPrevInput\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\x0cR\ + \x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndexJ\x04\ + \x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06\"5\n\x1bMintl\ + ayerPrevTransferOutput\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\x06amou\ + nt\"\xe3\x01\n\x17MintlayerTxAckUtxoInput\x12`\n\x02tx\x18\x01\x20\x02(\ + \x0b2P.hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxA\ + ckInputWrapperR\x02tx\x1af\n\x1aMintlayerTxAckInputWrapper\x12H\n\x05inp\ + ut\x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerUtxoTxIn\ + putR\x05input\"\xe6\x01\n\x14MintlayerTxAckOutput\x12^\n\x02tx\x18\x01\ + \x20\x02(\x0b2N.hw.trezor.messages.mintlayer.MintlayerTxAckOutput.Mintla\ + yerTxAckOutputWrapperR\x02tx\x1an\n\x1bMintlayerTxAckOutputWrapper\x12O\ + \n\x06output\x18\x05\x20\x02(\x0b27.hw.trezor.messages.mintlayer.Mintlay\ + erTransferTxOutputR\x06outputB=\n#com.satoshilabs.trezor.lib.protobufB\ + \x16TrezorMessageMintlayer\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(18); + messages.push(MintlayerGetAddress::generated_message_descriptor_data()); + messages.push(MintlayerAddress::generated_message_descriptor_data()); + messages.push(MintlayerGetPublicKey::generated_message_descriptor_data()); + messages.push(MintlayerPublicKey::generated_message_descriptor_data()); + messages.push(MintlayerVerifySig::generated_message_descriptor_data()); + messages.push(MintlayerSignTx::generated_message_descriptor_data()); + messages.push(MintlayerTxRequest::generated_message_descriptor_data()); + messages.push(MintlayerUtxoTxInput::generated_message_descriptor_data()); + messages.push(MintlayerTransferTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerPrevTx::generated_message_descriptor_data()); + messages.push(MintlayerPrevInput::generated_message_descriptor_data()); + messages.push(MintlayerPrevTransferOutput::generated_message_descriptor_data()); + messages.push(MintlayerTxAckUtxoInput::generated_message_descriptor_data()); + messages.push(MintlayerTxAckOutput::generated_message_descriptor_data()); + messages.push(mintlayer_tx_request::MintlayerTxRequestDetailsType::generated_message_descriptor_data()); + messages.push(mintlayer_tx_request::MintlayerTxRequestSerializedType::generated_message_descriptor_data()); + messages.push(mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper::generated_message_descriptor_data()); + messages.push(mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(1); + enums.push(mintlayer_tx_request::MintlayerRequestType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_monero.rs b/wallet/trezor-client/src/protos/generated/messages_monero.rs new file mode 100644 index 0000000000..e3827e178d --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_monero.rs @@ -0,0 +1,12061 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-monero.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionSourceEntry { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.outputs) + pub outputs: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_output) + pub real_output: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_out_tx_key) + pub real_out_tx_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_out_additional_tx_keys) + pub real_out_additional_tx_keys: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_output_in_tx_index) + pub real_output_in_tx_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.rct) + pub rct: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.mask) + pub mask: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.multisig_kLRki) + pub multisig_kLRki: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.subaddr_minor) + pub subaddr_minor: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionSourceEntry { + fn default() -> &'a MoneroTransactionSourceEntry { + ::default_instance() + } +} + +impl MoneroTransactionSourceEntry { + pub fn new() -> MoneroTransactionSourceEntry { + ::std::default::Default::default() + } + + // optional uint64 real_output = 2; + + pub fn real_output(&self) -> u64 { + self.real_output.unwrap_or(0) + } + + pub fn clear_real_output(&mut self) { + self.real_output = ::std::option::Option::None; + } + + pub fn has_real_output(&self) -> bool { + self.real_output.is_some() + } + + // Param is passed by value, moved + pub fn set_real_output(&mut self, v: u64) { + self.real_output = ::std::option::Option::Some(v); + } + + // optional bytes real_out_tx_key = 3; + + pub fn real_out_tx_key(&self) -> &[u8] { + match self.real_out_tx_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_real_out_tx_key(&mut self) { + self.real_out_tx_key = ::std::option::Option::None; + } + + pub fn has_real_out_tx_key(&self) -> bool { + self.real_out_tx_key.is_some() + } + + // Param is passed by value, moved + pub fn set_real_out_tx_key(&mut self, v: ::std::vec::Vec) { + self.real_out_tx_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_real_out_tx_key(&mut self) -> &mut ::std::vec::Vec { + if self.real_out_tx_key.is_none() { + self.real_out_tx_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.real_out_tx_key.as_mut().unwrap() + } + + // Take field + pub fn take_real_out_tx_key(&mut self) -> ::std::vec::Vec { + self.real_out_tx_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint64 real_output_in_tx_index = 5; + + pub fn real_output_in_tx_index(&self) -> u64 { + self.real_output_in_tx_index.unwrap_or(0) + } + + pub fn clear_real_output_in_tx_index(&mut self) { + self.real_output_in_tx_index = ::std::option::Option::None; + } + + pub fn has_real_output_in_tx_index(&self) -> bool { + self.real_output_in_tx_index.is_some() + } + + // Param is passed by value, moved + pub fn set_real_output_in_tx_index(&mut self, v: u64) { + self.real_output_in_tx_index = ::std::option::Option::Some(v); + } + + // optional uint64 amount = 6; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional bool rct = 7; + + pub fn rct(&self) -> bool { + self.rct.unwrap_or(false) + } + + pub fn clear_rct(&mut self) { + self.rct = ::std::option::Option::None; + } + + pub fn has_rct(&self) -> bool { + self.rct.is_some() + } + + // Param is passed by value, moved + pub fn set_rct(&mut self, v: bool) { + self.rct = ::std::option::Option::Some(v); + } + + // optional bytes mask = 8; + + pub fn mask(&self) -> &[u8] { + match self.mask.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mask(&mut self) { + self.mask = ::std::option::Option::None; + } + + pub fn has_mask(&self) -> bool { + self.mask.is_some() + } + + // Param is passed by value, moved + pub fn set_mask(&mut self, v: ::std::vec::Vec) { + self.mask = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mask(&mut self) -> &mut ::std::vec::Vec { + if self.mask.is_none() { + self.mask = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mask.as_mut().unwrap() + } + + // Take field + pub fn take_mask(&mut self) -> ::std::vec::Vec { + self.mask.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 subaddr_minor = 10; + + pub fn subaddr_minor(&self) -> u32 { + self.subaddr_minor.unwrap_or(0) + } + + pub fn clear_subaddr_minor(&mut self) { + self.subaddr_minor = ::std::option::Option::None; + } + + pub fn has_subaddr_minor(&self) -> bool { + self.subaddr_minor.is_some() + } + + // Param is passed by value, moved + pub fn set_subaddr_minor(&mut self, v: u32) { + self.subaddr_minor = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(10); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "outputs", + |m: &MoneroTransactionSourceEntry| { &m.outputs }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.outputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "real_output", + |m: &MoneroTransactionSourceEntry| { &m.real_output }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.real_output }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "real_out_tx_key", + |m: &MoneroTransactionSourceEntry| { &m.real_out_tx_key }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.real_out_tx_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "real_out_additional_tx_keys", + |m: &MoneroTransactionSourceEntry| { &m.real_out_additional_tx_keys }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.real_out_additional_tx_keys }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "real_output_in_tx_index", + |m: &MoneroTransactionSourceEntry| { &m.real_output_in_tx_index }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.real_output_in_tx_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MoneroTransactionSourceEntry| { &m.amount }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "rct", + |m: &MoneroTransactionSourceEntry| { &m.rct }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.rct }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mask", + |m: &MoneroTransactionSourceEntry| { &m.mask }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.mask }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_source_entry::MoneroMultisigKLRki>( + "multisig_kLRki", + |m: &MoneroTransactionSourceEntry| { &m.multisig_kLRki }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.multisig_kLRki }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "subaddr_minor", + |m: &MoneroTransactionSourceEntry| { &m.subaddr_minor }, + |m: &mut MoneroTransactionSourceEntry| { &mut m.subaddr_minor }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSourceEntry", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionSourceEntry { + const NAME: &'static str = "MoneroTransactionSourceEntry"; + + fn is_initialized(&self) -> bool { + for v in &self.outputs { + if !v.is_initialized() { + return false; + } + }; + for v in &self.multisig_kLRki { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.outputs.push(is.read_message()?); + }, + 16 => { + self.real_output = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + self.real_out_tx_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.real_out_additional_tx_keys.push(is.read_bytes()?); + }, + 40 => { + self.real_output_in_tx_index = ::std::option::Option::Some(is.read_uint64()?); + }, + 48 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 56 => { + self.rct = ::std::option::Option::Some(is.read_bool()?); + }, + 66 => { + self.mask = ::std::option::Option::Some(is.read_bytes()?); + }, + 74 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig_kLRki)?; + }, + 80 => { + self.subaddr_minor = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.outputs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.real_output { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.real_out_tx_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + for value in &self.real_out_additional_tx_keys { + my_size += ::protobuf::rt::bytes_size(4, &value); + }; + if let Some(v) = self.real_output_in_tx_index { + my_size += ::protobuf::rt::uint64_size(5, v); + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(6, v); + } + if let Some(v) = self.rct { + my_size += 1 + 1; + } + if let Some(v) = self.mask.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + if let Some(v) = self.multisig_kLRki.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.subaddr_minor { + my_size += ::protobuf::rt::uint32_size(10, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.outputs { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + if let Some(v) = self.real_output { + os.write_uint64(2, v)?; + } + if let Some(v) = self.real_out_tx_key.as_ref() { + os.write_bytes(3, v)?; + } + for v in &self.real_out_additional_tx_keys { + os.write_bytes(4, &v)?; + }; + if let Some(v) = self.real_output_in_tx_index { + os.write_uint64(5, v)?; + } + if let Some(v) = self.amount { + os.write_uint64(6, v)?; + } + if let Some(v) = self.rct { + os.write_bool(7, v)?; + } + if let Some(v) = self.mask.as_ref() { + os.write_bytes(8, v)?; + } + if let Some(v) = self.multisig_kLRki.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; + } + if let Some(v) = self.subaddr_minor { + os.write_uint32(10, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionSourceEntry { + MoneroTransactionSourceEntry::new() + } + + fn clear(&mut self) { + self.outputs.clear(); + self.real_output = ::std::option::Option::None; + self.real_out_tx_key = ::std::option::Option::None; + self.real_out_additional_tx_keys.clear(); + self.real_output_in_tx_index = ::std::option::Option::None; + self.amount = ::std::option::Option::None; + self.rct = ::std::option::Option::None; + self.mask = ::std::option::Option::None; + self.multisig_kLRki.clear(); + self.subaddr_minor = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionSourceEntry { + static instance: MoneroTransactionSourceEntry = MoneroTransactionSourceEntry { + outputs: ::std::vec::Vec::new(), + real_output: ::std::option::Option::None, + real_out_tx_key: ::std::option::Option::None, + real_out_additional_tx_keys: ::std::vec::Vec::new(), + real_output_in_tx_index: ::std::option::Option::None, + amount: ::std::option::Option::None, + rct: ::std::option::Option::None, + mask: ::std::option::Option::None, + multisig_kLRki: ::protobuf::MessageField::none(), + subaddr_minor: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionSourceEntry { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionSourceEntry { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSourceEntry { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MoneroTransactionSourceEntry` +pub mod monero_transaction_source_entry { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroOutputEntry { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.idx) + pub idx: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.key) + pub key: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroOutputEntry { + fn default() -> &'a MoneroOutputEntry { + ::default_instance() + } + } + + impl MoneroOutputEntry { + pub fn new() -> MoneroOutputEntry { + ::std::default::Default::default() + } + + // optional uint64 idx = 1; + + pub fn idx(&self) -> u64 { + self.idx.unwrap_or(0) + } + + pub fn clear_idx(&mut self) { + self.idx = ::std::option::Option::None; + } + + pub fn has_idx(&self) -> bool { + self.idx.is_some() + } + + // Param is passed by value, moved + pub fn set_idx(&mut self, v: u64) { + self.idx = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "idx", + |m: &MoneroOutputEntry| { &m.idx }, + |m: &mut MoneroOutputEntry| { &mut m.idx }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_output_entry::MoneroRctKeyPublic>( + "key", + |m: &MoneroOutputEntry| { &m.key }, + |m: &mut MoneroOutputEntry| { &mut m.key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSourceEntry.MoneroOutputEntry", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroOutputEntry { + const NAME: &'static str = "MoneroOutputEntry"; + + fn is_initialized(&self) -> bool { + for v in &self.key { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.idx = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.key)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.idx { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.key.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.idx { + os.write_uint64(1, v)?; + } + if let Some(v) = self.key.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroOutputEntry { + MoneroOutputEntry::new() + } + + fn clear(&mut self) { + self.idx = ::std::option::Option::None; + self.key.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroOutputEntry { + static instance: MoneroOutputEntry = MoneroOutputEntry { + idx: ::std::option::Option::None, + key: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroOutputEntry { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry.MoneroOutputEntry").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroOutputEntry { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroOutputEntry { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `MoneroOutputEntry` + pub mod monero_output_entry { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroRctKeyPublic { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic.dest) + pub dest: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic.commitment) + pub commitment: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroRctKeyPublic { + fn default() -> &'a MoneroRctKeyPublic { + ::default_instance() + } + } + + impl MoneroRctKeyPublic { + pub fn new() -> MoneroRctKeyPublic { + ::std::default::Default::default() + } + + // required bytes dest = 1; + + pub fn dest(&self) -> &[u8] { + match self.dest.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_dest(&mut self) { + self.dest = ::std::option::Option::None; + } + + pub fn has_dest(&self) -> bool { + self.dest.is_some() + } + + // Param is passed by value, moved + pub fn set_dest(&mut self, v: ::std::vec::Vec) { + self.dest = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_dest(&mut self) -> &mut ::std::vec::Vec { + if self.dest.is_none() { + self.dest = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.dest.as_mut().unwrap() + } + + // Take field + pub fn take_dest(&mut self) -> ::std::vec::Vec { + self.dest.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes commitment = 2; + + pub fn commitment(&self) -> &[u8] { + match self.commitment.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_commitment(&mut self) { + self.commitment = ::std::option::Option::None; + } + + pub fn has_commitment(&self) -> bool { + self.commitment.is_some() + } + + // Param is passed by value, moved + pub fn set_commitment(&mut self, v: ::std::vec::Vec) { + self.commitment = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_commitment(&mut self) -> &mut ::std::vec::Vec { + if self.commitment.is_none() { + self.commitment = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.commitment.as_mut().unwrap() + } + + // Take field + pub fn take_commitment(&mut self) -> ::std::vec::Vec { + self.commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "dest", + |m: &MoneroRctKeyPublic| { &m.dest }, + |m: &mut MoneroRctKeyPublic| { &mut m.dest }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "commitment", + |m: &MoneroRctKeyPublic| { &m.commitment }, + |m: &mut MoneroRctKeyPublic| { &mut m.commitment }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroRctKeyPublic { + const NAME: &'static str = "MoneroRctKeyPublic"; + + fn is_initialized(&self) -> bool { + if self.dest.is_none() { + return false; + } + if self.commitment.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.dest = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.commitment = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.dest.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.commitment.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.dest.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.commitment.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroRctKeyPublic { + MoneroRctKeyPublic::new() + } + + fn clear(&mut self) { + self.dest = ::std::option::Option::None; + self.commitment = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroRctKeyPublic { + static instance: MoneroRctKeyPublic = MoneroRctKeyPublic { + dest: ::std::option::Option::None, + commitment: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroRctKeyPublic { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroRctKeyPublic { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroRctKeyPublic { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + } + + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroMultisigKLRki { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.K) + pub K: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.L) + pub L: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.R) + pub R: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.ki) + pub ki: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroMultisigKLRki { + fn default() -> &'a MoneroMultisigKLRki { + ::default_instance() + } + } + + impl MoneroMultisigKLRki { + pub fn new() -> MoneroMultisigKLRki { + ::std::default::Default::default() + } + + // optional bytes K = 1; + + pub fn K(&self) -> &[u8] { + match self.K.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_K(&mut self) { + self.K = ::std::option::Option::None; + } + + pub fn has_K(&self) -> bool { + self.K.is_some() + } + + // Param is passed by value, moved + pub fn set_K(&mut self, v: ::std::vec::Vec) { + self.K = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_K(&mut self) -> &mut ::std::vec::Vec { + if self.K.is_none() { + self.K = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.K.as_mut().unwrap() + } + + // Take field + pub fn take_K(&mut self) -> ::std::vec::Vec { + self.K.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes L = 2; + + pub fn L(&self) -> &[u8] { + match self.L.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_L(&mut self) { + self.L = ::std::option::Option::None; + } + + pub fn has_L(&self) -> bool { + self.L.is_some() + } + + // Param is passed by value, moved + pub fn set_L(&mut self, v: ::std::vec::Vec) { + self.L = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_L(&mut self) -> &mut ::std::vec::Vec { + if self.L.is_none() { + self.L = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.L.as_mut().unwrap() + } + + // Take field + pub fn take_L(&mut self) -> ::std::vec::Vec { + self.L.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes R = 3; + + pub fn R(&self) -> &[u8] { + match self.R.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_R(&mut self) { + self.R = ::std::option::Option::None; + } + + pub fn has_R(&self) -> bool { + self.R.is_some() + } + + // Param is passed by value, moved + pub fn set_R(&mut self, v: ::std::vec::Vec) { + self.R = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_R(&mut self) -> &mut ::std::vec::Vec { + if self.R.is_none() { + self.R = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.R.as_mut().unwrap() + } + + // Take field + pub fn take_R(&mut self) -> ::std::vec::Vec { + self.R.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes ki = 4; + + pub fn ki(&self) -> &[u8] { + match self.ki.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ki(&mut self) { + self.ki = ::std::option::Option::None; + } + + pub fn has_ki(&self) -> bool { + self.ki.is_some() + } + + // Param is passed by value, moved + pub fn set_ki(&mut self, v: ::std::vec::Vec) { + self.ki = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ki(&mut self) -> &mut ::std::vec::Vec { + if self.ki.is_none() { + self.ki = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ki.as_mut().unwrap() + } + + // Take field + pub fn take_ki(&mut self) -> ::std::vec::Vec { + self.ki.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "K", + |m: &MoneroMultisigKLRki| { &m.K }, + |m: &mut MoneroMultisigKLRki| { &mut m.K }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "L", + |m: &MoneroMultisigKLRki| { &m.L }, + |m: &mut MoneroMultisigKLRki| { &mut m.L }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "R", + |m: &MoneroMultisigKLRki| { &m.R }, + |m: &mut MoneroMultisigKLRki| { &mut m.R }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ki", + |m: &MoneroMultisigKLRki| { &m.ki }, + |m: &mut MoneroMultisigKLRki| { &mut m.ki }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSourceEntry.MoneroMultisigKLRki", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroMultisigKLRki { + const NAME: &'static str = "MoneroMultisigKLRki"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.K = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.L = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.R = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.ki = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.K.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.L.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.R.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.ki.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.K.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.L.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.R.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.ki.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroMultisigKLRki { + MoneroMultisigKLRki::new() + } + + fn clear(&mut self) { + self.K = ::std::option::Option::None; + self.L = ::std::option::Option::None; + self.R = ::std::option::Option::None; + self.ki = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroMultisigKLRki { + static instance: MoneroMultisigKLRki = MoneroMultisigKLRki { + K: ::std::option::Option::None, + L: ::std::option::Option::None, + R: ::std::option::Option::None, + ki: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroMultisigKLRki { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry.MoneroMultisigKLRki").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroMultisigKLRki { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroMultisigKLRki { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionDestinationEntry) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionDestinationEntry { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.addr) + pub addr: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.is_subaddress) + pub is_subaddress: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.original) + pub original: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.is_integrated) + pub is_integrated: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionDestinationEntry { + fn default() -> &'a MoneroTransactionDestinationEntry { + ::default_instance() + } +} + +impl MoneroTransactionDestinationEntry { + pub fn new() -> MoneroTransactionDestinationEntry { + ::std::default::Default::default() + } + + // optional uint64 amount = 1; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional bool is_subaddress = 3; + + pub fn is_subaddress(&self) -> bool { + self.is_subaddress.unwrap_or(false) + } + + pub fn clear_is_subaddress(&mut self) { + self.is_subaddress = ::std::option::Option::None; + } + + pub fn has_is_subaddress(&self) -> bool { + self.is_subaddress.is_some() + } + + // Param is passed by value, moved + pub fn set_is_subaddress(&mut self, v: bool) { + self.is_subaddress = ::std::option::Option::Some(v); + } + + // optional bytes original = 4; + + pub fn original(&self) -> &[u8] { + match self.original.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_original(&mut self) { + self.original = ::std::option::Option::None; + } + + pub fn has_original(&self) -> bool { + self.original.is_some() + } + + // Param is passed by value, moved + pub fn set_original(&mut self, v: ::std::vec::Vec) { + self.original = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_original(&mut self) -> &mut ::std::vec::Vec { + if self.original.is_none() { + self.original = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.original.as_mut().unwrap() + } + + // Take field + pub fn take_original(&mut self) -> ::std::vec::Vec { + self.original.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool is_integrated = 5; + + pub fn is_integrated(&self) -> bool { + self.is_integrated.unwrap_or(false) + } + + pub fn clear_is_integrated(&mut self) { + self.is_integrated = ::std::option::Option::None; + } + + pub fn has_is_integrated(&self) -> bool { + self.is_integrated.is_some() + } + + // Param is passed by value, moved + pub fn set_is_integrated(&mut self, v: bool) { + self.is_integrated = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MoneroTransactionDestinationEntry| { &m.amount }, + |m: &mut MoneroTransactionDestinationEntry| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_destination_entry::MoneroAccountPublicAddress>( + "addr", + |m: &MoneroTransactionDestinationEntry| { &m.addr }, + |m: &mut MoneroTransactionDestinationEntry| { &mut m.addr }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "is_subaddress", + |m: &MoneroTransactionDestinationEntry| { &m.is_subaddress }, + |m: &mut MoneroTransactionDestinationEntry| { &mut m.is_subaddress }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "original", + |m: &MoneroTransactionDestinationEntry| { &m.original }, + |m: &mut MoneroTransactionDestinationEntry| { &mut m.original }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "is_integrated", + |m: &MoneroTransactionDestinationEntry| { &m.is_integrated }, + |m: &mut MoneroTransactionDestinationEntry| { &mut m.is_integrated }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionDestinationEntry", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionDestinationEntry { + const NAME: &'static str = "MoneroTransactionDestinationEntry"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.addr)?; + }, + 24 => { + self.is_subaddress = ::std::option::Option::Some(is.read_bool()?); + }, + 34 => { + self.original = ::std::option::Option::Some(is.read_bytes()?); + }, + 40 => { + self.is_integrated = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.addr.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.is_subaddress { + my_size += 1 + 1; + } + if let Some(v) = self.original.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.is_integrated { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount { + os.write_uint64(1, v)?; + } + if let Some(v) = self.addr.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.is_subaddress { + os.write_bool(3, v)?; + } + if let Some(v) = self.original.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.is_integrated { + os.write_bool(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionDestinationEntry { + MoneroTransactionDestinationEntry::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.addr.clear(); + self.is_subaddress = ::std::option::Option::None; + self.original = ::std::option::Option::None; + self.is_integrated = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionDestinationEntry { + static instance: MoneroTransactionDestinationEntry = MoneroTransactionDestinationEntry { + amount: ::std::option::Option::None, + addr: ::protobuf::MessageField::none(), + is_subaddress: ::std::option::Option::None, + original: ::std::option::Option::None, + is_integrated: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionDestinationEntry { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionDestinationEntry").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionDestinationEntry { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionDestinationEntry { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MoneroTransactionDestinationEntry` +pub mod monero_transaction_destination_entry { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroAccountPublicAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress.spend_public_key) + pub spend_public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress.view_public_key) + pub view_public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroAccountPublicAddress { + fn default() -> &'a MoneroAccountPublicAddress { + ::default_instance() + } + } + + impl MoneroAccountPublicAddress { + pub fn new() -> MoneroAccountPublicAddress { + ::std::default::Default::default() + } + + // optional bytes spend_public_key = 1; + + pub fn spend_public_key(&self) -> &[u8] { + match self.spend_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_spend_public_key(&mut self) { + self.spend_public_key = ::std::option::Option::None; + } + + pub fn has_spend_public_key(&self) -> bool { + self.spend_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_spend_public_key(&mut self, v: ::std::vec::Vec) { + self.spend_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_spend_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.spend_public_key.is_none() { + self.spend_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.spend_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_spend_public_key(&mut self) -> ::std::vec::Vec { + self.spend_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes view_public_key = 2; + + pub fn view_public_key(&self) -> &[u8] { + match self.view_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_view_public_key(&mut self) { + self.view_public_key = ::std::option::Option::None; + } + + pub fn has_view_public_key(&self) -> bool { + self.view_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_view_public_key(&mut self, v: ::std::vec::Vec) { + self.view_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_view_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.view_public_key.is_none() { + self.view_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.view_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_view_public_key(&mut self) -> ::std::vec::Vec { + self.view_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "spend_public_key", + |m: &MoneroAccountPublicAddress| { &m.spend_public_key }, + |m: &mut MoneroAccountPublicAddress| { &mut m.spend_public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "view_public_key", + |m: &MoneroAccountPublicAddress| { &m.view_public_key }, + |m: &mut MoneroAccountPublicAddress| { &mut m.view_public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionDestinationEntry.MoneroAccountPublicAddress", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroAccountPublicAddress { + const NAME: &'static str = "MoneroAccountPublicAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.spend_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.view_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.spend_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.view_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.spend_public_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.view_public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroAccountPublicAddress { + MoneroAccountPublicAddress::new() + } + + fn clear(&mut self) { + self.spend_public_key = ::std::option::Option::None; + self.view_public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroAccountPublicAddress { + static instance: MoneroAccountPublicAddress = MoneroAccountPublicAddress { + spend_public_key: ::std::option::Option::None, + view_public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroAccountPublicAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionDestinationEntry.MoneroAccountPublicAddress").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroAccountPublicAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroAccountPublicAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionRsigData) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionRsigData { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.rsig_type) + pub rsig_type: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.offload_type) + pub offload_type: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.grouping) + pub grouping: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.mask) + pub mask: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.rsig) + pub rsig: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.rsig_parts) + pub rsig_parts: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.bp_version) + pub bp_version: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionRsigData.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionRsigData { + fn default() -> &'a MoneroTransactionRsigData { + ::default_instance() + } +} + +impl MoneroTransactionRsigData { + pub fn new() -> MoneroTransactionRsigData { + ::std::default::Default::default() + } + + // optional uint32 rsig_type = 1; + + pub fn rsig_type(&self) -> u32 { + self.rsig_type.unwrap_or(0) + } + + pub fn clear_rsig_type(&mut self) { + self.rsig_type = ::std::option::Option::None; + } + + pub fn has_rsig_type(&self) -> bool { + self.rsig_type.is_some() + } + + // Param is passed by value, moved + pub fn set_rsig_type(&mut self, v: u32) { + self.rsig_type = ::std::option::Option::Some(v); + } + + // optional uint32 offload_type = 2; + + pub fn offload_type(&self) -> u32 { + self.offload_type.unwrap_or(0) + } + + pub fn clear_offload_type(&mut self) { + self.offload_type = ::std::option::Option::None; + } + + pub fn has_offload_type(&self) -> bool { + self.offload_type.is_some() + } + + // Param is passed by value, moved + pub fn set_offload_type(&mut self, v: u32) { + self.offload_type = ::std::option::Option::Some(v); + } + + // optional bytes mask = 4; + + pub fn mask(&self) -> &[u8] { + match self.mask.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_mask(&mut self) { + self.mask = ::std::option::Option::None; + } + + pub fn has_mask(&self) -> bool { + self.mask.is_some() + } + + // Param is passed by value, moved + pub fn set_mask(&mut self, v: ::std::vec::Vec) { + self.mask = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mask(&mut self) -> &mut ::std::vec::Vec { + if self.mask.is_none() { + self.mask = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.mask.as_mut().unwrap() + } + + // Take field + pub fn take_mask(&mut self) -> ::std::vec::Vec { + self.mask.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes rsig = 5; + + pub fn rsig(&self) -> &[u8] { + match self.rsig.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_rsig(&mut self) { + self.rsig = ::std::option::Option::None; + } + + pub fn has_rsig(&self) -> bool { + self.rsig.is_some() + } + + // Param is passed by value, moved + pub fn set_rsig(&mut self, v: ::std::vec::Vec) { + self.rsig = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_rsig(&mut self) -> &mut ::std::vec::Vec { + if self.rsig.is_none() { + self.rsig = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.rsig.as_mut().unwrap() + } + + // Take field + pub fn take_rsig(&mut self) -> ::std::vec::Vec { + self.rsig.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 bp_version = 7; + + pub fn bp_version(&self) -> u32 { + self.bp_version.unwrap_or(0) + } + + pub fn clear_bp_version(&mut self) { + self.bp_version = ::std::option::Option::None; + } + + pub fn has_bp_version(&self) -> bool { + self.bp_version.is_some() + } + + // Param is passed by value, moved + pub fn set_bp_version(&mut self, v: u32) { + self.bp_version = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "rsig_type", + |m: &MoneroTransactionRsigData| { &m.rsig_type }, + |m: &mut MoneroTransactionRsigData| { &mut m.rsig_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "offload_type", + |m: &MoneroTransactionRsigData| { &m.offload_type }, + |m: &mut MoneroTransactionRsigData| { &mut m.offload_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "grouping", + |m: &MoneroTransactionRsigData| { &m.grouping }, + |m: &mut MoneroTransactionRsigData| { &mut m.grouping }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mask", + |m: &MoneroTransactionRsigData| { &m.mask }, + |m: &mut MoneroTransactionRsigData| { &mut m.mask }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "rsig", + |m: &MoneroTransactionRsigData| { &m.rsig }, + |m: &mut MoneroTransactionRsigData| { &mut m.rsig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "rsig_parts", + |m: &MoneroTransactionRsigData| { &m.rsig_parts }, + |m: &mut MoneroTransactionRsigData| { &mut m.rsig_parts }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bp_version", + |m: &MoneroTransactionRsigData| { &m.bp_version }, + |m: &mut MoneroTransactionRsigData| { &mut m.bp_version }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionRsigData", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionRsigData { + const NAME: &'static str = "MoneroTransactionRsigData"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.rsig_type = ::std::option::Option::Some(is.read_uint32()?); + }, + 16 => { + self.offload_type = ::std::option::Option::Some(is.read_uint32()?); + }, + 26 => { + is.read_repeated_packed_uint64_into(&mut self.grouping)?; + }, + 24 => { + self.grouping.push(is.read_uint64()?); + }, + 34 => { + self.mask = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.rsig = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.rsig_parts.push(is.read_bytes()?); + }, + 56 => { + self.bp_version = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.rsig_type { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.offload_type { + my_size += ::protobuf::rt::uint32_size(2, v); + } + for value in &self.grouping { + my_size += ::protobuf::rt::uint64_size(3, *value); + }; + if let Some(v) = self.mask.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.rsig.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + for value in &self.rsig_parts { + my_size += ::protobuf::rt::bytes_size(6, &value); + }; + if let Some(v) = self.bp_version { + my_size += ::protobuf::rt::uint32_size(7, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.rsig_type { + os.write_uint32(1, v)?; + } + if let Some(v) = self.offload_type { + os.write_uint32(2, v)?; + } + for v in &self.grouping { + os.write_uint64(3, *v)?; + }; + if let Some(v) = self.mask.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.rsig.as_ref() { + os.write_bytes(5, v)?; + } + for v in &self.rsig_parts { + os.write_bytes(6, &v)?; + }; + if let Some(v) = self.bp_version { + os.write_uint32(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionRsigData { + MoneroTransactionRsigData::new() + } + + fn clear(&mut self) { + self.rsig_type = ::std::option::Option::None; + self.offload_type = ::std::option::Option::None; + self.grouping.clear(); + self.mask = ::std::option::Option::None; + self.rsig = ::std::option::Option::None; + self.rsig_parts.clear(); + self.bp_version = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionRsigData { + static instance: MoneroTransactionRsigData = MoneroTransactionRsigData { + rsig_type: ::std::option::Option::None, + offload_type: ::std::option::Option::None, + grouping: ::std::vec::Vec::new(), + mask: ::std::option::Option::None, + rsig: ::std::option::Option::None, + rsig_parts: ::std::vec::Vec::new(), + bp_version: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionRsigData { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionRsigData").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionRsigData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionRsigData { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.network_type) + pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.minor) + pub minor: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.payment_id) + pub payment_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroGetAddress { + fn default() -> &'a MoneroGetAddress { + ::default_instance() + } +} + +impl MoneroGetAddress { + pub fn new() -> MoneroGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 3; + + pub fn network_type(&self) -> MoneroNetworkType { + match self.network_type { + Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), + None => MoneroNetworkType::MAINNET, + } + } + + pub fn clear_network_type(&mut self) { + self.network_type = ::std::option::Option::None; + } + + pub fn has_network_type(&self) -> bool { + self.network_type.is_some() + } + + // Param is passed by value, moved + pub fn set_network_type(&mut self, v: MoneroNetworkType) { + self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint32 account = 4; + + pub fn account(&self) -> u32 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u32) { + self.account = ::std::option::Option::Some(v); + } + + // optional uint32 minor = 5; + + pub fn minor(&self) -> u32 { + self.minor.unwrap_or(0) + } + + pub fn clear_minor(&mut self) { + self.minor = ::std::option::Option::None; + } + + pub fn has_minor(&self) -> bool { + self.minor.is_some() + } + + // Param is passed by value, moved + pub fn set_minor(&mut self, v: u32) { + self.minor = ::std::option::Option::Some(v); + } + + // optional bytes payment_id = 6; + + pub fn payment_id(&self) -> &[u8] { + match self.payment_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_payment_id(&mut self) { + self.payment_id = ::std::option::Option::None; + } + + pub fn has_payment_id(&self) -> bool { + self.payment_id.is_some() + } + + // Param is passed by value, moved + pub fn set_payment_id(&mut self, v: ::std::vec::Vec) { + self.payment_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payment_id(&mut self) -> &mut ::std::vec::Vec { + if self.payment_id.is_none() { + self.payment_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.payment_id.as_mut().unwrap() + } + + // Take field + pub fn take_payment_id(&mut self) -> ::std::vec::Vec { + self.payment_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool chunkify = 7; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MoneroGetAddress| { &m.address_n }, + |m: &mut MoneroGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &MoneroGetAddress| { &m.show_display }, + |m: &mut MoneroGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_type", + |m: &MoneroGetAddress| { &m.network_type }, + |m: &mut MoneroGetAddress| { &mut m.network_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &MoneroGetAddress| { &m.account }, + |m: &mut MoneroGetAddress| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "minor", + |m: &MoneroGetAddress| { &m.minor }, + |m: &mut MoneroGetAddress| { &mut m.minor }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payment_id", + |m: &MoneroGetAddress| { &m.payment_id }, + |m: &mut MoneroGetAddress| { &mut m.payment_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &MoneroGetAddress| { &m.chunkify }, + |m: &mut MoneroGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroGetAddress { + const NAME: &'static str = "MoneroGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 32 => { + self.account = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.minor = ::std::option::Option::Some(is.read_uint32()?); + }, + 50 => { + self.payment_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 56 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.network_type { + my_size += ::protobuf::rt::int32_size(3, v.value()); + } + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.minor { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.payment_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.network_type { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.account { + os.write_uint32(4, v)?; + } + if let Some(v) = self.minor { + os.write_uint32(5, v)?; + } + if let Some(v) = self.payment_id.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroGetAddress { + MoneroGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.network_type = ::std::option::Option::None; + self.account = ::std::option::Option::None; + self.minor = ::std::option::Option::None; + self.payment_id = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroGetAddress { + static instance: MoneroGetAddress = MoneroGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + network_type: ::std::option::Option::None, + account: ::std::option::Option::None, + minor: ::std::option::Option::None, + payment_id: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroAddress.address) + pub address: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroAddress { + fn default() -> &'a MoneroAddress { + ::default_instance() + } +} + +impl MoneroAddress { + pub fn new() -> MoneroAddress { + ::std::default::Default::default() + } + + // optional bytes address = 1; + + pub fn address(&self) -> &[u8] { + match self.address.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::vec::Vec) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::vec::Vec { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::vec::Vec { + self.address.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MoneroAddress| { &m.address }, + |m: &mut MoneroAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroAddress { + const NAME: &'static str = "MoneroAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroAddress { + MoneroAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroAddress { + static instance: MoneroAddress = MoneroAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetWatchKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroGetWatchKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetWatchKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetWatchKey.network_type) + pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetWatchKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroGetWatchKey { + fn default() -> &'a MoneroGetWatchKey { + ::default_instance() + } +} + +impl MoneroGetWatchKey { + pub fn new() -> MoneroGetWatchKey { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 2; + + pub fn network_type(&self) -> MoneroNetworkType { + match self.network_type { + Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), + None => MoneroNetworkType::MAINNET, + } + } + + pub fn clear_network_type(&mut self) { + self.network_type = ::std::option::Option::None; + } + + pub fn has_network_type(&self) -> bool { + self.network_type.is_some() + } + + // Param is passed by value, moved + pub fn set_network_type(&mut self, v: MoneroNetworkType) { + self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MoneroGetWatchKey| { &m.address_n }, + |m: &mut MoneroGetWatchKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_type", + |m: &MoneroGetWatchKey| { &m.network_type }, + |m: &mut MoneroGetWatchKey| { &mut m.network_type }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroGetWatchKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroGetWatchKey { + const NAME: &'static str = "MoneroGetWatchKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.network_type { + my_size += ::protobuf::rt::int32_size(2, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.network_type { + os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroGetWatchKey { + MoneroGetWatchKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.network_type = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroGetWatchKey { + static instance: MoneroGetWatchKey = MoneroGetWatchKey { + address_n: ::std::vec::Vec::new(), + network_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroGetWatchKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetWatchKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroGetWatchKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroGetWatchKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroWatchKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroWatchKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroWatchKey.watch_key) + pub watch_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroWatchKey.address) + pub address: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroWatchKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroWatchKey { + fn default() -> &'a MoneroWatchKey { + ::default_instance() + } +} + +impl MoneroWatchKey { + pub fn new() -> MoneroWatchKey { + ::std::default::Default::default() + } + + // optional bytes watch_key = 1; + + pub fn watch_key(&self) -> &[u8] { + match self.watch_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_watch_key(&mut self) { + self.watch_key = ::std::option::Option::None; + } + + pub fn has_watch_key(&self) -> bool { + self.watch_key.is_some() + } + + // Param is passed by value, moved + pub fn set_watch_key(&mut self, v: ::std::vec::Vec) { + self.watch_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_watch_key(&mut self) -> &mut ::std::vec::Vec { + if self.watch_key.is_none() { + self.watch_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.watch_key.as_mut().unwrap() + } + + // Take field + pub fn take_watch_key(&mut self) -> ::std::vec::Vec { + self.watch_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes address = 2; + + pub fn address(&self) -> &[u8] { + match self.address.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::vec::Vec) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::vec::Vec { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::vec::Vec { + self.address.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "watch_key", + |m: &MoneroWatchKey| { &m.watch_key }, + |m: &mut MoneroWatchKey| { &mut m.watch_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MoneroWatchKey| { &m.address }, + |m: &mut MoneroWatchKey| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroWatchKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroWatchKey { + const NAME: &'static str = "MoneroWatchKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.watch_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.address = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.watch_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.watch_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.address.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroWatchKey { + MoneroWatchKey::new() + } + + fn clear(&mut self) { + self.watch_key = ::std::option::Option::None; + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroWatchKey { + static instance: MoneroWatchKey = MoneroWatchKey { + watch_key: ::std::option::Option::None, + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroWatchKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroWatchKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroWatchKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroWatchKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInitRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionInitRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.version) + pub version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.network_type) + pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.tsx_data) + pub tsx_data: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInitRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionInitRequest { + fn default() -> &'a MoneroTransactionInitRequest { + ::default_instance() + } +} + +impl MoneroTransactionInitRequest { + pub fn new() -> MoneroTransactionInitRequest { + ::std::default::Default::default() + } + + // optional uint32 version = 1; + + pub fn version(&self) -> u32 { + self.version.unwrap_or(0) + } + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u32) { + self.version = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 3; + + pub fn network_type(&self) -> MoneroNetworkType { + match self.network_type { + Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), + None => MoneroNetworkType::MAINNET, + } + } + + pub fn clear_network_type(&mut self) { + self.network_type = ::std::option::Option::None; + } + + pub fn has_network_type(&self) -> bool { + self.network_type.is_some() + } + + // Param is passed by value, moved + pub fn set_network_type(&mut self, v: MoneroNetworkType) { + self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version", + |m: &MoneroTransactionInitRequest| { &m.version }, + |m: &mut MoneroTransactionInitRequest| { &mut m.version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MoneroTransactionInitRequest| { &m.address_n }, + |m: &mut MoneroTransactionInitRequest| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_type", + |m: &MoneroTransactionInitRequest| { &m.network_type }, + |m: &mut MoneroTransactionInitRequest| { &mut m.network_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_init_request::MoneroTransactionData>( + "tsx_data", + |m: &MoneroTransactionInitRequest| { &m.tsx_data }, + |m: &mut MoneroTransactionInitRequest| { &mut m.tsx_data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionInitRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionInitRequest { + const NAME: &'static str = "MoneroTransactionInitRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.version = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 24 => { + self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tsx_data)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.version { + my_size += ::protobuf::rt::uint32_size(1, v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.network_type { + my_size += ::protobuf::rt::int32_size(3, v.value()); + } + if let Some(v) = self.tsx_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.version { + os.write_uint32(1, v)?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.network_type { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.tsx_data.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionInitRequest { + MoneroTransactionInitRequest::new() + } + + fn clear(&mut self) { + self.version = ::std::option::Option::None; + self.address_n.clear(); + self.network_type = ::std::option::Option::None; + self.tsx_data.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionInitRequest { + static instance: MoneroTransactionInitRequest = MoneroTransactionInitRequest { + version: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + network_type: ::std::option::Option::None, + tsx_data: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionInitRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInitRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionInitRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInitRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MoneroTransactionInitRequest` +pub mod monero_transaction_init_request { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroTransactionData { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.version) + pub version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.payment_id) + pub payment_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.unlock_time) + pub unlock_time: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.outputs) + pub outputs: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.change_dts) + pub change_dts: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.num_inputs) + pub num_inputs: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.mixin) + pub mixin: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.minor_indices) + pub minor_indices: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.rsig_data) + pub rsig_data: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.integrated_indices) + pub integrated_indices: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.client_version) + pub client_version: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.hard_fork) + pub hard_fork: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.monero_version) + pub monero_version: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroTransactionData { + fn default() -> &'a MoneroTransactionData { + ::default_instance() + } + } + + impl MoneroTransactionData { + pub fn new() -> MoneroTransactionData { + ::std::default::Default::default() + } + + // optional uint32 version = 1; + + pub fn version(&self) -> u32 { + self.version.unwrap_or(0) + } + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u32) { + self.version = ::std::option::Option::Some(v); + } + + // optional bytes payment_id = 2; + + pub fn payment_id(&self) -> &[u8] { + match self.payment_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_payment_id(&mut self) { + self.payment_id = ::std::option::Option::None; + } + + pub fn has_payment_id(&self) -> bool { + self.payment_id.is_some() + } + + // Param is passed by value, moved + pub fn set_payment_id(&mut self, v: ::std::vec::Vec) { + self.payment_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payment_id(&mut self) -> &mut ::std::vec::Vec { + if self.payment_id.is_none() { + self.payment_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.payment_id.as_mut().unwrap() + } + + // Take field + pub fn take_payment_id(&mut self) -> ::std::vec::Vec { + self.payment_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint64 unlock_time = 3; + + pub fn unlock_time(&self) -> u64 { + self.unlock_time.unwrap_or(0) + } + + pub fn clear_unlock_time(&mut self) { + self.unlock_time = ::std::option::Option::None; + } + + pub fn has_unlock_time(&self) -> bool { + self.unlock_time.is_some() + } + + // Param is passed by value, moved + pub fn set_unlock_time(&mut self, v: u64) { + self.unlock_time = ::std::option::Option::Some(v); + } + + // optional uint32 num_inputs = 6; + + pub fn num_inputs(&self) -> u32 { + self.num_inputs.unwrap_or(0) + } + + pub fn clear_num_inputs(&mut self) { + self.num_inputs = ::std::option::Option::None; + } + + pub fn has_num_inputs(&self) -> bool { + self.num_inputs.is_some() + } + + // Param is passed by value, moved + pub fn set_num_inputs(&mut self, v: u32) { + self.num_inputs = ::std::option::Option::Some(v); + } + + // optional uint32 mixin = 7; + + pub fn mixin(&self) -> u32 { + self.mixin.unwrap_or(0) + } + + pub fn clear_mixin(&mut self) { + self.mixin = ::std::option::Option::None; + } + + pub fn has_mixin(&self) -> bool { + self.mixin.is_some() + } + + // Param is passed by value, moved + pub fn set_mixin(&mut self, v: u32) { + self.mixin = ::std::option::Option::Some(v); + } + + // optional uint64 fee = 8; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // optional uint32 account = 9; + + pub fn account(&self) -> u32 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u32) { + self.account = ::std::option::Option::Some(v); + } + + // optional uint32 client_version = 13; + + pub fn client_version(&self) -> u32 { + self.client_version.unwrap_or(0) + } + + pub fn clear_client_version(&mut self) { + self.client_version = ::std::option::Option::None; + } + + pub fn has_client_version(&self) -> bool { + self.client_version.is_some() + } + + // Param is passed by value, moved + pub fn set_client_version(&mut self, v: u32) { + self.client_version = ::std::option::Option::Some(v); + } + + // optional uint32 hard_fork = 14; + + pub fn hard_fork(&self) -> u32 { + self.hard_fork.unwrap_or(0) + } + + pub fn clear_hard_fork(&mut self) { + self.hard_fork = ::std::option::Option::None; + } + + pub fn has_hard_fork(&self) -> bool { + self.hard_fork.is_some() + } + + // Param is passed by value, moved + pub fn set_hard_fork(&mut self, v: u32) { + self.hard_fork = ::std::option::Option::Some(v); + } + + // optional bytes monero_version = 15; + + pub fn monero_version(&self) -> &[u8] { + match self.monero_version.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_monero_version(&mut self) { + self.monero_version = ::std::option::Option::None; + } + + pub fn has_monero_version(&self) -> bool { + self.monero_version.is_some() + } + + // Param is passed by value, moved + pub fn set_monero_version(&mut self, v: ::std::vec::Vec) { + self.monero_version = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_monero_version(&mut self) -> &mut ::std::vec::Vec { + if self.monero_version.is_none() { + self.monero_version = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.monero_version.as_mut().unwrap() + } + + // Take field + pub fn take_monero_version(&mut self) -> ::std::vec::Vec { + self.monero_version.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool chunkify = 16; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(16); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "version", + |m: &MoneroTransactionData| { &m.version }, + |m: &mut MoneroTransactionData| { &mut m.version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payment_id", + |m: &MoneroTransactionData| { &m.payment_id }, + |m: &mut MoneroTransactionData| { &mut m.payment_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "unlock_time", + |m: &MoneroTransactionData| { &m.unlock_time }, + |m: &mut MoneroTransactionData| { &mut m.unlock_time }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "outputs", + |m: &MoneroTransactionData| { &m.outputs }, + |m: &mut MoneroTransactionData| { &mut m.outputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MoneroTransactionDestinationEntry>( + "change_dts", + |m: &MoneroTransactionData| { &m.change_dts }, + |m: &mut MoneroTransactionData| { &mut m.change_dts }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "num_inputs", + |m: &MoneroTransactionData| { &m.num_inputs }, + |m: &mut MoneroTransactionData| { &mut m.num_inputs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mixin", + |m: &MoneroTransactionData| { &m.mixin }, + |m: &mut MoneroTransactionData| { &mut m.mixin }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &MoneroTransactionData| { &m.fee }, + |m: &mut MoneroTransactionData| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &MoneroTransactionData| { &m.account }, + |m: &mut MoneroTransactionData| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "minor_indices", + |m: &MoneroTransactionData| { &m.minor_indices }, + |m: &mut MoneroTransactionData| { &mut m.minor_indices }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MoneroTransactionRsigData>( + "rsig_data", + |m: &MoneroTransactionData| { &m.rsig_data }, + |m: &mut MoneroTransactionData| { &mut m.rsig_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "integrated_indices", + |m: &MoneroTransactionData| { &m.integrated_indices }, + |m: &mut MoneroTransactionData| { &mut m.integrated_indices }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "client_version", + |m: &MoneroTransactionData| { &m.client_version }, + |m: &mut MoneroTransactionData| { &mut m.client_version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hard_fork", + |m: &MoneroTransactionData| { &m.hard_fork }, + |m: &mut MoneroTransactionData| { &mut m.hard_fork }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "monero_version", + |m: &MoneroTransactionData| { &m.monero_version }, + |m: &mut MoneroTransactionData| { &mut m.monero_version }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &MoneroTransactionData| { &m.chunkify }, + |m: &mut MoneroTransactionData| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionInitRequest.MoneroTransactionData", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroTransactionData { + const NAME: &'static str = "MoneroTransactionData"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.version = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.payment_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.unlock_time = ::std::option::Option::Some(is.read_uint64()?); + }, + 34 => { + self.outputs.push(is.read_message()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.change_dts)?; + }, + 48 => { + self.num_inputs = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.mixin = ::std::option::Option::Some(is.read_uint32()?); + }, + 64 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 72 => { + self.account = ::std::option::Option::Some(is.read_uint32()?); + }, + 82 => { + is.read_repeated_packed_uint32_into(&mut self.minor_indices)?; + }, + 80 => { + self.minor_indices.push(is.read_uint32()?); + }, + 90 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; + }, + 98 => { + is.read_repeated_packed_uint32_into(&mut self.integrated_indices)?; + }, + 96 => { + self.integrated_indices.push(is.read_uint32()?); + }, + 104 => { + self.client_version = ::std::option::Option::Some(is.read_uint32()?); + }, + 112 => { + self.hard_fork = ::std::option::Option::Some(is.read_uint32()?); + }, + 122 => { + self.monero_version = ::std::option::Option::Some(is.read_bytes()?); + }, + 128 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.version { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.payment_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.unlock_time { + my_size += ::protobuf::rt::uint64_size(3, v); + } + for value in &self.outputs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.change_dts.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.num_inputs { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.mixin { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(8, v); + } + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint32_size(9, v); + } + for value in &self.minor_indices { + my_size += ::protobuf::rt::uint32_size(10, *value); + }; + if let Some(v) = self.rsig_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + for value in &self.integrated_indices { + my_size += ::protobuf::rt::uint32_size(12, *value); + }; + if let Some(v) = self.client_version { + my_size += ::protobuf::rt::uint32_size(13, v); + } + if let Some(v) = self.hard_fork { + my_size += ::protobuf::rt::uint32_size(14, v); + } + if let Some(v) = self.monero_version.as_ref() { + my_size += ::protobuf::rt::bytes_size(15, &v); + } + if let Some(v) = self.chunkify { + my_size += 2 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.version { + os.write_uint32(1, v)?; + } + if let Some(v) = self.payment_id.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.unlock_time { + os.write_uint64(3, v)?; + } + for v in &self.outputs { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + }; + if let Some(v) = self.change_dts.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.num_inputs { + os.write_uint32(6, v)?; + } + if let Some(v) = self.mixin { + os.write_uint32(7, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(8, v)?; + } + if let Some(v) = self.account { + os.write_uint32(9, v)?; + } + for v in &self.minor_indices { + os.write_uint32(10, *v)?; + }; + if let Some(v) = self.rsig_data.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; + } + for v in &self.integrated_indices { + os.write_uint32(12, *v)?; + }; + if let Some(v) = self.client_version { + os.write_uint32(13, v)?; + } + if let Some(v) = self.hard_fork { + os.write_uint32(14, v)?; + } + if let Some(v) = self.monero_version.as_ref() { + os.write_bytes(15, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(16, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionData { + MoneroTransactionData::new() + } + + fn clear(&mut self) { + self.version = ::std::option::Option::None; + self.payment_id = ::std::option::Option::None; + self.unlock_time = ::std::option::Option::None; + self.outputs.clear(); + self.change_dts.clear(); + self.num_inputs = ::std::option::Option::None; + self.mixin = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.account = ::std::option::Option::None; + self.minor_indices.clear(); + self.rsig_data.clear(); + self.integrated_indices.clear(); + self.client_version = ::std::option::Option::None; + self.hard_fork = ::std::option::Option::None; + self.monero_version = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionData { + static instance: MoneroTransactionData = MoneroTransactionData { + version: ::std::option::Option::None, + payment_id: ::std::option::Option::None, + unlock_time: ::std::option::Option::None, + outputs: ::std::vec::Vec::new(), + change_dts: ::protobuf::MessageField::none(), + num_inputs: ::std::option::Option::None, + mixin: ::std::option::Option::None, + fee: ::std::option::Option::None, + account: ::std::option::Option::None, + minor_indices: ::std::vec::Vec::new(), + rsig_data: ::protobuf::MessageField::none(), + integrated_indices: ::std::vec::Vec::new(), + client_version: ::std::option::Option::None, + hard_fork: ::std::option::Option::None, + monero_version: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroTransactionData { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionInitRequest.MoneroTransactionData").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroTransactionData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroTransactionData { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInitAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionInitAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitAck.hmacs) + pub hmacs: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitAck.rsig_data) + pub rsig_data: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInitAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionInitAck { + fn default() -> &'a MoneroTransactionInitAck { + ::default_instance() + } +} + +impl MoneroTransactionInitAck { + pub fn new() -> MoneroTransactionInitAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "hmacs", + |m: &MoneroTransactionInitAck| { &m.hmacs }, + |m: &mut MoneroTransactionInitAck| { &mut m.hmacs }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( + "rsig_data", + |m: &MoneroTransactionInitAck| { &m.rsig_data }, + |m: &mut MoneroTransactionInitAck| { &mut m.rsig_data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionInitAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionInitAck { + const NAME: &'static str = "MoneroTransactionInitAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.hmacs.push(is.read_bytes()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.hmacs { + my_size += ::protobuf::rt::bytes_size(1, &value); + }; + if let Some(v) = self.rsig_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.hmacs { + os.write_bytes(1, &v)?; + }; + if let Some(v) = self.rsig_data.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionInitAck { + MoneroTransactionInitAck::new() + } + + fn clear(&mut self) { + self.hmacs.clear(); + self.rsig_data.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionInitAck { + static instance: MoneroTransactionInitAck = MoneroTransactionInitAck { + hmacs: ::std::vec::Vec::new(), + rsig_data: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionInitAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInitAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionInitAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInitAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetInputRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionSetInputRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputRequest.src_entr) + pub src_entr: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetInputRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionSetInputRequest { + fn default() -> &'a MoneroTransactionSetInputRequest { + ::default_instance() + } +} + +impl MoneroTransactionSetInputRequest { + pub fn new() -> MoneroTransactionSetInputRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionSourceEntry>( + "src_entr", + |m: &MoneroTransactionSetInputRequest| { &m.src_entr }, + |m: &mut MoneroTransactionSetInputRequest| { &mut m.src_entr }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSetInputRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionSetInputRequest { + const NAME: &'static str = "MoneroTransactionSetInputRequest"; + + fn is_initialized(&self) -> bool { + for v in &self.src_entr { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.src_entr)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.src_entr.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.src_entr.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionSetInputRequest { + MoneroTransactionSetInputRequest::new() + } + + fn clear(&mut self) { + self.src_entr.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionSetInputRequest { + static instance: MoneroTransactionSetInputRequest = MoneroTransactionSetInputRequest { + src_entr: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionSetInputRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetInputRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionSetInputRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetInputRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetInputAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionSetInputAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.vini) + pub vini: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.vini_hmac) + pub vini_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.pseudo_out) + pub pseudo_out: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.pseudo_out_hmac) + pub pseudo_out_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.pseudo_out_alpha) + pub pseudo_out_alpha: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.spend_key) + pub spend_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionSetInputAck { + fn default() -> &'a MoneroTransactionSetInputAck { + ::default_instance() + } +} + +impl MoneroTransactionSetInputAck { + pub fn new() -> MoneroTransactionSetInputAck { + ::std::default::Default::default() + } + + // optional bytes vini = 1; + + pub fn vini(&self) -> &[u8] { + match self.vini.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vini(&mut self) { + self.vini = ::std::option::Option::None; + } + + pub fn has_vini(&self) -> bool { + self.vini.is_some() + } + + // Param is passed by value, moved + pub fn set_vini(&mut self, v: ::std::vec::Vec) { + self.vini = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vini(&mut self) -> &mut ::std::vec::Vec { + if self.vini.is_none() { + self.vini = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vini.as_mut().unwrap() + } + + // Take field + pub fn take_vini(&mut self) -> ::std::vec::Vec { + self.vini.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes vini_hmac = 2; + + pub fn vini_hmac(&self) -> &[u8] { + match self.vini_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vini_hmac(&mut self) { + self.vini_hmac = ::std::option::Option::None; + } + + pub fn has_vini_hmac(&self) -> bool { + self.vini_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_vini_hmac(&mut self, v: ::std::vec::Vec) { + self.vini_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vini_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.vini_hmac.is_none() { + self.vini_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vini_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_vini_hmac(&mut self) -> ::std::vec::Vec { + self.vini_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out = 3; + + pub fn pseudo_out(&self) -> &[u8] { + match self.pseudo_out.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out(&mut self) { + self.pseudo_out = ::std::option::Option::None; + } + + pub fn has_pseudo_out(&self) -> bool { + self.pseudo_out.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { + self.pseudo_out = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out.is_none() { + self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { + self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out_hmac = 4; + + pub fn pseudo_out_hmac(&self) -> &[u8] { + match self.pseudo_out_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out_hmac(&mut self) { + self.pseudo_out_hmac = ::std::option::Option::None; + } + + pub fn has_pseudo_out_hmac(&self) -> bool { + self.pseudo_out_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out_hmac(&mut self, v: ::std::vec::Vec) { + self.pseudo_out_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out_hmac.is_none() { + self.pseudo_out_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out_hmac(&mut self) -> ::std::vec::Vec { + self.pseudo_out_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out_alpha = 5; + + pub fn pseudo_out_alpha(&self) -> &[u8] { + match self.pseudo_out_alpha.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out_alpha(&mut self) { + self.pseudo_out_alpha = ::std::option::Option::None; + } + + pub fn has_pseudo_out_alpha(&self) -> bool { + self.pseudo_out_alpha.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out_alpha(&mut self, v: ::std::vec::Vec) { + self.pseudo_out_alpha = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out_alpha(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out_alpha.is_none() { + self.pseudo_out_alpha = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out_alpha.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out_alpha(&mut self) -> ::std::vec::Vec { + self.pseudo_out_alpha.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes spend_key = 6; + + pub fn spend_key(&self) -> &[u8] { + match self.spend_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_spend_key(&mut self) { + self.spend_key = ::std::option::Option::None; + } + + pub fn has_spend_key(&self) -> bool { + self.spend_key.is_some() + } + + // Param is passed by value, moved + pub fn set_spend_key(&mut self, v: ::std::vec::Vec) { + self.spend_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_spend_key(&mut self) -> &mut ::std::vec::Vec { + if self.spend_key.is_none() { + self.spend_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.spend_key.as_mut().unwrap() + } + + // Take field + pub fn take_spend_key(&mut self) -> ::std::vec::Vec { + self.spend_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vini", + |m: &MoneroTransactionSetInputAck| { &m.vini }, + |m: &mut MoneroTransactionSetInputAck| { &mut m.vini }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vini_hmac", + |m: &MoneroTransactionSetInputAck| { &m.vini_hmac }, + |m: &mut MoneroTransactionSetInputAck| { &mut m.vini_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out", + |m: &MoneroTransactionSetInputAck| { &m.pseudo_out }, + |m: &mut MoneroTransactionSetInputAck| { &mut m.pseudo_out }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out_hmac", + |m: &MoneroTransactionSetInputAck| { &m.pseudo_out_hmac }, + |m: &mut MoneroTransactionSetInputAck| { &mut m.pseudo_out_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out_alpha", + |m: &MoneroTransactionSetInputAck| { &m.pseudo_out_alpha }, + |m: &mut MoneroTransactionSetInputAck| { &mut m.pseudo_out_alpha }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "spend_key", + |m: &MoneroTransactionSetInputAck| { &m.spend_key }, + |m: &mut MoneroTransactionSetInputAck| { &mut m.spend_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSetInputAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionSetInputAck { + const NAME: &'static str = "MoneroTransactionSetInputAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.vini = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.vini_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.pseudo_out_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.pseudo_out_alpha = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.spend_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.vini.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.vini_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.pseudo_out.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.pseudo_out_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.pseudo_out_alpha.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.spend_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.vini.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.vini_hmac.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.pseudo_out.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.pseudo_out_hmac.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.pseudo_out_alpha.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.spend_key.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionSetInputAck { + MoneroTransactionSetInputAck::new() + } + + fn clear(&mut self) { + self.vini = ::std::option::Option::None; + self.vini_hmac = ::std::option::Option::None; + self.pseudo_out = ::std::option::Option::None; + self.pseudo_out_hmac = ::std::option::Option::None; + self.pseudo_out_alpha = ::std::option::Option::None; + self.spend_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionSetInputAck { + static instance: MoneroTransactionSetInputAck = MoneroTransactionSetInputAck { + vini: ::std::option::Option::None, + vini_hmac: ::std::option::Option::None, + pseudo_out: ::std::option::Option::None, + pseudo_out_hmac: ::std::option::Option::None, + pseudo_out_alpha: ::std::option::Option::None, + spend_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionSetInputAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetInputAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionSetInputAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetInputAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInputViniRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionInputViniRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.src_entr) + pub src_entr: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.vini) + pub vini: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.vini_hmac) + pub vini_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.pseudo_out) + pub pseudo_out: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.pseudo_out_hmac) + pub pseudo_out_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.orig_idx) + pub orig_idx: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionInputViniRequest { + fn default() -> &'a MoneroTransactionInputViniRequest { + ::default_instance() + } +} + +impl MoneroTransactionInputViniRequest { + pub fn new() -> MoneroTransactionInputViniRequest { + ::std::default::Default::default() + } + + // optional bytes vini = 2; + + pub fn vini(&self) -> &[u8] { + match self.vini.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vini(&mut self) { + self.vini = ::std::option::Option::None; + } + + pub fn has_vini(&self) -> bool { + self.vini.is_some() + } + + // Param is passed by value, moved + pub fn set_vini(&mut self, v: ::std::vec::Vec) { + self.vini = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vini(&mut self) -> &mut ::std::vec::Vec { + if self.vini.is_none() { + self.vini = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vini.as_mut().unwrap() + } + + // Take field + pub fn take_vini(&mut self) -> ::std::vec::Vec { + self.vini.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes vini_hmac = 3; + + pub fn vini_hmac(&self) -> &[u8] { + match self.vini_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vini_hmac(&mut self) { + self.vini_hmac = ::std::option::Option::None; + } + + pub fn has_vini_hmac(&self) -> bool { + self.vini_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_vini_hmac(&mut self, v: ::std::vec::Vec) { + self.vini_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vini_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.vini_hmac.is_none() { + self.vini_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vini_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_vini_hmac(&mut self) -> ::std::vec::Vec { + self.vini_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out = 4; + + pub fn pseudo_out(&self) -> &[u8] { + match self.pseudo_out.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out(&mut self) { + self.pseudo_out = ::std::option::Option::None; + } + + pub fn has_pseudo_out(&self) -> bool { + self.pseudo_out.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { + self.pseudo_out = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out.is_none() { + self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { + self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out_hmac = 5; + + pub fn pseudo_out_hmac(&self) -> &[u8] { + match self.pseudo_out_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out_hmac(&mut self) { + self.pseudo_out_hmac = ::std::option::Option::None; + } + + pub fn has_pseudo_out_hmac(&self) -> bool { + self.pseudo_out_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out_hmac(&mut self, v: ::std::vec::Vec) { + self.pseudo_out_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out_hmac.is_none() { + self.pseudo_out_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out_hmac(&mut self) -> ::std::vec::Vec { + self.pseudo_out_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 orig_idx = 6; + + pub fn orig_idx(&self) -> u32 { + self.orig_idx.unwrap_or(0) + } + + pub fn clear_orig_idx(&mut self) { + self.orig_idx = ::std::option::Option::None; + } + + pub fn has_orig_idx(&self) -> bool { + self.orig_idx.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_idx(&mut self, v: u32) { + self.orig_idx = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionSourceEntry>( + "src_entr", + |m: &MoneroTransactionInputViniRequest| { &m.src_entr }, + |m: &mut MoneroTransactionInputViniRequest| { &mut m.src_entr }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vini", + |m: &MoneroTransactionInputViniRequest| { &m.vini }, + |m: &mut MoneroTransactionInputViniRequest| { &mut m.vini }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vini_hmac", + |m: &MoneroTransactionInputViniRequest| { &m.vini_hmac }, + |m: &mut MoneroTransactionInputViniRequest| { &mut m.vini_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out", + |m: &MoneroTransactionInputViniRequest| { &m.pseudo_out }, + |m: &mut MoneroTransactionInputViniRequest| { &mut m.pseudo_out }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out_hmac", + |m: &MoneroTransactionInputViniRequest| { &m.pseudo_out_hmac }, + |m: &mut MoneroTransactionInputViniRequest| { &mut m.pseudo_out_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_idx", + |m: &MoneroTransactionInputViniRequest| { &m.orig_idx }, + |m: &mut MoneroTransactionInputViniRequest| { &mut m.orig_idx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionInputViniRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionInputViniRequest { + const NAME: &'static str = "MoneroTransactionInputViniRequest"; + + fn is_initialized(&self) -> bool { + for v in &self.src_entr { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.src_entr)?; + }, + 18 => { + self.vini = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.vini_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.pseudo_out_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 48 => { + self.orig_idx = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.src_entr.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.vini.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.vini_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.pseudo_out.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.pseudo_out_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.orig_idx { + my_size += ::protobuf::rt::uint32_size(6, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.src_entr.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.vini.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.vini_hmac.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.pseudo_out.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.pseudo_out_hmac.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.orig_idx { + os.write_uint32(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionInputViniRequest { + MoneroTransactionInputViniRequest::new() + } + + fn clear(&mut self) { + self.src_entr.clear(); + self.vini = ::std::option::Option::None; + self.vini_hmac = ::std::option::Option::None; + self.pseudo_out = ::std::option::Option::None; + self.pseudo_out_hmac = ::std::option::Option::None; + self.orig_idx = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionInputViniRequest { + static instance: MoneroTransactionInputViniRequest = MoneroTransactionInputViniRequest { + src_entr: ::protobuf::MessageField::none(), + vini: ::std::option::Option::None, + vini_hmac: ::std::option::Option::None, + pseudo_out: ::std::option::Option::None, + pseudo_out_hmac: ::std::option::Option::None, + orig_idx: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionInputViniRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInputViniRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionInputViniRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInputViniRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInputViniAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionInputViniAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInputViniAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionInputViniAck { + fn default() -> &'a MoneroTransactionInputViniAck { + ::default_instance() + } +} + +impl MoneroTransactionInputViniAck { + pub fn new() -> MoneroTransactionInputViniAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionInputViniAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionInputViniAck { + const NAME: &'static str = "MoneroTransactionInputViniAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionInputViniAck { + MoneroTransactionInputViniAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionInputViniAck { + static instance: MoneroTransactionInputViniAck = MoneroTransactionInputViniAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionInputViniAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInputViniAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionInputViniAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInputViniAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllInputsSetRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionAllInputsSetRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllInputsSetRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionAllInputsSetRequest { + fn default() -> &'a MoneroTransactionAllInputsSetRequest { + ::default_instance() + } +} + +impl MoneroTransactionAllInputsSetRequest { + pub fn new() -> MoneroTransactionAllInputsSetRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionAllInputsSetRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionAllInputsSetRequest { + const NAME: &'static str = "MoneroTransactionAllInputsSetRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionAllInputsSetRequest { + MoneroTransactionAllInputsSetRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionAllInputsSetRequest { + static instance: MoneroTransactionAllInputsSetRequest = MoneroTransactionAllInputsSetRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionAllInputsSetRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllInputsSetRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionAllInputsSetRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllInputsSetRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllInputsSetAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionAllInputsSetAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllInputsSetAck.rsig_data) + pub rsig_data: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllInputsSetAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionAllInputsSetAck { + fn default() -> &'a MoneroTransactionAllInputsSetAck { + ::default_instance() + } +} + +impl MoneroTransactionAllInputsSetAck { + pub fn new() -> MoneroTransactionAllInputsSetAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( + "rsig_data", + |m: &MoneroTransactionAllInputsSetAck| { &m.rsig_data }, + |m: &mut MoneroTransactionAllInputsSetAck| { &mut m.rsig_data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionAllInputsSetAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionAllInputsSetAck { + const NAME: &'static str = "MoneroTransactionAllInputsSetAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.rsig_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.rsig_data.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionAllInputsSetAck { + MoneroTransactionAllInputsSetAck::new() + } + + fn clear(&mut self) { + self.rsig_data.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionAllInputsSetAck { + static instance: MoneroTransactionAllInputsSetAck = MoneroTransactionAllInputsSetAck { + rsig_data: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionAllInputsSetAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllInputsSetAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionAllInputsSetAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllInputsSetAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionSetOutputRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.dst_entr) + pub dst_entr: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.dst_entr_hmac) + pub dst_entr_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.rsig_data) + pub rsig_data: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.is_offloaded_bp) + pub is_offloaded_bp: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionSetOutputRequest { + fn default() -> &'a MoneroTransactionSetOutputRequest { + ::default_instance() + } +} + +impl MoneroTransactionSetOutputRequest { + pub fn new() -> MoneroTransactionSetOutputRequest { + ::std::default::Default::default() + } + + // optional bytes dst_entr_hmac = 2; + + pub fn dst_entr_hmac(&self) -> &[u8] { + match self.dst_entr_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_dst_entr_hmac(&mut self) { + self.dst_entr_hmac = ::std::option::Option::None; + } + + pub fn has_dst_entr_hmac(&self) -> bool { + self.dst_entr_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_dst_entr_hmac(&mut self, v: ::std::vec::Vec) { + self.dst_entr_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_dst_entr_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.dst_entr_hmac.is_none() { + self.dst_entr_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.dst_entr_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_dst_entr_hmac(&mut self) -> ::std::vec::Vec { + self.dst_entr_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool is_offloaded_bp = 4; + + pub fn is_offloaded_bp(&self) -> bool { + self.is_offloaded_bp.unwrap_or(false) + } + + pub fn clear_is_offloaded_bp(&mut self) { + self.is_offloaded_bp = ::std::option::Option::None; + } + + pub fn has_is_offloaded_bp(&self) -> bool { + self.is_offloaded_bp.is_some() + } + + // Param is passed by value, moved + pub fn set_is_offloaded_bp(&mut self, v: bool) { + self.is_offloaded_bp = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionDestinationEntry>( + "dst_entr", + |m: &MoneroTransactionSetOutputRequest| { &m.dst_entr }, + |m: &mut MoneroTransactionSetOutputRequest| { &mut m.dst_entr }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "dst_entr_hmac", + |m: &MoneroTransactionSetOutputRequest| { &m.dst_entr_hmac }, + |m: &mut MoneroTransactionSetOutputRequest| { &mut m.dst_entr_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( + "rsig_data", + |m: &MoneroTransactionSetOutputRequest| { &m.rsig_data }, + |m: &mut MoneroTransactionSetOutputRequest| { &mut m.rsig_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "is_offloaded_bp", + |m: &MoneroTransactionSetOutputRequest| { &m.is_offloaded_bp }, + |m: &mut MoneroTransactionSetOutputRequest| { &mut m.is_offloaded_bp }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSetOutputRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionSetOutputRequest { + const NAME: &'static str = "MoneroTransactionSetOutputRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.dst_entr)?; + }, + 18 => { + self.dst_entr_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; + }, + 32 => { + self.is_offloaded_bp = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.dst_entr.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.dst_entr_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.rsig_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.is_offloaded_bp { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.dst_entr.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.dst_entr_hmac.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.rsig_data.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.is_offloaded_bp { + os.write_bool(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionSetOutputRequest { + MoneroTransactionSetOutputRequest::new() + } + + fn clear(&mut self) { + self.dst_entr.clear(); + self.dst_entr_hmac = ::std::option::Option::None; + self.rsig_data.clear(); + self.is_offloaded_bp = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionSetOutputRequest { + static instance: MoneroTransactionSetOutputRequest = MoneroTransactionSetOutputRequest { + dst_entr: ::protobuf::MessageField::none(), + dst_entr_hmac: ::std::option::Option::None, + rsig_data: ::protobuf::MessageField::none(), + is_offloaded_bp: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionSetOutputRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetOutputRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionSetOutputRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetOutputRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetOutputAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionSetOutputAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.tx_out) + pub tx_out: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.vouti_hmac) + pub vouti_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.rsig_data) + pub rsig_data: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.out_pk) + pub out_pk: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.ecdh_info) + pub ecdh_info: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionSetOutputAck { + fn default() -> &'a MoneroTransactionSetOutputAck { + ::default_instance() + } +} + +impl MoneroTransactionSetOutputAck { + pub fn new() -> MoneroTransactionSetOutputAck { + ::std::default::Default::default() + } + + // optional bytes tx_out = 1; + + pub fn tx_out(&self) -> &[u8] { + match self.tx_out.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_out(&mut self) { + self.tx_out = ::std::option::Option::None; + } + + pub fn has_tx_out(&self) -> bool { + self.tx_out.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_out(&mut self, v: ::std::vec::Vec) { + self.tx_out = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_out(&mut self) -> &mut ::std::vec::Vec { + if self.tx_out.is_none() { + self.tx_out = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_out.as_mut().unwrap() + } + + // Take field + pub fn take_tx_out(&mut self) -> ::std::vec::Vec { + self.tx_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes vouti_hmac = 2; + + pub fn vouti_hmac(&self) -> &[u8] { + match self.vouti_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vouti_hmac(&mut self) { + self.vouti_hmac = ::std::option::Option::None; + } + + pub fn has_vouti_hmac(&self) -> bool { + self.vouti_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_vouti_hmac(&mut self, v: ::std::vec::Vec) { + self.vouti_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vouti_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.vouti_hmac.is_none() { + self.vouti_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vouti_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_vouti_hmac(&mut self) -> ::std::vec::Vec { + self.vouti_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes out_pk = 4; + + pub fn out_pk(&self) -> &[u8] { + match self.out_pk.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_out_pk(&mut self) { + self.out_pk = ::std::option::Option::None; + } + + pub fn has_out_pk(&self) -> bool { + self.out_pk.is_some() + } + + // Param is passed by value, moved + pub fn set_out_pk(&mut self, v: ::std::vec::Vec) { + self.out_pk = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_out_pk(&mut self) -> &mut ::std::vec::Vec { + if self.out_pk.is_none() { + self.out_pk = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.out_pk.as_mut().unwrap() + } + + // Take field + pub fn take_out_pk(&mut self) -> ::std::vec::Vec { + self.out_pk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes ecdh_info = 5; + + pub fn ecdh_info(&self) -> &[u8] { + match self.ecdh_info.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ecdh_info(&mut self) { + self.ecdh_info = ::std::option::Option::None; + } + + pub fn has_ecdh_info(&self) -> bool { + self.ecdh_info.is_some() + } + + // Param is passed by value, moved + pub fn set_ecdh_info(&mut self, v: ::std::vec::Vec) { + self.ecdh_info = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ecdh_info(&mut self) -> &mut ::std::vec::Vec { + if self.ecdh_info.is_none() { + self.ecdh_info = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ecdh_info.as_mut().unwrap() + } + + // Take field + pub fn take_ecdh_info(&mut self) -> ::std::vec::Vec { + self.ecdh_info.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_out", + |m: &MoneroTransactionSetOutputAck| { &m.tx_out }, + |m: &mut MoneroTransactionSetOutputAck| { &mut m.tx_out }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vouti_hmac", + |m: &MoneroTransactionSetOutputAck| { &m.vouti_hmac }, + |m: &mut MoneroTransactionSetOutputAck| { &mut m.vouti_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( + "rsig_data", + |m: &MoneroTransactionSetOutputAck| { &m.rsig_data }, + |m: &mut MoneroTransactionSetOutputAck| { &mut m.rsig_data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "out_pk", + |m: &MoneroTransactionSetOutputAck| { &m.out_pk }, + |m: &mut MoneroTransactionSetOutputAck| { &mut m.out_pk }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ecdh_info", + |m: &MoneroTransactionSetOutputAck| { &m.ecdh_info }, + |m: &mut MoneroTransactionSetOutputAck| { &mut m.ecdh_info }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSetOutputAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionSetOutputAck { + const NAME: &'static str = "MoneroTransactionSetOutputAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.tx_out = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.vouti_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; + }, + 34 => { + self.out_pk = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.ecdh_info = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tx_out.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.vouti_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.rsig_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.out_pk.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.ecdh_info.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tx_out.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.vouti_hmac.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.rsig_data.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.out_pk.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.ecdh_info.as_ref() { + os.write_bytes(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionSetOutputAck { + MoneroTransactionSetOutputAck::new() + } + + fn clear(&mut self) { + self.tx_out = ::std::option::Option::None; + self.vouti_hmac = ::std::option::Option::None; + self.rsig_data.clear(); + self.out_pk = ::std::option::Option::None; + self.ecdh_info = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionSetOutputAck { + static instance: MoneroTransactionSetOutputAck = MoneroTransactionSetOutputAck { + tx_out: ::std::option::Option::None, + vouti_hmac: ::std::option::Option::None, + rsig_data: ::protobuf::MessageField::none(), + out_pk: ::std::option::Option::None, + ecdh_info: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionSetOutputAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetOutputAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionSetOutputAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetOutputAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllOutSetRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionAllOutSetRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetRequest.rsig_data) + pub rsig_data: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllOutSetRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionAllOutSetRequest { + fn default() -> &'a MoneroTransactionAllOutSetRequest { + ::default_instance() + } +} + +impl MoneroTransactionAllOutSetRequest { + pub fn new() -> MoneroTransactionAllOutSetRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( + "rsig_data", + |m: &MoneroTransactionAllOutSetRequest| { &m.rsig_data }, + |m: &mut MoneroTransactionAllOutSetRequest| { &mut m.rsig_data }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionAllOutSetRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionAllOutSetRequest { + const NAME: &'static str = "MoneroTransactionAllOutSetRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.rsig_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.rsig_data.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionAllOutSetRequest { + MoneroTransactionAllOutSetRequest::new() + } + + fn clear(&mut self) { + self.rsig_data.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionAllOutSetRequest { + static instance: MoneroTransactionAllOutSetRequest = MoneroTransactionAllOutSetRequest { + rsig_data: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionAllOutSetRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllOutSetRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionAllOutSetRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllOutSetRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionAllOutSetAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.extra) + pub extra: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.tx_prefix_hash) + pub tx_prefix_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.rv) + pub rv: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.full_message_hash) + pub full_message_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionAllOutSetAck { + fn default() -> &'a MoneroTransactionAllOutSetAck { + ::default_instance() + } +} + +impl MoneroTransactionAllOutSetAck { + pub fn new() -> MoneroTransactionAllOutSetAck { + ::std::default::Default::default() + } + + // optional bytes extra = 1; + + pub fn extra(&self) -> &[u8] { + match self.extra.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_extra(&mut self) { + self.extra = ::std::option::Option::None; + } + + pub fn has_extra(&self) -> bool { + self.extra.is_some() + } + + // Param is passed by value, moved + pub fn set_extra(&mut self, v: ::std::vec::Vec) { + self.extra = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_extra(&mut self) -> &mut ::std::vec::Vec { + if self.extra.is_none() { + self.extra = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.extra.as_mut().unwrap() + } + + // Take field + pub fn take_extra(&mut self) -> ::std::vec::Vec { + self.extra.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes tx_prefix_hash = 2; + + pub fn tx_prefix_hash(&self) -> &[u8] { + match self.tx_prefix_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_prefix_hash(&mut self) { + self.tx_prefix_hash = ::std::option::Option::None; + } + + pub fn has_tx_prefix_hash(&self) -> bool { + self.tx_prefix_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_prefix_hash(&mut self, v: ::std::vec::Vec) { + self.tx_prefix_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_prefix_hash(&mut self) -> &mut ::std::vec::Vec { + if self.tx_prefix_hash.is_none() { + self.tx_prefix_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_prefix_hash.as_mut().unwrap() + } + + // Take field + pub fn take_tx_prefix_hash(&mut self) -> ::std::vec::Vec { + self.tx_prefix_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes full_message_hash = 5; + + pub fn full_message_hash(&self) -> &[u8] { + match self.full_message_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_full_message_hash(&mut self) { + self.full_message_hash = ::std::option::Option::None; + } + + pub fn has_full_message_hash(&self) -> bool { + self.full_message_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_full_message_hash(&mut self, v: ::std::vec::Vec) { + self.full_message_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_full_message_hash(&mut self) -> &mut ::std::vec::Vec { + if self.full_message_hash.is_none() { + self.full_message_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.full_message_hash.as_mut().unwrap() + } + + // Take field + pub fn take_full_message_hash(&mut self) -> ::std::vec::Vec { + self.full_message_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "extra", + |m: &MoneroTransactionAllOutSetAck| { &m.extra }, + |m: &mut MoneroTransactionAllOutSetAck| { &mut m.extra }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_prefix_hash", + |m: &MoneroTransactionAllOutSetAck| { &m.tx_prefix_hash }, + |m: &mut MoneroTransactionAllOutSetAck| { &mut m.tx_prefix_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_all_out_set_ack::MoneroRingCtSig>( + "rv", + |m: &MoneroTransactionAllOutSetAck| { &m.rv }, + |m: &mut MoneroTransactionAllOutSetAck| { &mut m.rv }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "full_message_hash", + |m: &MoneroTransactionAllOutSetAck| { &m.full_message_hash }, + |m: &mut MoneroTransactionAllOutSetAck| { &mut m.full_message_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionAllOutSetAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionAllOutSetAck { + const NAME: &'static str = "MoneroTransactionAllOutSetAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.extra = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.tx_prefix_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.rv)?; + }, + 42 => { + self.full_message_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.extra.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.tx_prefix_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.rv.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.full_message_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.extra.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.tx_prefix_hash.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.rv.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.full_message_hash.as_ref() { + os.write_bytes(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionAllOutSetAck { + MoneroTransactionAllOutSetAck::new() + } + + fn clear(&mut self) { + self.extra = ::std::option::Option::None; + self.tx_prefix_hash = ::std::option::Option::None; + self.rv.clear(); + self.full_message_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionAllOutSetAck { + static instance: MoneroTransactionAllOutSetAck = MoneroTransactionAllOutSetAck { + extra: ::std::option::Option::None, + tx_prefix_hash: ::std::option::Option::None, + rv: ::protobuf::MessageField::none(), + full_message_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionAllOutSetAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllOutSetAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionAllOutSetAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllOutSetAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MoneroTransactionAllOutSetAck` +pub mod monero_transaction_all_out_set_ack { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroRingCtSig { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.txn_fee) + pub txn_fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.message) + pub message: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.rv_type) + pub rv_type: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroRingCtSig { + fn default() -> &'a MoneroRingCtSig { + ::default_instance() + } + } + + impl MoneroRingCtSig { + pub fn new() -> MoneroRingCtSig { + ::std::default::Default::default() + } + + // optional uint64 txn_fee = 1; + + pub fn txn_fee(&self) -> u64 { + self.txn_fee.unwrap_or(0) + } + + pub fn clear_txn_fee(&mut self) { + self.txn_fee = ::std::option::Option::None; + } + + pub fn has_txn_fee(&self) -> bool { + self.txn_fee.is_some() + } + + // Param is passed by value, moved + pub fn set_txn_fee(&mut self, v: u64) { + self.txn_fee = ::std::option::Option::Some(v); + } + + // optional bytes message = 2; + + pub fn message(&self) -> &[u8] { + match self.message.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_message(&mut self) { + self.message = ::std::option::Option::None; + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::vec::Vec) { + self.message = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { + if self.message.is_none() { + self.message = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::vec::Vec { + self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 rv_type = 3; + + pub fn rv_type(&self) -> u32 { + self.rv_type.unwrap_or(0) + } + + pub fn clear_rv_type(&mut self) { + self.rv_type = ::std::option::Option::None; + } + + pub fn has_rv_type(&self) -> bool { + self.rv_type.is_some() + } + + // Param is passed by value, moved + pub fn set_rv_type(&mut self, v: u32) { + self.rv_type = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "txn_fee", + |m: &MoneroRingCtSig| { &m.txn_fee }, + |m: &mut MoneroRingCtSig| { &mut m.txn_fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "message", + |m: &MoneroRingCtSig| { &m.message }, + |m: &mut MoneroRingCtSig| { &mut m.message }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "rv_type", + |m: &MoneroRingCtSig| { &m.rv_type }, + |m: &mut MoneroRingCtSig| { &mut m.rv_type }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionAllOutSetAck.MoneroRingCtSig", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroRingCtSig { + const NAME: &'static str = "MoneroRingCtSig"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.txn_fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + self.message = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.rv_type = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.txn_fee { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.message.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.rv_type { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.txn_fee { + os.write_uint64(1, v)?; + } + if let Some(v) = self.message.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.rv_type { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroRingCtSig { + MoneroRingCtSig::new() + } + + fn clear(&mut self) { + self.txn_fee = ::std::option::Option::None; + self.message = ::std::option::Option::None; + self.rv_type = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroRingCtSig { + static instance: MoneroRingCtSig = MoneroRingCtSig { + txn_fee: ::std::option::Option::None, + message: ::std::option::Option::None, + rv_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroRingCtSig { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionAllOutSetAck.MoneroRingCtSig").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroRingCtSig { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroRingCtSig { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSignInputRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionSignInputRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.src_entr) + pub src_entr: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.vini) + pub vini: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.vini_hmac) + pub vini_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.pseudo_out) + pub pseudo_out: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.pseudo_out_hmac) + pub pseudo_out_hmac: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.pseudo_out_alpha) + pub pseudo_out_alpha: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.spend_key) + pub spend_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.orig_idx) + pub orig_idx: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionSignInputRequest { + fn default() -> &'a MoneroTransactionSignInputRequest { + ::default_instance() + } +} + +impl MoneroTransactionSignInputRequest { + pub fn new() -> MoneroTransactionSignInputRequest { + ::std::default::Default::default() + } + + // optional bytes vini = 2; + + pub fn vini(&self) -> &[u8] { + match self.vini.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vini(&mut self) { + self.vini = ::std::option::Option::None; + } + + pub fn has_vini(&self) -> bool { + self.vini.is_some() + } + + // Param is passed by value, moved + pub fn set_vini(&mut self, v: ::std::vec::Vec) { + self.vini = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vini(&mut self) -> &mut ::std::vec::Vec { + if self.vini.is_none() { + self.vini = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vini.as_mut().unwrap() + } + + // Take field + pub fn take_vini(&mut self) -> ::std::vec::Vec { + self.vini.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes vini_hmac = 3; + + pub fn vini_hmac(&self) -> &[u8] { + match self.vini_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_vini_hmac(&mut self) { + self.vini_hmac = ::std::option::Option::None; + } + + pub fn has_vini_hmac(&self) -> bool { + self.vini_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_vini_hmac(&mut self, v: ::std::vec::Vec) { + self.vini_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vini_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.vini_hmac.is_none() { + self.vini_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.vini_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_vini_hmac(&mut self) -> ::std::vec::Vec { + self.vini_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out = 4; + + pub fn pseudo_out(&self) -> &[u8] { + match self.pseudo_out.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out(&mut self) { + self.pseudo_out = ::std::option::Option::None; + } + + pub fn has_pseudo_out(&self) -> bool { + self.pseudo_out.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { + self.pseudo_out = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out.is_none() { + self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { + self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out_hmac = 5; + + pub fn pseudo_out_hmac(&self) -> &[u8] { + match self.pseudo_out_hmac.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out_hmac(&mut self) { + self.pseudo_out_hmac = ::std::option::Option::None; + } + + pub fn has_pseudo_out_hmac(&self) -> bool { + self.pseudo_out_hmac.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out_hmac(&mut self, v: ::std::vec::Vec) { + self.pseudo_out_hmac = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out_hmac(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out_hmac.is_none() { + self.pseudo_out_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out_hmac.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out_hmac(&mut self) -> ::std::vec::Vec { + self.pseudo_out_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out_alpha = 6; + + pub fn pseudo_out_alpha(&self) -> &[u8] { + match self.pseudo_out_alpha.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out_alpha(&mut self) { + self.pseudo_out_alpha = ::std::option::Option::None; + } + + pub fn has_pseudo_out_alpha(&self) -> bool { + self.pseudo_out_alpha.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out_alpha(&mut self, v: ::std::vec::Vec) { + self.pseudo_out_alpha = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out_alpha(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out_alpha.is_none() { + self.pseudo_out_alpha = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out_alpha.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out_alpha(&mut self) -> ::std::vec::Vec { + self.pseudo_out_alpha.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes spend_key = 7; + + pub fn spend_key(&self) -> &[u8] { + match self.spend_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_spend_key(&mut self) { + self.spend_key = ::std::option::Option::None; + } + + pub fn has_spend_key(&self) -> bool { + self.spend_key.is_some() + } + + // Param is passed by value, moved + pub fn set_spend_key(&mut self, v: ::std::vec::Vec) { + self.spend_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_spend_key(&mut self) -> &mut ::std::vec::Vec { + if self.spend_key.is_none() { + self.spend_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.spend_key.as_mut().unwrap() + } + + // Take field + pub fn take_spend_key(&mut self) -> ::std::vec::Vec { + self.spend_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 orig_idx = 8; + + pub fn orig_idx(&self) -> u32 { + self.orig_idx.unwrap_or(0) + } + + pub fn clear_orig_idx(&mut self) { + self.orig_idx = ::std::option::Option::None; + } + + pub fn has_orig_idx(&self) -> bool { + self.orig_idx.is_some() + } + + // Param is passed by value, moved + pub fn set_orig_idx(&mut self, v: u32) { + self.orig_idx = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionSourceEntry>( + "src_entr", + |m: &MoneroTransactionSignInputRequest| { &m.src_entr }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.src_entr }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vini", + |m: &MoneroTransactionSignInputRequest| { &m.vini }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.vini }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vini_hmac", + |m: &MoneroTransactionSignInputRequest| { &m.vini_hmac }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.vini_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out", + |m: &MoneroTransactionSignInputRequest| { &m.pseudo_out }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.pseudo_out }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out_hmac", + |m: &MoneroTransactionSignInputRequest| { &m.pseudo_out_hmac }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.pseudo_out_hmac }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out_alpha", + |m: &MoneroTransactionSignInputRequest| { &m.pseudo_out_alpha }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.pseudo_out_alpha }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "spend_key", + |m: &MoneroTransactionSignInputRequest| { &m.spend_key }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.spend_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "orig_idx", + |m: &MoneroTransactionSignInputRequest| { &m.orig_idx }, + |m: &mut MoneroTransactionSignInputRequest| { &mut m.orig_idx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSignInputRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionSignInputRequest { + const NAME: &'static str = "MoneroTransactionSignInputRequest"; + + fn is_initialized(&self) -> bool { + for v in &self.src_entr { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.src_entr)?; + }, + 18 => { + self.vini = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.vini_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.pseudo_out_hmac = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.pseudo_out_alpha = ::std::option::Option::Some(is.read_bytes()?); + }, + 58 => { + self.spend_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 64 => { + self.orig_idx = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.src_entr.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.vini.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.vini_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.pseudo_out.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.pseudo_out_hmac.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.pseudo_out_alpha.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.spend_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + if let Some(v) = self.orig_idx { + my_size += ::protobuf::rt::uint32_size(8, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.src_entr.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.vini.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.vini_hmac.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.pseudo_out.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.pseudo_out_hmac.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.pseudo_out_alpha.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.spend_key.as_ref() { + os.write_bytes(7, v)?; + } + if let Some(v) = self.orig_idx { + os.write_uint32(8, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionSignInputRequest { + MoneroTransactionSignInputRequest::new() + } + + fn clear(&mut self) { + self.src_entr.clear(); + self.vini = ::std::option::Option::None; + self.vini_hmac = ::std::option::Option::None; + self.pseudo_out = ::std::option::Option::None; + self.pseudo_out_hmac = ::std::option::Option::None; + self.pseudo_out_alpha = ::std::option::Option::None; + self.spend_key = ::std::option::Option::None; + self.orig_idx = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionSignInputRequest { + static instance: MoneroTransactionSignInputRequest = MoneroTransactionSignInputRequest { + src_entr: ::protobuf::MessageField::none(), + vini: ::std::option::Option::None, + vini_hmac: ::std::option::Option::None, + pseudo_out: ::std::option::Option::None, + pseudo_out_hmac: ::std::option::Option::None, + pseudo_out_alpha: ::std::option::Option::None, + spend_key: ::std::option::Option::None, + orig_idx: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionSignInputRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSignInputRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionSignInputRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSignInputRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSignInputAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionSignInputAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputAck.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputAck.pseudo_out) + pub pseudo_out: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSignInputAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionSignInputAck { + fn default() -> &'a MoneroTransactionSignInputAck { + ::default_instance() + } +} + +impl MoneroTransactionSignInputAck { + pub fn new() -> MoneroTransactionSignInputAck { + ::std::default::Default::default() + } + + // optional bytes signature = 1; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes pseudo_out = 2; + + pub fn pseudo_out(&self) -> &[u8] { + match self.pseudo_out.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pseudo_out(&mut self) { + self.pseudo_out = ::std::option::Option::None; + } + + pub fn has_pseudo_out(&self) -> bool { + self.pseudo_out.is_some() + } + + // Param is passed by value, moved + pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { + self.pseudo_out = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { + if self.pseudo_out.is_none() { + self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pseudo_out.as_mut().unwrap() + } + + // Take field + pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { + self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &MoneroTransactionSignInputAck| { &m.signature }, + |m: &mut MoneroTransactionSignInputAck| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pseudo_out", + |m: &MoneroTransactionSignInputAck| { &m.pseudo_out }, + |m: &mut MoneroTransactionSignInputAck| { &mut m.pseudo_out }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionSignInputAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionSignInputAck { + const NAME: &'static str = "MoneroTransactionSignInputAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.pseudo_out.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.pseudo_out.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionSignInputAck { + MoneroTransactionSignInputAck::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.pseudo_out = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionSignInputAck { + static instance: MoneroTransactionSignInputAck = MoneroTransactionSignInputAck { + signature: ::std::option::Option::None, + pseudo_out: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionSignInputAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSignInputAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionSignInputAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSignInputAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionFinalRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionFinalRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionFinalRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionFinalRequest { + fn default() -> &'a MoneroTransactionFinalRequest { + ::default_instance() + } +} + +impl MoneroTransactionFinalRequest { + pub fn new() -> MoneroTransactionFinalRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionFinalRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionFinalRequest { + const NAME: &'static str = "MoneroTransactionFinalRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionFinalRequest { + MoneroTransactionFinalRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionFinalRequest { + static instance: MoneroTransactionFinalRequest = MoneroTransactionFinalRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionFinalRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionFinalRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionFinalRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionFinalRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionFinalAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroTransactionFinalAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.cout_key) + pub cout_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.salt) + pub salt: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.rand_mult) + pub rand_mult: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.tx_enc_keys) + pub tx_enc_keys: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.opening_key) + pub opening_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionFinalAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroTransactionFinalAck { + fn default() -> &'a MoneroTransactionFinalAck { + ::default_instance() + } +} + +impl MoneroTransactionFinalAck { + pub fn new() -> MoneroTransactionFinalAck { + ::std::default::Default::default() + } + + // optional bytes cout_key = 1; + + pub fn cout_key(&self) -> &[u8] { + match self.cout_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_cout_key(&mut self) { + self.cout_key = ::std::option::Option::None; + } + + pub fn has_cout_key(&self) -> bool { + self.cout_key.is_some() + } + + // Param is passed by value, moved + pub fn set_cout_key(&mut self, v: ::std::vec::Vec) { + self.cout_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cout_key(&mut self) -> &mut ::std::vec::Vec { + if self.cout_key.is_none() { + self.cout_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.cout_key.as_mut().unwrap() + } + + // Take field + pub fn take_cout_key(&mut self) -> ::std::vec::Vec { + self.cout_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes salt = 2; + + pub fn salt(&self) -> &[u8] { + match self.salt.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_salt(&mut self) { + self.salt = ::std::option::Option::None; + } + + pub fn has_salt(&self) -> bool { + self.salt.is_some() + } + + // Param is passed by value, moved + pub fn set_salt(&mut self, v: ::std::vec::Vec) { + self.salt = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_salt(&mut self) -> &mut ::std::vec::Vec { + if self.salt.is_none() { + self.salt = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.salt.as_mut().unwrap() + } + + // Take field + pub fn take_salt(&mut self) -> ::std::vec::Vec { + self.salt.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes rand_mult = 3; + + pub fn rand_mult(&self) -> &[u8] { + match self.rand_mult.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_rand_mult(&mut self) { + self.rand_mult = ::std::option::Option::None; + } + + pub fn has_rand_mult(&self) -> bool { + self.rand_mult.is_some() + } + + // Param is passed by value, moved + pub fn set_rand_mult(&mut self, v: ::std::vec::Vec) { + self.rand_mult = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_rand_mult(&mut self) -> &mut ::std::vec::Vec { + if self.rand_mult.is_none() { + self.rand_mult = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.rand_mult.as_mut().unwrap() + } + + // Take field + pub fn take_rand_mult(&mut self) -> ::std::vec::Vec { + self.rand_mult.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes tx_enc_keys = 4; + + pub fn tx_enc_keys(&self) -> &[u8] { + match self.tx_enc_keys.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_enc_keys(&mut self) { + self.tx_enc_keys = ::std::option::Option::None; + } + + pub fn has_tx_enc_keys(&self) -> bool { + self.tx_enc_keys.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_enc_keys(&mut self, v: ::std::vec::Vec) { + self.tx_enc_keys = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_enc_keys(&mut self) -> &mut ::std::vec::Vec { + if self.tx_enc_keys.is_none() { + self.tx_enc_keys = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_enc_keys.as_mut().unwrap() + } + + // Take field + pub fn take_tx_enc_keys(&mut self) -> ::std::vec::Vec { + self.tx_enc_keys.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes opening_key = 5; + + pub fn opening_key(&self) -> &[u8] { + match self.opening_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_opening_key(&mut self) { + self.opening_key = ::std::option::Option::None; + } + + pub fn has_opening_key(&self) -> bool { + self.opening_key.is_some() + } + + // Param is passed by value, moved + pub fn set_opening_key(&mut self, v: ::std::vec::Vec) { + self.opening_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_opening_key(&mut self) -> &mut ::std::vec::Vec { + if self.opening_key.is_none() { + self.opening_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.opening_key.as_mut().unwrap() + } + + // Take field + pub fn take_opening_key(&mut self) -> ::std::vec::Vec { + self.opening_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "cout_key", + |m: &MoneroTransactionFinalAck| { &m.cout_key }, + |m: &mut MoneroTransactionFinalAck| { &mut m.cout_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "salt", + |m: &MoneroTransactionFinalAck| { &m.salt }, + |m: &mut MoneroTransactionFinalAck| { &mut m.salt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "rand_mult", + |m: &MoneroTransactionFinalAck| { &m.rand_mult }, + |m: &mut MoneroTransactionFinalAck| { &mut m.rand_mult }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_enc_keys", + |m: &MoneroTransactionFinalAck| { &m.tx_enc_keys }, + |m: &mut MoneroTransactionFinalAck| { &mut m.tx_enc_keys }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "opening_key", + |m: &MoneroTransactionFinalAck| { &m.opening_key }, + |m: &mut MoneroTransactionFinalAck| { &mut m.opening_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroTransactionFinalAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroTransactionFinalAck { + const NAME: &'static str = "MoneroTransactionFinalAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.cout_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.salt = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.rand_mult = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.tx_enc_keys = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.opening_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.cout_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.salt.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.rand_mult.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.tx_enc_keys.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.opening_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.cout_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.salt.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.rand_mult.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.tx_enc_keys.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.opening_key.as_ref() { + os.write_bytes(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransactionFinalAck { + MoneroTransactionFinalAck::new() + } + + fn clear(&mut self) { + self.cout_key = ::std::option::Option::None; + self.salt = ::std::option::Option::None; + self.rand_mult = ::std::option::Option::None; + self.tx_enc_keys = ::std::option::Option::None; + self.opening_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransactionFinalAck { + static instance: MoneroTransactionFinalAck = MoneroTransactionFinalAck { + cout_key: ::std::option::Option::None, + salt: ::std::option::Option::None, + rand_mult: ::std::option::Option::None, + tx_enc_keys: ::std::option::Option::None, + opening_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroTransactionFinalAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionFinalAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroTransactionFinalAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroTransactionFinalAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroKeyImageExportInitRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.num) + pub num: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.hash) + pub hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.network_type) + pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.subs) + pub subs: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroKeyImageExportInitRequest { + fn default() -> &'a MoneroKeyImageExportInitRequest { + ::default_instance() + } +} + +impl MoneroKeyImageExportInitRequest { + pub fn new() -> MoneroKeyImageExportInitRequest { + ::std::default::Default::default() + } + + // required uint64 num = 1; + + pub fn num(&self) -> u64 { + self.num.unwrap_or(0) + } + + pub fn clear_num(&mut self) { + self.num = ::std::option::Option::None; + } + + pub fn has_num(&self) -> bool { + self.num.is_some() + } + + // Param is passed by value, moved + pub fn set_num(&mut self, v: u64) { + self.num = ::std::option::Option::Some(v); + } + + // required bytes hash = 2; + + pub fn hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 4; + + pub fn network_type(&self) -> MoneroNetworkType { + match self.network_type { + Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), + None => MoneroNetworkType::MAINNET, + } + } + + pub fn clear_network_type(&mut self) { + self.network_type = ::std::option::Option::None; + } + + pub fn has_network_type(&self) -> bool { + self.network_type.is_some() + } + + // Param is passed by value, moved + pub fn set_network_type(&mut self, v: MoneroNetworkType) { + self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "num", + |m: &MoneroKeyImageExportInitRequest| { &m.num }, + |m: &mut MoneroKeyImageExportInitRequest| { &mut m.num }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hash", + |m: &MoneroKeyImageExportInitRequest| { &m.hash }, + |m: &mut MoneroKeyImageExportInitRequest| { &mut m.hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MoneroKeyImageExportInitRequest| { &m.address_n }, + |m: &mut MoneroKeyImageExportInitRequest| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_type", + |m: &MoneroKeyImageExportInitRequest| { &m.network_type }, + |m: &mut MoneroKeyImageExportInitRequest| { &mut m.network_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "subs", + |m: &MoneroKeyImageExportInitRequest| { &m.subs }, + |m: &mut MoneroKeyImageExportInitRequest| { &mut m.subs }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageExportInitRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroKeyImageExportInitRequest { + const NAME: &'static str = "MoneroKeyImageExportInitRequest"; + + fn is_initialized(&self) -> bool { + if self.num.is_none() { + return false; + } + if self.hash.is_none() { + return false; + } + for v in &self.subs { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.num = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + self.hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 24 => { + self.address_n.push(is.read_uint32()?); + }, + 32 => { + self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 42 => { + self.subs.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.num { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(3, *value); + }; + if let Some(v) = self.network_type { + my_size += ::protobuf::rt::int32_size(4, v.value()); + } + for value in &self.subs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.num { + os.write_uint64(1, v)?; + } + if let Some(v) = self.hash.as_ref() { + os.write_bytes(2, v)?; + } + for v in &self.address_n { + os.write_uint32(3, *v)?; + }; + if let Some(v) = self.network_type { + os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; + } + for v in &self.subs { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroKeyImageExportInitRequest { + MoneroKeyImageExportInitRequest::new() + } + + fn clear(&mut self) { + self.num = ::std::option::Option::None; + self.hash = ::std::option::Option::None; + self.address_n.clear(); + self.network_type = ::std::option::Option::None; + self.subs.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroKeyImageExportInitRequest { + static instance: MoneroKeyImageExportInitRequest = MoneroKeyImageExportInitRequest { + num: ::std::option::Option::None, + hash: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + network_type: ::std::option::Option::None, + subs: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroKeyImageExportInitRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageExportInitRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroKeyImageExportInitRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageExportInitRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MoneroKeyImageExportInitRequest` +pub mod monero_key_image_export_init_request { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroSubAddressIndicesList { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList.account) + pub account: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList.minor_indices) + pub minor_indices: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroSubAddressIndicesList { + fn default() -> &'a MoneroSubAddressIndicesList { + ::default_instance() + } + } + + impl MoneroSubAddressIndicesList { + pub fn new() -> MoneroSubAddressIndicesList { + ::std::default::Default::default() + } + + // required uint32 account = 1; + + pub fn account(&self) -> u32 { + self.account.unwrap_or(0) + } + + pub fn clear_account(&mut self) { + self.account = ::std::option::Option::None; + } + + pub fn has_account(&self) -> bool { + self.account.is_some() + } + + // Param is passed by value, moved + pub fn set_account(&mut self, v: u32) { + self.account = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "account", + |m: &MoneroSubAddressIndicesList| { &m.account }, + |m: &mut MoneroSubAddressIndicesList| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "minor_indices", + |m: &MoneroSubAddressIndicesList| { &m.minor_indices }, + |m: &mut MoneroSubAddressIndicesList| { &mut m.minor_indices }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroSubAddressIndicesList { + const NAME: &'static str = "MoneroSubAddressIndicesList"; + + fn is_initialized(&self) -> bool { + if self.account.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.account = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.minor_indices)?; + }, + 16 => { + self.minor_indices.push(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.account { + my_size += ::protobuf::rt::uint32_size(1, v); + } + for value in &self.minor_indices { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.account { + os.write_uint32(1, v)?; + } + for v in &self.minor_indices { + os.write_uint32(2, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroSubAddressIndicesList { + MoneroSubAddressIndicesList::new() + } + + fn clear(&mut self) { + self.account = ::std::option::Option::None; + self.minor_indices.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroSubAddressIndicesList { + static instance: MoneroSubAddressIndicesList = MoneroSubAddressIndicesList { + account: ::std::option::Option::None, + minor_indices: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroSubAddressIndicesList { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroSubAddressIndicesList { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroSubAddressIndicesList { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageExportInitAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroKeyImageExportInitAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageExportInitAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroKeyImageExportInitAck { + fn default() -> &'a MoneroKeyImageExportInitAck { + ::default_instance() + } +} + +impl MoneroKeyImageExportInitAck { + pub fn new() -> MoneroKeyImageExportInitAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageExportInitAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroKeyImageExportInitAck { + const NAME: &'static str = "MoneroKeyImageExportInitAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroKeyImageExportInitAck { + MoneroKeyImageExportInitAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroKeyImageExportInitAck { + static instance: MoneroKeyImageExportInitAck = MoneroKeyImageExportInitAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroKeyImageExportInitAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageExportInitAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroKeyImageExportInitAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageExportInitAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroKeyImageSyncStepRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.tdis) + pub tdis: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncStepRequest { + fn default() -> &'a MoneroKeyImageSyncStepRequest { + ::default_instance() + } +} + +impl MoneroKeyImageSyncStepRequest { + pub fn new() -> MoneroKeyImageSyncStepRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "tdis", + |m: &MoneroKeyImageSyncStepRequest| { &m.tdis }, + |m: &mut MoneroKeyImageSyncStepRequest| { &mut m.tdis }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageSyncStepRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroKeyImageSyncStepRequest { + const NAME: &'static str = "MoneroKeyImageSyncStepRequest"; + + fn is_initialized(&self) -> bool { + for v in &self.tdis { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.tdis.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.tdis { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.tdis { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroKeyImageSyncStepRequest { + MoneroKeyImageSyncStepRequest::new() + } + + fn clear(&mut self) { + self.tdis.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroKeyImageSyncStepRequest { + static instance: MoneroKeyImageSyncStepRequest = MoneroKeyImageSyncStepRequest { + tdis: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroKeyImageSyncStepRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroKeyImageSyncStepRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncStepRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MoneroKeyImageSyncStepRequest` +pub mod monero_key_image_sync_step_request { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroTransferDetails { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.out_key) + pub out_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.tx_pub_key) + pub tx_pub_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.additional_tx_pub_keys) + pub additional_tx_pub_keys: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.internal_output_index) + pub internal_output_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.sub_addr_major) + pub sub_addr_major: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.sub_addr_minor) + pub sub_addr_minor: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroTransferDetails { + fn default() -> &'a MoneroTransferDetails { + ::default_instance() + } + } + + impl MoneroTransferDetails { + pub fn new() -> MoneroTransferDetails { + ::std::default::Default::default() + } + + // required bytes out_key = 1; + + pub fn out_key(&self) -> &[u8] { + match self.out_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_out_key(&mut self) { + self.out_key = ::std::option::Option::None; + } + + pub fn has_out_key(&self) -> bool { + self.out_key.is_some() + } + + // Param is passed by value, moved + pub fn set_out_key(&mut self, v: ::std::vec::Vec) { + self.out_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_out_key(&mut self) -> &mut ::std::vec::Vec { + if self.out_key.is_none() { + self.out_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.out_key.as_mut().unwrap() + } + + // Take field + pub fn take_out_key(&mut self) -> ::std::vec::Vec { + self.out_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes tx_pub_key = 2; + + pub fn tx_pub_key(&self) -> &[u8] { + match self.tx_pub_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_pub_key(&mut self) { + self.tx_pub_key = ::std::option::Option::None; + } + + pub fn has_tx_pub_key(&self) -> bool { + self.tx_pub_key.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_pub_key(&mut self, v: ::std::vec::Vec) { + self.tx_pub_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_pub_key(&mut self) -> &mut ::std::vec::Vec { + if self.tx_pub_key.is_none() { + self.tx_pub_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_pub_key.as_mut().unwrap() + } + + // Take field + pub fn take_tx_pub_key(&mut self) -> ::std::vec::Vec { + self.tx_pub_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 internal_output_index = 4; + + pub fn internal_output_index(&self) -> u64 { + self.internal_output_index.unwrap_or(0) + } + + pub fn clear_internal_output_index(&mut self) { + self.internal_output_index = ::std::option::Option::None; + } + + pub fn has_internal_output_index(&self) -> bool { + self.internal_output_index.is_some() + } + + // Param is passed by value, moved + pub fn set_internal_output_index(&mut self, v: u64) { + self.internal_output_index = ::std::option::Option::Some(v); + } + + // optional uint32 sub_addr_major = 5; + + pub fn sub_addr_major(&self) -> u32 { + self.sub_addr_major.unwrap_or(0) + } + + pub fn clear_sub_addr_major(&mut self) { + self.sub_addr_major = ::std::option::Option::None; + } + + pub fn has_sub_addr_major(&self) -> bool { + self.sub_addr_major.is_some() + } + + // Param is passed by value, moved + pub fn set_sub_addr_major(&mut self, v: u32) { + self.sub_addr_major = ::std::option::Option::Some(v); + } + + // optional uint32 sub_addr_minor = 6; + + pub fn sub_addr_minor(&self) -> u32 { + self.sub_addr_minor.unwrap_or(0) + } + + pub fn clear_sub_addr_minor(&mut self) { + self.sub_addr_minor = ::std::option::Option::None; + } + + pub fn has_sub_addr_minor(&self) -> bool { + self.sub_addr_minor.is_some() + } + + // Param is passed by value, moved + pub fn set_sub_addr_minor(&mut self, v: u32) { + self.sub_addr_minor = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "out_key", + |m: &MoneroTransferDetails| { &m.out_key }, + |m: &mut MoneroTransferDetails| { &mut m.out_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_pub_key", + |m: &MoneroTransferDetails| { &m.tx_pub_key }, + |m: &mut MoneroTransferDetails| { &mut m.tx_pub_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "additional_tx_pub_keys", + |m: &MoneroTransferDetails| { &m.additional_tx_pub_keys }, + |m: &mut MoneroTransferDetails| { &mut m.additional_tx_pub_keys }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "internal_output_index", + |m: &MoneroTransferDetails| { &m.internal_output_index }, + |m: &mut MoneroTransferDetails| { &mut m.internal_output_index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sub_addr_major", + |m: &MoneroTransferDetails| { &m.sub_addr_major }, + |m: &mut MoneroTransferDetails| { &mut m.sub_addr_major }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sub_addr_minor", + |m: &MoneroTransferDetails| { &m.sub_addr_minor }, + |m: &mut MoneroTransferDetails| { &mut m.sub_addr_minor }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageSyncStepRequest.MoneroTransferDetails", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroTransferDetails { + const NAME: &'static str = "MoneroTransferDetails"; + + fn is_initialized(&self) -> bool { + if self.out_key.is_none() { + return false; + } + if self.tx_pub_key.is_none() { + return false; + } + if self.internal_output_index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.out_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.tx_pub_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.additional_tx_pub_keys.push(is.read_bytes()?); + }, + 32 => { + self.internal_output_index = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.sub_addr_major = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.sub_addr_minor = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.out_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.tx_pub_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + for value in &self.additional_tx_pub_keys { + my_size += ::protobuf::rt::bytes_size(3, &value); + }; + if let Some(v) = self.internal_output_index { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.sub_addr_major { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.sub_addr_minor { + my_size += ::protobuf::rt::uint32_size(6, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.out_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.tx_pub_key.as_ref() { + os.write_bytes(2, v)?; + } + for v in &self.additional_tx_pub_keys { + os.write_bytes(3, &v)?; + }; + if let Some(v) = self.internal_output_index { + os.write_uint64(4, v)?; + } + if let Some(v) = self.sub_addr_major { + os.write_uint32(5, v)?; + } + if let Some(v) = self.sub_addr_minor { + os.write_uint32(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroTransferDetails { + MoneroTransferDetails::new() + } + + fn clear(&mut self) { + self.out_key = ::std::option::Option::None; + self.tx_pub_key = ::std::option::Option::None; + self.additional_tx_pub_keys.clear(); + self.internal_output_index = ::std::option::Option::None; + self.sub_addr_major = ::std::option::Option::None; + self.sub_addr_minor = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroTransferDetails { + static instance: MoneroTransferDetails = MoneroTransferDetails { + out_key: ::std::option::Option::None, + tx_pub_key: ::std::option::Option::None, + additional_tx_pub_keys: ::std::vec::Vec::new(), + internal_output_index: ::std::option::Option::None, + sub_addr_major: ::std::option::Option::None, + sub_addr_minor: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroTransferDetails { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepRequest.MoneroTransferDetails").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroTransferDetails { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroTransferDetails { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroKeyImageSyncStepAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.kis) + pub kis: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncStepAck { + fn default() -> &'a MoneroKeyImageSyncStepAck { + ::default_instance() + } +} + +impl MoneroKeyImageSyncStepAck { + pub fn new() -> MoneroKeyImageSyncStepAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "kis", + |m: &MoneroKeyImageSyncStepAck| { &m.kis }, + |m: &mut MoneroKeyImageSyncStepAck| { &mut m.kis }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageSyncStepAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroKeyImageSyncStepAck { + const NAME: &'static str = "MoneroKeyImageSyncStepAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.kis.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.kis { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.kis { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroKeyImageSyncStepAck { + MoneroKeyImageSyncStepAck::new() + } + + fn clear(&mut self) { + self.kis.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroKeyImageSyncStepAck { + static instance: MoneroKeyImageSyncStepAck = MoneroKeyImageSyncStepAck { + kis: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroKeyImageSyncStepAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroKeyImageSyncStepAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncStepAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `MoneroKeyImageSyncStepAck` +pub mod monero_key_image_sync_step_ack { + // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MoneroExportedKeyImage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage.iv) + pub iv: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage.blob) + pub blob: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MoneroExportedKeyImage { + fn default() -> &'a MoneroExportedKeyImage { + ::default_instance() + } + } + + impl MoneroExportedKeyImage { + pub fn new() -> MoneroExportedKeyImage { + ::std::default::Default::default() + } + + // optional bytes iv = 1; + + pub fn iv(&self) -> &[u8] { + match self.iv.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_iv(&mut self) { + self.iv = ::std::option::Option::None; + } + + pub fn has_iv(&self) -> bool { + self.iv.is_some() + } + + // Param is passed by value, moved + pub fn set_iv(&mut self, v: ::std::vec::Vec) { + self.iv = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_iv(&mut self) -> &mut ::std::vec::Vec { + if self.iv.is_none() { + self.iv = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.iv.as_mut().unwrap() + } + + // Take field + pub fn take_iv(&mut self) -> ::std::vec::Vec { + self.iv.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes blob = 3; + + pub fn blob(&self) -> &[u8] { + match self.blob.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_blob(&mut self) { + self.blob = ::std::option::Option::None; + } + + pub fn has_blob(&self) -> bool { + self.blob.is_some() + } + + // Param is passed by value, moved + pub fn set_blob(&mut self, v: ::std::vec::Vec) { + self.blob = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_blob(&mut self) -> &mut ::std::vec::Vec { + if self.blob.is_none() { + self.blob = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.blob.as_mut().unwrap() + } + + // Take field + pub fn take_blob(&mut self) -> ::std::vec::Vec { + self.blob.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "iv", + |m: &MoneroExportedKeyImage| { &m.iv }, + |m: &mut MoneroExportedKeyImage| { &mut m.iv }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "blob", + |m: &MoneroExportedKeyImage| { &m.blob }, + |m: &mut MoneroExportedKeyImage| { &mut m.blob }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageSyncStepAck.MoneroExportedKeyImage", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MoneroExportedKeyImage { + const NAME: &'static str = "MoneroExportedKeyImage"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.iv = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.blob = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.iv.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.blob.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.iv.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.blob.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroExportedKeyImage { + MoneroExportedKeyImage::new() + } + + fn clear(&mut self) { + self.iv = ::std::option::Option::None; + self.blob = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroExportedKeyImage { + static instance: MoneroExportedKeyImage = MoneroExportedKeyImage { + iv: ::std::option::Option::None, + blob: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MoneroExportedKeyImage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepAck.MoneroExportedKeyImage").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MoneroExportedKeyImage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MoneroExportedKeyImage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncFinalRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroKeyImageSyncFinalRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncFinalRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncFinalRequest { + fn default() -> &'a MoneroKeyImageSyncFinalRequest { + ::default_instance() + } +} + +impl MoneroKeyImageSyncFinalRequest { + pub fn new() -> MoneroKeyImageSyncFinalRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageSyncFinalRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroKeyImageSyncFinalRequest { + const NAME: &'static str = "MoneroKeyImageSyncFinalRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroKeyImageSyncFinalRequest { + MoneroKeyImageSyncFinalRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroKeyImageSyncFinalRequest { + static instance: MoneroKeyImageSyncFinalRequest = MoneroKeyImageSyncFinalRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroKeyImageSyncFinalRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncFinalRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroKeyImageSyncFinalRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncFinalRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncFinalAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroKeyImageSyncFinalAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncFinalAck.enc_key) + pub enc_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncFinalAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncFinalAck { + fn default() -> &'a MoneroKeyImageSyncFinalAck { + ::default_instance() + } +} + +impl MoneroKeyImageSyncFinalAck { + pub fn new() -> MoneroKeyImageSyncFinalAck { + ::std::default::Default::default() + } + + // optional bytes enc_key = 1; + + pub fn enc_key(&self) -> &[u8] { + match self.enc_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_enc_key(&mut self) { + self.enc_key = ::std::option::Option::None; + } + + pub fn has_enc_key(&self) -> bool { + self.enc_key.is_some() + } + + // Param is passed by value, moved + pub fn set_enc_key(&mut self, v: ::std::vec::Vec) { + self.enc_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_enc_key(&mut self) -> &mut ::std::vec::Vec { + if self.enc_key.is_none() { + self.enc_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.enc_key.as_mut().unwrap() + } + + // Take field + pub fn take_enc_key(&mut self) -> ::std::vec::Vec { + self.enc_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "enc_key", + |m: &MoneroKeyImageSyncFinalAck| { &m.enc_key }, + |m: &mut MoneroKeyImageSyncFinalAck| { &mut m.enc_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroKeyImageSyncFinalAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroKeyImageSyncFinalAck { + const NAME: &'static str = "MoneroKeyImageSyncFinalAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.enc_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.enc_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.enc_key.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroKeyImageSyncFinalAck { + MoneroKeyImageSyncFinalAck::new() + } + + fn clear(&mut self) { + self.enc_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroKeyImageSyncFinalAck { + static instance: MoneroKeyImageSyncFinalAck = MoneroKeyImageSyncFinalAck { + enc_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroKeyImageSyncFinalAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncFinalAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroKeyImageSyncFinalAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncFinalAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetTxKeyRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroGetTxKeyRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.network_type) + pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.salt1) + pub salt1: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.salt2) + pub salt2: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.tx_enc_keys) + pub tx_enc_keys: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.tx_prefix_hash) + pub tx_prefix_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.reason) + pub reason: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.view_public_key) + pub view_public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroGetTxKeyRequest { + fn default() -> &'a MoneroGetTxKeyRequest { + ::default_instance() + } +} + +impl MoneroGetTxKeyRequest { + pub fn new() -> MoneroGetTxKeyRequest { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 2; + + pub fn network_type(&self) -> MoneroNetworkType { + match self.network_type { + Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), + None => MoneroNetworkType::MAINNET, + } + } + + pub fn clear_network_type(&mut self) { + self.network_type = ::std::option::Option::None; + } + + pub fn has_network_type(&self) -> bool { + self.network_type.is_some() + } + + // Param is passed by value, moved + pub fn set_network_type(&mut self, v: MoneroNetworkType) { + self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required bytes salt1 = 3; + + pub fn salt1(&self) -> &[u8] { + match self.salt1.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_salt1(&mut self) { + self.salt1 = ::std::option::Option::None; + } + + pub fn has_salt1(&self) -> bool { + self.salt1.is_some() + } + + // Param is passed by value, moved + pub fn set_salt1(&mut self, v: ::std::vec::Vec) { + self.salt1 = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_salt1(&mut self) -> &mut ::std::vec::Vec { + if self.salt1.is_none() { + self.salt1 = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.salt1.as_mut().unwrap() + } + + // Take field + pub fn take_salt1(&mut self) -> ::std::vec::Vec { + self.salt1.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes salt2 = 4; + + pub fn salt2(&self) -> &[u8] { + match self.salt2.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_salt2(&mut self) { + self.salt2 = ::std::option::Option::None; + } + + pub fn has_salt2(&self) -> bool { + self.salt2.is_some() + } + + // Param is passed by value, moved + pub fn set_salt2(&mut self, v: ::std::vec::Vec) { + self.salt2 = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_salt2(&mut self) -> &mut ::std::vec::Vec { + if self.salt2.is_none() { + self.salt2 = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.salt2.as_mut().unwrap() + } + + // Take field + pub fn take_salt2(&mut self) -> ::std::vec::Vec { + self.salt2.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes tx_enc_keys = 5; + + pub fn tx_enc_keys(&self) -> &[u8] { + match self.tx_enc_keys.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_enc_keys(&mut self) { + self.tx_enc_keys = ::std::option::Option::None; + } + + pub fn has_tx_enc_keys(&self) -> bool { + self.tx_enc_keys.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_enc_keys(&mut self, v: ::std::vec::Vec) { + self.tx_enc_keys = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_enc_keys(&mut self) -> &mut ::std::vec::Vec { + if self.tx_enc_keys.is_none() { + self.tx_enc_keys = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_enc_keys.as_mut().unwrap() + } + + // Take field + pub fn take_tx_enc_keys(&mut self) -> ::std::vec::Vec { + self.tx_enc_keys.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes tx_prefix_hash = 6; + + pub fn tx_prefix_hash(&self) -> &[u8] { + match self.tx_prefix_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_prefix_hash(&mut self) { + self.tx_prefix_hash = ::std::option::Option::None; + } + + pub fn has_tx_prefix_hash(&self) -> bool { + self.tx_prefix_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_prefix_hash(&mut self, v: ::std::vec::Vec) { + self.tx_prefix_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_prefix_hash(&mut self) -> &mut ::std::vec::Vec { + if self.tx_prefix_hash.is_none() { + self.tx_prefix_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_prefix_hash.as_mut().unwrap() + } + + // Take field + pub fn take_tx_prefix_hash(&mut self) -> ::std::vec::Vec { + self.tx_prefix_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 reason = 7; + + pub fn reason(&self) -> u32 { + self.reason.unwrap_or(0) + } + + pub fn clear_reason(&mut self) { + self.reason = ::std::option::Option::None; + } + + pub fn has_reason(&self) -> bool { + self.reason.is_some() + } + + // Param is passed by value, moved + pub fn set_reason(&mut self, v: u32) { + self.reason = ::std::option::Option::Some(v); + } + + // optional bytes view_public_key = 8; + + pub fn view_public_key(&self) -> &[u8] { + match self.view_public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_view_public_key(&mut self) { + self.view_public_key = ::std::option::Option::None; + } + + pub fn has_view_public_key(&self) -> bool { + self.view_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_view_public_key(&mut self, v: ::std::vec::Vec) { + self.view_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_view_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.view_public_key.is_none() { + self.view_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.view_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_view_public_key(&mut self) -> ::std::vec::Vec { + self.view_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MoneroGetTxKeyRequest| { &m.address_n }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_type", + |m: &MoneroGetTxKeyRequest| { &m.network_type }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.network_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "salt1", + |m: &MoneroGetTxKeyRequest| { &m.salt1 }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.salt1 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "salt2", + |m: &MoneroGetTxKeyRequest| { &m.salt2 }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.salt2 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_enc_keys", + |m: &MoneroGetTxKeyRequest| { &m.tx_enc_keys }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.tx_enc_keys }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_prefix_hash", + |m: &MoneroGetTxKeyRequest| { &m.tx_prefix_hash }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.tx_prefix_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "reason", + |m: &MoneroGetTxKeyRequest| { &m.reason }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.reason }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "view_public_key", + |m: &MoneroGetTxKeyRequest| { &m.view_public_key }, + |m: &mut MoneroGetTxKeyRequest| { &mut m.view_public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroGetTxKeyRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroGetTxKeyRequest { + const NAME: &'static str = "MoneroGetTxKeyRequest"; + + fn is_initialized(&self) -> bool { + if self.salt1.is_none() { + return false; + } + if self.salt2.is_none() { + return false; + } + if self.tx_enc_keys.is_none() { + return false; + } + if self.tx_prefix_hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 26 => { + self.salt1 = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.salt2 = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.tx_enc_keys = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.tx_prefix_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 56 => { + self.reason = ::std::option::Option::Some(is.read_uint32()?); + }, + 66 => { + self.view_public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.network_type { + my_size += ::protobuf::rt::int32_size(2, v.value()); + } + if let Some(v) = self.salt1.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.salt2.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.tx_enc_keys.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.tx_prefix_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.reason { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.view_public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.network_type { + os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.salt1.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.salt2.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.tx_enc_keys.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.tx_prefix_hash.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.reason { + os.write_uint32(7, v)?; + } + if let Some(v) = self.view_public_key.as_ref() { + os.write_bytes(8, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroGetTxKeyRequest { + MoneroGetTxKeyRequest::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.network_type = ::std::option::Option::None; + self.salt1 = ::std::option::Option::None; + self.salt2 = ::std::option::Option::None; + self.tx_enc_keys = ::std::option::Option::None; + self.tx_prefix_hash = ::std::option::Option::None; + self.reason = ::std::option::Option::None; + self.view_public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroGetTxKeyRequest { + static instance: MoneroGetTxKeyRequest = MoneroGetTxKeyRequest { + address_n: ::std::vec::Vec::new(), + network_type: ::std::option::Option::None, + salt1: ::std::option::Option::None, + salt2: ::std::option::Option::None, + tx_enc_keys: ::std::option::Option::None, + tx_prefix_hash: ::std::option::Option::None, + reason: ::std::option::Option::None, + view_public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroGetTxKeyRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetTxKeyRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroGetTxKeyRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroGetTxKeyRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetTxKeyAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroGetTxKeyAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyAck.salt) + pub salt: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyAck.tx_keys) + pub tx_keys: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyAck.tx_derivations) + pub tx_derivations: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetTxKeyAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroGetTxKeyAck { + fn default() -> &'a MoneroGetTxKeyAck { + ::default_instance() + } +} + +impl MoneroGetTxKeyAck { + pub fn new() -> MoneroGetTxKeyAck { + ::std::default::Default::default() + } + + // optional bytes salt = 1; + + pub fn salt(&self) -> &[u8] { + match self.salt.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_salt(&mut self) { + self.salt = ::std::option::Option::None; + } + + pub fn has_salt(&self) -> bool { + self.salt.is_some() + } + + // Param is passed by value, moved + pub fn set_salt(&mut self, v: ::std::vec::Vec) { + self.salt = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_salt(&mut self) -> &mut ::std::vec::Vec { + if self.salt.is_none() { + self.salt = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.salt.as_mut().unwrap() + } + + // Take field + pub fn take_salt(&mut self) -> ::std::vec::Vec { + self.salt.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes tx_keys = 2; + + pub fn tx_keys(&self) -> &[u8] { + match self.tx_keys.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_keys(&mut self) { + self.tx_keys = ::std::option::Option::None; + } + + pub fn has_tx_keys(&self) -> bool { + self.tx_keys.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_keys(&mut self, v: ::std::vec::Vec) { + self.tx_keys = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_keys(&mut self) -> &mut ::std::vec::Vec { + if self.tx_keys.is_none() { + self.tx_keys = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_keys.as_mut().unwrap() + } + + // Take field + pub fn take_tx_keys(&mut self) -> ::std::vec::Vec { + self.tx_keys.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes tx_derivations = 3; + + pub fn tx_derivations(&self) -> &[u8] { + match self.tx_derivations.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_tx_derivations(&mut self) { + self.tx_derivations = ::std::option::Option::None; + } + + pub fn has_tx_derivations(&self) -> bool { + self.tx_derivations.is_some() + } + + // Param is passed by value, moved + pub fn set_tx_derivations(&mut self, v: ::std::vec::Vec) { + self.tx_derivations = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tx_derivations(&mut self) -> &mut ::std::vec::Vec { + if self.tx_derivations.is_none() { + self.tx_derivations = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.tx_derivations.as_mut().unwrap() + } + + // Take field + pub fn take_tx_derivations(&mut self) -> ::std::vec::Vec { + self.tx_derivations.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "salt", + |m: &MoneroGetTxKeyAck| { &m.salt }, + |m: &mut MoneroGetTxKeyAck| { &mut m.salt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_keys", + |m: &MoneroGetTxKeyAck| { &m.tx_keys }, + |m: &mut MoneroGetTxKeyAck| { &mut m.tx_keys }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tx_derivations", + |m: &MoneroGetTxKeyAck| { &m.tx_derivations }, + |m: &mut MoneroGetTxKeyAck| { &mut m.tx_derivations }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroGetTxKeyAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroGetTxKeyAck { + const NAME: &'static str = "MoneroGetTxKeyAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.salt = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.tx_keys = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.tx_derivations = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.salt.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.tx_keys.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.tx_derivations.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.salt.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.tx_keys.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.tx_derivations.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroGetTxKeyAck { + MoneroGetTxKeyAck::new() + } + + fn clear(&mut self) { + self.salt = ::std::option::Option::None; + self.tx_keys = ::std::option::Option::None; + self.tx_derivations = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroGetTxKeyAck { + static instance: MoneroGetTxKeyAck = MoneroGetTxKeyAck { + salt: ::std::option::Option::None, + tx_keys: ::std::option::Option::None, + tx_derivations: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroGetTxKeyAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetTxKeyAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroGetTxKeyAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroGetTxKeyAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroLiveRefreshStartRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest.network_type) + pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStartRequest { + fn default() -> &'a MoneroLiveRefreshStartRequest { + ::default_instance() + } +} + +impl MoneroLiveRefreshStartRequest { + pub fn new() -> MoneroLiveRefreshStartRequest { + ::std::default::Default::default() + } + + // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 2; + + pub fn network_type(&self) -> MoneroNetworkType { + match self.network_type { + Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), + None => MoneroNetworkType::MAINNET, + } + } + + pub fn clear_network_type(&mut self) { + self.network_type = ::std::option::Option::None; + } + + pub fn has_network_type(&self) -> bool { + self.network_type.is_some() + } + + // Param is passed by value, moved + pub fn set_network_type(&mut self, v: MoneroNetworkType) { + self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MoneroLiveRefreshStartRequest| { &m.address_n }, + |m: &mut MoneroLiveRefreshStartRequest| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_type", + |m: &MoneroLiveRefreshStartRequest| { &m.network_type }, + |m: &mut MoneroLiveRefreshStartRequest| { &mut m.network_type }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroLiveRefreshStartRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroLiveRefreshStartRequest { + const NAME: &'static str = "MoneroLiveRefreshStartRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.network_type { + my_size += ::protobuf::rt::int32_size(2, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.network_type { + os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroLiveRefreshStartRequest { + MoneroLiveRefreshStartRequest::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.network_type = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroLiveRefreshStartRequest { + static instance: MoneroLiveRefreshStartRequest = MoneroLiveRefreshStartRequest { + address_n: ::std::vec::Vec::new(), + network_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroLiveRefreshStartRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStartRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroLiveRefreshStartRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStartRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStartAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroLiveRefreshStartAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStartAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStartAck { + fn default() -> &'a MoneroLiveRefreshStartAck { + ::default_instance() + } +} + +impl MoneroLiveRefreshStartAck { + pub fn new() -> MoneroLiveRefreshStartAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroLiveRefreshStartAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroLiveRefreshStartAck { + const NAME: &'static str = "MoneroLiveRefreshStartAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroLiveRefreshStartAck { + MoneroLiveRefreshStartAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroLiveRefreshStartAck { + static instance: MoneroLiveRefreshStartAck = MoneroLiveRefreshStartAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroLiveRefreshStartAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStartAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroLiveRefreshStartAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStartAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroLiveRefreshStepRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.out_key) + pub out_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.recv_deriv) + pub recv_deriv: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.real_out_idx) + pub real_out_idx: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.sub_addr_major) + pub sub_addr_major: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.sub_addr_minor) + pub sub_addr_minor: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStepRequest { + fn default() -> &'a MoneroLiveRefreshStepRequest { + ::default_instance() + } +} + +impl MoneroLiveRefreshStepRequest { + pub fn new() -> MoneroLiveRefreshStepRequest { + ::std::default::Default::default() + } + + // required bytes out_key = 1; + + pub fn out_key(&self) -> &[u8] { + match self.out_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_out_key(&mut self) { + self.out_key = ::std::option::Option::None; + } + + pub fn has_out_key(&self) -> bool { + self.out_key.is_some() + } + + // Param is passed by value, moved + pub fn set_out_key(&mut self, v: ::std::vec::Vec) { + self.out_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_out_key(&mut self) -> &mut ::std::vec::Vec { + if self.out_key.is_none() { + self.out_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.out_key.as_mut().unwrap() + } + + // Take field + pub fn take_out_key(&mut self) -> ::std::vec::Vec { + self.out_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes recv_deriv = 2; + + pub fn recv_deriv(&self) -> &[u8] { + match self.recv_deriv.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_recv_deriv(&mut self) { + self.recv_deriv = ::std::option::Option::None; + } + + pub fn has_recv_deriv(&self) -> bool { + self.recv_deriv.is_some() + } + + // Param is passed by value, moved + pub fn set_recv_deriv(&mut self, v: ::std::vec::Vec) { + self.recv_deriv = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_recv_deriv(&mut self) -> &mut ::std::vec::Vec { + if self.recv_deriv.is_none() { + self.recv_deriv = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.recv_deriv.as_mut().unwrap() + } + + // Take field + pub fn take_recv_deriv(&mut self) -> ::std::vec::Vec { + self.recv_deriv.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 real_out_idx = 3; + + pub fn real_out_idx(&self) -> u64 { + self.real_out_idx.unwrap_or(0) + } + + pub fn clear_real_out_idx(&mut self) { + self.real_out_idx = ::std::option::Option::None; + } + + pub fn has_real_out_idx(&self) -> bool { + self.real_out_idx.is_some() + } + + // Param is passed by value, moved + pub fn set_real_out_idx(&mut self, v: u64) { + self.real_out_idx = ::std::option::Option::Some(v); + } + + // required uint32 sub_addr_major = 4; + + pub fn sub_addr_major(&self) -> u32 { + self.sub_addr_major.unwrap_or(0) + } + + pub fn clear_sub_addr_major(&mut self) { + self.sub_addr_major = ::std::option::Option::None; + } + + pub fn has_sub_addr_major(&self) -> bool { + self.sub_addr_major.is_some() + } + + // Param is passed by value, moved + pub fn set_sub_addr_major(&mut self, v: u32) { + self.sub_addr_major = ::std::option::Option::Some(v); + } + + // required uint32 sub_addr_minor = 5; + + pub fn sub_addr_minor(&self) -> u32 { + self.sub_addr_minor.unwrap_or(0) + } + + pub fn clear_sub_addr_minor(&mut self) { + self.sub_addr_minor = ::std::option::Option::None; + } + + pub fn has_sub_addr_minor(&self) -> bool { + self.sub_addr_minor.is_some() + } + + // Param is passed by value, moved + pub fn set_sub_addr_minor(&mut self, v: u32) { + self.sub_addr_minor = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "out_key", + |m: &MoneroLiveRefreshStepRequest| { &m.out_key }, + |m: &mut MoneroLiveRefreshStepRequest| { &mut m.out_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "recv_deriv", + |m: &MoneroLiveRefreshStepRequest| { &m.recv_deriv }, + |m: &mut MoneroLiveRefreshStepRequest| { &mut m.recv_deriv }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "real_out_idx", + |m: &MoneroLiveRefreshStepRequest| { &m.real_out_idx }, + |m: &mut MoneroLiveRefreshStepRequest| { &mut m.real_out_idx }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sub_addr_major", + |m: &MoneroLiveRefreshStepRequest| { &m.sub_addr_major }, + |m: &mut MoneroLiveRefreshStepRequest| { &mut m.sub_addr_major }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sub_addr_minor", + |m: &MoneroLiveRefreshStepRequest| { &m.sub_addr_minor }, + |m: &mut MoneroLiveRefreshStepRequest| { &mut m.sub_addr_minor }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroLiveRefreshStepRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroLiveRefreshStepRequest { + const NAME: &'static str = "MoneroLiveRefreshStepRequest"; + + fn is_initialized(&self) -> bool { + if self.out_key.is_none() { + return false; + } + if self.recv_deriv.is_none() { + return false; + } + if self.real_out_idx.is_none() { + return false; + } + if self.sub_addr_major.is_none() { + return false; + } + if self.sub_addr_minor.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.out_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.recv_deriv = ::std::option::Option::Some(is.read_bytes()?); + }, + 24 => { + self.real_out_idx = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.sub_addr_major = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.sub_addr_minor = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.out_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.recv_deriv.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.real_out_idx { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.sub_addr_major { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.sub_addr_minor { + my_size += ::protobuf::rt::uint32_size(5, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.out_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.recv_deriv.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.real_out_idx { + os.write_uint64(3, v)?; + } + if let Some(v) = self.sub_addr_major { + os.write_uint32(4, v)?; + } + if let Some(v) = self.sub_addr_minor { + os.write_uint32(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroLiveRefreshStepRequest { + MoneroLiveRefreshStepRequest::new() + } + + fn clear(&mut self) { + self.out_key = ::std::option::Option::None; + self.recv_deriv = ::std::option::Option::None; + self.real_out_idx = ::std::option::Option::None; + self.sub_addr_major = ::std::option::Option::None; + self.sub_addr_minor = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroLiveRefreshStepRequest { + static instance: MoneroLiveRefreshStepRequest = MoneroLiveRefreshStepRequest { + out_key: ::std::option::Option::None, + recv_deriv: ::std::option::Option::None, + real_out_idx: ::std::option::Option::None, + sub_addr_major: ::std::option::Option::None, + sub_addr_minor: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroLiveRefreshStepRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStepRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroLiveRefreshStepRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStepRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStepAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroLiveRefreshStepAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepAck.salt) + pub salt: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepAck.key_image) + pub key_image: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStepAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStepAck { + fn default() -> &'a MoneroLiveRefreshStepAck { + ::default_instance() + } +} + +impl MoneroLiveRefreshStepAck { + pub fn new() -> MoneroLiveRefreshStepAck { + ::std::default::Default::default() + } + + // optional bytes salt = 1; + + pub fn salt(&self) -> &[u8] { + match self.salt.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_salt(&mut self) { + self.salt = ::std::option::Option::None; + } + + pub fn has_salt(&self) -> bool { + self.salt.is_some() + } + + // Param is passed by value, moved + pub fn set_salt(&mut self, v: ::std::vec::Vec) { + self.salt = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_salt(&mut self) -> &mut ::std::vec::Vec { + if self.salt.is_none() { + self.salt = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.salt.as_mut().unwrap() + } + + // Take field + pub fn take_salt(&mut self) -> ::std::vec::Vec { + self.salt.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes key_image = 2; + + pub fn key_image(&self) -> &[u8] { + match self.key_image.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_key_image(&mut self) { + self.key_image = ::std::option::Option::None; + } + + pub fn has_key_image(&self) -> bool { + self.key_image.is_some() + } + + // Param is passed by value, moved + pub fn set_key_image(&mut self, v: ::std::vec::Vec) { + self.key_image = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key_image(&mut self) -> &mut ::std::vec::Vec { + if self.key_image.is_none() { + self.key_image = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.key_image.as_mut().unwrap() + } + + // Take field + pub fn take_key_image(&mut self) -> ::std::vec::Vec { + self.key_image.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "salt", + |m: &MoneroLiveRefreshStepAck| { &m.salt }, + |m: &mut MoneroLiveRefreshStepAck| { &mut m.salt }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key_image", + |m: &MoneroLiveRefreshStepAck| { &m.key_image }, + |m: &mut MoneroLiveRefreshStepAck| { &mut m.key_image }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroLiveRefreshStepAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroLiveRefreshStepAck { + const NAME: &'static str = "MoneroLiveRefreshStepAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.salt = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.key_image = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.salt.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.key_image.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.salt.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.key_image.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroLiveRefreshStepAck { + MoneroLiveRefreshStepAck::new() + } + + fn clear(&mut self) { + self.salt = ::std::option::Option::None; + self.key_image = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroLiveRefreshStepAck { + static instance: MoneroLiveRefreshStepAck = MoneroLiveRefreshStepAck { + salt: ::std::option::Option::None, + key_image: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroLiveRefreshStepAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStepAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroLiveRefreshStepAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStepAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshFinalRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroLiveRefreshFinalRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshFinalRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroLiveRefreshFinalRequest { + fn default() -> &'a MoneroLiveRefreshFinalRequest { + ::default_instance() + } +} + +impl MoneroLiveRefreshFinalRequest { + pub fn new() -> MoneroLiveRefreshFinalRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroLiveRefreshFinalRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroLiveRefreshFinalRequest { + const NAME: &'static str = "MoneroLiveRefreshFinalRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroLiveRefreshFinalRequest { + MoneroLiveRefreshFinalRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroLiveRefreshFinalRequest { + static instance: MoneroLiveRefreshFinalRequest = MoneroLiveRefreshFinalRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroLiveRefreshFinalRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshFinalRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroLiveRefreshFinalRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshFinalRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshFinalAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MoneroLiveRefreshFinalAck { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshFinalAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MoneroLiveRefreshFinalAck { + fn default() -> &'a MoneroLiveRefreshFinalAck { + ::default_instance() + } +} + +impl MoneroLiveRefreshFinalAck { + pub fn new() -> MoneroLiveRefreshFinalAck { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MoneroLiveRefreshFinalAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MoneroLiveRefreshFinalAck { + const NAME: &'static str = "MoneroLiveRefreshFinalAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MoneroLiveRefreshFinalAck { + MoneroLiveRefreshFinalAck::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static MoneroLiveRefreshFinalAck { + static instance: MoneroLiveRefreshFinalAck = MoneroLiveRefreshFinalAck { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MoneroLiveRefreshFinalAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshFinalAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MoneroLiveRefreshFinalAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshFinalAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.DebugMoneroDiagRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugMoneroDiagRequest { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.ins) + pub ins: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.p1) + pub p1: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.p2) + pub p2: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.pd) + pub pd: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.data1) + pub data1: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.data2) + pub data2: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.DebugMoneroDiagRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugMoneroDiagRequest { + fn default() -> &'a DebugMoneroDiagRequest { + ::default_instance() + } +} + +impl DebugMoneroDiagRequest { + pub fn new() -> DebugMoneroDiagRequest { + ::std::default::Default::default() + } + + // optional uint64 ins = 1; + + pub fn ins(&self) -> u64 { + self.ins.unwrap_or(0) + } + + pub fn clear_ins(&mut self) { + self.ins = ::std::option::Option::None; + } + + pub fn has_ins(&self) -> bool { + self.ins.is_some() + } + + // Param is passed by value, moved + pub fn set_ins(&mut self, v: u64) { + self.ins = ::std::option::Option::Some(v); + } + + // optional uint64 p1 = 2; + + pub fn p1(&self) -> u64 { + self.p1.unwrap_or(0) + } + + pub fn clear_p1(&mut self) { + self.p1 = ::std::option::Option::None; + } + + pub fn has_p1(&self) -> bool { + self.p1.is_some() + } + + // Param is passed by value, moved + pub fn set_p1(&mut self, v: u64) { + self.p1 = ::std::option::Option::Some(v); + } + + // optional uint64 p2 = 3; + + pub fn p2(&self) -> u64 { + self.p2.unwrap_or(0) + } + + pub fn clear_p2(&mut self) { + self.p2 = ::std::option::Option::None; + } + + pub fn has_p2(&self) -> bool { + self.p2.is_some() + } + + // Param is passed by value, moved + pub fn set_p2(&mut self, v: u64) { + self.p2 = ::std::option::Option::Some(v); + } + + // optional bytes data1 = 5; + + pub fn data1(&self) -> &[u8] { + match self.data1.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data1(&mut self) { + self.data1 = ::std::option::Option::None; + } + + pub fn has_data1(&self) -> bool { + self.data1.is_some() + } + + // Param is passed by value, moved + pub fn set_data1(&mut self, v: ::std::vec::Vec) { + self.data1 = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data1(&mut self) -> &mut ::std::vec::Vec { + if self.data1.is_none() { + self.data1 = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data1.as_mut().unwrap() + } + + // Take field + pub fn take_data1(&mut self) -> ::std::vec::Vec { + self.data1.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes data2 = 6; + + pub fn data2(&self) -> &[u8] { + match self.data2.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data2(&mut self) { + self.data2 = ::std::option::Option::None; + } + + pub fn has_data2(&self) -> bool { + self.data2.is_some() + } + + // Param is passed by value, moved + pub fn set_data2(&mut self, v: ::std::vec::Vec) { + self.data2 = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data2(&mut self) -> &mut ::std::vec::Vec { + if self.data2.is_none() { + self.data2 = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data2.as_mut().unwrap() + } + + // Take field + pub fn take_data2(&mut self) -> ::std::vec::Vec { + self.data2.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ins", + |m: &DebugMoneroDiagRequest| { &m.ins }, + |m: &mut DebugMoneroDiagRequest| { &mut m.ins }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "p1", + |m: &DebugMoneroDiagRequest| { &m.p1 }, + |m: &mut DebugMoneroDiagRequest| { &mut m.p1 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "p2", + |m: &DebugMoneroDiagRequest| { &m.p2 }, + |m: &mut DebugMoneroDiagRequest| { &mut m.p2 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "pd", + |m: &DebugMoneroDiagRequest| { &m.pd }, + |m: &mut DebugMoneroDiagRequest| { &mut m.pd }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data1", + |m: &DebugMoneroDiagRequest| { &m.data1 }, + |m: &mut DebugMoneroDiagRequest| { &mut m.data1 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data2", + |m: &DebugMoneroDiagRequest| { &m.data2 }, + |m: &mut DebugMoneroDiagRequest| { &mut m.data2 }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugMoneroDiagRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugMoneroDiagRequest { + const NAME: &'static str = "DebugMoneroDiagRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.ins = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.p1 = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.p2 = ::std::option::Option::Some(is.read_uint64()?); + }, + 34 => { + is.read_repeated_packed_uint64_into(&mut self.pd)?; + }, + 32 => { + self.pd.push(is.read_uint64()?); + }, + 42 => { + self.data1 = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.data2 = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.ins { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.p1 { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.p2 { + my_size += ::protobuf::rt::uint64_size(3, v); + } + for value in &self.pd { + my_size += ::protobuf::rt::uint64_size(4, *value); + }; + if let Some(v) = self.data1.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.data2.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.ins { + os.write_uint64(1, v)?; + } + if let Some(v) = self.p1 { + os.write_uint64(2, v)?; + } + if let Some(v) = self.p2 { + os.write_uint64(3, v)?; + } + for v in &self.pd { + os.write_uint64(4, *v)?; + }; + if let Some(v) = self.data1.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.data2.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugMoneroDiagRequest { + DebugMoneroDiagRequest::new() + } + + fn clear(&mut self) { + self.ins = ::std::option::Option::None; + self.p1 = ::std::option::Option::None; + self.p2 = ::std::option::Option::None; + self.pd.clear(); + self.data1 = ::std::option::Option::None; + self.data2 = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugMoneroDiagRequest { + static instance: DebugMoneroDiagRequest = DebugMoneroDiagRequest { + ins: ::std::option::Option::None, + p1: ::std::option::Option::None, + p2: ::std::option::Option::None, + pd: ::std::vec::Vec::new(), + data1: ::std::option::Option::None, + data2: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugMoneroDiagRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugMoneroDiagRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugMoneroDiagRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugMoneroDiagRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.monero.DebugMoneroDiagAck) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct DebugMoneroDiagAck { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.ins) + pub ins: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.p1) + pub p1: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.p2) + pub p2: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.pd) + pub pd: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.data1) + pub data1: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.data2) + pub data2: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.DebugMoneroDiagAck.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a DebugMoneroDiagAck { + fn default() -> &'a DebugMoneroDiagAck { + ::default_instance() + } +} + +impl DebugMoneroDiagAck { + pub fn new() -> DebugMoneroDiagAck { + ::std::default::Default::default() + } + + // optional uint64 ins = 1; + + pub fn ins(&self) -> u64 { + self.ins.unwrap_or(0) + } + + pub fn clear_ins(&mut self) { + self.ins = ::std::option::Option::None; + } + + pub fn has_ins(&self) -> bool { + self.ins.is_some() + } + + // Param is passed by value, moved + pub fn set_ins(&mut self, v: u64) { + self.ins = ::std::option::Option::Some(v); + } + + // optional uint64 p1 = 2; + + pub fn p1(&self) -> u64 { + self.p1.unwrap_or(0) + } + + pub fn clear_p1(&mut self) { + self.p1 = ::std::option::Option::None; + } + + pub fn has_p1(&self) -> bool { + self.p1.is_some() + } + + // Param is passed by value, moved + pub fn set_p1(&mut self, v: u64) { + self.p1 = ::std::option::Option::Some(v); + } + + // optional uint64 p2 = 3; + + pub fn p2(&self) -> u64 { + self.p2.unwrap_or(0) + } + + pub fn clear_p2(&mut self) { + self.p2 = ::std::option::Option::None; + } + + pub fn has_p2(&self) -> bool { + self.p2.is_some() + } + + // Param is passed by value, moved + pub fn set_p2(&mut self, v: u64) { + self.p2 = ::std::option::Option::Some(v); + } + + // optional bytes data1 = 5; + + pub fn data1(&self) -> &[u8] { + match self.data1.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data1(&mut self) { + self.data1 = ::std::option::Option::None; + } + + pub fn has_data1(&self) -> bool { + self.data1.is_some() + } + + // Param is passed by value, moved + pub fn set_data1(&mut self, v: ::std::vec::Vec) { + self.data1 = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data1(&mut self) -> &mut ::std::vec::Vec { + if self.data1.is_none() { + self.data1 = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data1.as_mut().unwrap() + } + + // Take field + pub fn take_data1(&mut self) -> ::std::vec::Vec { + self.data1.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes data2 = 6; + + pub fn data2(&self) -> &[u8] { + match self.data2.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data2(&mut self) { + self.data2 = ::std::option::Option::None; + } + + pub fn has_data2(&self) -> bool { + self.data2.is_some() + } + + // Param is passed by value, moved + pub fn set_data2(&mut self, v: ::std::vec::Vec) { + self.data2 = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data2(&mut self) -> &mut ::std::vec::Vec { + if self.data2.is_none() { + self.data2 = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data2.as_mut().unwrap() + } + + // Take field + pub fn take_data2(&mut self) -> ::std::vec::Vec { + self.data2.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ins", + |m: &DebugMoneroDiagAck| { &m.ins }, + |m: &mut DebugMoneroDiagAck| { &mut m.ins }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "p1", + |m: &DebugMoneroDiagAck| { &m.p1 }, + |m: &mut DebugMoneroDiagAck| { &mut m.p1 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "p2", + |m: &DebugMoneroDiagAck| { &m.p2 }, + |m: &mut DebugMoneroDiagAck| { &mut m.p2 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "pd", + |m: &DebugMoneroDiagAck| { &m.pd }, + |m: &mut DebugMoneroDiagAck| { &mut m.pd }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data1", + |m: &DebugMoneroDiagAck| { &m.data1 }, + |m: &mut DebugMoneroDiagAck| { &mut m.data1 }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data2", + |m: &DebugMoneroDiagAck| { &m.data2 }, + |m: &mut DebugMoneroDiagAck| { &mut m.data2 }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "DebugMoneroDiagAck", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for DebugMoneroDiagAck { + const NAME: &'static str = "DebugMoneroDiagAck"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.ins = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.p1 = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.p2 = ::std::option::Option::Some(is.read_uint64()?); + }, + 34 => { + is.read_repeated_packed_uint64_into(&mut self.pd)?; + }, + 32 => { + self.pd.push(is.read_uint64()?); + }, + 42 => { + self.data1 = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.data2 = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.ins { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.p1 { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.p2 { + my_size += ::protobuf::rt::uint64_size(3, v); + } + for value in &self.pd { + my_size += ::protobuf::rt::uint64_size(4, *value); + }; + if let Some(v) = self.data1.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.data2.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.ins { + os.write_uint64(1, v)?; + } + if let Some(v) = self.p1 { + os.write_uint64(2, v)?; + } + if let Some(v) = self.p2 { + os.write_uint64(3, v)?; + } + for v in &self.pd { + os.write_uint64(4, *v)?; + }; + if let Some(v) = self.data1.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.data2.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> DebugMoneroDiagAck { + DebugMoneroDiagAck::new() + } + + fn clear(&mut self) { + self.ins = ::std::option::Option::None; + self.p1 = ::std::option::Option::None; + self.p2 = ::std::option::Option::None; + self.pd.clear(); + self.data1 = ::std::option::Option::None; + self.data2 = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static DebugMoneroDiagAck { + static instance: DebugMoneroDiagAck = DebugMoneroDiagAck { + ins: ::std::option::Option::None, + p1: ::std::option::Option::None, + p2: ::std::option::Option::None, + pd: ::std::vec::Vec::new(), + data1: ::std::option::Option::None, + data2: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for DebugMoneroDiagAck { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugMoneroDiagAck").unwrap()).clone() + } +} + +impl ::std::fmt::Display for DebugMoneroDiagAck { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DebugMoneroDiagAck { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.monero.MoneroNetworkType) +pub enum MoneroNetworkType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.MAINNET) + MAINNET = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.TESTNET) + TESTNET = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.STAGENET) + STAGENET = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.FAKECHAIN) + FAKECHAIN = 3, +} + +impl ::protobuf::Enum for MoneroNetworkType { + const NAME: &'static str = "MoneroNetworkType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(MoneroNetworkType::MAINNET), + 1 => ::std::option::Option::Some(MoneroNetworkType::TESTNET), + 2 => ::std::option::Option::Some(MoneroNetworkType::STAGENET), + 3 => ::std::option::Option::Some(MoneroNetworkType::FAKECHAIN), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "MAINNET" => ::std::option::Option::Some(MoneroNetworkType::MAINNET), + "TESTNET" => ::std::option::Option::Some(MoneroNetworkType::TESTNET), + "STAGENET" => ::std::option::Option::Some(MoneroNetworkType::STAGENET), + "FAKECHAIN" => ::std::option::Option::Some(MoneroNetworkType::FAKECHAIN), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [MoneroNetworkType] = &[ + MoneroNetworkType::MAINNET, + MoneroNetworkType::TESTNET, + MoneroNetworkType::STAGENET, + MoneroNetworkType::FAKECHAIN, + ]; +} + +impl ::protobuf::EnumFull for MoneroNetworkType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("MoneroNetworkType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for MoneroNetworkType { + fn default() -> Self { + MoneroNetworkType::MAINNET + } +} + +impl MoneroNetworkType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MoneroNetworkType") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x15messages-monero.proto\x12\x19hw.trezor.messages.monero\"\xc9\x06\n\ + \x1cMoneroTransactionSourceEntry\x12c\n\x07outputs\x18\x01\x20\x03(\x0b2\ + I.hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEnt\ + ryR\x07outputs\x12\x1f\n\x0breal_output\x18\x02\x20\x01(\x04R\nrealOutpu\ + t\x12%\n\x0freal_out_tx_key\x18\x03\x20\x01(\x0cR\x0crealOutTxKey\x12<\n\ + \x1breal_out_additional_tx_keys\x18\x04\x20\x03(\x0cR\x17realOutAddition\ + alTxKeys\x124\n\x17real_output_in_tx_index\x18\x05\x20\x01(\x04R\x13real\ + OutputInTxIndex\x12\x16\n\x06amount\x18\x06\x20\x01(\x04R\x06amount\x12\ + \x10\n\x03rct\x18\x07\x20\x01(\x08R\x03rct\x12\x12\n\x04mask\x18\x08\x20\ + \x01(\x0cR\x04mask\x12r\n\x0emultisig_kLRki\x18\t\x20\x01(\x0b2K.hw.trez\ + or.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRkiR\rmu\ + ltisigKLRki\x12#\n\rsubaddr_minor\x18\n\x20\x01(\rR\x0csubaddrMinor\x1a\ + \xdf\x01\n\x11MoneroOutputEntry\x12\x10\n\x03idx\x18\x01\x20\x01(\x04R\ + \x03idx\x12n\n\x03key\x18\x02\x20\x01(\x0b2\\.hw.trezor.messages.monero.\ + MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublicR\x03ke\ + y\x1aH\n\x12MoneroRctKeyPublic\x12\x12\n\x04dest\x18\x01\x20\x02(\x0cR\ + \x04dest\x12\x1e\n\ncommitment\x18\x02\x20\x02(\x0cR\ncommitment\x1aO\n\ + \x13MoneroMultisigKLRki\x12\x0c\n\x01K\x18\x01\x20\x01(\x0cR\x01K\x12\ + \x0c\n\x01L\x18\x02\x20\x01(\x0cR\x01L\x12\x0c\n\x01R\x18\x03\x20\x01(\ + \x0cR\x01R\x12\x0e\n\x02ki\x18\x04\x20\x01(\x0cR\x02ki\"\xfe\x02\n!Moner\ + oTransactionDestinationEntry\x12\x16\n\x06amount\x18\x01\x20\x01(\x04R\ + \x06amount\x12k\n\x04addr\x18\x02\x20\x01(\x0b2W.hw.trezor.messages.mone\ + ro.MoneroTransactionDestinationEntry.MoneroAccountPublicAddressR\x04addr\ + \x12#\n\ris_subaddress\x18\x03\x20\x01(\x08R\x0cisSubaddress\x12\x1a\n\ + \x08original\x18\x04\x20\x01(\x0cR\x08original\x12#\n\ris_integrated\x18\ + \x05\x20\x01(\x08R\x0cisIntegrated\x1an\n\x1aMoneroAccountPublicAddress\ + \x12(\n\x10spend_public_key\x18\x01\x20\x01(\x0cR\x0espendPublicKey\x12&\ + \n\x0fview_public_key\x18\x02\x20\x01(\x0cR\rviewPublicKey\"\xdd\x01\n\ + \x19MoneroTransactionRsigData\x12\x1b\n\trsig_type\x18\x01\x20\x01(\rR\ + \x08rsigType\x12!\n\x0coffload_type\x18\x02\x20\x01(\rR\x0boffloadType\ + \x12\x1a\n\x08grouping\x18\x03\x20\x03(\x04R\x08grouping\x12\x12\n\x04ma\ + sk\x18\x04\x20\x01(\x0cR\x04mask\x12\x12\n\x04rsig\x18\x05\x20\x01(\x0cR\ + \x04rsig\x12\x1d\n\nrsig_parts\x18\x06\x20\x03(\x0cR\trsigParts\x12\x1d\ + \n\nbp_version\x18\x07\x20\x01(\rR\tbpVersion\"\x97\x02\n\x10MoneroGetAd\ + dress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0csho\ + w_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12X\n\x0cnetwork_type\ + \x18\x03\x20\x01(\x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07\ + MAINNETR\x0bnetworkType\x12\x18\n\x07account\x18\x04\x20\x01(\rR\x07acco\ + unt\x12\x14\n\x05minor\x18\x05\x20\x01(\rR\x05minor\x12\x1d\n\npayment_i\ + d\x18\x06\x20\x01(\x0cR\tpaymentId\x12\x1a\n\x08chunkify\x18\x07\x20\x01\ + (\x08R\x08chunkify\")\n\rMoneroAddress\x12\x18\n\x07address\x18\x01\x20\ + \x01(\x0cR\x07address\"\x8a\x01\n\x11MoneroGetWatchKey\x12\x1b\n\taddres\ + s_n\x18\x01\x20\x03(\rR\x08addressN\x12X\n\x0cnetwork_type\x18\x02\x20\ + \x01(\x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07MAINNETR\x0b\ + networkType\"G\n\x0eMoneroWatchKey\x12\x1b\n\twatch_key\x18\x01\x20\x01(\ + \x0cR\x08watchKey\x12\x18\n\x07address\x18\x02\x20\x01(\x0cR\x07address\ + \"\xd1\x07\n\x1cMoneroTransactionInitRequest\x12\x18\n\x07version\x18\ + \x01\x20\x01(\rR\x07version\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08\ + addressN\x12X\n\x0cnetwork_type\x18\x03\x20\x01(\x0e2,.hw.trezor.message\ + s.monero.MoneroNetworkType:\x07MAINNETR\x0bnetworkType\x12h\n\x08tsx_dat\ + a\x18\x04\x20\x01(\x0b2M.hw.trezor.messages.monero.MoneroTransactionInit\ + Request.MoneroTransactionDataR\x07tsxData\x1a\xb5\x05\n\x15MoneroTransac\ + tionData\x12\x18\n\x07version\x18\x01\x20\x01(\rR\x07version\x12\x1d\n\n\ + payment_id\x18\x02\x20\x01(\x0cR\tpaymentId\x12\x1f\n\x0bunlock_time\x18\ + \x03\x20\x01(\x04R\nunlockTime\x12V\n\x07outputs\x18\x04\x20\x03(\x0b2<.\ + hw.trezor.messages.monero.MoneroTransactionDestinationEntryR\x07outputs\ + \x12[\n\nchange_dts\x18\x05\x20\x01(\x0b2<.hw.trezor.messages.monero.Mon\ + eroTransactionDestinationEntryR\tchangeDts\x12\x1d\n\nnum_inputs\x18\x06\ + \x20\x01(\rR\tnumInputs\x12\x14\n\x05mixin\x18\x07\x20\x01(\rR\x05mixin\ + \x12\x10\n\x03fee\x18\x08\x20\x01(\x04R\x03fee\x12\x18\n\x07account\x18\ + \t\x20\x01(\rR\x07account\x12#\n\rminor_indices\x18\n\x20\x03(\rR\x0cmin\ + orIndices\x12Q\n\trsig_data\x18\x0b\x20\x01(\x0b24.hw.trezor.messages.mo\ + nero.MoneroTransactionRsigDataR\x08rsigData\x12-\n\x12integrated_indices\ + \x18\x0c\x20\x03(\rR\x11integratedIndices\x12%\n\x0eclient_version\x18\r\ + \x20\x01(\rR\rclientVersion\x12\x1b\n\thard_fork\x18\x0e\x20\x01(\rR\x08\ + hardFork\x12%\n\x0emonero_version\x18\x0f\x20\x01(\x0cR\rmoneroVersion\ + \x12\x1a\n\x08chunkify\x18\x10\x20\x01(\x08R\x08chunkify\"\x83\x01\n\x18\ + MoneroTransactionInitAck\x12\x14\n\x05hmacs\x18\x01\x20\x03(\x0cR\x05hma\ + cs\x12Q\n\trsig_data\x18\x02\x20\x01(\x0b24.hw.trezor.messages.monero.Mo\ + neroTransactionRsigDataR\x08rsigData\"v\n\x20MoneroTransactionSetInputRe\ + quest\x12R\n\x08src_entr\x18\x01\x20\x01(\x0b27.hw.trezor.messages.moner\ + o.MoneroTransactionSourceEntryR\x07srcEntr\"\xdd\x01\n\x1cMoneroTransact\ + ionSetInputAck\x12\x12\n\x04vini\x18\x01\x20\x01(\x0cR\x04vini\x12\x1b\n\ + \tvini_hmac\x18\x02\x20\x01(\x0cR\x08viniHmac\x12\x1d\n\npseudo_out\x18\ + \x03\x20\x01(\x0cR\tpseudoOut\x12&\n\x0fpseudo_out_hmac\x18\x04\x20\x01(\ + \x0cR\rpseudoOutHmac\x12(\n\x10pseudo_out_alpha\x18\x05\x20\x01(\x0cR\ + \x0epseudoOutAlpha\x12\x1b\n\tspend_key\x18\x06\x20\x01(\x0cR\x08spendKe\ + y\"\x8a\x02\n!MoneroTransactionInputViniRequest\x12R\n\x08src_entr\x18\ + \x01\x20\x01(\x0b27.hw.trezor.messages.monero.MoneroTransactionSourceEnt\ + ryR\x07srcEntr\x12\x12\n\x04vini\x18\x02\x20\x01(\x0cR\x04vini\x12\x1b\n\ + \tvini_hmac\x18\x03\x20\x01(\x0cR\x08viniHmac\x12\x1d\n\npseudo_out\x18\ + \x04\x20\x01(\x0cR\tpseudoOut\x12&\n\x0fpseudo_out_hmac\x18\x05\x20\x01(\ + \x0cR\rpseudoOutHmac\x12\x19\n\x08orig_idx\x18\x06\x20\x01(\rR\x07origId\ + x\"\x1f\n\x1dMoneroTransactionInputViniAck\"&\n$MoneroTransactionAllInpu\ + tsSetRequest\"u\n\x20MoneroTransactionAllInputsSetAck\x12Q\n\trsig_data\ + \x18\x01\x20\x01(\x0b24.hw.trezor.messages.monero.MoneroTransactionRsigD\ + ataR\x08rsigData\"\x9b\x02\n!MoneroTransactionSetOutputRequest\x12W\n\ + \x08dst_entr\x18\x01\x20\x01(\x0b2<.hw.trezor.messages.monero.MoneroTran\ + sactionDestinationEntryR\x07dstEntr\x12\"\n\rdst_entr_hmac\x18\x02\x20\ + \x01(\x0cR\x0bdstEntrHmac\x12Q\n\trsig_data\x18\x03\x20\x01(\x0b24.hw.tr\ + ezor.messages.monero.MoneroTransactionRsigDataR\x08rsigData\x12&\n\x0fis\ + _offloaded_bp\x18\x04\x20\x01(\x08R\risOffloadedBp\"\xdc\x01\n\x1dMonero\ + TransactionSetOutputAck\x12\x15\n\x06tx_out\x18\x01\x20\x01(\x0cR\x05txO\ + ut\x12\x1d\n\nvouti_hmac\x18\x02\x20\x01(\x0cR\tvoutiHmac\x12Q\n\trsig_d\ + ata\x18\x03\x20\x01(\x0b24.hw.trezor.messages.monero.MoneroTransactionRs\ + igDataR\x08rsigData\x12\x15\n\x06out_pk\x18\x04\x20\x01(\x0cR\x05outPk\ + \x12\x1b\n\tecdh_info\x18\x05\x20\x01(\x0cR\x08ecdhInfo\"v\n!MoneroTrans\ + actionAllOutSetRequest\x12Q\n\trsig_data\x18\x01\x20\x01(\x0b24.hw.trezo\ + r.messages.monero.MoneroTransactionRsigDataR\x08rsigData\"\xc0\x02\n\x1d\ + MoneroTransactionAllOutSetAck\x12\x14\n\x05extra\x18\x01\x20\x01(\x0cR\ + \x05extra\x12$\n\x0etx_prefix_hash\x18\x02\x20\x01(\x0cR\x0ctxPrefixHash\ + \x12X\n\x02rv\x18\x04\x20\x01(\x0b2H.hw.trezor.messages.monero.MoneroTra\ + nsactionAllOutSetAck.MoneroRingCtSigR\x02rv\x12*\n\x11full_message_hash\ + \x18\x05\x20\x01(\x0cR\x0ffullMessageHash\x1a]\n\x0fMoneroRingCtSig\x12\ + \x17\n\x07txn_fee\x18\x01\x20\x01(\x04R\x06txnFee\x12\x18\n\x07message\ + \x18\x02\x20\x01(\x0cR\x07message\x12\x17\n\x07rv_type\x18\x03\x20\x01(\ + \rR\x06rvType\"\xd1\x02\n!MoneroTransactionSignInputRequest\x12R\n\x08sr\ + c_entr\x18\x01\x20\x01(\x0b27.hw.trezor.messages.monero.MoneroTransactio\ + nSourceEntryR\x07srcEntr\x12\x12\n\x04vini\x18\x02\x20\x01(\x0cR\x04vini\ + \x12\x1b\n\tvini_hmac\x18\x03\x20\x01(\x0cR\x08viniHmac\x12\x1d\n\npseud\ + o_out\x18\x04\x20\x01(\x0cR\tpseudoOut\x12&\n\x0fpseudo_out_hmac\x18\x05\ + \x20\x01(\x0cR\rpseudoOutHmac\x12(\n\x10pseudo_out_alpha\x18\x06\x20\x01\ + (\x0cR\x0epseudoOutAlpha\x12\x1b\n\tspend_key\x18\x07\x20\x01(\x0cR\x08s\ + pendKey\x12\x19\n\x08orig_idx\x18\x08\x20\x01(\rR\x07origIdx\"\\\n\x1dMo\ + neroTransactionSignInputAck\x12\x1c\n\tsignature\x18\x01\x20\x01(\x0cR\t\ + signature\x12\x1d\n\npseudo_out\x18\x02\x20\x01(\x0cR\tpseudoOut\"\x1f\n\ + \x1dMoneroTransactionFinalRequest\"\xa8\x01\n\x19MoneroTransactionFinalA\ + ck\x12\x19\n\x08cout_key\x18\x01\x20\x01(\x0cR\x07coutKey\x12\x12\n\x04s\ + alt\x18\x02\x20\x01(\x0cR\x04salt\x12\x1b\n\trand_mult\x18\x03\x20\x01(\ + \x0cR\x08randMult\x12\x1e\n\x0btx_enc_keys\x18\x04\x20\x01(\x0cR\ttxEncK\ + eys\x12\x1f\n\x0bopening_key\x18\x05\x20\x01(\x0cR\nopeningKey\"\x88\x03\ + \n\x1fMoneroKeyImageExportInitRequest\x12\x10\n\x03num\x18\x01\x20\x02(\ + \x04R\x03num\x12\x12\n\x04hash\x18\x02\x20\x02(\x0cR\x04hash\x12\x1b\n\t\ + address_n\x18\x03\x20\x03(\rR\x08addressN\x12X\n\x0cnetwork_type\x18\x04\ + \x20\x01(\x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07MAINNETR\ + \x0bnetworkType\x12j\n\x04subs\x18\x05\x20\x03(\x0b2V.hw.trezor.messages\ + .monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesListR\x04\ + subs\x1a\\\n\x1bMoneroSubAddressIndicesList\x12\x18\n\x07account\x18\x01\ + \x20\x02(\rR\x07account\x12#\n\rminor_indices\x18\x02\x20\x03(\rR\x0cmin\ + orIndices\"\x1d\n\x1bMoneroKeyImageExportInitAck\"\x89\x03\n\x1dMoneroKe\ + yImageSyncStepRequest\x12b\n\x04tdis\x18\x01\x20\x03(\x0b2N.hw.trezor.me\ + ssages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetailsR\x04td\ + is\x1a\x83\x02\n\x15MoneroTransferDetails\x12\x17\n\x07out_key\x18\x01\ + \x20\x02(\x0cR\x06outKey\x12\x1c\n\ntx_pub_key\x18\x02\x20\x02(\x0cR\x08\ + txPubKey\x123\n\x16additional_tx_pub_keys\x18\x03\x20\x03(\x0cR\x13addit\ + ionalTxPubKeys\x122\n\x15internal_output_index\x18\x04\x20\x02(\x04R\x13\ + internalOutputIndex\x12$\n\x0esub_addr_major\x18\x05\x20\x01(\rR\x0csubA\ + ddrMajor\x12$\n\x0esub_addr_minor\x18\x06\x20\x01(\rR\x0csubAddrMinor\"\ + \xb8\x01\n\x19MoneroKeyImageSyncStepAck\x12]\n\x03kis\x18\x01\x20\x03(\ + \x0b2K.hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExporte\ + dKeyImageR\x03kis\x1a<\n\x16MoneroExportedKeyImage\x12\x0e\n\x02iv\x18\ + \x01\x20\x01(\x0cR\x02iv\x12\x12\n\x04blob\x18\x03\x20\x01(\x0cR\x04blob\ + \"\x20\n\x1eMoneroKeyImageSyncFinalRequest\"5\n\x1aMoneroKeyImageSyncFin\ + alAck\x12\x17\n\x07enc_key\x18\x01\x20\x01(\x0cR\x06encKey\"\xc0\x02\n\ + \x15MoneroGetTxKeyRequest\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08ad\ + dressN\x12X\n\x0cnetwork_type\x18\x02\x20\x01(\x0e2,.hw.trezor.messages.\ + monero.MoneroNetworkType:\x07MAINNETR\x0bnetworkType\x12\x14\n\x05salt1\ + \x18\x03\x20\x02(\x0cR\x05salt1\x12\x14\n\x05salt2\x18\x04\x20\x02(\x0cR\ + \x05salt2\x12\x1e\n\x0btx_enc_keys\x18\x05\x20\x02(\x0cR\ttxEncKeys\x12$\ + \n\x0etx_prefix_hash\x18\x06\x20\x02(\x0cR\x0ctxPrefixHash\x12\x16\n\x06\ + reason\x18\x07\x20\x01(\rR\x06reason\x12&\n\x0fview_public_key\x18\x08\ + \x20\x01(\x0cR\rviewPublicKey\"g\n\x11MoneroGetTxKeyAck\x12\x12\n\x04sal\ + t\x18\x01\x20\x01(\x0cR\x04salt\x12\x17\n\x07tx_keys\x18\x02\x20\x01(\ + \x0cR\x06txKeys\x12%\n\x0etx_derivations\x18\x03\x20\x01(\x0cR\rtxDeriva\ + tions\"\x96\x01\n\x1dMoneroLiveRefreshStartRequest\x12\x1b\n\taddress_n\ + \x18\x01\x20\x03(\rR\x08addressN\x12X\n\x0cnetwork_type\x18\x02\x20\x01(\ + \x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07MAINNETR\x0bnetwo\ + rkType\"\x1b\n\x19MoneroLiveRefreshStartAck\"\xc4\x01\n\x1cMoneroLiveRef\ + reshStepRequest\x12\x17\n\x07out_key\x18\x01\x20\x02(\x0cR\x06outKey\x12\ + \x1d\n\nrecv_deriv\x18\x02\x20\x02(\x0cR\trecvDeriv\x12\x20\n\x0creal_ou\ + t_idx\x18\x03\x20\x02(\x04R\nrealOutIdx\x12$\n\x0esub_addr_major\x18\x04\ + \x20\x02(\rR\x0csubAddrMajor\x12$\n\x0esub_addr_minor\x18\x05\x20\x02(\r\ + R\x0csubAddrMinor\"K\n\x18MoneroLiveRefreshStepAck\x12\x12\n\x04salt\x18\ + \x01\x20\x01(\x0cR\x04salt\x12\x1b\n\tkey_image\x18\x02\x20\x01(\x0cR\ + \x08keyImage\"\x1f\n\x1dMoneroLiveRefreshFinalRequest\"\x1b\n\x19MoneroL\ + iveRefreshFinalAck\"\x86\x01\n\x16DebugMoneroDiagRequest\x12\x10\n\x03in\ + s\x18\x01\x20\x01(\x04R\x03ins\x12\x0e\n\x02p1\x18\x02\x20\x01(\x04R\x02\ + p1\x12\x0e\n\x02p2\x18\x03\x20\x01(\x04R\x02p2\x12\x0e\n\x02pd\x18\x04\ + \x20\x03(\x04R\x02pd\x12\x14\n\x05data1\x18\x05\x20\x01(\x0cR\x05data1\ + \x12\x14\n\x05data2\x18\x06\x20\x01(\x0cR\x05data2\"\x82\x01\n\x12DebugM\ + oneroDiagAck\x12\x10\n\x03ins\x18\x01\x20\x01(\x04R\x03ins\x12\x0e\n\x02\ + p1\x18\x02\x20\x01(\x04R\x02p1\x12\x0e\n\x02p2\x18\x03\x20\x01(\x04R\x02\ + p2\x12\x0e\n\x02pd\x18\x04\x20\x03(\x04R\x02pd\x12\x14\n\x05data1\x18\ + \x05\x20\x01(\x0cR\x05data1\x12\x14\n\x05data2\x18\x06\x20\x01(\x0cR\x05\ + data2*J\n\x11MoneroNetworkType\x12\x0b\n\x07MAINNET\x10\0\x12\x0b\n\x07T\ + ESTNET\x10\x01\x12\x0c\n\x08STAGENET\x10\x02\x12\r\n\tFAKECHAIN\x10\x03B\ + :\n#com.satoshilabs.trezor.lib.protobufB\x13TrezorMessageMonero\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(48); + messages.push(MoneroTransactionSourceEntry::generated_message_descriptor_data()); + messages.push(MoneroTransactionDestinationEntry::generated_message_descriptor_data()); + messages.push(MoneroTransactionRsigData::generated_message_descriptor_data()); + messages.push(MoneroGetAddress::generated_message_descriptor_data()); + messages.push(MoneroAddress::generated_message_descriptor_data()); + messages.push(MoneroGetWatchKey::generated_message_descriptor_data()); + messages.push(MoneroWatchKey::generated_message_descriptor_data()); + messages.push(MoneroTransactionInitRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionInitAck::generated_message_descriptor_data()); + messages.push(MoneroTransactionSetInputRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionSetInputAck::generated_message_descriptor_data()); + messages.push(MoneroTransactionInputViniRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionInputViniAck::generated_message_descriptor_data()); + messages.push(MoneroTransactionAllInputsSetRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionAllInputsSetAck::generated_message_descriptor_data()); + messages.push(MoneroTransactionSetOutputRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionSetOutputAck::generated_message_descriptor_data()); + messages.push(MoneroTransactionAllOutSetRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionAllOutSetAck::generated_message_descriptor_data()); + messages.push(MoneroTransactionSignInputRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionSignInputAck::generated_message_descriptor_data()); + messages.push(MoneroTransactionFinalRequest::generated_message_descriptor_data()); + messages.push(MoneroTransactionFinalAck::generated_message_descriptor_data()); + messages.push(MoneroKeyImageExportInitRequest::generated_message_descriptor_data()); + messages.push(MoneroKeyImageExportInitAck::generated_message_descriptor_data()); + messages.push(MoneroKeyImageSyncStepRequest::generated_message_descriptor_data()); + messages.push(MoneroKeyImageSyncStepAck::generated_message_descriptor_data()); + messages.push(MoneroKeyImageSyncFinalRequest::generated_message_descriptor_data()); + messages.push(MoneroKeyImageSyncFinalAck::generated_message_descriptor_data()); + messages.push(MoneroGetTxKeyRequest::generated_message_descriptor_data()); + messages.push(MoneroGetTxKeyAck::generated_message_descriptor_data()); + messages.push(MoneroLiveRefreshStartRequest::generated_message_descriptor_data()); + messages.push(MoneroLiveRefreshStartAck::generated_message_descriptor_data()); + messages.push(MoneroLiveRefreshStepRequest::generated_message_descriptor_data()); + messages.push(MoneroLiveRefreshStepAck::generated_message_descriptor_data()); + messages.push(MoneroLiveRefreshFinalRequest::generated_message_descriptor_data()); + messages.push(MoneroLiveRefreshFinalAck::generated_message_descriptor_data()); + messages.push(DebugMoneroDiagRequest::generated_message_descriptor_data()); + messages.push(DebugMoneroDiagAck::generated_message_descriptor_data()); + messages.push(monero_transaction_source_entry::MoneroOutputEntry::generated_message_descriptor_data()); + messages.push(monero_transaction_source_entry::MoneroMultisigKLRki::generated_message_descriptor_data()); + messages.push(monero_transaction_source_entry::monero_output_entry::MoneroRctKeyPublic::generated_message_descriptor_data()); + messages.push(monero_transaction_destination_entry::MoneroAccountPublicAddress::generated_message_descriptor_data()); + messages.push(monero_transaction_init_request::MoneroTransactionData::generated_message_descriptor_data()); + messages.push(monero_transaction_all_out_set_ack::MoneroRingCtSig::generated_message_descriptor_data()); + messages.push(monero_key_image_export_init_request::MoneroSubAddressIndicesList::generated_message_descriptor_data()); + messages.push(monero_key_image_sync_step_request::MoneroTransferDetails::generated_message_descriptor_data()); + messages.push(monero_key_image_sync_step_ack::MoneroExportedKeyImage::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(1); + enums.push(MoneroNetworkType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_nem.rs b/wallet/trezor-client/src/protos/generated/messages_nem.rs new file mode 100644 index 0000000000..e607f49f51 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_nem.rs @@ -0,0 +1,4998 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-nem.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NEMGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.network) + pub network: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NEMGetAddress { + fn default() -> &'a NEMGetAddress { + ::default_instance() + } +} + +impl NEMGetAddress { + pub fn new() -> NEMGetAddress { + ::std::default::Default::default() + } + + // optional uint32 network = 2; + + pub fn network(&self) -> u32 { + self.network.unwrap_or(104u32) + } + + pub fn clear_network(&mut self) { + self.network = ::std::option::Option::None; + } + + pub fn has_network(&self) -> bool { + self.network.is_some() + } + + // Param is passed by value, moved + pub fn set_network(&mut self, v: u32) { + self.network = ::std::option::Option::Some(v); + } + + // optional bool show_display = 3; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 4; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &NEMGetAddress| { &m.address_n }, + |m: &mut NEMGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network", + |m: &NEMGetAddress| { &m.network }, + |m: &mut NEMGetAddress| { &mut m.network }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &NEMGetAddress| { &m.show_display }, + |m: &mut NEMGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &NEMGetAddress| { &m.chunkify }, + |m: &mut NEMGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NEMGetAddress { + const NAME: &'static str = "NEMGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.network = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 32 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.network { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.network { + os.write_uint32(2, v)?; + } + if let Some(v) = self.show_display { + os.write_bool(3, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMGetAddress { + NEMGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.network = ::std::option::Option::None; + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMGetAddress { + static instance: NEMGetAddress = NEMGetAddress { + address_n: ::std::vec::Vec::new(), + network: ::std::option::Option::None, + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NEMGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NEMGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NEMGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NEMAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NEMAddress { + fn default() -> &'a NEMAddress { + ::default_instance() + } +} + +impl NEMAddress { + pub fn new() -> NEMAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &NEMAddress| { &m.address }, + |m: &mut NEMAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NEMAddress { + const NAME: &'static str = "NEMAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMAddress { + NEMAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMAddress { + static instance: NEMAddress = NEMAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NEMAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NEMAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NEMAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NEMSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.transaction) + pub transaction: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.multisig) + pub multisig: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.transfer) + pub transfer: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.cosigning) + pub cosigning: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.provision_namespace) + pub provision_namespace: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.mosaic_creation) + pub mosaic_creation: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.supply_change) + pub supply_change: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.aggregate_modification) + pub aggregate_modification: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.importance_transfer) + pub importance_transfer: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NEMSignTx { + fn default() -> &'a NEMSignTx { + ::default_instance() + } +} + +impl NEMSignTx { + pub fn new() -> NEMSignTx { + ::std::default::Default::default() + } + + // optional bool cosigning = 4; + + pub fn cosigning(&self) -> bool { + self.cosigning.unwrap_or(false) + } + + pub fn clear_cosigning(&mut self) { + self.cosigning = ::std::option::Option::None; + } + + pub fn has_cosigning(&self) -> bool { + self.cosigning.is_some() + } + + // Param is passed by value, moved + pub fn set_cosigning(&mut self, v: bool) { + self.cosigning = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 10; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(10); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMTransactionCommon>( + "transaction", + |m: &NEMSignTx| { &m.transaction }, + |m: &mut NEMSignTx| { &mut m.transaction }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMTransactionCommon>( + "multisig", + |m: &NEMSignTx| { &m.multisig }, + |m: &mut NEMSignTx| { &mut m.multisig }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMTransfer>( + "transfer", + |m: &NEMSignTx| { &m.transfer }, + |m: &mut NEMSignTx| { &mut m.transfer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "cosigning", + |m: &NEMSignTx| { &m.cosigning }, + |m: &mut NEMSignTx| { &mut m.cosigning }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMProvisionNamespace>( + "provision_namespace", + |m: &NEMSignTx| { &m.provision_namespace }, + |m: &mut NEMSignTx| { &mut m.provision_namespace }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMMosaicCreation>( + "mosaic_creation", + |m: &NEMSignTx| { &m.mosaic_creation }, + |m: &mut NEMSignTx| { &mut m.mosaic_creation }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMMosaicSupplyChange>( + "supply_change", + |m: &NEMSignTx| { &m.supply_change }, + |m: &mut NEMSignTx| { &mut m.supply_change }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMAggregateModification>( + "aggregate_modification", + |m: &NEMSignTx| { &m.aggregate_modification }, + |m: &mut NEMSignTx| { &mut m.aggregate_modification }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMImportanceTransfer>( + "importance_transfer", + |m: &NEMSignTx| { &m.importance_transfer }, + |m: &mut NEMSignTx| { &mut m.importance_transfer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &NEMSignTx| { &m.chunkify }, + |m: &mut NEMSignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NEMSignTx { + const NAME: &'static str = "NEMSignTx"; + + fn is_initialized(&self) -> bool { + if self.transaction.is_none() { + return false; + } + for v in &self.transaction { + if !v.is_initialized() { + return false; + } + }; + for v in &self.multisig { + if !v.is_initialized() { + return false; + } + }; + for v in &self.transfer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.provision_namespace { + if !v.is_initialized() { + return false; + } + }; + for v in &self.mosaic_creation { + if !v.is_initialized() { + return false; + } + }; + for v in &self.supply_change { + if !v.is_initialized() { + return false; + } + }; + for v in &self.aggregate_modification { + if !v.is_initialized() { + return false; + } + }; + for v in &self.importance_transfer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.transaction)?; + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; + }, + 32 => { + self.cosigning = ::std::option::Option::Some(is.read_bool()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.provision_namespace)?; + }, + 50 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.mosaic_creation)?; + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.supply_change)?; + }, + 66 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.aggregate_modification)?; + }, + 74 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.importance_transfer)?; + }, + 80 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.transaction.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.multisig.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.transfer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.cosigning { + my_size += 1 + 1; + } + if let Some(v) = self.provision_namespace.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.mosaic_creation.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.supply_change.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.aggregate_modification.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.importance_transfer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.transaction.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.multisig.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.transfer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.cosigning { + os.write_bool(4, v)?; + } + if let Some(v) = self.provision_namespace.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.mosaic_creation.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; + } + if let Some(v) = self.supply_change.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.aggregate_modification.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; + } + if let Some(v) = self.importance_transfer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; + } + if let Some(v) = self.chunkify { + os.write_bool(10, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMSignTx { + NEMSignTx::new() + } + + fn clear(&mut self) { + self.transaction.clear(); + self.multisig.clear(); + self.transfer.clear(); + self.cosigning = ::std::option::Option::None; + self.provision_namespace.clear(); + self.mosaic_creation.clear(); + self.supply_change.clear(); + self.aggregate_modification.clear(); + self.importance_transfer.clear(); + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMSignTx { + static instance: NEMSignTx = NEMSignTx { + transaction: ::protobuf::MessageField::none(), + multisig: ::protobuf::MessageField::none(), + transfer: ::protobuf::MessageField::none(), + cosigning: ::std::option::Option::None, + provision_namespace: ::protobuf::MessageField::none(), + mosaic_creation: ::protobuf::MessageField::none(), + supply_change: ::protobuf::MessageField::none(), + aggregate_modification: ::protobuf::MessageField::none(), + importance_transfer: ::protobuf::MessageField::none(), + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NEMSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NEMSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NEMSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `NEMSignTx` +pub mod nemsign_tx { + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMTransactionCommon { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.network) + pub network: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.timestamp) + pub timestamp: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.deadline) + pub deadline: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.signer) + pub signer: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMTransactionCommon { + fn default() -> &'a NEMTransactionCommon { + ::default_instance() + } + } + + impl NEMTransactionCommon { + pub fn new() -> NEMTransactionCommon { + ::std::default::Default::default() + } + + // optional uint32 network = 2; + + pub fn network(&self) -> u32 { + self.network.unwrap_or(104u32) + } + + pub fn clear_network(&mut self) { + self.network = ::std::option::Option::None; + } + + pub fn has_network(&self) -> bool { + self.network.is_some() + } + + // Param is passed by value, moved + pub fn set_network(&mut self, v: u32) { + self.network = ::std::option::Option::Some(v); + } + + // required uint32 timestamp = 3; + + pub fn timestamp(&self) -> u32 { + self.timestamp.unwrap_or(0) + } + + pub fn clear_timestamp(&mut self) { + self.timestamp = ::std::option::Option::None; + } + + pub fn has_timestamp(&self) -> bool { + self.timestamp.is_some() + } + + // Param is passed by value, moved + pub fn set_timestamp(&mut self, v: u32) { + self.timestamp = ::std::option::Option::Some(v); + } + + // required uint64 fee = 4; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // required uint32 deadline = 5; + + pub fn deadline(&self) -> u32 { + self.deadline.unwrap_or(0) + } + + pub fn clear_deadline(&mut self) { + self.deadline = ::std::option::Option::None; + } + + pub fn has_deadline(&self) -> bool { + self.deadline.is_some() + } + + // Param is passed by value, moved + pub fn set_deadline(&mut self, v: u32) { + self.deadline = ::std::option::Option::Some(v); + } + + // optional bytes signer = 6; + + pub fn signer(&self) -> &[u8] { + match self.signer.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signer(&mut self) { + self.signer = ::std::option::Option::None; + } + + pub fn has_signer(&self) -> bool { + self.signer.is_some() + } + + // Param is passed by value, moved + pub fn set_signer(&mut self, v: ::std::vec::Vec) { + self.signer = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signer(&mut self) -> &mut ::std::vec::Vec { + if self.signer.is_none() { + self.signer = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signer.as_mut().unwrap() + } + + // Take field + pub fn take_signer(&mut self) -> ::std::vec::Vec { + self.signer.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &NEMTransactionCommon| { &m.address_n }, + |m: &mut NEMTransactionCommon| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network", + |m: &NEMTransactionCommon| { &m.network }, + |m: &mut NEMTransactionCommon| { &mut m.network }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "timestamp", + |m: &NEMTransactionCommon| { &m.timestamp }, + |m: &mut NEMTransactionCommon| { &mut m.timestamp }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &NEMTransactionCommon| { &m.fee }, + |m: &mut NEMTransactionCommon| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "deadline", + |m: &NEMTransactionCommon| { &m.deadline }, + |m: &mut NEMTransactionCommon| { &mut m.deadline }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signer", + |m: &NEMTransactionCommon| { &m.signer }, + |m: &mut NEMTransactionCommon| { &mut m.signer }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMTransactionCommon", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMTransactionCommon { + const NAME: &'static str = "NEMTransactionCommon"; + + fn is_initialized(&self) -> bool { + if self.timestamp.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + if self.deadline.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.network = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.timestamp = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.deadline = ::std::option::Option::Some(is.read_uint32()?); + }, + 50 => { + self.signer = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.network { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.timestamp { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.deadline { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.signer.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.network { + os.write_uint32(2, v)?; + } + if let Some(v) = self.timestamp { + os.write_uint32(3, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(4, v)?; + } + if let Some(v) = self.deadline { + os.write_uint32(5, v)?; + } + if let Some(v) = self.signer.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMTransactionCommon { + NEMTransactionCommon::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.network = ::std::option::Option::None; + self.timestamp = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.deadline = ::std::option::Option::None; + self.signer = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMTransactionCommon { + static instance: NEMTransactionCommon = NEMTransactionCommon { + address_n: ::std::vec::Vec::new(), + network: ::std::option::Option::None, + timestamp: ::std::option::Option::None, + fee: ::std::option::Option::None, + deadline: ::std::option::Option::None, + signer: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMTransactionCommon { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMTransactionCommon").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMTransactionCommon { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMTransactionCommon { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMTransfer) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMTransfer { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.recipient) + pub recipient: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.payload) + pub payload: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.mosaics) + pub mosaics: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMTransfer { + fn default() -> &'a NEMTransfer { + ::default_instance() + } + } + + impl NEMTransfer { + pub fn new() -> NEMTransfer { + ::std::default::Default::default() + } + + // required string recipient = 1; + + pub fn recipient(&self) -> &str { + match self.recipient.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_recipient(&mut self) { + self.recipient = ::std::option::Option::None; + } + + pub fn has_recipient(&self) -> bool { + self.recipient.is_some() + } + + // Param is passed by value, moved + pub fn set_recipient(&mut self, v: ::std::string::String) { + self.recipient = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_recipient(&mut self) -> &mut ::std::string::String { + if self.recipient.is_none() { + self.recipient = ::std::option::Option::Some(::std::string::String::new()); + } + self.recipient.as_mut().unwrap() + } + + // Take field + pub fn take_recipient(&mut self) -> ::std::string::String { + self.recipient.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 amount = 2; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional bytes payload = 3; + + pub fn payload(&self) -> &[u8] { + match self.payload.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_payload(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_payload(&self) -> bool { + self.payload.is_some() + } + + // Param is passed by value, moved + pub fn set_payload(&mut self, v: ::std::vec::Vec) { + self.payload = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { + if self.payload.is_none() { + self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.payload.as_mut().unwrap() + } + + // Take field + pub fn take_payload(&mut self) -> ::std::vec::Vec { + self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes public_key = 4; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "recipient", + |m: &NEMTransfer| { &m.recipient }, + |m: &mut NEMTransfer| { &mut m.recipient }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &NEMTransfer| { &m.amount }, + |m: &mut NEMTransfer| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payload", + |m: &NEMTransfer| { &m.payload }, + |m: &mut NEMTransfer| { &mut m.payload }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &NEMTransfer| { &m.public_key }, + |m: &mut NEMTransfer| { &mut m.public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "mosaics", + |m: &NEMTransfer| { &m.mosaics }, + |m: &mut NEMTransfer| { &mut m.mosaics }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMTransfer", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMTransfer { + const NAME: &'static str = "NEMTransfer"; + + fn is_initialized(&self) -> bool { + if self.recipient.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + for v in &self.mosaics { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.recipient = ::std::option::Option::Some(is.read_string()?); + }, + 16 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + self.payload = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.mosaics.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.recipient.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.payload.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + for value in &self.mosaics { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.recipient.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.amount { + os.write_uint64(2, v)?; + } + if let Some(v) = self.payload.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(4, v)?; + } + for v in &self.mosaics { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMTransfer { + NEMTransfer::new() + } + + fn clear(&mut self) { + self.recipient = ::std::option::Option::None; + self.amount = ::std::option::Option::None; + self.payload = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.mosaics.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMTransfer { + static instance: NEMTransfer = NEMTransfer { + recipient: ::std::option::Option::None, + amount: ::std::option::Option::None, + payload: ::std::option::Option::None, + public_key: ::std::option::Option::None, + mosaics: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMTransfer { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMTransfer").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMTransfer { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMTransfer { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `NEMTransfer` + pub mod nemtransfer { + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMMosaic { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.namespace) + pub namespace: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.mosaic) + pub mosaic: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.quantity) + pub quantity: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMMosaic { + fn default() -> &'a NEMMosaic { + ::default_instance() + } + } + + impl NEMMosaic { + pub fn new() -> NEMMosaic { + ::std::default::Default::default() + } + + // required string namespace = 1; + + pub fn namespace(&self) -> &str { + match self.namespace.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_namespace(&mut self) { + self.namespace = ::std::option::Option::None; + } + + pub fn has_namespace(&self) -> bool { + self.namespace.is_some() + } + + // Param is passed by value, moved + pub fn set_namespace(&mut self, v: ::std::string::String) { + self.namespace = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_namespace(&mut self) -> &mut ::std::string::String { + if self.namespace.is_none() { + self.namespace = ::std::option::Option::Some(::std::string::String::new()); + } + self.namespace.as_mut().unwrap() + } + + // Take field + pub fn take_namespace(&mut self) -> ::std::string::String { + self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string mosaic = 2; + + pub fn mosaic(&self) -> &str { + match self.mosaic.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_mosaic(&mut self) { + self.mosaic = ::std::option::Option::None; + } + + pub fn has_mosaic(&self) -> bool { + self.mosaic.is_some() + } + + // Param is passed by value, moved + pub fn set_mosaic(&mut self, v: ::std::string::String) { + self.mosaic = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mosaic(&mut self) -> &mut ::std::string::String { + if self.mosaic.is_none() { + self.mosaic = ::std::option::Option::Some(::std::string::String::new()); + } + self.mosaic.as_mut().unwrap() + } + + // Take field + pub fn take_mosaic(&mut self) -> ::std::string::String { + self.mosaic.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 quantity = 3; + + pub fn quantity(&self) -> u64 { + self.quantity.unwrap_or(0) + } + + pub fn clear_quantity(&mut self) { + self.quantity = ::std::option::Option::None; + } + + pub fn has_quantity(&self) -> bool { + self.quantity.is_some() + } + + // Param is passed by value, moved + pub fn set_quantity(&mut self, v: u64) { + self.quantity = ::std::option::Option::Some(v); + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "namespace", + |m: &NEMMosaic| { &m.namespace }, + |m: &mut NEMMosaic| { &mut m.namespace }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mosaic", + |m: &NEMMosaic| { &m.mosaic }, + |m: &mut NEMMosaic| { &mut m.mosaic }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "quantity", + |m: &NEMMosaic| { &m.quantity }, + |m: &mut NEMMosaic| { &mut m.quantity }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMTransfer.NEMMosaic", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMMosaic { + const NAME: &'static str = "NEMMosaic"; + + fn is_initialized(&self) -> bool { + if self.namespace.is_none() { + return false; + } + if self.mosaic.is_none() { + return false; + } + if self.quantity.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.namespace = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.mosaic = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.quantity = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.namespace.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.mosaic.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.quantity { + my_size += ::protobuf::rt::uint64_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.namespace.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.mosaic.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.quantity { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMMosaic { + NEMMosaic::new() + } + + fn clear(&mut self) { + self.namespace = ::std::option::Option::None; + self.mosaic = ::std::option::Option::None; + self.quantity = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMMosaic { + static instance: NEMMosaic = NEMMosaic { + namespace: ::std::option::Option::None, + mosaic: ::std::option::Option::None, + quantity: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMMosaic { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMTransfer.NEMMosaic").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMMosaic { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMMosaic { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + } + + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMProvisionNamespace { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.namespace) + pub namespace: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.parent) + pub parent: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.sink) + pub sink: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.fee) + pub fee: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMProvisionNamespace { + fn default() -> &'a NEMProvisionNamespace { + ::default_instance() + } + } + + impl NEMProvisionNamespace { + pub fn new() -> NEMProvisionNamespace { + ::std::default::Default::default() + } + + // required string namespace = 1; + + pub fn namespace(&self) -> &str { + match self.namespace.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_namespace(&mut self) { + self.namespace = ::std::option::Option::None; + } + + pub fn has_namespace(&self) -> bool { + self.namespace.is_some() + } + + // Param is passed by value, moved + pub fn set_namespace(&mut self, v: ::std::string::String) { + self.namespace = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_namespace(&mut self) -> &mut ::std::string::String { + if self.namespace.is_none() { + self.namespace = ::std::option::Option::Some(::std::string::String::new()); + } + self.namespace.as_mut().unwrap() + } + + // Take field + pub fn take_namespace(&mut self) -> ::std::string::String { + self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string parent = 2; + + pub fn parent(&self) -> &str { + match self.parent.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_parent(&mut self) { + self.parent = ::std::option::Option::None; + } + + pub fn has_parent(&self) -> bool { + self.parent.is_some() + } + + // Param is passed by value, moved + pub fn set_parent(&mut self, v: ::std::string::String) { + self.parent = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_parent(&mut self) -> &mut ::std::string::String { + if self.parent.is_none() { + self.parent = ::std::option::Option::Some(::std::string::String::new()); + } + self.parent.as_mut().unwrap() + } + + // Take field + pub fn take_parent(&mut self) -> ::std::string::String { + self.parent.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string sink = 3; + + pub fn sink(&self) -> &str { + match self.sink.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_sink(&mut self) { + self.sink = ::std::option::Option::None; + } + + pub fn has_sink(&self) -> bool { + self.sink.is_some() + } + + // Param is passed by value, moved + pub fn set_sink(&mut self, v: ::std::string::String) { + self.sink = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sink(&mut self) -> &mut ::std::string::String { + if self.sink.is_none() { + self.sink = ::std::option::Option::Some(::std::string::String::new()); + } + self.sink.as_mut().unwrap() + } + + // Take field + pub fn take_sink(&mut self) -> ::std::string::String { + self.sink.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 fee = 4; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "namespace", + |m: &NEMProvisionNamespace| { &m.namespace }, + |m: &mut NEMProvisionNamespace| { &mut m.namespace }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "parent", + |m: &NEMProvisionNamespace| { &m.parent }, + |m: &mut NEMProvisionNamespace| { &mut m.parent }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sink", + |m: &NEMProvisionNamespace| { &m.sink }, + |m: &mut NEMProvisionNamespace| { &mut m.sink }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &NEMProvisionNamespace| { &m.fee }, + |m: &mut NEMProvisionNamespace| { &mut m.fee }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMProvisionNamespace", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMProvisionNamespace { + const NAME: &'static str = "NEMProvisionNamespace"; + + fn is_initialized(&self) -> bool { + if self.namespace.is_none() { + return false; + } + if self.sink.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.namespace = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.parent = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.sink = ::std::option::Option::Some(is.read_string()?); + }, + 32 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.namespace.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.parent.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.sink.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(4, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.namespace.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.parent.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.sink.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMProvisionNamespace { + NEMProvisionNamespace::new() + } + + fn clear(&mut self) { + self.namespace = ::std::option::Option::None; + self.parent = ::std::option::Option::None; + self.sink = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMProvisionNamespace { + static instance: NEMProvisionNamespace = NEMProvisionNamespace { + namespace: ::std::option::Option::None, + parent: ::std::option::Option::None, + sink: ::std::option::Option::None, + fee: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMProvisionNamespace { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMProvisionNamespace").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMProvisionNamespace { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMProvisionNamespace { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMMosaicCreation { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.definition) + pub definition: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.sink) + pub sink: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.fee) + pub fee: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMMosaicCreation { + fn default() -> &'a NEMMosaicCreation { + ::default_instance() + } + } + + impl NEMMosaicCreation { + pub fn new() -> NEMMosaicCreation { + ::std::default::Default::default() + } + + // required string sink = 2; + + pub fn sink(&self) -> &str { + match self.sink.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_sink(&mut self) { + self.sink = ::std::option::Option::None; + } + + pub fn has_sink(&self) -> bool { + self.sink.is_some() + } + + // Param is passed by value, moved + pub fn set_sink(&mut self, v: ::std::string::String) { + self.sink = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sink(&mut self) -> &mut ::std::string::String { + if self.sink.is_none() { + self.sink = ::std::option::Option::Some(::std::string::String::new()); + } + self.sink.as_mut().unwrap() + } + + // Take field + pub fn take_sink(&mut self) -> ::std::string::String { + self.sink.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 fee = 3; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemmosaic_creation::NEMMosaicDefinition>( + "definition", + |m: &NEMMosaicCreation| { &m.definition }, + |m: &mut NEMMosaicCreation| { &mut m.definition }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sink", + |m: &NEMMosaicCreation| { &m.sink }, + |m: &mut NEMMosaicCreation| { &mut m.sink }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &NEMMosaicCreation| { &m.fee }, + |m: &mut NEMMosaicCreation| { &mut m.fee }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMMosaicCreation", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMMosaicCreation { + const NAME: &'static str = "NEMMosaicCreation"; + + fn is_initialized(&self) -> bool { + if self.definition.is_none() { + return false; + } + if self.sink.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + for v in &self.definition { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.definition)?; + }, + 18 => { + self.sink = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.definition.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.sink.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.definition.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.sink.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMMosaicCreation { + NEMMosaicCreation::new() + } + + fn clear(&mut self) { + self.definition.clear(); + self.sink = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMMosaicCreation { + static instance: NEMMosaicCreation = NEMMosaicCreation { + definition: ::protobuf::MessageField::none(), + sink: ::std::option::Option::None, + fee: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMMosaicCreation { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMMosaicCreation").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMMosaicCreation { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMMosaicCreation { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `NEMMosaicCreation` + pub mod nemmosaic_creation { + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMMosaicDefinition { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.name) + pub name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.ticker) + pub ticker: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.namespace) + pub namespace: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.mosaic) + pub mosaic: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.divisibility) + pub divisibility: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy) + pub levy: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy_address) + pub levy_address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy_namespace) + pub levy_namespace: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy_mosaic) + pub levy_mosaic: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.supply) + pub supply: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.mutable_supply) + pub mutable_supply: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.transferable) + pub transferable: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.description) + pub description: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.networks) + pub networks: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMMosaicDefinition { + fn default() -> &'a NEMMosaicDefinition { + ::default_instance() + } + } + + impl NEMMosaicDefinition { + pub fn new() -> NEMMosaicDefinition { + ::std::default::Default::default() + } + + // optional string name = 1; + + pub fn name(&self) -> &str { + match self.name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name = ::std::option::Option::Some(::std::string::String::new()); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string ticker = 2; + + pub fn ticker(&self) -> &str { + match self.ticker.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_ticker(&mut self) { + self.ticker = ::std::option::Option::None; + } + + pub fn has_ticker(&self) -> bool { + self.ticker.is_some() + } + + // Param is passed by value, moved + pub fn set_ticker(&mut self, v: ::std::string::String) { + self.ticker = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ticker(&mut self) -> &mut ::std::string::String { + if self.ticker.is_none() { + self.ticker = ::std::option::Option::Some(::std::string::String::new()); + } + self.ticker.as_mut().unwrap() + } + + // Take field + pub fn take_ticker(&mut self) -> ::std::string::String { + self.ticker.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string namespace = 3; + + pub fn namespace(&self) -> &str { + match self.namespace.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_namespace(&mut self) { + self.namespace = ::std::option::Option::None; + } + + pub fn has_namespace(&self) -> bool { + self.namespace.is_some() + } + + // Param is passed by value, moved + pub fn set_namespace(&mut self, v: ::std::string::String) { + self.namespace = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_namespace(&mut self) -> &mut ::std::string::String { + if self.namespace.is_none() { + self.namespace = ::std::option::Option::Some(::std::string::String::new()); + } + self.namespace.as_mut().unwrap() + } + + // Take field + pub fn take_namespace(&mut self) -> ::std::string::String { + self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string mosaic = 4; + + pub fn mosaic(&self) -> &str { + match self.mosaic.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_mosaic(&mut self) { + self.mosaic = ::std::option::Option::None; + } + + pub fn has_mosaic(&self) -> bool { + self.mosaic.is_some() + } + + // Param is passed by value, moved + pub fn set_mosaic(&mut self, v: ::std::string::String) { + self.mosaic = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mosaic(&mut self) -> &mut ::std::string::String { + if self.mosaic.is_none() { + self.mosaic = ::std::option::Option::Some(::std::string::String::new()); + } + self.mosaic.as_mut().unwrap() + } + + // Take field + pub fn take_mosaic(&mut self) -> ::std::string::String { + self.mosaic.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 divisibility = 5; + + pub fn divisibility(&self) -> u32 { + self.divisibility.unwrap_or(0) + } + + pub fn clear_divisibility(&mut self) { + self.divisibility = ::std::option::Option::None; + } + + pub fn has_divisibility(&self) -> bool { + self.divisibility.is_some() + } + + // Param is passed by value, moved + pub fn set_divisibility(&mut self, v: u32) { + self.divisibility = ::std::option::Option::Some(v); + } + + // optional .hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy levy = 6; + + pub fn levy(&self) -> nemmosaic_definition::NEMMosaicLevy { + match self.levy { + Some(e) => e.enum_value_or(nemmosaic_definition::NEMMosaicLevy::MosaicLevy_Absolute), + None => nemmosaic_definition::NEMMosaicLevy::MosaicLevy_Absolute, + } + } + + pub fn clear_levy(&mut self) { + self.levy = ::std::option::Option::None; + } + + pub fn has_levy(&self) -> bool { + self.levy.is_some() + } + + // Param is passed by value, moved + pub fn set_levy(&mut self, v: nemmosaic_definition::NEMMosaicLevy) { + self.levy = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional uint64 fee = 7; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // optional string levy_address = 8; + + pub fn levy_address(&self) -> &str { + match self.levy_address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_levy_address(&mut self) { + self.levy_address = ::std::option::Option::None; + } + + pub fn has_levy_address(&self) -> bool { + self.levy_address.is_some() + } + + // Param is passed by value, moved + pub fn set_levy_address(&mut self, v: ::std::string::String) { + self.levy_address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_levy_address(&mut self) -> &mut ::std::string::String { + if self.levy_address.is_none() { + self.levy_address = ::std::option::Option::Some(::std::string::String::new()); + } + self.levy_address.as_mut().unwrap() + } + + // Take field + pub fn take_levy_address(&mut self) -> ::std::string::String { + self.levy_address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string levy_namespace = 9; + + pub fn levy_namespace(&self) -> &str { + match self.levy_namespace.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_levy_namespace(&mut self) { + self.levy_namespace = ::std::option::Option::None; + } + + pub fn has_levy_namespace(&self) -> bool { + self.levy_namespace.is_some() + } + + // Param is passed by value, moved + pub fn set_levy_namespace(&mut self, v: ::std::string::String) { + self.levy_namespace = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_levy_namespace(&mut self) -> &mut ::std::string::String { + if self.levy_namespace.is_none() { + self.levy_namespace = ::std::option::Option::Some(::std::string::String::new()); + } + self.levy_namespace.as_mut().unwrap() + } + + // Take field + pub fn take_levy_namespace(&mut self) -> ::std::string::String { + self.levy_namespace.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string levy_mosaic = 10; + + pub fn levy_mosaic(&self) -> &str { + match self.levy_mosaic.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_levy_mosaic(&mut self) { + self.levy_mosaic = ::std::option::Option::None; + } + + pub fn has_levy_mosaic(&self) -> bool { + self.levy_mosaic.is_some() + } + + // Param is passed by value, moved + pub fn set_levy_mosaic(&mut self, v: ::std::string::String) { + self.levy_mosaic = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_levy_mosaic(&mut self) -> &mut ::std::string::String { + if self.levy_mosaic.is_none() { + self.levy_mosaic = ::std::option::Option::Some(::std::string::String::new()); + } + self.levy_mosaic.as_mut().unwrap() + } + + // Take field + pub fn take_levy_mosaic(&mut self) -> ::std::string::String { + self.levy_mosaic.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint64 supply = 11; + + pub fn supply(&self) -> u64 { + self.supply.unwrap_or(0) + } + + pub fn clear_supply(&mut self) { + self.supply = ::std::option::Option::None; + } + + pub fn has_supply(&self) -> bool { + self.supply.is_some() + } + + // Param is passed by value, moved + pub fn set_supply(&mut self, v: u64) { + self.supply = ::std::option::Option::Some(v); + } + + // optional bool mutable_supply = 12; + + pub fn mutable_supply(&self) -> bool { + self.mutable_supply.unwrap_or(false) + } + + pub fn clear_mutable_supply(&mut self) { + self.mutable_supply = ::std::option::Option::None; + } + + pub fn has_mutable_supply(&self) -> bool { + self.mutable_supply.is_some() + } + + // Param is passed by value, moved + pub fn set_mutable_supply(&mut self, v: bool) { + self.mutable_supply = ::std::option::Option::Some(v); + } + + // optional bool transferable = 13; + + pub fn transferable(&self) -> bool { + self.transferable.unwrap_or(false) + } + + pub fn clear_transferable(&mut self) { + self.transferable = ::std::option::Option::None; + } + + pub fn has_transferable(&self) -> bool { + self.transferable.is_some() + } + + // Param is passed by value, moved + pub fn set_transferable(&mut self, v: bool) { + self.transferable = ::std::option::Option::Some(v); + } + + // required string description = 14; + + pub fn description(&self) -> &str { + match self.description.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_description(&mut self) { + self.description = ::std::option::Option::None; + } + + pub fn has_description(&self) -> bool { + self.description.is_some() + } + + // Param is passed by value, moved + pub fn set_description(&mut self, v: ::std::string::String) { + self.description = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_description(&mut self) -> &mut ::std::string::String { + if self.description.is_none() { + self.description = ::std::option::Option::Some(::std::string::String::new()); + } + self.description.as_mut().unwrap() + } + + // Take field + pub fn take_description(&mut self) -> ::std::string::String { + self.description.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(15); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &NEMMosaicDefinition| { &m.name }, + |m: &mut NEMMosaicDefinition| { &mut m.name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ticker", + |m: &NEMMosaicDefinition| { &m.ticker }, + |m: &mut NEMMosaicDefinition| { &mut m.ticker }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "namespace", + |m: &NEMMosaicDefinition| { &m.namespace }, + |m: &mut NEMMosaicDefinition| { &mut m.namespace }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mosaic", + |m: &NEMMosaicDefinition| { &m.mosaic }, + |m: &mut NEMMosaicDefinition| { &mut m.mosaic }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "divisibility", + |m: &NEMMosaicDefinition| { &m.divisibility }, + |m: &mut NEMMosaicDefinition| { &mut m.divisibility }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "levy", + |m: &NEMMosaicDefinition| { &m.levy }, + |m: &mut NEMMosaicDefinition| { &mut m.levy }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &NEMMosaicDefinition| { &m.fee }, + |m: &mut NEMMosaicDefinition| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "levy_address", + |m: &NEMMosaicDefinition| { &m.levy_address }, + |m: &mut NEMMosaicDefinition| { &mut m.levy_address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "levy_namespace", + |m: &NEMMosaicDefinition| { &m.levy_namespace }, + |m: &mut NEMMosaicDefinition| { &mut m.levy_namespace }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "levy_mosaic", + |m: &NEMMosaicDefinition| { &m.levy_mosaic }, + |m: &mut NEMMosaicDefinition| { &mut m.levy_mosaic }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "supply", + |m: &NEMMosaicDefinition| { &m.supply }, + |m: &mut NEMMosaicDefinition| { &mut m.supply }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mutable_supply", + |m: &NEMMosaicDefinition| { &m.mutable_supply }, + |m: &mut NEMMosaicDefinition| { &mut m.mutable_supply }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "transferable", + |m: &NEMMosaicDefinition| { &m.transferable }, + |m: &mut NEMMosaicDefinition| { &mut m.transferable }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "description", + |m: &NEMMosaicDefinition| { &m.description }, + |m: &mut NEMMosaicDefinition| { &mut m.description }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "networks", + |m: &NEMMosaicDefinition| { &m.networks }, + |m: &mut NEMMosaicDefinition| { &mut m.networks }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMMosaicDefinition { + const NAME: &'static str = "NEMMosaicDefinition"; + + fn is_initialized(&self) -> bool { + if self.namespace.is_none() { + return false; + } + if self.mosaic.is_none() { + return false; + } + if self.description.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.name = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.ticker = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.namespace = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.mosaic = ::std::option::Option::Some(is.read_string()?); + }, + 40 => { + self.divisibility = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.levy = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 56 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 66 => { + self.levy_address = ::std::option::Option::Some(is.read_string()?); + }, + 74 => { + self.levy_namespace = ::std::option::Option::Some(is.read_string()?); + }, + 82 => { + self.levy_mosaic = ::std::option::Option::Some(is.read_string()?); + }, + 88 => { + self.supply = ::std::option::Option::Some(is.read_uint64()?); + }, + 96 => { + self.mutable_supply = ::std::option::Option::Some(is.read_bool()?); + }, + 104 => { + self.transferable = ::std::option::Option::Some(is.read_bool()?); + }, + 114 => { + self.description = ::std::option::Option::Some(is.read_string()?); + }, + 122 => { + is.read_repeated_packed_uint32_into(&mut self.networks)?; + }, + 120 => { + self.networks.push(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.ticker.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.namespace.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.mosaic.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.divisibility { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.levy { + my_size += ::protobuf::rt::int32_size(6, v.value()); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(7, v); + } + if let Some(v) = self.levy_address.as_ref() { + my_size += ::protobuf::rt::string_size(8, &v); + } + if let Some(v) = self.levy_namespace.as_ref() { + my_size += ::protobuf::rt::string_size(9, &v); + } + if let Some(v) = self.levy_mosaic.as_ref() { + my_size += ::protobuf::rt::string_size(10, &v); + } + if let Some(v) = self.supply { + my_size += ::protobuf::rt::uint64_size(11, v); + } + if let Some(v) = self.mutable_supply { + my_size += 1 + 1; + } + if let Some(v) = self.transferable { + my_size += 1 + 1; + } + if let Some(v) = self.description.as_ref() { + my_size += ::protobuf::rt::string_size(14, &v); + } + for value in &self.networks { + my_size += ::protobuf::rt::uint32_size(15, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.name.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.ticker.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.namespace.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.mosaic.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.divisibility { + os.write_uint32(5, v)?; + } + if let Some(v) = self.levy { + os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.fee { + os.write_uint64(7, v)?; + } + if let Some(v) = self.levy_address.as_ref() { + os.write_string(8, v)?; + } + if let Some(v) = self.levy_namespace.as_ref() { + os.write_string(9, v)?; + } + if let Some(v) = self.levy_mosaic.as_ref() { + os.write_string(10, v)?; + } + if let Some(v) = self.supply { + os.write_uint64(11, v)?; + } + if let Some(v) = self.mutable_supply { + os.write_bool(12, v)?; + } + if let Some(v) = self.transferable { + os.write_bool(13, v)?; + } + if let Some(v) = self.description.as_ref() { + os.write_string(14, v)?; + } + for v in &self.networks { + os.write_uint32(15, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMMosaicDefinition { + NEMMosaicDefinition::new() + } + + fn clear(&mut self) { + self.name = ::std::option::Option::None; + self.ticker = ::std::option::Option::None; + self.namespace = ::std::option::Option::None; + self.mosaic = ::std::option::Option::None; + self.divisibility = ::std::option::Option::None; + self.levy = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.levy_address = ::std::option::Option::None; + self.levy_namespace = ::std::option::Option::None; + self.levy_mosaic = ::std::option::Option::None; + self.supply = ::std::option::Option::None; + self.mutable_supply = ::std::option::Option::None; + self.transferable = ::std::option::Option::None; + self.description = ::std::option::Option::None; + self.networks.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMMosaicDefinition { + static instance: NEMMosaicDefinition = NEMMosaicDefinition { + name: ::std::option::Option::None, + ticker: ::std::option::Option::None, + namespace: ::std::option::Option::None, + mosaic: ::std::option::Option::None, + divisibility: ::std::option::Option::None, + levy: ::std::option::Option::None, + fee: ::std::option::Option::None, + levy_address: ::std::option::Option::None, + levy_namespace: ::std::option::Option::None, + levy_mosaic: ::std::option::Option::None, + supply: ::std::option::Option::None, + mutable_supply: ::std::option::Option::None, + transferable: ::std::option::Option::None, + description: ::std::option::Option::None, + networks: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMMosaicDefinition { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMMosaicDefinition { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMMosaicDefinition { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `NEMMosaicDefinition` + pub mod nemmosaic_definition { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy) + pub enum NEMMosaicLevy { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy.MosaicLevy_Absolute) + MosaicLevy_Absolute = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy.MosaicLevy_Percentile) + MosaicLevy_Percentile = 2, + } + + impl ::protobuf::Enum for NEMMosaicLevy { + const NAME: &'static str = "NEMMosaicLevy"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Absolute), + 2 => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Percentile), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "MosaicLevy_Absolute" => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Absolute), + "MosaicLevy_Percentile" => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Percentile), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [NEMMosaicLevy] = &[ + NEMMosaicLevy::MosaicLevy_Absolute, + NEMMosaicLevy::MosaicLevy_Percentile, + ]; + } + + impl ::protobuf::EnumFull for NEMMosaicLevy { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + NEMMosaicLevy::MosaicLevy_Absolute => 0, + NEMMosaicLevy::MosaicLevy_Percentile => 1, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for NEMMosaicLevy { + fn default() -> Self { + NEMMosaicLevy::MosaicLevy_Absolute + } + } + + impl NEMMosaicLevy { + pub(in super::super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy") + } + } + } + } + + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMMosaicSupplyChange { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.namespace) + pub namespace: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.mosaic) + pub mosaic: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.delta) + pub delta: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMMosaicSupplyChange { + fn default() -> &'a NEMMosaicSupplyChange { + ::default_instance() + } + } + + impl NEMMosaicSupplyChange { + pub fn new() -> NEMMosaicSupplyChange { + ::std::default::Default::default() + } + + // required string namespace = 1; + + pub fn namespace(&self) -> &str { + match self.namespace.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_namespace(&mut self) { + self.namespace = ::std::option::Option::None; + } + + pub fn has_namespace(&self) -> bool { + self.namespace.is_some() + } + + // Param is passed by value, moved + pub fn set_namespace(&mut self, v: ::std::string::String) { + self.namespace = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_namespace(&mut self) -> &mut ::std::string::String { + if self.namespace.is_none() { + self.namespace = ::std::option::Option::Some(::std::string::String::new()); + } + self.namespace.as_mut().unwrap() + } + + // Take field + pub fn take_namespace(&mut self) -> ::std::string::String { + self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string mosaic = 2; + + pub fn mosaic(&self) -> &str { + match self.mosaic.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_mosaic(&mut self) { + self.mosaic = ::std::option::Option::None; + } + + pub fn has_mosaic(&self) -> bool { + self.mosaic.is_some() + } + + // Param is passed by value, moved + pub fn set_mosaic(&mut self, v: ::std::string::String) { + self.mosaic = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mosaic(&mut self) -> &mut ::std::string::String { + if self.mosaic.is_none() { + self.mosaic = ::std::option::Option::Some(::std::string::String::new()); + } + self.mosaic.as_mut().unwrap() + } + + // Take field + pub fn take_mosaic(&mut self) -> ::std::string::String { + self.mosaic.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required .hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType type = 3; + + pub fn type_(&self) -> nemmosaic_supply_change::NEMSupplyChangeType { + match self.type_ { + Some(e) => e.enum_value_or(nemmosaic_supply_change::NEMSupplyChangeType::SupplyChange_Increase), + None => nemmosaic_supply_change::NEMSupplyChangeType::SupplyChange_Increase, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: nemmosaic_supply_change::NEMSupplyChangeType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required uint64 delta = 4; + + pub fn delta(&self) -> u64 { + self.delta.unwrap_or(0) + } + + pub fn clear_delta(&mut self) { + self.delta = ::std::option::Option::None; + } + + pub fn has_delta(&self) -> bool { + self.delta.is_some() + } + + // Param is passed by value, moved + pub fn set_delta(&mut self, v: u64) { + self.delta = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "namespace", + |m: &NEMMosaicSupplyChange| { &m.namespace }, + |m: &mut NEMMosaicSupplyChange| { &mut m.namespace }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mosaic", + |m: &NEMMosaicSupplyChange| { &m.mosaic }, + |m: &mut NEMMosaicSupplyChange| { &mut m.mosaic }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &NEMMosaicSupplyChange| { &m.type_ }, + |m: &mut NEMMosaicSupplyChange| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "delta", + |m: &NEMMosaicSupplyChange| { &m.delta }, + |m: &mut NEMMosaicSupplyChange| { &mut m.delta }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMMosaicSupplyChange", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMMosaicSupplyChange { + const NAME: &'static str = "NEMMosaicSupplyChange"; + + fn is_initialized(&self) -> bool { + if self.namespace.is_none() { + return false; + } + if self.mosaic.is_none() { + return false; + } + if self.type_.is_none() { + return false; + } + if self.delta.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.namespace = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.mosaic = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 32 => { + self.delta = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.namespace.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.mosaic.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(3, v.value()); + } + if let Some(v) = self.delta { + my_size += ::protobuf::rt::uint64_size(4, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.namespace.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.mosaic.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.type_ { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.delta { + os.write_uint64(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMMosaicSupplyChange { + NEMMosaicSupplyChange::new() + } + + fn clear(&mut self) { + self.namespace = ::std::option::Option::None; + self.mosaic = ::std::option::Option::None; + self.type_ = ::std::option::Option::None; + self.delta = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMMosaicSupplyChange { + static instance: NEMMosaicSupplyChange = NEMMosaicSupplyChange { + namespace: ::std::option::Option::None, + mosaic: ::std::option::Option::None, + type_: ::std::option::Option::None, + delta: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMMosaicSupplyChange { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMMosaicSupplyChange").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMMosaicSupplyChange { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMMosaicSupplyChange { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `NEMMosaicSupplyChange` + pub mod nemmosaic_supply_change { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType) + pub enum NEMSupplyChangeType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType.SupplyChange_Increase) + SupplyChange_Increase = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType.SupplyChange_Decrease) + SupplyChange_Decrease = 2, + } + + impl ::protobuf::Enum for NEMSupplyChangeType { + const NAME: &'static str = "NEMSupplyChangeType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Increase), + 2 => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Decrease), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SupplyChange_Increase" => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Increase), + "SupplyChange_Decrease" => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Decrease), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [NEMSupplyChangeType] = &[ + NEMSupplyChangeType::SupplyChange_Increase, + NEMSupplyChangeType::SupplyChange_Decrease, + ]; + } + + impl ::protobuf::EnumFull for NEMSupplyChangeType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + NEMSupplyChangeType::SupplyChange_Increase => 0, + NEMSupplyChangeType::SupplyChange_Decrease => 1, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for NEMSupplyChangeType { + fn default() -> Self { + NEMSupplyChangeType::SupplyChange_Increase + } + } + + impl NEMSupplyChangeType { + pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType") + } + } + } + + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMAggregateModification { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.modifications) + pub modifications: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.relative_change) + pub relative_change: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMAggregateModification { + fn default() -> &'a NEMAggregateModification { + ::default_instance() + } + } + + impl NEMAggregateModification { + pub fn new() -> NEMAggregateModification { + ::std::default::Default::default() + } + + // optional sint32 relative_change = 2; + + pub fn relative_change(&self) -> i32 { + self.relative_change.unwrap_or(0) + } + + pub fn clear_relative_change(&mut self) { + self.relative_change = ::std::option::Option::None; + } + + pub fn has_relative_change(&self) -> bool { + self.relative_change.is_some() + } + + // Param is passed by value, moved + pub fn set_relative_change(&mut self, v: i32) { + self.relative_change = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "modifications", + |m: &NEMAggregateModification| { &m.modifications }, + |m: &mut NEMAggregateModification| { &mut m.modifications }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "relative_change", + |m: &NEMAggregateModification| { &m.relative_change }, + |m: &mut NEMAggregateModification| { &mut m.relative_change }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMAggregateModification", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMAggregateModification { + const NAME: &'static str = "NEMAggregateModification"; + + fn is_initialized(&self) -> bool { + for v in &self.modifications { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.modifications.push(is.read_message()?); + }, + 16 => { + self.relative_change = ::std::option::Option::Some(is.read_sint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.modifications { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.relative_change { + my_size += ::protobuf::rt::sint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.modifications { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + if let Some(v) = self.relative_change { + os.write_sint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMAggregateModification { + NEMAggregateModification::new() + } + + fn clear(&mut self) { + self.modifications.clear(); + self.relative_change = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMAggregateModification { + static instance: NEMAggregateModification = NEMAggregateModification { + modifications: ::std::vec::Vec::new(), + relative_change: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMAggregateModification { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMAggregateModification").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMAggregateModification { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMAggregateModification { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `NEMAggregateModification` + pub mod nemaggregate_modification { + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMCosignatoryModification { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMCosignatoryModification { + fn default() -> &'a NEMCosignatoryModification { + ::default_instance() + } + } + + impl NEMCosignatoryModification { + pub fn new() -> NEMCosignatoryModification { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType type = 1; + + pub fn type_(&self) -> nemcosignatory_modification::NEMModificationType { + match self.type_ { + Some(e) => e.enum_value_or(nemcosignatory_modification::NEMModificationType::CosignatoryModification_Add), + None => nemcosignatory_modification::NEMModificationType::CosignatoryModification_Add, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: nemcosignatory_modification::NEMModificationType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required bytes public_key = 2; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &NEMCosignatoryModification| { &m.type_ }, + |m: &mut NEMCosignatoryModification| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &NEMCosignatoryModification| { &m.public_key }, + |m: &mut NEMCosignatoryModification| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMAggregateModification.NEMCosignatoryModification", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMCosignatoryModification { + const NAME: &'static str = "NEMCosignatoryModification"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMCosignatoryModification { + NEMCosignatoryModification::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMCosignatoryModification { + static instance: NEMCosignatoryModification = NEMCosignatoryModification { + type_: ::std::option::Option::None, + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMCosignatoryModification { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMAggregateModification.NEMCosignatoryModification").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMCosignatoryModification { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMCosignatoryModification { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `NEMCosignatoryModification` + pub mod nemcosignatory_modification { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType) + pub enum NEMModificationType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType.CosignatoryModification_Add) + CosignatoryModification_Add = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType.CosignatoryModification_Delete) + CosignatoryModification_Delete = 2, + } + + impl ::protobuf::Enum for NEMModificationType { + const NAME: &'static str = "NEMModificationType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Add), + 2 => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Delete), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "CosignatoryModification_Add" => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Add), + "CosignatoryModification_Delete" => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Delete), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [NEMModificationType] = &[ + NEMModificationType::CosignatoryModification_Add, + NEMModificationType::CosignatoryModification_Delete, + ]; + } + + impl ::protobuf::EnumFull for NEMModificationType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + NEMModificationType::CosignatoryModification_Add => 0, + NEMModificationType::CosignatoryModification_Delete => 1, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for NEMModificationType { + fn default() -> Self { + NEMModificationType::CosignatoryModification_Add + } + } + + impl NEMModificationType { + pub(in super::super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType") + } + } + } + } + + // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct NEMImportanceTransfer { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.mode) + pub mode: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a NEMImportanceTransfer { + fn default() -> &'a NEMImportanceTransfer { + ::default_instance() + } + } + + impl NEMImportanceTransfer { + pub fn new() -> NEMImportanceTransfer { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode mode = 1; + + pub fn mode(&self) -> nemimportance_transfer::NEMImportanceTransferMode { + match self.mode { + Some(e) => e.enum_value_or(nemimportance_transfer::NEMImportanceTransferMode::ImportanceTransfer_Activate), + None => nemimportance_transfer::NEMImportanceTransferMode::ImportanceTransfer_Activate, + } + } + + pub fn clear_mode(&mut self) { + self.mode = ::std::option::Option::None; + } + + pub fn has_mode(&self) -> bool { + self.mode.is_some() + } + + // Param is passed by value, moved + pub fn set_mode(&mut self, v: nemimportance_transfer::NEMImportanceTransferMode) { + self.mode = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required bytes public_key = 2; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "mode", + |m: &NEMImportanceTransfer| { &m.mode }, + |m: &mut NEMImportanceTransfer| { &mut m.mode }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &NEMImportanceTransfer| { &m.public_key }, + |m: &mut NEMImportanceTransfer| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignTx.NEMImportanceTransfer", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for NEMImportanceTransfer { + const NAME: &'static str = "NEMImportanceTransfer"; + + fn is_initialized(&self) -> bool { + if self.mode.is_none() { + return false; + } + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.mode = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.mode { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.mode { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMImportanceTransfer { + NEMImportanceTransfer::new() + } + + fn clear(&mut self) { + self.mode = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMImportanceTransfer { + static instance: NEMImportanceTransfer = NEMImportanceTransfer { + mode: ::std::option::Option::None, + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for NEMImportanceTransfer { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMImportanceTransfer").unwrap()).clone() + } + } + + impl ::std::fmt::Display for NEMImportanceTransfer { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for NEMImportanceTransfer { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `NEMImportanceTransfer` + pub mod nemimportance_transfer { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode) + pub enum NEMImportanceTransferMode { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode.ImportanceTransfer_Activate) + ImportanceTransfer_Activate = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode.ImportanceTransfer_Deactivate) + ImportanceTransfer_Deactivate = 2, + } + + impl ::protobuf::Enum for NEMImportanceTransferMode { + const NAME: &'static str = "NEMImportanceTransferMode"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Activate), + 2 => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Deactivate), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "ImportanceTransfer_Activate" => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Activate), + "ImportanceTransfer_Deactivate" => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Deactivate), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [NEMImportanceTransferMode] = &[ + NEMImportanceTransferMode::ImportanceTransfer_Activate, + NEMImportanceTransferMode::ImportanceTransfer_Deactivate, + ]; + } + + impl ::protobuf::EnumFull for NEMImportanceTransferMode { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = match self { + NEMImportanceTransferMode::ImportanceTransfer_Activate => 0, + NEMImportanceTransferMode::ImportanceTransfer_Deactivate => 1, + }; + Self::enum_descriptor().value_by_index(index) + } + } + + // Note, `Default` is implemented although default value is not 0 + impl ::std::default::Default for NEMImportanceTransferMode { + fn default() -> Self { + NEMImportanceTransferMode::ImportanceTransfer_Activate + } + } + + impl NEMImportanceTransferMode { + pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode") + } + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignedTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NEMSignedTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignedTx.data) + pub data: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignedTx.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignedTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NEMSignedTx { + fn default() -> &'a NEMSignedTx { + ::default_instance() + } +} + +impl NEMSignedTx { + pub fn new() -> NEMSignedTx { + ::std::default::Default::default() + } + + // required bytes data = 1; + + pub fn data(&self) -> &[u8] { + match self.data.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_data(&mut self) { + self.data = ::std::option::Option::None; + } + + pub fn has_data(&self) -> bool { + self.data.is_some() + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.data.as_mut().unwrap() + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "data", + |m: &NEMSignedTx| { &m.data }, + |m: &mut NEMSignedTx| { &mut m.data }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &NEMSignedTx| { &m.signature }, + |m: &mut NEMSignedTx| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMSignedTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NEMSignedTx { + const NAME: &'static str = "NEMSignedTx"; + + fn is_initialized(&self) -> bool { + if self.data.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.data = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.data.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMSignedTx { + NEMSignedTx::new() + } + + fn clear(&mut self) { + self.data = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMSignedTx { + static instance: NEMSignedTx = NEMSignedTx { + data: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NEMSignedTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMSignedTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NEMSignedTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NEMSignedTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMDecryptMessage) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NEMDecryptMessage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.network) + pub network: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.payload) + pub payload: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMDecryptMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NEMDecryptMessage { + fn default() -> &'a NEMDecryptMessage { + ::default_instance() + } +} + +impl NEMDecryptMessage { + pub fn new() -> NEMDecryptMessage { + ::std::default::Default::default() + } + + // optional uint32 network = 2; + + pub fn network(&self) -> u32 { + self.network.unwrap_or(0) + } + + pub fn clear_network(&mut self) { + self.network = ::std::option::Option::None; + } + + pub fn has_network(&self) -> bool { + self.network.is_some() + } + + // Param is passed by value, moved + pub fn set_network(&mut self, v: u32) { + self.network = ::std::option::Option::Some(v); + } + + // optional bytes public_key = 3; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes payload = 4; + + pub fn payload(&self) -> &[u8] { + match self.payload.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_payload(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_payload(&self) -> bool { + self.payload.is_some() + } + + // Param is passed by value, moved + pub fn set_payload(&mut self, v: ::std::vec::Vec) { + self.payload = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { + if self.payload.is_none() { + self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.payload.as_mut().unwrap() + } + + // Take field + pub fn take_payload(&mut self) -> ::std::vec::Vec { + self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &NEMDecryptMessage| { &m.address_n }, + |m: &mut NEMDecryptMessage| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network", + |m: &NEMDecryptMessage| { &m.network }, + |m: &mut NEMDecryptMessage| { &mut m.network }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &NEMDecryptMessage| { &m.public_key }, + |m: &mut NEMDecryptMessage| { &mut m.public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payload", + |m: &NEMDecryptMessage| { &m.payload }, + |m: &mut NEMDecryptMessage| { &mut m.payload }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMDecryptMessage", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NEMDecryptMessage { + const NAME: &'static str = "NEMDecryptMessage"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.network = ::std::option::Option::Some(is.read_uint32()?); + }, + 26 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + self.payload = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.network { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.payload.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.network { + os.write_uint32(2, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.payload.as_ref() { + os.write_bytes(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMDecryptMessage { + NEMDecryptMessage::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.network = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.payload = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMDecryptMessage { + static instance: NEMDecryptMessage = NEMDecryptMessage { + address_n: ::std::vec::Vec::new(), + network: ::std::option::Option::None, + public_key: ::std::option::Option::None, + payload: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NEMDecryptMessage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMDecryptMessage").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NEMDecryptMessage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NEMDecryptMessage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMDecryptedMessage) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NEMDecryptedMessage { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptedMessage.payload) + pub payload: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMDecryptedMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NEMDecryptedMessage { + fn default() -> &'a NEMDecryptedMessage { + ::default_instance() + } +} + +impl NEMDecryptedMessage { + pub fn new() -> NEMDecryptedMessage { + ::std::default::Default::default() + } + + // required bytes payload = 1; + + pub fn payload(&self) -> &[u8] { + match self.payload.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_payload(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_payload(&self) -> bool { + self.payload.is_some() + } + + // Param is passed by value, moved + pub fn set_payload(&mut self, v: ::std::vec::Vec) { + self.payload = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { + if self.payload.is_none() { + self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.payload.as_mut().unwrap() + } + + // Take field + pub fn take_payload(&mut self) -> ::std::vec::Vec { + self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "payload", + |m: &NEMDecryptedMessage| { &m.payload }, + |m: &mut NEMDecryptedMessage| { &mut m.payload }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NEMDecryptedMessage", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NEMDecryptedMessage { + const NAME: &'static str = "NEMDecryptedMessage"; + + fn is_initialized(&self) -> bool { + if self.payload.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.payload = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payload.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.payload.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NEMDecryptedMessage { + NEMDecryptedMessage::new() + } + + fn clear(&mut self) { + self.payload = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NEMDecryptedMessage { + static instance: NEMDecryptedMessage = NEMDecryptedMessage { + payload: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NEMDecryptedMessage { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMDecryptedMessage").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NEMDecryptedMessage { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NEMDecryptedMessage { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x12messages-nem.proto\x12\x16hw.trezor.messages.nem\"\x8a\x01\n\rNEMG\ + etAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1d\n\ + \x07network\x18\x02\x20\x01(\r:\x03104R\x07network\x12!\n\x0cshow_displa\ + y\x18\x03\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\x18\x04\x20\ + \x01(\x08R\x08chunkify\"&\n\nNEMAddress\x12\x18\n\x07address\x18\x01\x20\ + \x02(\tR\x07address\"\xa2\x19\n\tNEMSignTx\x12X\n\x0btransaction\x18\x01\ + \x20\x02(\x0b26.hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommonR\ + \x0btransaction\x12R\n\x08multisig\x18\x02\x20\x01(\x0b26.hw.trezor.mess\ + ages.nem.NEMSignTx.NEMTransactionCommonR\x08multisig\x12I\n\x08transfer\ + \x18\x03\x20\x01(\x0b2-.hw.trezor.messages.nem.NEMSignTx.NEMTransferR\ + \x08transfer\x12\x1c\n\tcosigning\x18\x04\x20\x01(\x08R\tcosigning\x12h\ + \n\x13provision_namespace\x18\x05\x20\x01(\x0b27.hw.trezor.messages.nem.\ + NEMSignTx.NEMProvisionNamespaceR\x12provisionNamespace\x12\\\n\x0fmosaic\ + _creation\x18\x06\x20\x01(\x0b23.hw.trezor.messages.nem.NEMSignTx.NEMMos\ + aicCreationR\x0emosaicCreation\x12\\\n\rsupply_change\x18\x07\x20\x01(\ + \x0b27.hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChangeR\x0csupply\ + Change\x12q\n\x16aggregate_modification\x18\x08\x20\x01(\x0b2:.hw.trezor\ + .messages.nem.NEMSignTx.NEMAggregateModificationR\x15aggregateModificati\ + on\x12h\n\x13importance_transfer\x18\t\x20\x01(\x0b27.hw.trezor.messages\ + .nem.NEMSignTx.NEMImportanceTransferR\x12importanceTransfer\x12\x1a\n\ + \x08chunkify\x18\n\x20\x01(\x08R\x08chunkify\x1a\xb6\x01\n\x14NEMTransac\ + tionCommon\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1d\ + \n\x07network\x18\x02\x20\x01(\r:\x03104R\x07network\x12\x1c\n\ttimestam\ + p\x18\x03\x20\x02(\rR\ttimestamp\x12\x10\n\x03fee\x18\x04\x20\x02(\x04R\ + \x03fee\x12\x1a\n\x08deadline\x18\x05\x20\x02(\rR\x08deadline\x12\x16\n\ + \x06signer\x18\x06\x20\x01(\x0cR\x06signer\x1a\xae\x02\n\x0bNEMTransfer\ + \x12\x1c\n\trecipient\x18\x01\x20\x02(\tR\trecipient\x12\x16\n\x06amount\ + \x18\x02\x20\x02(\x04R\x06amount\x12\x18\n\x07payload\x18\x03\x20\x01(\ + \x0cR\x07payload\x12\x1d\n\npublic_key\x18\x04\x20\x01(\x0cR\tpublicKey\ + \x12Q\n\x07mosaics\x18\x05\x20\x03(\x0b27.hw.trezor.messages.nem.NEMSign\ + Tx.NEMTransfer.NEMMosaicR\x07mosaics\x1a]\n\tNEMMosaic\x12\x1c\n\tnamesp\ + ace\x18\x01\x20\x02(\tR\tnamespace\x12\x16\n\x06mosaic\x18\x02\x20\x02(\ + \tR\x06mosaic\x12\x1a\n\x08quantity\x18\x03\x20\x02(\x04R\x08quantity\ + \x1as\n\x15NEMProvisionNamespace\x12\x1c\n\tnamespace\x18\x01\x20\x02(\t\ + R\tnamespace\x12\x16\n\x06parent\x18\x02\x20\x01(\tR\x06parent\x12\x12\n\ + \x04sink\x18\x03\x20\x02(\tR\x04sink\x12\x10\n\x03fee\x18\x04\x20\x02(\ + \x04R\x03fee\x1a\x8e\x06\n\x11NEMMosaicCreation\x12g\n\ndefinition\x18\ + \x01\x20\x02(\x0b2G.hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.N\ + EMMosaicDefinitionR\ndefinition\x12\x12\n\x04sink\x18\x02\x20\x02(\tR\ + \x04sink\x12\x10\n\x03fee\x18\x03\x20\x02(\x04R\x03fee\x1a\xe9\x04\n\x13\ + NEMMosaicDefinition\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\ + \x16\n\x06ticker\x18\x02\x20\x01(\tR\x06ticker\x12\x1c\n\tnamespace\x18\ + \x03\x20\x02(\tR\tnamespace\x12\x16\n\x06mosaic\x18\x04\x20\x02(\tR\x06m\ + osaic\x12\"\n\x0cdivisibility\x18\x05\x20\x01(\rR\x0cdivisibility\x12i\n\ + \x04levy\x18\x06\x20\x01(\x0e2U.hw.trezor.messages.nem.NEMSignTx.NEMMosa\ + icCreation.NEMMosaicDefinition.NEMMosaicLevyR\x04levy\x12\x10\n\x03fee\ + \x18\x07\x20\x01(\x04R\x03fee\x12!\n\x0clevy_address\x18\x08\x20\x01(\tR\ + \x0blevyAddress\x12%\n\x0elevy_namespace\x18\t\x20\x01(\tR\rlevyNamespac\ + e\x12\x1f\n\x0blevy_mosaic\x18\n\x20\x01(\tR\nlevyMosaic\x12\x16\n\x06su\ + pply\x18\x0b\x20\x01(\x04R\x06supply\x12%\n\x0emutable_supply\x18\x0c\ + \x20\x01(\x08R\rmutableSupply\x12\"\n\x0ctransferable\x18\r\x20\x01(\x08\ + R\x0ctransferable\x12\x20\n\x0bdescription\x18\x0e\x20\x02(\tR\x0bdescri\ + ption\x12\x1a\n\x08networks\x18\x0f\x20\x03(\rR\x08networks\"C\n\rNEMMos\ + aicLevy\x12\x17\n\x13MosaicLevy_Absolute\x10\x01\x12\x19\n\x15MosaicLevy\ + _Percentile\x10\x02\x1a\x91\x02\n\x15NEMMosaicSupplyChange\x12\x1c\n\tna\ + mespace\x18\x01\x20\x02(\tR\tnamespace\x12\x16\n\x06mosaic\x18\x02\x20\ + \x02(\tR\x06mosaic\x12_\n\x04type\x18\x03\x20\x02(\x0e2K.hw.trezor.messa\ + ges.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeTypeR\x04type\x12\ + \x14\n\x05delta\x18\x04\x20\x02(\x04R\x05delta\"K\n\x13NEMSupplyChangeTy\ + pe\x12\x19\n\x15SupplyChange_Increase\x10\x01\x12\x19\n\x15SupplyChange_\ + Decrease\x10\x02\x1a\xd9\x03\n\x18NEMAggregateModification\x12{\n\rmodif\ + ications\x18\x01\x20\x03(\x0b2U.hw.trezor.messages.nem.NEMSignTx.NEMAggr\ + egateModification.NEMCosignatoryModificationR\rmodifications\x12'\n\x0fr\ + elative_change\x18\x02\x20\x01(\x11R\x0erelativeChange\x1a\x96\x02\n\x1a\ + NEMCosignatoryModification\x12}\n\x04type\x18\x01\x20\x02(\x0e2i.hw.trez\ + or.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModific\ + ation.NEMModificationTypeR\x04type\x12\x1d\n\npublic_key\x18\x02\x20\x02\ + (\x0cR\tpublicKey\"Z\n\x13NEMModificationType\x12\x1f\n\x1bCosignatoryMo\ + dification_Add\x10\x01\x12\"\n\x1eCosignatoryModification_Delete\x10\x02\ + \x1a\xfe\x01\n\x15NEMImportanceTransfer\x12e\n\x04mode\x18\x01\x20\x02(\ + \x0e2Q.hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImporta\ + nceTransferModeR\x04mode\x12\x1d\n\npublic_key\x18\x02\x20\x02(\x0cR\tpu\ + blicKey\"_\n\x19NEMImportanceTransferMode\x12\x1f\n\x1bImportanceTransfe\ + r_Activate\x10\x01\x12!\n\x1dImportanceTransfer_Deactivate\x10\x02\"?\n\ + \x0bNEMSignedTx\x12\x12\n\x04data\x18\x01\x20\x02(\x0cR\x04data\x12\x1c\ + \n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\"\x83\x01\n\x11NEMDecrypt\ + Message\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\ + \x07network\x18\x02\x20\x01(\rR\x07network\x12\x1d\n\npublic_key\x18\x03\ + \x20\x01(\x0cR\tpublicKey\x12\x18\n\x07payload\x18\x04\x20\x01(\x0cR\x07\ + payload\"/\n\x13NEMDecryptedMessage\x12\x18\n\x07payload\x18\x01\x20\x02\ + (\x0cR\x07payloadB7\n#com.satoshilabs.trezor.lib.protobufB\x10TrezorMess\ + ageNem\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(16); + messages.push(NEMGetAddress::generated_message_descriptor_data()); + messages.push(NEMAddress::generated_message_descriptor_data()); + messages.push(NEMSignTx::generated_message_descriptor_data()); + messages.push(NEMSignedTx::generated_message_descriptor_data()); + messages.push(NEMDecryptMessage::generated_message_descriptor_data()); + messages.push(NEMDecryptedMessage::generated_message_descriptor_data()); + messages.push(nemsign_tx::NEMTransactionCommon::generated_message_descriptor_data()); + messages.push(nemsign_tx::NEMTransfer::generated_message_descriptor_data()); + messages.push(nemsign_tx::NEMProvisionNamespace::generated_message_descriptor_data()); + messages.push(nemsign_tx::NEMMosaicCreation::generated_message_descriptor_data()); + messages.push(nemsign_tx::NEMMosaicSupplyChange::generated_message_descriptor_data()); + messages.push(nemsign_tx::NEMAggregateModification::generated_message_descriptor_data()); + messages.push(nemsign_tx::NEMImportanceTransfer::generated_message_descriptor_data()); + messages.push(nemsign_tx::nemtransfer::NEMMosaic::generated_message_descriptor_data()); + messages.push(nemsign_tx::nemmosaic_creation::NEMMosaicDefinition::generated_message_descriptor_data()); + messages.push(nemsign_tx::nemaggregate_modification::NEMCosignatoryModification::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(4); + enums.push(nemsign_tx::nemmosaic_creation::nemmosaic_definition::NEMMosaicLevy::generated_enum_descriptor_data()); + enums.push(nemsign_tx::nemmosaic_supply_change::NEMSupplyChangeType::generated_enum_descriptor_data()); + enums.push(nemsign_tx::nemaggregate_modification::nemcosignatory_modification::NEMModificationType::generated_enum_descriptor_data()); + enums.push(nemsign_tx::nemimportance_transfer::NEMImportanceTransferMode::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_ripple.rs b/wallet/trezor-client/src/protos/generated/messages_ripple.rs new file mode 100644 index 0000000000..ab9a5487fe --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_ripple.rs @@ -0,0 +1,1241 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-ripple.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct RippleGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RippleGetAddress { + fn default() -> &'a RippleGetAddress { + ::default_instance() + } +} + +impl RippleGetAddress { + pub fn new() -> RippleGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &RippleGetAddress| { &m.address_n }, + |m: &mut RippleGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &RippleGetAddress| { &m.show_display }, + |m: &mut RippleGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &RippleGetAddress| { &m.chunkify }, + |m: &mut RippleGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "RippleGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for RippleGetAddress { + const NAME: &'static str = "RippleGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RippleGetAddress { + RippleGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RippleGetAddress { + static instance: RippleGetAddress = RippleGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for RippleGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RippleGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RippleGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct RippleAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RippleAddress { + fn default() -> &'a RippleAddress { + ::default_instance() + } +} + +impl RippleAddress { + pub fn new() -> RippleAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &RippleAddress| { &m.address }, + |m: &mut RippleAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "RippleAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for RippleAddress { + const NAME: &'static str = "RippleAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RippleAddress { + RippleAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RippleAddress { + static instance: RippleAddress = RippleAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for RippleAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RippleAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RippleAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct RippleSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.flags) + pub flags: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.last_ledger_sequence) + pub last_ledger_sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.payment) + pub payment: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RippleSignTx { + fn default() -> &'a RippleSignTx { + ::default_instance() + } +} + +impl RippleSignTx { + pub fn new() -> RippleSignTx { + ::std::default::Default::default() + } + + // required uint64 fee = 2; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // optional uint32 flags = 3; + + pub fn flags(&self) -> u32 { + self.flags.unwrap_or(0u32) + } + + pub fn clear_flags(&mut self) { + self.flags = ::std::option::Option::None; + } + + pub fn has_flags(&self) -> bool { + self.flags.is_some() + } + + // Param is passed by value, moved + pub fn set_flags(&mut self, v: u32) { + self.flags = ::std::option::Option::Some(v); + } + + // required uint32 sequence = 4; + + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(0) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); + } + + // optional uint32 last_ledger_sequence = 5; + + pub fn last_ledger_sequence(&self) -> u32 { + self.last_ledger_sequence.unwrap_or(0) + } + + pub fn clear_last_ledger_sequence(&mut self) { + self.last_ledger_sequence = ::std::option::Option::None; + } + + pub fn has_last_ledger_sequence(&self) -> bool { + self.last_ledger_sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_last_ledger_sequence(&mut self, v: u32) { + self.last_ledger_sequence = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 7; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &RippleSignTx| { &m.address_n }, + |m: &mut RippleSignTx| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &RippleSignTx| { &m.fee }, + |m: &mut RippleSignTx| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "flags", + |m: &RippleSignTx| { &m.flags }, + |m: &mut RippleSignTx| { &mut m.flags }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &RippleSignTx| { &m.sequence }, + |m: &mut RippleSignTx| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "last_ledger_sequence", + |m: &RippleSignTx| { &m.last_ledger_sequence }, + |m: &mut RippleSignTx| { &mut m.last_ledger_sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ripple_sign_tx::RipplePayment>( + "payment", + |m: &RippleSignTx| { &m.payment }, + |m: &mut RippleSignTx| { &mut m.payment }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &RippleSignTx| { &m.chunkify }, + |m: &mut RippleSignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "RippleSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for RippleSignTx { + const NAME: &'static str = "RippleSignTx"; + + fn is_initialized(&self) -> bool { + if self.fee.is_none() { + return false; + } + if self.sequence.is_none() { + return false; + } + if self.payment.is_none() { + return false; + } + for v in &self.payment { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.flags = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.last_ledger_sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 50 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.payment)?; + }, + 56 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.flags { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.last_ledger_sequence { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.payment.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.fee { + os.write_uint64(2, v)?; + } + if let Some(v) = self.flags { + os.write_uint32(3, v)?; + } + if let Some(v) = self.sequence { + os.write_uint32(4, v)?; + } + if let Some(v) = self.last_ledger_sequence { + os.write_uint32(5, v)?; + } + if let Some(v) = self.payment.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; + } + if let Some(v) = self.chunkify { + os.write_bool(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RippleSignTx { + RippleSignTx::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.fee = ::std::option::Option::None; + self.flags = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.last_ledger_sequence = ::std::option::Option::None; + self.payment.clear(); + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RippleSignTx { + static instance: RippleSignTx = RippleSignTx { + address_n: ::std::vec::Vec::new(), + fee: ::std::option::Option::None, + flags: ::std::option::Option::None, + sequence: ::std::option::Option::None, + last_ledger_sequence: ::std::option::Option::None, + payment: ::protobuf::MessageField::none(), + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for RippleSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RippleSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RippleSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `RippleSignTx` +pub mod ripple_sign_tx { + // @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleSignTx.RipplePayment) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct RipplePayment { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.destination) + pub destination: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.destination_tag) + pub destination_tag: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a RipplePayment { + fn default() -> &'a RipplePayment { + ::default_instance() + } + } + + impl RipplePayment { + pub fn new() -> RipplePayment { + ::std::default::Default::default() + } + + // required uint64 amount = 1; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // required string destination = 2; + + pub fn destination(&self) -> &str { + match self.destination.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination(&mut self) { + self.destination = ::std::option::Option::None; + } + + pub fn has_destination(&self) -> bool { + self.destination.is_some() + } + + // Param is passed by value, moved + pub fn set_destination(&mut self, v: ::std::string::String) { + self.destination = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination(&mut self) -> &mut ::std::string::String { + if self.destination.is_none() { + self.destination = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination.as_mut().unwrap() + } + + // Take field + pub fn take_destination(&mut self) -> ::std::string::String { + self.destination.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 destination_tag = 3; + + pub fn destination_tag(&self) -> u32 { + self.destination_tag.unwrap_or(0) + } + + pub fn clear_destination_tag(&mut self) { + self.destination_tag = ::std::option::Option::None; + } + + pub fn has_destination_tag(&self) -> bool { + self.destination_tag.is_some() + } + + // Param is passed by value, moved + pub fn set_destination_tag(&mut self, v: u32) { + self.destination_tag = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &RipplePayment| { &m.amount }, + |m: &mut RipplePayment| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination", + |m: &RipplePayment| { &m.destination }, + |m: &mut RipplePayment| { &mut m.destination }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination_tag", + |m: &RipplePayment| { &m.destination_tag }, + |m: &mut RipplePayment| { &mut m.destination_tag }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "RippleSignTx.RipplePayment", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for RipplePayment { + const NAME: &'static str = "RipplePayment"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + if self.destination.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 18 => { + self.destination = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.destination_tag = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.destination.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.destination_tag { + my_size += ::protobuf::rt::uint32_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount { + os.write_uint64(1, v)?; + } + if let Some(v) = self.destination.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.destination_tag { + os.write_uint32(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RipplePayment { + RipplePayment::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.destination = ::std::option::Option::None; + self.destination_tag = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RipplePayment { + static instance: RipplePayment = RipplePayment { + amount: ::std::option::Option::None, + destination: ::std::option::Option::None, + destination_tag: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for RipplePayment { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("RippleSignTx.RipplePayment").unwrap()).clone() + } + } + + impl ::std::fmt::Display for RipplePayment { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for RipplePayment { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleSignedTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct RippleSignedTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignedTx.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignedTx.serialized_tx) + pub serialized_tx: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleSignedTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RippleSignedTx { + fn default() -> &'a RippleSignedTx { + ::default_instance() + } +} + +impl RippleSignedTx { + pub fn new() -> RippleSignedTx { + ::std::default::Default::default() + } + + // required bytes signature = 1; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes serialized_tx = 2; + + pub fn serialized_tx(&self) -> &[u8] { + match self.serialized_tx.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_serialized_tx(&mut self) { + self.serialized_tx = ::std::option::Option::None; + } + + pub fn has_serialized_tx(&self) -> bool { + self.serialized_tx.is_some() + } + + // Param is passed by value, moved + pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { + self.serialized_tx = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { + if self.serialized_tx.is_none() { + self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.serialized_tx.as_mut().unwrap() + } + + // Take field + pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { + self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &RippleSignedTx| { &m.signature }, + |m: &mut RippleSignedTx| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "serialized_tx", + |m: &RippleSignedTx| { &m.serialized_tx }, + |m: &mut RippleSignedTx| { &mut m.serialized_tx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "RippleSignedTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for RippleSignedTx { + const NAME: &'static str = "RippleSignedTx"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + if self.serialized_tx.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.serialized_tx.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.serialized_tx.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> RippleSignedTx { + RippleSignedTx::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.serialized_tx = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RippleSignedTx { + static instance: RippleSignedTx = RippleSignedTx { + signature: ::std::option::Option::None, + serialized_tx: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for RippleSignedTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleSignedTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RippleSignedTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RippleSignedTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x15messages-ripple.proto\x12\x19hw.trezor.messages.ripple\"n\n\x10Rip\ + pleGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\ + \n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chu\ + nkify\x18\x03\x20\x01(\x08R\x08chunkify\")\n\rRippleAddress\x12\x18\n\ + \x07address\x18\x01\x20\x02(\tR\x07address\"\x85\x03\n\x0cRippleSignTx\ + \x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x10\n\x03fee\ + \x18\x02\x20\x02(\x04R\x03fee\x12\x17\n\x05flags\x18\x03\x20\x01(\r:\x01\ + 0R\x05flags\x12\x1a\n\x08sequence\x18\x04\x20\x02(\rR\x08sequence\x120\n\ + \x14last_ledger_sequence\x18\x05\x20\x01(\rR\x12lastLedgerSequence\x12O\ + \n\x07payment\x18\x06\x20\x02(\x0b25.hw.trezor.messages.ripple.RippleSig\ + nTx.RipplePaymentR\x07payment\x12\x1a\n\x08chunkify\x18\x07\x20\x01(\x08\ + R\x08chunkify\x1ar\n\rRipplePayment\x12\x16\n\x06amount\x18\x01\x20\x02(\ + \x04R\x06amount\x12\x20\n\x0bdestination\x18\x02\x20\x02(\tR\x0bdestinat\ + ion\x12'\n\x0fdestination_tag\x18\x03\x20\x01(\rR\x0edestinationTag\"S\n\ + \x0eRippleSignedTx\x12\x1c\n\tsignature\x18\x01\x20\x02(\x0cR\tsignature\ + \x12#\n\rserialized_tx\x18\x02\x20\x02(\x0cR\x0cserializedTxB:\n#com.sat\ + oshilabs.trezor.lib.protobufB\x13TrezorMessageRipple\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(5); + messages.push(RippleGetAddress::generated_message_descriptor_data()); + messages.push(RippleAddress::generated_message_descriptor_data()); + messages.push(RippleSignTx::generated_message_descriptor_data()); + messages.push(RippleSignedTx::generated_message_descriptor_data()); + messages.push(ripple_sign_tx::RipplePayment::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_solana.rs b/wallet/trezor-client/src/protos/generated/messages_solana.rs new file mode 100644 index 0000000000..38d4ba81aa --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_solana.rs @@ -0,0 +1,1594 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-solana.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaGetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaGetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetPublicKey.show_display) + pub show_display: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaGetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaGetPublicKey { + fn default() -> &'a SolanaGetPublicKey { + ::default_instance() + } +} + +impl SolanaGetPublicKey { + pub fn new() -> SolanaGetPublicKey { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &SolanaGetPublicKey| { &m.address_n }, + |m: &mut SolanaGetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &SolanaGetPublicKey| { &m.show_display }, + |m: &mut SolanaGetPublicKey| { &mut m.show_display }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaGetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaGetPublicKey { + const NAME: &'static str = "SolanaGetPublicKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaGetPublicKey { + SolanaGetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaGetPublicKey { + static instance: SolanaGetPublicKey = SolanaGetPublicKey { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaGetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaGetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaGetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaGetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaPublicKey.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaPublicKey { + fn default() -> &'a SolanaPublicKey { + ::default_instance() + } +} + +impl SolanaPublicKey { + pub fn new() -> SolanaPublicKey { + ::std::default::Default::default() + } + + // required bytes public_key = 1; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &SolanaPublicKey| { &m.public_key }, + |m: &mut SolanaPublicKey| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaPublicKey { + const NAME: &'static str = "SolanaPublicKey"; + + fn is_initialized(&self) -> bool { + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaPublicKey { + SolanaPublicKey::new() + } + + fn clear(&mut self) { + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaPublicKey { + static instance: SolanaPublicKey = SolanaPublicKey { + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaGetAddress { + fn default() -> &'a SolanaGetAddress { + ::default_instance() + } +} + +impl SolanaGetAddress { + pub fn new() -> SolanaGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &SolanaGetAddress| { &m.address_n }, + |m: &mut SolanaGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &SolanaGetAddress| { &m.show_display }, + |m: &mut SolanaGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &SolanaGetAddress| { &m.chunkify }, + |m: &mut SolanaGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaGetAddress { + const NAME: &'static str = "SolanaGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaGetAddress { + SolanaGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaGetAddress { + static instance: SolanaGetAddress = SolanaGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaAddress { + fn default() -> &'a SolanaAddress { + ::default_instance() + } +} + +impl SolanaAddress { + pub fn new() -> SolanaAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &SolanaAddress| { &m.address }, + |m: &mut SolanaAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaAddress { + const NAME: &'static str = "SolanaAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaAddress { + SolanaAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaAddress { + static instance: SolanaAddress = SolanaAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaTxTokenAccountInfo) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaTxTokenAccountInfo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.base_address) + pub base_address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.token_program) + pub token_program: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.token_mint) + pub token_mint: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.token_account) + pub token_account: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaTxTokenAccountInfo { + fn default() -> &'a SolanaTxTokenAccountInfo { + ::default_instance() + } +} + +impl SolanaTxTokenAccountInfo { + pub fn new() -> SolanaTxTokenAccountInfo { + ::std::default::Default::default() + } + + // required string base_address = 1; + + pub fn base_address(&self) -> &str { + match self.base_address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_base_address(&mut self) { + self.base_address = ::std::option::Option::None; + } + + pub fn has_base_address(&self) -> bool { + self.base_address.is_some() + } + + // Param is passed by value, moved + pub fn set_base_address(&mut self, v: ::std::string::String) { + self.base_address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_base_address(&mut self) -> &mut ::std::string::String { + if self.base_address.is_none() { + self.base_address = ::std::option::Option::Some(::std::string::String::new()); + } + self.base_address.as_mut().unwrap() + } + + // Take field + pub fn take_base_address(&mut self) -> ::std::string::String { + self.base_address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string token_program = 2; + + pub fn token_program(&self) -> &str { + match self.token_program.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_token_program(&mut self) { + self.token_program = ::std::option::Option::None; + } + + pub fn has_token_program(&self) -> bool { + self.token_program.is_some() + } + + // Param is passed by value, moved + pub fn set_token_program(&mut self, v: ::std::string::String) { + self.token_program = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_program(&mut self) -> &mut ::std::string::String { + if self.token_program.is_none() { + self.token_program = ::std::option::Option::Some(::std::string::String::new()); + } + self.token_program.as_mut().unwrap() + } + + // Take field + pub fn take_token_program(&mut self) -> ::std::string::String { + self.token_program.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string token_mint = 3; + + pub fn token_mint(&self) -> &str { + match self.token_mint.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_token_mint(&mut self) { + self.token_mint = ::std::option::Option::None; + } + + pub fn has_token_mint(&self) -> bool { + self.token_mint.is_some() + } + + // Param is passed by value, moved + pub fn set_token_mint(&mut self, v: ::std::string::String) { + self.token_mint = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_mint(&mut self) -> &mut ::std::string::String { + if self.token_mint.is_none() { + self.token_mint = ::std::option::Option::Some(::std::string::String::new()); + } + self.token_mint.as_mut().unwrap() + } + + // Take field + pub fn take_token_mint(&mut self) -> ::std::string::String { + self.token_mint.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string token_account = 4; + + pub fn token_account(&self) -> &str { + match self.token_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_token_account(&mut self) { + self.token_account = ::std::option::Option::None; + } + + pub fn has_token_account(&self) -> bool { + self.token_account.is_some() + } + + // Param is passed by value, moved + pub fn set_token_account(&mut self, v: ::std::string::String) { + self.token_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_account(&mut self) -> &mut ::std::string::String { + if self.token_account.is_none() { + self.token_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.token_account.as_mut().unwrap() + } + + // Take field + pub fn take_token_account(&mut self) -> ::std::string::String { + self.token_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "base_address", + |m: &SolanaTxTokenAccountInfo| { &m.base_address }, + |m: &mut SolanaTxTokenAccountInfo| { &mut m.base_address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_program", + |m: &SolanaTxTokenAccountInfo| { &m.token_program }, + |m: &mut SolanaTxTokenAccountInfo| { &mut m.token_program }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_mint", + |m: &SolanaTxTokenAccountInfo| { &m.token_mint }, + |m: &mut SolanaTxTokenAccountInfo| { &mut m.token_mint }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_account", + |m: &SolanaTxTokenAccountInfo| { &m.token_account }, + |m: &mut SolanaTxTokenAccountInfo| { &mut m.token_account }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaTxTokenAccountInfo", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaTxTokenAccountInfo { + const NAME: &'static str = "SolanaTxTokenAccountInfo"; + + fn is_initialized(&self) -> bool { + if self.base_address.is_none() { + return false; + } + if self.token_program.is_none() { + return false; + } + if self.token_mint.is_none() { + return false; + } + if self.token_account.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.base_address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.token_program = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.token_mint = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.token_account = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.base_address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.token_program.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.token_mint.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.token_account.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.base_address.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.token_program.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.token_mint.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.token_account.as_ref() { + os.write_string(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaTxTokenAccountInfo { + SolanaTxTokenAccountInfo::new() + } + + fn clear(&mut self) { + self.base_address = ::std::option::Option::None; + self.token_program = ::std::option::Option::None; + self.token_mint = ::std::option::Option::None; + self.token_account = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaTxTokenAccountInfo { + static instance: SolanaTxTokenAccountInfo = SolanaTxTokenAccountInfo { + base_address: ::std::option::Option::None, + token_program: ::std::option::Option::None, + token_mint: ::std::option::Option::None, + token_account: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaTxTokenAccountInfo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaTxTokenAccountInfo").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaTxTokenAccountInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaTxTokenAccountInfo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaTxAdditionalInfo) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaTxAdditionalInfo { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.token_accounts_infos) + pub token_accounts_infos: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaTxAdditionalInfo { + fn default() -> &'a SolanaTxAdditionalInfo { + ::default_instance() + } +} + +impl SolanaTxAdditionalInfo { + pub fn new() -> SolanaTxAdditionalInfo { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "token_accounts_infos", + |m: &SolanaTxAdditionalInfo| { &m.token_accounts_infos }, + |m: &mut SolanaTxAdditionalInfo| { &mut m.token_accounts_infos }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaTxAdditionalInfo", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaTxAdditionalInfo { + const NAME: &'static str = "SolanaTxAdditionalInfo"; + + fn is_initialized(&self) -> bool { + for v in &self.token_accounts_infos { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_accounts_infos.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.token_accounts_infos { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.token_accounts_infos { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaTxAdditionalInfo { + SolanaTxAdditionalInfo::new() + } + + fn clear(&mut self) { + self.token_accounts_infos.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaTxAdditionalInfo { + static instance: SolanaTxAdditionalInfo = SolanaTxAdditionalInfo { + token_accounts_infos: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaTxAdditionalInfo { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaTxAdditionalInfo").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaTxAdditionalInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaTxAdditionalInfo { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaSignTx.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaSignTx.serialized_tx) + pub serialized_tx: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaSignTx.additional_info) + pub additional_info: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaSignTx { + fn default() -> &'a SolanaSignTx { + ::default_instance() + } +} + +impl SolanaSignTx { + pub fn new() -> SolanaSignTx { + ::std::default::Default::default() + } + + // required bytes serialized_tx = 2; + + pub fn serialized_tx(&self) -> &[u8] { + match self.serialized_tx.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_serialized_tx(&mut self) { + self.serialized_tx = ::std::option::Option::None; + } + + pub fn has_serialized_tx(&self) -> bool { + self.serialized_tx.is_some() + } + + // Param is passed by value, moved + pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { + self.serialized_tx = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { + if self.serialized_tx.is_none() { + self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.serialized_tx.as_mut().unwrap() + } + + // Take field + pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { + self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &SolanaSignTx| { &m.address_n }, + |m: &mut SolanaSignTx| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "serialized_tx", + |m: &SolanaSignTx| { &m.serialized_tx }, + |m: &mut SolanaSignTx| { &mut m.serialized_tx }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, SolanaTxAdditionalInfo>( + "additional_info", + |m: &SolanaSignTx| { &m.additional_info }, + |m: &mut SolanaSignTx| { &mut m.additional_info }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaSignTx { + const NAME: &'static str = "SolanaSignTx"; + + fn is_initialized(&self) -> bool { + if self.serialized_tx.is_none() { + return false; + } + for v in &self.additional_info { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.additional_info)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.serialized_tx.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.additional_info.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.serialized_tx.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.additional_info.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaSignTx { + SolanaSignTx::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.serialized_tx = ::std::option::Option::None; + self.additional_info.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaSignTx { + static instance: SolanaSignTx = SolanaSignTx { + address_n: ::std::vec::Vec::new(), + serialized_tx: ::std::option::Option::None, + additional_info: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaTxSignature) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct SolanaTxSignature { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxSignature.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxSignature.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SolanaTxSignature { + fn default() -> &'a SolanaTxSignature { + ::default_instance() + } +} + +impl SolanaTxSignature { + pub fn new() -> SolanaTxSignature { + ::std::default::Default::default() + } + + // required bytes signature = 1; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &SolanaTxSignature| { &m.signature }, + |m: &mut SolanaTxSignature| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "SolanaTxSignature", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for SolanaTxSignature { + const NAME: &'static str = "SolanaTxSignature"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> SolanaTxSignature { + SolanaTxSignature::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SolanaTxSignature { + static instance: SolanaTxSignature = SolanaTxSignature { + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for SolanaTxSignature { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaTxSignature").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SolanaTxSignature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SolanaTxSignature { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x15messages-solana.proto\x12\x19hw.trezor.messages.solana\"T\n\x12Sol\ + anaGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\ + !\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"0\n\x0fSolanaP\ + ublicKey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\"n\n\x10\ + SolanaGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ + \x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\ + \x08chunkify\x18\x03\x20\x01(\x08R\x08chunkify\")\n\rSolanaAddress\x12\ + \x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"\xa6\x01\n\x18SolanaTx\ + TokenAccountInfo\x12!\n\x0cbase_address\x18\x01\x20\x02(\tR\x0bbaseAddre\ + ss\x12#\n\rtoken_program\x18\x02\x20\x02(\tR\x0ctokenProgram\x12\x1d\n\n\ + token_mint\x18\x03\x20\x02(\tR\ttokenMint\x12#\n\rtoken_account\x18\x04\ + \x20\x02(\tR\x0ctokenAccount\"\x7f\n\x16SolanaTxAdditionalInfo\x12e\n\ + \x14token_accounts_infos\x18\x01\x20\x03(\x0b23.hw.trezor.messages.solan\ + a.SolanaTxTokenAccountInfoR\x12tokenAccountsInfos\"\xac\x01\n\x0cSolanaS\ + ignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12#\n\rseria\ + lized_tx\x18\x02\x20\x02(\x0cR\x0cserializedTx\x12Z\n\x0fadditional_info\ + \x18\x03\x20\x01(\x0b21.hw.trezor.messages.solana.SolanaTxAdditionalInfo\ + R\x0eadditionalInfo\"1\n\x11SolanaTxSignature\x12\x1c\n\tsignature\x18\ + \x01\x20\x02(\x0cR\tsignature\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(8); + messages.push(SolanaGetPublicKey::generated_message_descriptor_data()); + messages.push(SolanaPublicKey::generated_message_descriptor_data()); + messages.push(SolanaGetAddress::generated_message_descriptor_data()); + messages.push(SolanaAddress::generated_message_descriptor_data()); + messages.push(SolanaTxTokenAccountInfo::generated_message_descriptor_data()); + messages.push(SolanaTxAdditionalInfo::generated_message_descriptor_data()); + messages.push(SolanaSignTx::generated_message_descriptor_data()); + messages.push(SolanaTxSignature::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_stellar.rs b/wallet/trezor-client/src/protos/generated/messages_stellar.rs new file mode 100644 index 0000000000..e9fa8fa9e9 --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_stellar.rs @@ -0,0 +1,6413 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-stellar.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAsset) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarAsset { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAsset.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAsset.code) + pub code: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAsset.issuer) + pub issuer: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAsset.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarAsset { + fn default() -> &'a StellarAsset { + ::default_instance() + } +} + +impl StellarAsset { + pub fn new() -> StellarAsset { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.stellar.StellarAssetType type = 1; + + pub fn type_(&self) -> StellarAssetType { + match self.type_ { + Some(e) => e.enum_value_or(StellarAssetType::NATIVE), + None => StellarAssetType::NATIVE, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: StellarAssetType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional string code = 2; + + pub fn code(&self) -> &str { + match self.code.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_code(&mut self) { + self.code = ::std::option::Option::None; + } + + pub fn has_code(&self) -> bool { + self.code.is_some() + } + + // Param is passed by value, moved + pub fn set_code(&mut self, v: ::std::string::String) { + self.code = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_code(&mut self) -> &mut ::std::string::String { + if self.code.is_none() { + self.code = ::std::option::Option::Some(::std::string::String::new()); + } + self.code.as_mut().unwrap() + } + + // Take field + pub fn take_code(&mut self) -> ::std::string::String { + self.code.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string issuer = 3; + + pub fn issuer(&self) -> &str { + match self.issuer.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_issuer(&mut self) { + self.issuer = ::std::option::Option::None; + } + + pub fn has_issuer(&self) -> bool { + self.issuer.is_some() + } + + // Param is passed by value, moved + pub fn set_issuer(&mut self, v: ::std::string::String) { + self.issuer = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_issuer(&mut self) -> &mut ::std::string::String { + if self.issuer.is_none() { + self.issuer = ::std::option::Option::Some(::std::string::String::new()); + } + self.issuer.as_mut().unwrap() + } + + // Take field + pub fn take_issuer(&mut self) -> ::std::string::String { + self.issuer.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &StellarAsset| { &m.type_ }, + |m: &mut StellarAsset| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "code", + |m: &StellarAsset| { &m.code }, + |m: &mut StellarAsset| { &mut m.code }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "issuer", + |m: &StellarAsset| { &m.issuer }, + |m: &mut StellarAsset| { &mut m.issuer }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarAsset", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarAsset { + const NAME: &'static str = "StellarAsset"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.code = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.issuer = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.code.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.issuer.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.code.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.issuer.as_ref() { + os.write_string(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarAsset { + StellarAsset::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.code = ::std::option::Option::None; + self.issuer = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarAsset { + static instance: StellarAsset = StellarAsset { + type_: ::std::option::Option::None, + code: ::std::option::Option::None, + issuer: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarAsset { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAsset").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarAsset { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarAsset { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarGetAddress { + fn default() -> &'a StellarGetAddress { + ::default_instance() + } +} + +impl StellarGetAddress { + pub fn new() -> StellarGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &StellarGetAddress| { &m.address_n }, + |m: &mut StellarGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &StellarGetAddress| { &m.show_display }, + |m: &mut StellarGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &StellarGetAddress| { &m.chunkify }, + |m: &mut StellarGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarGetAddress { + const NAME: &'static str = "StellarGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarGetAddress { + StellarGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarGetAddress { + static instance: StellarGetAddress = StellarGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarAddress { + fn default() -> &'a StellarAddress { + ::default_instance() + } +} + +impl StellarAddress { + pub fn new() -> StellarAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &StellarAddress| { &m.address }, + |m: &mut StellarAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarAddress { + const NAME: &'static str = "StellarAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarAddress { + StellarAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarAddress { + static instance: StellarAddress = StellarAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.network_passphrase) + pub network_passphrase: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.sequence_number) + pub sequence_number: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.timebounds_start) + pub timebounds_start: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.timebounds_end) + pub timebounds_end: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_type) + pub memo_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_text) + pub memo_text: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_id) + pub memo_id: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_hash) + pub memo_hash: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.num_operations) + pub num_operations: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarSignTx { + fn default() -> &'a StellarSignTx { + ::default_instance() + } +} + +impl StellarSignTx { + pub fn new() -> StellarSignTx { + ::std::default::Default::default() + } + + // required string network_passphrase = 3; + + pub fn network_passphrase(&self) -> &str { + match self.network_passphrase.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_network_passphrase(&mut self) { + self.network_passphrase = ::std::option::Option::None; + } + + pub fn has_network_passphrase(&self) -> bool { + self.network_passphrase.is_some() + } + + // Param is passed by value, moved + pub fn set_network_passphrase(&mut self, v: ::std::string::String) { + self.network_passphrase = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_network_passphrase(&mut self) -> &mut ::std::string::String { + if self.network_passphrase.is_none() { + self.network_passphrase = ::std::option::Option::Some(::std::string::String::new()); + } + self.network_passphrase.as_mut().unwrap() + } + + // Take field + pub fn take_network_passphrase(&mut self) -> ::std::string::String { + self.network_passphrase.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string source_account = 4; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint32 fee = 5; + + pub fn fee(&self) -> u32 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u32) { + self.fee = ::std::option::Option::Some(v); + } + + // required uint64 sequence_number = 6; + + pub fn sequence_number(&self) -> u64 { + self.sequence_number.unwrap_or(0) + } + + pub fn clear_sequence_number(&mut self) { + self.sequence_number = ::std::option::Option::None; + } + + pub fn has_sequence_number(&self) -> bool { + self.sequence_number.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence_number(&mut self, v: u64) { + self.sequence_number = ::std::option::Option::Some(v); + } + + // required uint32 timebounds_start = 8; + + pub fn timebounds_start(&self) -> u32 { + self.timebounds_start.unwrap_or(0) + } + + pub fn clear_timebounds_start(&mut self) { + self.timebounds_start = ::std::option::Option::None; + } + + pub fn has_timebounds_start(&self) -> bool { + self.timebounds_start.is_some() + } + + // Param is passed by value, moved + pub fn set_timebounds_start(&mut self, v: u32) { + self.timebounds_start = ::std::option::Option::Some(v); + } + + // required uint32 timebounds_end = 9; + + pub fn timebounds_end(&self) -> u32 { + self.timebounds_end.unwrap_or(0) + } + + pub fn clear_timebounds_end(&mut self) { + self.timebounds_end = ::std::option::Option::None; + } + + pub fn has_timebounds_end(&self) -> bool { + self.timebounds_end.is_some() + } + + // Param is passed by value, moved + pub fn set_timebounds_end(&mut self, v: u32) { + self.timebounds_end = ::std::option::Option::Some(v); + } + + // required .hw.trezor.messages.stellar.StellarSignTx.StellarMemoType memo_type = 10; + + pub fn memo_type(&self) -> stellar_sign_tx::StellarMemoType { + match self.memo_type { + Some(e) => e.enum_value_or(stellar_sign_tx::StellarMemoType::NONE), + None => stellar_sign_tx::StellarMemoType::NONE, + } + } + + pub fn clear_memo_type(&mut self) { + self.memo_type = ::std::option::Option::None; + } + + pub fn has_memo_type(&self) -> bool { + self.memo_type.is_some() + } + + // Param is passed by value, moved + pub fn set_memo_type(&mut self, v: stellar_sign_tx::StellarMemoType) { + self.memo_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional string memo_text = 11; + + pub fn memo_text(&self) -> &str { + match self.memo_text.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_memo_text(&mut self) { + self.memo_text = ::std::option::Option::None; + } + + pub fn has_memo_text(&self) -> bool { + self.memo_text.is_some() + } + + // Param is passed by value, moved + pub fn set_memo_text(&mut self, v: ::std::string::String) { + self.memo_text = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_memo_text(&mut self) -> &mut ::std::string::String { + if self.memo_text.is_none() { + self.memo_text = ::std::option::Option::Some(::std::string::String::new()); + } + self.memo_text.as_mut().unwrap() + } + + // Take field + pub fn take_memo_text(&mut self) -> ::std::string::String { + self.memo_text.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint64 memo_id = 12; + + pub fn memo_id(&self) -> u64 { + self.memo_id.unwrap_or(0) + } + + pub fn clear_memo_id(&mut self) { + self.memo_id = ::std::option::Option::None; + } + + pub fn has_memo_id(&self) -> bool { + self.memo_id.is_some() + } + + // Param is passed by value, moved + pub fn set_memo_id(&mut self, v: u64) { + self.memo_id = ::std::option::Option::Some(v); + } + + // optional bytes memo_hash = 13; + + pub fn memo_hash(&self) -> &[u8] { + match self.memo_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_memo_hash(&mut self) { + self.memo_hash = ::std::option::Option::None; + } + + pub fn has_memo_hash(&self) -> bool { + self.memo_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_memo_hash(&mut self, v: ::std::vec::Vec) { + self.memo_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_memo_hash(&mut self) -> &mut ::std::vec::Vec { + if self.memo_hash.is_none() { + self.memo_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.memo_hash.as_mut().unwrap() + } + + // Take field + pub fn take_memo_hash(&mut self) -> ::std::vec::Vec { + self.memo_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 num_operations = 14; + + pub fn num_operations(&self) -> u32 { + self.num_operations.unwrap_or(0) + } + + pub fn clear_num_operations(&mut self) { + self.num_operations = ::std::option::Option::None; + } + + pub fn has_num_operations(&self) -> bool { + self.num_operations.is_some() + } + + // Param is passed by value, moved + pub fn set_num_operations(&mut self, v: u32) { + self.num_operations = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(12); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &StellarSignTx| { &m.address_n }, + |m: &mut StellarSignTx| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "network_passphrase", + |m: &StellarSignTx| { &m.network_passphrase }, + |m: &mut StellarSignTx| { &mut m.network_passphrase }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarSignTx| { &m.source_account }, + |m: &mut StellarSignTx| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &StellarSignTx| { &m.fee }, + |m: &mut StellarSignTx| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence_number", + |m: &StellarSignTx| { &m.sequence_number }, + |m: &mut StellarSignTx| { &mut m.sequence_number }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "timebounds_start", + |m: &StellarSignTx| { &m.timebounds_start }, + |m: &mut StellarSignTx| { &mut m.timebounds_start }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "timebounds_end", + |m: &StellarSignTx| { &m.timebounds_end }, + |m: &mut StellarSignTx| { &mut m.timebounds_end }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memo_type", + |m: &StellarSignTx| { &m.memo_type }, + |m: &mut StellarSignTx| { &mut m.memo_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memo_text", + |m: &StellarSignTx| { &m.memo_text }, + |m: &mut StellarSignTx| { &mut m.memo_text }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memo_id", + |m: &StellarSignTx| { &m.memo_id }, + |m: &mut StellarSignTx| { &mut m.memo_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "memo_hash", + |m: &StellarSignTx| { &m.memo_hash }, + |m: &mut StellarSignTx| { &mut m.memo_hash }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "num_operations", + |m: &StellarSignTx| { &m.num_operations }, + |m: &mut StellarSignTx| { &mut m.num_operations }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarSignTx { + const NAME: &'static str = "StellarSignTx"; + + fn is_initialized(&self) -> bool { + if self.network_passphrase.is_none() { + return false; + } + if self.source_account.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + if self.sequence_number.is_none() { + return false; + } + if self.timebounds_start.is_none() { + return false; + } + if self.timebounds_end.is_none() { + return false; + } + if self.memo_type.is_none() { + return false; + } + if self.num_operations.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 26 => { + self.network_passphrase = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 40 => { + self.fee = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.sequence_number = ::std::option::Option::Some(is.read_uint64()?); + }, + 64 => { + self.timebounds_start = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.timebounds_end = ::std::option::Option::Some(is.read_uint32()?); + }, + 80 => { + self.memo_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 90 => { + self.memo_text = ::std::option::Option::Some(is.read_string()?); + }, + 96 => { + self.memo_id = ::std::option::Option::Some(is.read_uint64()?); + }, + 106 => { + self.memo_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + 112 => { + self.num_operations = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.network_passphrase.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.sequence_number { + my_size += ::protobuf::rt::uint64_size(6, v); + } + if let Some(v) = self.timebounds_start { + my_size += ::protobuf::rt::uint32_size(8, v); + } + if let Some(v) = self.timebounds_end { + my_size += ::protobuf::rt::uint32_size(9, v); + } + if let Some(v) = self.memo_type { + my_size += ::protobuf::rt::int32_size(10, v.value()); + } + if let Some(v) = self.memo_text.as_ref() { + my_size += ::protobuf::rt::string_size(11, &v); + } + if let Some(v) = self.memo_id { + my_size += ::protobuf::rt::uint64_size(12, v); + } + if let Some(v) = self.memo_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(13, &v); + } + if let Some(v) = self.num_operations { + my_size += ::protobuf::rt::uint32_size(14, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.network_passphrase.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.source_account.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.fee { + os.write_uint32(5, v)?; + } + if let Some(v) = self.sequence_number { + os.write_uint64(6, v)?; + } + if let Some(v) = self.timebounds_start { + os.write_uint32(8, v)?; + } + if let Some(v) = self.timebounds_end { + os.write_uint32(9, v)?; + } + if let Some(v) = self.memo_type { + os.write_enum(10, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.memo_text.as_ref() { + os.write_string(11, v)?; + } + if let Some(v) = self.memo_id { + os.write_uint64(12, v)?; + } + if let Some(v) = self.memo_hash.as_ref() { + os.write_bytes(13, v)?; + } + if let Some(v) = self.num_operations { + os.write_uint32(14, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarSignTx { + StellarSignTx::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.network_passphrase = ::std::option::Option::None; + self.source_account = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.sequence_number = ::std::option::Option::None; + self.timebounds_start = ::std::option::Option::None; + self.timebounds_end = ::std::option::Option::None; + self.memo_type = ::std::option::Option::None; + self.memo_text = ::std::option::Option::None; + self.memo_id = ::std::option::Option::None; + self.memo_hash = ::std::option::Option::None; + self.num_operations = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarSignTx { + static instance: StellarSignTx = StellarSignTx { + address_n: ::std::vec::Vec::new(), + network_passphrase: ::std::option::Option::None, + source_account: ::std::option::Option::None, + fee: ::std::option::Option::None, + sequence_number: ::std::option::Option::None, + timebounds_start: ::std::option::Option::None, + timebounds_end: ::std::option::Option::None, + memo_type: ::std::option::Option::None, + memo_text: ::std::option::Option::None, + memo_id: ::std::option::Option::None, + memo_hash: ::std::option::Option::None, + num_operations: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `StellarSignTx` +pub mod stellar_sign_tx { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType) + pub enum StellarMemoType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.NONE) + NONE = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.TEXT) + TEXT = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.ID) + ID = 2, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.HASH) + HASH = 3, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.RETURN) + RETURN = 4, + } + + impl ::protobuf::Enum for StellarMemoType { + const NAME: &'static str = "StellarMemoType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(StellarMemoType::NONE), + 1 => ::std::option::Option::Some(StellarMemoType::TEXT), + 2 => ::std::option::Option::Some(StellarMemoType::ID), + 3 => ::std::option::Option::Some(StellarMemoType::HASH), + 4 => ::std::option::Option::Some(StellarMemoType::RETURN), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "NONE" => ::std::option::Option::Some(StellarMemoType::NONE), + "TEXT" => ::std::option::Option::Some(StellarMemoType::TEXT), + "ID" => ::std::option::Option::Some(StellarMemoType::ID), + "HASH" => ::std::option::Option::Some(StellarMemoType::HASH), + "RETURN" => ::std::option::Option::Some(StellarMemoType::RETURN), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [StellarMemoType] = &[ + StellarMemoType::NONE, + StellarMemoType::TEXT, + StellarMemoType::ID, + StellarMemoType::HASH, + StellarMemoType::RETURN, + ]; + } + + impl ::protobuf::EnumFull for StellarMemoType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("StellarSignTx.StellarMemoType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for StellarMemoType { + fn default() -> Self { + StellarMemoType::NONE + } + } + + impl StellarMemoType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("StellarSignTx.StellarMemoType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarTxOpRequest) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarTxOpRequest { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarTxOpRequest.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarTxOpRequest { + fn default() -> &'a StellarTxOpRequest { + ::default_instance() + } +} + +impl StellarTxOpRequest { + pub fn new() -> StellarTxOpRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarTxOpRequest", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarTxOpRequest { + const NAME: &'static str = "StellarTxOpRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarTxOpRequest { + StellarTxOpRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarTxOpRequest { + static instance: StellarTxOpRequest = StellarTxOpRequest { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarTxOpRequest { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarTxOpRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarTxOpRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarTxOpRequest { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarPaymentOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarPaymentOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.destination_account) + pub destination_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.asset) + pub asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.amount) + pub amount: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarPaymentOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarPaymentOp { + fn default() -> &'a StellarPaymentOp { + ::default_instance() + } +} + +impl StellarPaymentOp { + pub fn new() -> StellarPaymentOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string destination_account = 2; + + pub fn destination_account(&self) -> &str { + match self.destination_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination_account(&mut self) { + self.destination_account = ::std::option::Option::None; + } + + pub fn has_destination_account(&self) -> bool { + self.destination_account.is_some() + } + + // Param is passed by value, moved + pub fn set_destination_account(&mut self, v: ::std::string::String) { + self.destination_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { + if self.destination_account.is_none() { + self.destination_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination_account.as_mut().unwrap() + } + + // Take field + pub fn take_destination_account(&mut self) -> ::std::string::String { + self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 amount = 4; + + pub fn amount(&self) -> i64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: i64) { + self.amount = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarPaymentOp| { &m.source_account }, + |m: &mut StellarPaymentOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination_account", + |m: &StellarPaymentOp| { &m.destination_account }, + |m: &mut StellarPaymentOp| { &mut m.destination_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "asset", + |m: &StellarPaymentOp| { &m.asset }, + |m: &mut StellarPaymentOp| { &mut m.asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &StellarPaymentOp| { &m.amount }, + |m: &mut StellarPaymentOp| { &mut m.amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarPaymentOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarPaymentOp { + const NAME: &'static str = "StellarPaymentOp"; + + fn is_initialized(&self) -> bool { + if self.destination_account.is_none() { + return false; + } + if self.asset.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + for v in &self.asset { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.destination_account = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.asset)?; + }, + 32 => { + self.amount = ::std::option::Option::Some(is.read_sint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.destination_account.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::sint64_size(4, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.destination_account.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.amount { + os.write_sint64(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarPaymentOp { + StellarPaymentOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.destination_account = ::std::option::Option::None; + self.asset.clear(); + self.amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarPaymentOp { + static instance: StellarPaymentOp = StellarPaymentOp { + source_account: ::std::option::Option::None, + destination_account: ::std::option::Option::None, + asset: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarPaymentOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarPaymentOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarPaymentOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarPaymentOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarCreateAccountOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarCreateAccountOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreateAccountOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreateAccountOp.new_account) + pub new_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreateAccountOp.starting_balance) + pub starting_balance: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarCreateAccountOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarCreateAccountOp { + fn default() -> &'a StellarCreateAccountOp { + ::default_instance() + } +} + +impl StellarCreateAccountOp { + pub fn new() -> StellarCreateAccountOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string new_account = 2; + + pub fn new_account(&self) -> &str { + match self.new_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_new_account(&mut self) { + self.new_account = ::std::option::Option::None; + } + + pub fn has_new_account(&self) -> bool { + self.new_account.is_some() + } + + // Param is passed by value, moved + pub fn set_new_account(&mut self, v: ::std::string::String) { + self.new_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_new_account(&mut self) -> &mut ::std::string::String { + if self.new_account.is_none() { + self.new_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.new_account.as_mut().unwrap() + } + + // Take field + pub fn take_new_account(&mut self) -> ::std::string::String { + self.new_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 starting_balance = 3; + + pub fn starting_balance(&self) -> i64 { + self.starting_balance.unwrap_or(0) + } + + pub fn clear_starting_balance(&mut self) { + self.starting_balance = ::std::option::Option::None; + } + + pub fn has_starting_balance(&self) -> bool { + self.starting_balance.is_some() + } + + // Param is passed by value, moved + pub fn set_starting_balance(&mut self, v: i64) { + self.starting_balance = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarCreateAccountOp| { &m.source_account }, + |m: &mut StellarCreateAccountOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "new_account", + |m: &StellarCreateAccountOp| { &m.new_account }, + |m: &mut StellarCreateAccountOp| { &mut m.new_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "starting_balance", + |m: &StellarCreateAccountOp| { &m.starting_balance }, + |m: &mut StellarCreateAccountOp| { &mut m.starting_balance }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarCreateAccountOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarCreateAccountOp { + const NAME: &'static str = "StellarCreateAccountOp"; + + fn is_initialized(&self) -> bool { + if self.new_account.is_none() { + return false; + } + if self.starting_balance.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.new_account = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.starting_balance = ::std::option::Option::Some(is.read_sint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.new_account.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.starting_balance { + my_size += ::protobuf::rt::sint64_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.new_account.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.starting_balance { + os.write_sint64(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarCreateAccountOp { + StellarCreateAccountOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.new_account = ::std::option::Option::None; + self.starting_balance = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarCreateAccountOp { + static instance: StellarCreateAccountOp = StellarCreateAccountOp { + source_account: ::std::option::Option::None, + new_account: ::std::option::Option::None, + starting_balance: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarCreateAccountOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarCreateAccountOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarCreateAccountOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarCreateAccountOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarPathPaymentStrictReceiveOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.send_asset) + pub send_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.send_max) + pub send_max: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.destination_account) + pub destination_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.destination_asset) + pub destination_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.destination_amount) + pub destination_amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.paths) + pub paths: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarPathPaymentStrictReceiveOp { + fn default() -> &'a StellarPathPaymentStrictReceiveOp { + ::default_instance() + } +} + +impl StellarPathPaymentStrictReceiveOp { + pub fn new() -> StellarPathPaymentStrictReceiveOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 send_max = 3; + + pub fn send_max(&self) -> i64 { + self.send_max.unwrap_or(0) + } + + pub fn clear_send_max(&mut self) { + self.send_max = ::std::option::Option::None; + } + + pub fn has_send_max(&self) -> bool { + self.send_max.is_some() + } + + // Param is passed by value, moved + pub fn set_send_max(&mut self, v: i64) { + self.send_max = ::std::option::Option::Some(v); + } + + // required string destination_account = 4; + + pub fn destination_account(&self) -> &str { + match self.destination_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination_account(&mut self) { + self.destination_account = ::std::option::Option::None; + } + + pub fn has_destination_account(&self) -> bool { + self.destination_account.is_some() + } + + // Param is passed by value, moved + pub fn set_destination_account(&mut self, v: ::std::string::String) { + self.destination_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { + if self.destination_account.is_none() { + self.destination_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination_account.as_mut().unwrap() + } + + // Take field + pub fn take_destination_account(&mut self) -> ::std::string::String { + self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 destination_amount = 6; + + pub fn destination_amount(&self) -> i64 { + self.destination_amount.unwrap_or(0) + } + + pub fn clear_destination_amount(&mut self) { + self.destination_amount = ::std::option::Option::None; + } + + pub fn has_destination_amount(&self) -> bool { + self.destination_amount.is_some() + } + + // Param is passed by value, moved + pub fn set_destination_amount(&mut self, v: i64) { + self.destination_amount = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarPathPaymentStrictReceiveOp| { &m.source_account }, + |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "send_asset", + |m: &StellarPathPaymentStrictReceiveOp| { &m.send_asset }, + |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.send_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "send_max", + |m: &StellarPathPaymentStrictReceiveOp| { &m.send_max }, + |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.send_max }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination_account", + |m: &StellarPathPaymentStrictReceiveOp| { &m.destination_account }, + |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.destination_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "destination_asset", + |m: &StellarPathPaymentStrictReceiveOp| { &m.destination_asset }, + |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.destination_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination_amount", + |m: &StellarPathPaymentStrictReceiveOp| { &m.destination_amount }, + |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.destination_amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "paths", + |m: &StellarPathPaymentStrictReceiveOp| { &m.paths }, + |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.paths }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarPathPaymentStrictReceiveOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarPathPaymentStrictReceiveOp { + const NAME: &'static str = "StellarPathPaymentStrictReceiveOp"; + + fn is_initialized(&self) -> bool { + if self.send_asset.is_none() { + return false; + } + if self.send_max.is_none() { + return false; + } + if self.destination_account.is_none() { + return false; + } + if self.destination_asset.is_none() { + return false; + } + if self.destination_amount.is_none() { + return false; + } + for v in &self.send_asset { + if !v.is_initialized() { + return false; + } + }; + for v in &self.destination_asset { + if !v.is_initialized() { + return false; + } + }; + for v in &self.paths { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.send_asset)?; + }, + 24 => { + self.send_max = ::std::option::Option::Some(is.read_sint64()?); + }, + 34 => { + self.destination_account = ::std::option::Option::Some(is.read_string()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination_asset)?; + }, + 48 => { + self.destination_amount = ::std::option::Option::Some(is.read_sint64()?); + }, + 58 => { + self.paths.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.send_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.send_max { + my_size += ::protobuf::rt::sint64_size(3, v); + } + if let Some(v) = self.destination_account.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.destination_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.destination_amount { + my_size += ::protobuf::rt::sint64_size(6, v); + } + for value in &self.paths { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.send_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.send_max { + os.write_sint64(3, v)?; + } + if let Some(v) = self.destination_account.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.destination_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.destination_amount { + os.write_sint64(6, v)?; + } + for v in &self.paths { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarPathPaymentStrictReceiveOp { + StellarPathPaymentStrictReceiveOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.send_asset.clear(); + self.send_max = ::std::option::Option::None; + self.destination_account = ::std::option::Option::None; + self.destination_asset.clear(); + self.destination_amount = ::std::option::Option::None; + self.paths.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarPathPaymentStrictReceiveOp { + static instance: StellarPathPaymentStrictReceiveOp = StellarPathPaymentStrictReceiveOp { + source_account: ::std::option::Option::None, + send_asset: ::protobuf::MessageField::none(), + send_max: ::std::option::Option::None, + destination_account: ::std::option::Option::None, + destination_asset: ::protobuf::MessageField::none(), + destination_amount: ::std::option::Option::None, + paths: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarPathPaymentStrictReceiveOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarPathPaymentStrictReceiveOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarPathPaymentStrictReceiveOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarPathPaymentStrictReceiveOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarPathPaymentStrictSendOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.send_asset) + pub send_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.send_amount) + pub send_amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.destination_account) + pub destination_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.destination_asset) + pub destination_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.destination_min) + pub destination_min: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.paths) + pub paths: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarPathPaymentStrictSendOp { + fn default() -> &'a StellarPathPaymentStrictSendOp { + ::default_instance() + } +} + +impl StellarPathPaymentStrictSendOp { + pub fn new() -> StellarPathPaymentStrictSendOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 send_amount = 3; + + pub fn send_amount(&self) -> i64 { + self.send_amount.unwrap_or(0) + } + + pub fn clear_send_amount(&mut self) { + self.send_amount = ::std::option::Option::None; + } + + pub fn has_send_amount(&self) -> bool { + self.send_amount.is_some() + } + + // Param is passed by value, moved + pub fn set_send_amount(&mut self, v: i64) { + self.send_amount = ::std::option::Option::Some(v); + } + + // required string destination_account = 4; + + pub fn destination_account(&self) -> &str { + match self.destination_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination_account(&mut self) { + self.destination_account = ::std::option::Option::None; + } + + pub fn has_destination_account(&self) -> bool { + self.destination_account.is_some() + } + + // Param is passed by value, moved + pub fn set_destination_account(&mut self, v: ::std::string::String) { + self.destination_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { + if self.destination_account.is_none() { + self.destination_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination_account.as_mut().unwrap() + } + + // Take field + pub fn take_destination_account(&mut self) -> ::std::string::String { + self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 destination_min = 6; + + pub fn destination_min(&self) -> i64 { + self.destination_min.unwrap_or(0) + } + + pub fn clear_destination_min(&mut self) { + self.destination_min = ::std::option::Option::None; + } + + pub fn has_destination_min(&self) -> bool { + self.destination_min.is_some() + } + + // Param is passed by value, moved + pub fn set_destination_min(&mut self, v: i64) { + self.destination_min = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarPathPaymentStrictSendOp| { &m.source_account }, + |m: &mut StellarPathPaymentStrictSendOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "send_asset", + |m: &StellarPathPaymentStrictSendOp| { &m.send_asset }, + |m: &mut StellarPathPaymentStrictSendOp| { &mut m.send_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "send_amount", + |m: &StellarPathPaymentStrictSendOp| { &m.send_amount }, + |m: &mut StellarPathPaymentStrictSendOp| { &mut m.send_amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination_account", + |m: &StellarPathPaymentStrictSendOp| { &m.destination_account }, + |m: &mut StellarPathPaymentStrictSendOp| { &mut m.destination_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "destination_asset", + |m: &StellarPathPaymentStrictSendOp| { &m.destination_asset }, + |m: &mut StellarPathPaymentStrictSendOp| { &mut m.destination_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination_min", + |m: &StellarPathPaymentStrictSendOp| { &m.destination_min }, + |m: &mut StellarPathPaymentStrictSendOp| { &mut m.destination_min }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "paths", + |m: &StellarPathPaymentStrictSendOp| { &m.paths }, + |m: &mut StellarPathPaymentStrictSendOp| { &mut m.paths }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarPathPaymentStrictSendOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarPathPaymentStrictSendOp { + const NAME: &'static str = "StellarPathPaymentStrictSendOp"; + + fn is_initialized(&self) -> bool { + if self.send_asset.is_none() { + return false; + } + if self.send_amount.is_none() { + return false; + } + if self.destination_account.is_none() { + return false; + } + if self.destination_asset.is_none() { + return false; + } + if self.destination_min.is_none() { + return false; + } + for v in &self.send_asset { + if !v.is_initialized() { + return false; + } + }; + for v in &self.destination_asset { + if !v.is_initialized() { + return false; + } + }; + for v in &self.paths { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.send_asset)?; + }, + 24 => { + self.send_amount = ::std::option::Option::Some(is.read_sint64()?); + }, + 34 => { + self.destination_account = ::std::option::Option::Some(is.read_string()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination_asset)?; + }, + 48 => { + self.destination_min = ::std::option::Option::Some(is.read_sint64()?); + }, + 58 => { + self.paths.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.send_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.send_amount { + my_size += ::protobuf::rt::sint64_size(3, v); + } + if let Some(v) = self.destination_account.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.destination_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.destination_min { + my_size += ::protobuf::rt::sint64_size(6, v); + } + for value in &self.paths { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.send_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.send_amount { + os.write_sint64(3, v)?; + } + if let Some(v) = self.destination_account.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.destination_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.destination_min { + os.write_sint64(6, v)?; + } + for v in &self.paths { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarPathPaymentStrictSendOp { + StellarPathPaymentStrictSendOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.send_asset.clear(); + self.send_amount = ::std::option::Option::None; + self.destination_account = ::std::option::Option::None; + self.destination_asset.clear(); + self.destination_min = ::std::option::Option::None; + self.paths.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarPathPaymentStrictSendOp { + static instance: StellarPathPaymentStrictSendOp = StellarPathPaymentStrictSendOp { + source_account: ::std::option::Option::None, + send_asset: ::protobuf::MessageField::none(), + send_amount: ::std::option::Option::None, + destination_account: ::std::option::Option::None, + destination_asset: ::protobuf::MessageField::none(), + destination_min: ::std::option::Option::None, + paths: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarPathPaymentStrictSendOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarPathPaymentStrictSendOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarPathPaymentStrictSendOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarPathPaymentStrictSendOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarManageSellOfferOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarManageSellOfferOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.selling_asset) + pub selling_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.buying_asset) + pub buying_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.price_n) + pub price_n: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.price_d) + pub price_d: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.offer_id) + pub offer_id: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarManageSellOfferOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarManageSellOfferOp { + fn default() -> &'a StellarManageSellOfferOp { + ::default_instance() + } +} + +impl StellarManageSellOfferOp { + pub fn new() -> StellarManageSellOfferOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 amount = 4; + + pub fn amount(&self) -> i64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: i64) { + self.amount = ::std::option::Option::Some(v); + } + + // required uint32 price_n = 5; + + pub fn price_n(&self) -> u32 { + self.price_n.unwrap_or(0) + } + + pub fn clear_price_n(&mut self) { + self.price_n = ::std::option::Option::None; + } + + pub fn has_price_n(&self) -> bool { + self.price_n.is_some() + } + + // Param is passed by value, moved + pub fn set_price_n(&mut self, v: u32) { + self.price_n = ::std::option::Option::Some(v); + } + + // required uint32 price_d = 6; + + pub fn price_d(&self) -> u32 { + self.price_d.unwrap_or(0) + } + + pub fn clear_price_d(&mut self) { + self.price_d = ::std::option::Option::None; + } + + pub fn has_price_d(&self) -> bool { + self.price_d.is_some() + } + + // Param is passed by value, moved + pub fn set_price_d(&mut self, v: u32) { + self.price_d = ::std::option::Option::Some(v); + } + + // required uint64 offer_id = 7; + + pub fn offer_id(&self) -> u64 { + self.offer_id.unwrap_or(0) + } + + pub fn clear_offer_id(&mut self) { + self.offer_id = ::std::option::Option::None; + } + + pub fn has_offer_id(&self) -> bool { + self.offer_id.is_some() + } + + // Param is passed by value, moved + pub fn set_offer_id(&mut self, v: u64) { + self.offer_id = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarManageSellOfferOp| { &m.source_account }, + |m: &mut StellarManageSellOfferOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "selling_asset", + |m: &StellarManageSellOfferOp| { &m.selling_asset }, + |m: &mut StellarManageSellOfferOp| { &mut m.selling_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "buying_asset", + |m: &StellarManageSellOfferOp| { &m.buying_asset }, + |m: &mut StellarManageSellOfferOp| { &mut m.buying_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &StellarManageSellOfferOp| { &m.amount }, + |m: &mut StellarManageSellOfferOp| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "price_n", + |m: &StellarManageSellOfferOp| { &m.price_n }, + |m: &mut StellarManageSellOfferOp| { &mut m.price_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "price_d", + |m: &StellarManageSellOfferOp| { &m.price_d }, + |m: &mut StellarManageSellOfferOp| { &mut m.price_d }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "offer_id", + |m: &StellarManageSellOfferOp| { &m.offer_id }, + |m: &mut StellarManageSellOfferOp| { &mut m.offer_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarManageSellOfferOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarManageSellOfferOp { + const NAME: &'static str = "StellarManageSellOfferOp"; + + fn is_initialized(&self) -> bool { + if self.selling_asset.is_none() { + return false; + } + if self.buying_asset.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + if self.price_n.is_none() { + return false; + } + if self.price_d.is_none() { + return false; + } + if self.offer_id.is_none() { + return false; + } + for v in &self.selling_asset { + if !v.is_initialized() { + return false; + } + }; + for v in &self.buying_asset { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.selling_asset)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.buying_asset)?; + }, + 32 => { + self.amount = ::std::option::Option::Some(is.read_sint64()?); + }, + 40 => { + self.price_n = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.price_d = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.offer_id = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.selling_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.buying_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::sint64_size(4, v); + } + if let Some(v) = self.price_n { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.price_d { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.offer_id { + my_size += ::protobuf::rt::uint64_size(7, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.selling_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.buying_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.amount { + os.write_sint64(4, v)?; + } + if let Some(v) = self.price_n { + os.write_uint32(5, v)?; + } + if let Some(v) = self.price_d { + os.write_uint32(6, v)?; + } + if let Some(v) = self.offer_id { + os.write_uint64(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarManageSellOfferOp { + StellarManageSellOfferOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.selling_asset.clear(); + self.buying_asset.clear(); + self.amount = ::std::option::Option::None; + self.price_n = ::std::option::Option::None; + self.price_d = ::std::option::Option::None; + self.offer_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarManageSellOfferOp { + static instance: StellarManageSellOfferOp = StellarManageSellOfferOp { + source_account: ::std::option::Option::None, + selling_asset: ::protobuf::MessageField::none(), + buying_asset: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + price_n: ::std::option::Option::None, + price_d: ::std::option::Option::None, + offer_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarManageSellOfferOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarManageSellOfferOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarManageSellOfferOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarManageSellOfferOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarManageBuyOfferOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarManageBuyOfferOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.selling_asset) + pub selling_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.buying_asset) + pub buying_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.price_n) + pub price_n: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.price_d) + pub price_d: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.offer_id) + pub offer_id: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarManageBuyOfferOp { + fn default() -> &'a StellarManageBuyOfferOp { + ::default_instance() + } +} + +impl StellarManageBuyOfferOp { + pub fn new() -> StellarManageBuyOfferOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 amount = 4; + + pub fn amount(&self) -> i64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: i64) { + self.amount = ::std::option::Option::Some(v); + } + + // required uint32 price_n = 5; + + pub fn price_n(&self) -> u32 { + self.price_n.unwrap_or(0) + } + + pub fn clear_price_n(&mut self) { + self.price_n = ::std::option::Option::None; + } + + pub fn has_price_n(&self) -> bool { + self.price_n.is_some() + } + + // Param is passed by value, moved + pub fn set_price_n(&mut self, v: u32) { + self.price_n = ::std::option::Option::Some(v); + } + + // required uint32 price_d = 6; + + pub fn price_d(&self) -> u32 { + self.price_d.unwrap_or(0) + } + + pub fn clear_price_d(&mut self) { + self.price_d = ::std::option::Option::None; + } + + pub fn has_price_d(&self) -> bool { + self.price_d.is_some() + } + + // Param is passed by value, moved + pub fn set_price_d(&mut self, v: u32) { + self.price_d = ::std::option::Option::Some(v); + } + + // required uint64 offer_id = 7; + + pub fn offer_id(&self) -> u64 { + self.offer_id.unwrap_or(0) + } + + pub fn clear_offer_id(&mut self) { + self.offer_id = ::std::option::Option::None; + } + + pub fn has_offer_id(&self) -> bool { + self.offer_id.is_some() + } + + // Param is passed by value, moved + pub fn set_offer_id(&mut self, v: u64) { + self.offer_id = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarManageBuyOfferOp| { &m.source_account }, + |m: &mut StellarManageBuyOfferOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "selling_asset", + |m: &StellarManageBuyOfferOp| { &m.selling_asset }, + |m: &mut StellarManageBuyOfferOp| { &mut m.selling_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "buying_asset", + |m: &StellarManageBuyOfferOp| { &m.buying_asset }, + |m: &mut StellarManageBuyOfferOp| { &mut m.buying_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &StellarManageBuyOfferOp| { &m.amount }, + |m: &mut StellarManageBuyOfferOp| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "price_n", + |m: &StellarManageBuyOfferOp| { &m.price_n }, + |m: &mut StellarManageBuyOfferOp| { &mut m.price_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "price_d", + |m: &StellarManageBuyOfferOp| { &m.price_d }, + |m: &mut StellarManageBuyOfferOp| { &mut m.price_d }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "offer_id", + |m: &StellarManageBuyOfferOp| { &m.offer_id }, + |m: &mut StellarManageBuyOfferOp| { &mut m.offer_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarManageBuyOfferOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarManageBuyOfferOp { + const NAME: &'static str = "StellarManageBuyOfferOp"; + + fn is_initialized(&self) -> bool { + if self.selling_asset.is_none() { + return false; + } + if self.buying_asset.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + if self.price_n.is_none() { + return false; + } + if self.price_d.is_none() { + return false; + } + if self.offer_id.is_none() { + return false; + } + for v in &self.selling_asset { + if !v.is_initialized() { + return false; + } + }; + for v in &self.buying_asset { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.selling_asset)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.buying_asset)?; + }, + 32 => { + self.amount = ::std::option::Option::Some(is.read_sint64()?); + }, + 40 => { + self.price_n = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.price_d = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.offer_id = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.selling_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.buying_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::sint64_size(4, v); + } + if let Some(v) = self.price_n { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.price_d { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.offer_id { + my_size += ::protobuf::rt::uint64_size(7, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.selling_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.buying_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.amount { + os.write_sint64(4, v)?; + } + if let Some(v) = self.price_n { + os.write_uint32(5, v)?; + } + if let Some(v) = self.price_d { + os.write_uint32(6, v)?; + } + if let Some(v) = self.offer_id { + os.write_uint64(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarManageBuyOfferOp { + StellarManageBuyOfferOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.selling_asset.clear(); + self.buying_asset.clear(); + self.amount = ::std::option::Option::None; + self.price_n = ::std::option::Option::None; + self.price_d = ::std::option::Option::None; + self.offer_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarManageBuyOfferOp { + static instance: StellarManageBuyOfferOp = StellarManageBuyOfferOp { + source_account: ::std::option::Option::None, + selling_asset: ::protobuf::MessageField::none(), + buying_asset: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + price_n: ::std::option::Option::None, + price_d: ::std::option::Option::None, + offer_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarManageBuyOfferOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarManageBuyOfferOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarManageBuyOfferOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarManageBuyOfferOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarCreatePassiveSellOfferOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.selling_asset) + pub selling_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.buying_asset) + pub buying_asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.price_n) + pub price_n: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.price_d) + pub price_d: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarCreatePassiveSellOfferOp { + fn default() -> &'a StellarCreatePassiveSellOfferOp { + ::default_instance() + } +} + +impl StellarCreatePassiveSellOfferOp { + pub fn new() -> StellarCreatePassiveSellOfferOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required sint64 amount = 4; + + pub fn amount(&self) -> i64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: i64) { + self.amount = ::std::option::Option::Some(v); + } + + // required uint32 price_n = 5; + + pub fn price_n(&self) -> u32 { + self.price_n.unwrap_or(0) + } + + pub fn clear_price_n(&mut self) { + self.price_n = ::std::option::Option::None; + } + + pub fn has_price_n(&self) -> bool { + self.price_n.is_some() + } + + // Param is passed by value, moved + pub fn set_price_n(&mut self, v: u32) { + self.price_n = ::std::option::Option::Some(v); + } + + // required uint32 price_d = 6; + + pub fn price_d(&self) -> u32 { + self.price_d.unwrap_or(0) + } + + pub fn clear_price_d(&mut self) { + self.price_d = ::std::option::Option::None; + } + + pub fn has_price_d(&self) -> bool { + self.price_d.is_some() + } + + // Param is passed by value, moved + pub fn set_price_d(&mut self, v: u32) { + self.price_d = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarCreatePassiveSellOfferOp| { &m.source_account }, + |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "selling_asset", + |m: &StellarCreatePassiveSellOfferOp| { &m.selling_asset }, + |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.selling_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "buying_asset", + |m: &StellarCreatePassiveSellOfferOp| { &m.buying_asset }, + |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.buying_asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &StellarCreatePassiveSellOfferOp| { &m.amount }, + |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "price_n", + |m: &StellarCreatePassiveSellOfferOp| { &m.price_n }, + |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.price_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "price_d", + |m: &StellarCreatePassiveSellOfferOp| { &m.price_d }, + |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.price_d }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarCreatePassiveSellOfferOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarCreatePassiveSellOfferOp { + const NAME: &'static str = "StellarCreatePassiveSellOfferOp"; + + fn is_initialized(&self) -> bool { + if self.selling_asset.is_none() { + return false; + } + if self.buying_asset.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + if self.price_n.is_none() { + return false; + } + if self.price_d.is_none() { + return false; + } + for v in &self.selling_asset { + if !v.is_initialized() { + return false; + } + }; + for v in &self.buying_asset { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.selling_asset)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.buying_asset)?; + }, + 32 => { + self.amount = ::std::option::Option::Some(is.read_sint64()?); + }, + 40 => { + self.price_n = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.price_d = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.selling_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.buying_asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::sint64_size(4, v); + } + if let Some(v) = self.price_n { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.price_d { + my_size += ::protobuf::rt::uint32_size(6, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.selling_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.buying_asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.amount { + os.write_sint64(4, v)?; + } + if let Some(v) = self.price_n { + os.write_uint32(5, v)?; + } + if let Some(v) = self.price_d { + os.write_uint32(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarCreatePassiveSellOfferOp { + StellarCreatePassiveSellOfferOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.selling_asset.clear(); + self.buying_asset.clear(); + self.amount = ::std::option::Option::None; + self.price_n = ::std::option::Option::None; + self.price_d = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarCreatePassiveSellOfferOp { + static instance: StellarCreatePassiveSellOfferOp = StellarCreatePassiveSellOfferOp { + source_account: ::std::option::Option::None, + selling_asset: ::protobuf::MessageField::none(), + buying_asset: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + price_n: ::std::option::Option::None, + price_d: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarCreatePassiveSellOfferOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarCreatePassiveSellOfferOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarCreatePassiveSellOfferOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarCreatePassiveSellOfferOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarSetOptionsOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarSetOptionsOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.inflation_destination_account) + pub inflation_destination_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.clear_flags) + pub clear_flags: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.set_flags) + pub set_flags: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.master_weight) + pub master_weight: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.low_threshold) + pub low_threshold: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.medium_threshold) + pub medium_threshold: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.high_threshold) + pub high_threshold: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.home_domain) + pub home_domain: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.signer_type) + pub signer_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.signer_key) + pub signer_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.signer_weight) + pub signer_weight: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarSetOptionsOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarSetOptionsOp { + fn default() -> &'a StellarSetOptionsOp { + ::default_instance() + } +} + +impl StellarSetOptionsOp { + pub fn new() -> StellarSetOptionsOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string inflation_destination_account = 2; + + pub fn inflation_destination_account(&self) -> &str { + match self.inflation_destination_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_inflation_destination_account(&mut self) { + self.inflation_destination_account = ::std::option::Option::None; + } + + pub fn has_inflation_destination_account(&self) -> bool { + self.inflation_destination_account.is_some() + } + + // Param is passed by value, moved + pub fn set_inflation_destination_account(&mut self, v: ::std::string::String) { + self.inflation_destination_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_inflation_destination_account(&mut self) -> &mut ::std::string::String { + if self.inflation_destination_account.is_none() { + self.inflation_destination_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.inflation_destination_account.as_mut().unwrap() + } + + // Take field + pub fn take_inflation_destination_account(&mut self) -> ::std::string::String { + self.inflation_destination_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 clear_flags = 3; + + pub fn clear_flags(&self) -> u32 { + self.clear_flags.unwrap_or(0) + } + + pub fn clear_clear_flags(&mut self) { + self.clear_flags = ::std::option::Option::None; + } + + pub fn has_clear_flags(&self) -> bool { + self.clear_flags.is_some() + } + + // Param is passed by value, moved + pub fn set_clear_flags(&mut self, v: u32) { + self.clear_flags = ::std::option::Option::Some(v); + } + + // optional uint32 set_flags = 4; + + pub fn set_flags(&self) -> u32 { + self.set_flags.unwrap_or(0) + } + + pub fn clear_set_flags(&mut self) { + self.set_flags = ::std::option::Option::None; + } + + pub fn has_set_flags(&self) -> bool { + self.set_flags.is_some() + } + + // Param is passed by value, moved + pub fn set_set_flags(&mut self, v: u32) { + self.set_flags = ::std::option::Option::Some(v); + } + + // optional uint32 master_weight = 5; + + pub fn master_weight(&self) -> u32 { + self.master_weight.unwrap_or(0) + } + + pub fn clear_master_weight(&mut self) { + self.master_weight = ::std::option::Option::None; + } + + pub fn has_master_weight(&self) -> bool { + self.master_weight.is_some() + } + + // Param is passed by value, moved + pub fn set_master_weight(&mut self, v: u32) { + self.master_weight = ::std::option::Option::Some(v); + } + + // optional uint32 low_threshold = 6; + + pub fn low_threshold(&self) -> u32 { + self.low_threshold.unwrap_or(0) + } + + pub fn clear_low_threshold(&mut self) { + self.low_threshold = ::std::option::Option::None; + } + + pub fn has_low_threshold(&self) -> bool { + self.low_threshold.is_some() + } + + // Param is passed by value, moved + pub fn set_low_threshold(&mut self, v: u32) { + self.low_threshold = ::std::option::Option::Some(v); + } + + // optional uint32 medium_threshold = 7; + + pub fn medium_threshold(&self) -> u32 { + self.medium_threshold.unwrap_or(0) + } + + pub fn clear_medium_threshold(&mut self) { + self.medium_threshold = ::std::option::Option::None; + } + + pub fn has_medium_threshold(&self) -> bool { + self.medium_threshold.is_some() + } + + // Param is passed by value, moved + pub fn set_medium_threshold(&mut self, v: u32) { + self.medium_threshold = ::std::option::Option::Some(v); + } + + // optional uint32 high_threshold = 8; + + pub fn high_threshold(&self) -> u32 { + self.high_threshold.unwrap_or(0) + } + + pub fn clear_high_threshold(&mut self) { + self.high_threshold = ::std::option::Option::None; + } + + pub fn has_high_threshold(&self) -> bool { + self.high_threshold.is_some() + } + + // Param is passed by value, moved + pub fn set_high_threshold(&mut self, v: u32) { + self.high_threshold = ::std::option::Option::Some(v); + } + + // optional string home_domain = 9; + + pub fn home_domain(&self) -> &str { + match self.home_domain.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_home_domain(&mut self) { + self.home_domain = ::std::option::Option::None; + } + + pub fn has_home_domain(&self) -> bool { + self.home_domain.is_some() + } + + // Param is passed by value, moved + pub fn set_home_domain(&mut self, v: ::std::string::String) { + self.home_domain = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_home_domain(&mut self) -> &mut ::std::string::String { + if self.home_domain.is_none() { + self.home_domain = ::std::option::Option::Some(::std::string::String::new()); + } + self.home_domain.as_mut().unwrap() + } + + // Take field + pub fn take_home_domain(&mut self) -> ::std::string::String { + self.home_domain.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional .hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType signer_type = 10; + + pub fn signer_type(&self) -> stellar_set_options_op::StellarSignerType { + match self.signer_type { + Some(e) => e.enum_value_or(stellar_set_options_op::StellarSignerType::ACCOUNT), + None => stellar_set_options_op::StellarSignerType::ACCOUNT, + } + } + + pub fn clear_signer_type(&mut self) { + self.signer_type = ::std::option::Option::None; + } + + pub fn has_signer_type(&self) -> bool { + self.signer_type.is_some() + } + + // Param is passed by value, moved + pub fn set_signer_type(&mut self, v: stellar_set_options_op::StellarSignerType) { + self.signer_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes signer_key = 11; + + pub fn signer_key(&self) -> &[u8] { + match self.signer_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signer_key(&mut self) { + self.signer_key = ::std::option::Option::None; + } + + pub fn has_signer_key(&self) -> bool { + self.signer_key.is_some() + } + + // Param is passed by value, moved + pub fn set_signer_key(&mut self, v: ::std::vec::Vec) { + self.signer_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signer_key(&mut self) -> &mut ::std::vec::Vec { + if self.signer_key.is_none() { + self.signer_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signer_key.as_mut().unwrap() + } + + // Take field + pub fn take_signer_key(&mut self) -> ::std::vec::Vec { + self.signer_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional uint32 signer_weight = 12; + + pub fn signer_weight(&self) -> u32 { + self.signer_weight.unwrap_or(0) + } + + pub fn clear_signer_weight(&mut self) { + self.signer_weight = ::std::option::Option::None; + } + + pub fn has_signer_weight(&self) -> bool { + self.signer_weight.is_some() + } + + // Param is passed by value, moved + pub fn set_signer_weight(&mut self, v: u32) { + self.signer_weight = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(12); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarSetOptionsOp| { &m.source_account }, + |m: &mut StellarSetOptionsOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "inflation_destination_account", + |m: &StellarSetOptionsOp| { &m.inflation_destination_account }, + |m: &mut StellarSetOptionsOp| { &mut m.inflation_destination_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "clear_flags", + |m: &StellarSetOptionsOp| { &m.clear_flags }, + |m: &mut StellarSetOptionsOp| { &mut m.clear_flags }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "set_flags", + |m: &StellarSetOptionsOp| { &m.set_flags }, + |m: &mut StellarSetOptionsOp| { &mut m.set_flags }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "master_weight", + |m: &StellarSetOptionsOp| { &m.master_weight }, + |m: &mut StellarSetOptionsOp| { &mut m.master_weight }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "low_threshold", + |m: &StellarSetOptionsOp| { &m.low_threshold }, + |m: &mut StellarSetOptionsOp| { &mut m.low_threshold }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "medium_threshold", + |m: &StellarSetOptionsOp| { &m.medium_threshold }, + |m: &mut StellarSetOptionsOp| { &mut m.medium_threshold }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "high_threshold", + |m: &StellarSetOptionsOp| { &m.high_threshold }, + |m: &mut StellarSetOptionsOp| { &mut m.high_threshold }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "home_domain", + |m: &StellarSetOptionsOp| { &m.home_domain }, + |m: &mut StellarSetOptionsOp| { &mut m.home_domain }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signer_type", + |m: &StellarSetOptionsOp| { &m.signer_type }, + |m: &mut StellarSetOptionsOp| { &mut m.signer_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signer_key", + |m: &StellarSetOptionsOp| { &m.signer_key }, + |m: &mut StellarSetOptionsOp| { &mut m.signer_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signer_weight", + |m: &StellarSetOptionsOp| { &m.signer_weight }, + |m: &mut StellarSetOptionsOp| { &mut m.signer_weight }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarSetOptionsOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarSetOptionsOp { + const NAME: &'static str = "StellarSetOptionsOp"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.inflation_destination_account = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.clear_flags = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.set_flags = ::std::option::Option::Some(is.read_uint32()?); + }, + 40 => { + self.master_weight = ::std::option::Option::Some(is.read_uint32()?); + }, + 48 => { + self.low_threshold = ::std::option::Option::Some(is.read_uint32()?); + }, + 56 => { + self.medium_threshold = ::std::option::Option::Some(is.read_uint32()?); + }, + 64 => { + self.high_threshold = ::std::option::Option::Some(is.read_uint32()?); + }, + 74 => { + self.home_domain = ::std::option::Option::Some(is.read_string()?); + }, + 80 => { + self.signer_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 90 => { + self.signer_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 96 => { + self.signer_weight = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.inflation_destination_account.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.clear_flags { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.set_flags { + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.master_weight { + my_size += ::protobuf::rt::uint32_size(5, v); + } + if let Some(v) = self.low_threshold { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.medium_threshold { + my_size += ::protobuf::rt::uint32_size(7, v); + } + if let Some(v) = self.high_threshold { + my_size += ::protobuf::rt::uint32_size(8, v); + } + if let Some(v) = self.home_domain.as_ref() { + my_size += ::protobuf::rt::string_size(9, &v); + } + if let Some(v) = self.signer_type { + my_size += ::protobuf::rt::int32_size(10, v.value()); + } + if let Some(v) = self.signer_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(11, &v); + } + if let Some(v) = self.signer_weight { + my_size += ::protobuf::rt::uint32_size(12, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.inflation_destination_account.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.clear_flags { + os.write_uint32(3, v)?; + } + if let Some(v) = self.set_flags { + os.write_uint32(4, v)?; + } + if let Some(v) = self.master_weight { + os.write_uint32(5, v)?; + } + if let Some(v) = self.low_threshold { + os.write_uint32(6, v)?; + } + if let Some(v) = self.medium_threshold { + os.write_uint32(7, v)?; + } + if let Some(v) = self.high_threshold { + os.write_uint32(8, v)?; + } + if let Some(v) = self.home_domain.as_ref() { + os.write_string(9, v)?; + } + if let Some(v) = self.signer_type { + os.write_enum(10, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.signer_key.as_ref() { + os.write_bytes(11, v)?; + } + if let Some(v) = self.signer_weight { + os.write_uint32(12, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarSetOptionsOp { + StellarSetOptionsOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.inflation_destination_account = ::std::option::Option::None; + self.clear_flags = ::std::option::Option::None; + self.set_flags = ::std::option::Option::None; + self.master_weight = ::std::option::Option::None; + self.low_threshold = ::std::option::Option::None; + self.medium_threshold = ::std::option::Option::None; + self.high_threshold = ::std::option::Option::None; + self.home_domain = ::std::option::Option::None; + self.signer_type = ::std::option::Option::None; + self.signer_key = ::std::option::Option::None; + self.signer_weight = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarSetOptionsOp { + static instance: StellarSetOptionsOp = StellarSetOptionsOp { + source_account: ::std::option::Option::None, + inflation_destination_account: ::std::option::Option::None, + clear_flags: ::std::option::Option::None, + set_flags: ::std::option::Option::None, + master_weight: ::std::option::Option::None, + low_threshold: ::std::option::Option::None, + medium_threshold: ::std::option::Option::None, + high_threshold: ::std::option::Option::None, + home_domain: ::std::option::Option::None, + signer_type: ::std::option::Option::None, + signer_key: ::std::option::Option::None, + signer_weight: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarSetOptionsOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarSetOptionsOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarSetOptionsOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarSetOptionsOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `StellarSetOptionsOp` +pub mod stellar_set_options_op { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType) + pub enum StellarSignerType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType.ACCOUNT) + ACCOUNT = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType.PRE_AUTH) + PRE_AUTH = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType.HASH) + HASH = 2, + } + + impl ::protobuf::Enum for StellarSignerType { + const NAME: &'static str = "StellarSignerType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(StellarSignerType::ACCOUNT), + 1 => ::std::option::Option::Some(StellarSignerType::PRE_AUTH), + 2 => ::std::option::Option::Some(StellarSignerType::HASH), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "ACCOUNT" => ::std::option::Option::Some(StellarSignerType::ACCOUNT), + "PRE_AUTH" => ::std::option::Option::Some(StellarSignerType::PRE_AUTH), + "HASH" => ::std::option::Option::Some(StellarSignerType::HASH), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [StellarSignerType] = &[ + StellarSignerType::ACCOUNT, + StellarSignerType::PRE_AUTH, + StellarSignerType::HASH, + ]; + } + + impl ::protobuf::EnumFull for StellarSignerType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("StellarSetOptionsOp.StellarSignerType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for StellarSignerType { + fn default() -> Self { + StellarSignerType::ACCOUNT + } + } + + impl StellarSignerType { + pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("StellarSetOptionsOp.StellarSignerType") + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarChangeTrustOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarChangeTrustOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarChangeTrustOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarChangeTrustOp.asset) + pub asset: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarChangeTrustOp.limit) + pub limit: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarChangeTrustOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarChangeTrustOp { + fn default() -> &'a StellarChangeTrustOp { + ::default_instance() + } +} + +impl StellarChangeTrustOp { + pub fn new() -> StellarChangeTrustOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 limit = 3; + + pub fn limit(&self) -> u64 { + self.limit.unwrap_or(0) + } + + pub fn clear_limit(&mut self) { + self.limit = ::std::option::Option::None; + } + + pub fn has_limit(&self) -> bool { + self.limit.is_some() + } + + // Param is passed by value, moved + pub fn set_limit(&mut self, v: u64) { + self.limit = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarChangeTrustOp| { &m.source_account }, + |m: &mut StellarChangeTrustOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( + "asset", + |m: &StellarChangeTrustOp| { &m.asset }, + |m: &mut StellarChangeTrustOp| { &mut m.asset }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "limit", + |m: &StellarChangeTrustOp| { &m.limit }, + |m: &mut StellarChangeTrustOp| { &mut m.limit }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarChangeTrustOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarChangeTrustOp { + const NAME: &'static str = "StellarChangeTrustOp"; + + fn is_initialized(&self) -> bool { + if self.asset.is_none() { + return false; + } + if self.limit.is_none() { + return false; + } + for v in &self.asset { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.asset)?; + }, + 24 => { + self.limit = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.asset.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.limit { + my_size += ::protobuf::rt::uint64_size(3, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.asset.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.limit { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarChangeTrustOp { + StellarChangeTrustOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.asset.clear(); + self.limit = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarChangeTrustOp { + static instance: StellarChangeTrustOp = StellarChangeTrustOp { + source_account: ::std::option::Option::None, + asset: ::protobuf::MessageField::none(), + limit: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarChangeTrustOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarChangeTrustOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarChangeTrustOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarChangeTrustOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAllowTrustOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarAllowTrustOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.trusted_account) + pub trusted_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.asset_type) + pub asset_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.asset_code) + pub asset_code: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.is_authorized) + pub is_authorized: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAllowTrustOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarAllowTrustOp { + fn default() -> &'a StellarAllowTrustOp { + ::default_instance() + } +} + +impl StellarAllowTrustOp { + pub fn new() -> StellarAllowTrustOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string trusted_account = 2; + + pub fn trusted_account(&self) -> &str { + match self.trusted_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_trusted_account(&mut self) { + self.trusted_account = ::std::option::Option::None; + } + + pub fn has_trusted_account(&self) -> bool { + self.trusted_account.is_some() + } + + // Param is passed by value, moved + pub fn set_trusted_account(&mut self, v: ::std::string::String) { + self.trusted_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_trusted_account(&mut self) -> &mut ::std::string::String { + if self.trusted_account.is_none() { + self.trusted_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.trusted_account.as_mut().unwrap() + } + + // Take field + pub fn take_trusted_account(&mut self) -> ::std::string::String { + self.trusted_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required .hw.trezor.messages.stellar.StellarAssetType asset_type = 3; + + pub fn asset_type(&self) -> StellarAssetType { + match self.asset_type { + Some(e) => e.enum_value_or(StellarAssetType::NATIVE), + None => StellarAssetType::NATIVE, + } + } + + pub fn clear_asset_type(&mut self) { + self.asset_type = ::std::option::Option::None; + } + + pub fn has_asset_type(&self) -> bool { + self.asset_type.is_some() + } + + // Param is passed by value, moved + pub fn set_asset_type(&mut self, v: StellarAssetType) { + self.asset_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional string asset_code = 4; + + pub fn asset_code(&self) -> &str { + match self.asset_code.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_asset_code(&mut self) { + self.asset_code = ::std::option::Option::None; + } + + pub fn has_asset_code(&self) -> bool { + self.asset_code.is_some() + } + + // Param is passed by value, moved + pub fn set_asset_code(&mut self, v: ::std::string::String) { + self.asset_code = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_asset_code(&mut self) -> &mut ::std::string::String { + if self.asset_code.is_none() { + self.asset_code = ::std::option::Option::Some(::std::string::String::new()); + } + self.asset_code.as_mut().unwrap() + } + + // Take field + pub fn take_asset_code(&mut self) -> ::std::string::String { + self.asset_code.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bool is_authorized = 5; + + pub fn is_authorized(&self) -> bool { + self.is_authorized.unwrap_or(false) + } + + pub fn clear_is_authorized(&mut self) { + self.is_authorized = ::std::option::Option::None; + } + + pub fn has_is_authorized(&self) -> bool { + self.is_authorized.is_some() + } + + // Param is passed by value, moved + pub fn set_is_authorized(&mut self, v: bool) { + self.is_authorized = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarAllowTrustOp| { &m.source_account }, + |m: &mut StellarAllowTrustOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "trusted_account", + |m: &StellarAllowTrustOp| { &m.trusted_account }, + |m: &mut StellarAllowTrustOp| { &mut m.trusted_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "asset_type", + |m: &StellarAllowTrustOp| { &m.asset_type }, + |m: &mut StellarAllowTrustOp| { &mut m.asset_type }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "asset_code", + |m: &StellarAllowTrustOp| { &m.asset_code }, + |m: &mut StellarAllowTrustOp| { &mut m.asset_code }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "is_authorized", + |m: &StellarAllowTrustOp| { &m.is_authorized }, + |m: &mut StellarAllowTrustOp| { &mut m.is_authorized }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarAllowTrustOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarAllowTrustOp { + const NAME: &'static str = "StellarAllowTrustOp"; + + fn is_initialized(&self) -> bool { + if self.trusted_account.is_none() { + return false; + } + if self.asset_type.is_none() { + return false; + } + if self.is_authorized.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.trusted_account = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.asset_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 34 => { + self.asset_code = ::std::option::Option::Some(is.read_string()?); + }, + 40 => { + self.is_authorized = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.trusted_account.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.asset_type { + my_size += ::protobuf::rt::int32_size(3, v.value()); + } + if let Some(v) = self.asset_code.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.is_authorized { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.trusted_account.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.asset_type { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.asset_code.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.is_authorized { + os.write_bool(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarAllowTrustOp { + StellarAllowTrustOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.trusted_account = ::std::option::Option::None; + self.asset_type = ::std::option::Option::None; + self.asset_code = ::std::option::Option::None; + self.is_authorized = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarAllowTrustOp { + static instance: StellarAllowTrustOp = StellarAllowTrustOp { + source_account: ::std::option::Option::None, + trusted_account: ::std::option::Option::None, + asset_type: ::std::option::Option::None, + asset_code: ::std::option::Option::None, + is_authorized: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarAllowTrustOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAllowTrustOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarAllowTrustOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarAllowTrustOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAccountMergeOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarAccountMergeOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAccountMergeOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAccountMergeOp.destination_account) + pub destination_account: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAccountMergeOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarAccountMergeOp { + fn default() -> &'a StellarAccountMergeOp { + ::default_instance() + } +} + +impl StellarAccountMergeOp { + pub fn new() -> StellarAccountMergeOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string destination_account = 2; + + pub fn destination_account(&self) -> &str { + match self.destination_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination_account(&mut self) { + self.destination_account = ::std::option::Option::None; + } + + pub fn has_destination_account(&self) -> bool { + self.destination_account.is_some() + } + + // Param is passed by value, moved + pub fn set_destination_account(&mut self, v: ::std::string::String) { + self.destination_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { + if self.destination_account.is_none() { + self.destination_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination_account.as_mut().unwrap() + } + + // Take field + pub fn take_destination_account(&mut self) -> ::std::string::String { + self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarAccountMergeOp| { &m.source_account }, + |m: &mut StellarAccountMergeOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination_account", + |m: &StellarAccountMergeOp| { &m.destination_account }, + |m: &mut StellarAccountMergeOp| { &mut m.destination_account }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarAccountMergeOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarAccountMergeOp { + const NAME: &'static str = "StellarAccountMergeOp"; + + fn is_initialized(&self) -> bool { + if self.destination_account.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.destination_account = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.destination_account.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.destination_account.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarAccountMergeOp { + StellarAccountMergeOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.destination_account = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarAccountMergeOp { + static instance: StellarAccountMergeOp = StellarAccountMergeOp { + source_account: ::std::option::Option::None, + destination_account: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarAccountMergeOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAccountMergeOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarAccountMergeOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarAccountMergeOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarManageDataOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarManageDataOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageDataOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageDataOp.key) + pub key: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageDataOp.value) + pub value: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarManageDataOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarManageDataOp { + fn default() -> &'a StellarManageDataOp { + ::default_instance() + } +} + +impl StellarManageDataOp { + pub fn new() -> StellarManageDataOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string key = 2; + + pub fn key(&self) -> &str { + match self.key.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_key(&mut self) { + self.key = ::std::option::Option::None; + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::string::String) { + self.key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::string::String { + if self.key.is_none() { + self.key = ::std::option::Option::Some(::std::string::String::new()); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::string::String { + self.key.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes value = 3; + + pub fn value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarManageDataOp| { &m.source_account }, + |m: &mut StellarManageDataOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "key", + |m: &StellarManageDataOp| { &m.key }, + |m: &mut StellarManageDataOp| { &mut m.key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &StellarManageDataOp| { &m.value }, + |m: &mut StellarManageDataOp| { &mut m.value }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarManageDataOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarManageDataOp { + const NAME: &'static str = "StellarManageDataOp"; + + fn is_initialized(&self) -> bool { + if self.key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.key = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.value = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.key.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.key.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.value.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarManageDataOp { + StellarManageDataOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.key = ::std::option::Option::None; + self.value = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarManageDataOp { + static instance: StellarManageDataOp = StellarManageDataOp { + source_account: ::std::option::Option::None, + key: ::std::option::Option::None, + value: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarManageDataOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarManageDataOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarManageDataOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarManageDataOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarBumpSequenceOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarBumpSequenceOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarBumpSequenceOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarBumpSequenceOp.bump_to) + pub bump_to: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarBumpSequenceOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarBumpSequenceOp { + fn default() -> &'a StellarBumpSequenceOp { + ::default_instance() + } +} + +impl StellarBumpSequenceOp { + pub fn new() -> StellarBumpSequenceOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 bump_to = 2; + + pub fn bump_to(&self) -> u64 { + self.bump_to.unwrap_or(0) + } + + pub fn clear_bump_to(&mut self) { + self.bump_to = ::std::option::Option::None; + } + + pub fn has_bump_to(&self) -> bool { + self.bump_to.is_some() + } + + // Param is passed by value, moved + pub fn set_bump_to(&mut self, v: u64) { + self.bump_to = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarBumpSequenceOp| { &m.source_account }, + |m: &mut StellarBumpSequenceOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "bump_to", + |m: &StellarBumpSequenceOp| { &m.bump_to }, + |m: &mut StellarBumpSequenceOp| { &mut m.bump_to }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarBumpSequenceOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarBumpSequenceOp { + const NAME: &'static str = "StellarBumpSequenceOp"; + + fn is_initialized(&self) -> bool { + if self.bump_to.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 16 => { + self.bump_to = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.bump_to { + my_size += ::protobuf::rt::uint64_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.bump_to { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarBumpSequenceOp { + StellarBumpSequenceOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.bump_to = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarBumpSequenceOp { + static instance: StellarBumpSequenceOp = StellarBumpSequenceOp { + source_account: ::std::option::Option::None, + bump_to: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarBumpSequenceOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarBumpSequenceOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarBumpSequenceOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarBumpSequenceOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarClaimClaimableBalanceOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp.source_account) + pub source_account: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp.balance_id) + pub balance_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarClaimClaimableBalanceOp { + fn default() -> &'a StellarClaimClaimableBalanceOp { + ::default_instance() + } +} + +impl StellarClaimClaimableBalanceOp { + pub fn new() -> StellarClaimClaimableBalanceOp { + ::std::default::Default::default() + } + + // optional string source_account = 1; + + pub fn source_account(&self) -> &str { + match self.source_account.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_source_account(&mut self) { + self.source_account = ::std::option::Option::None; + } + + pub fn has_source_account(&self) -> bool { + self.source_account.is_some() + } + + // Param is passed by value, moved + pub fn set_source_account(&mut self, v: ::std::string::String) { + self.source_account = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source_account(&mut self) -> &mut ::std::string::String { + if self.source_account.is_none() { + self.source_account = ::std::option::Option::Some(::std::string::String::new()); + } + self.source_account.as_mut().unwrap() + } + + // Take field + pub fn take_source_account(&mut self) -> ::std::string::String { + self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes balance_id = 2; + + pub fn balance_id(&self) -> &[u8] { + match self.balance_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_balance_id(&mut self) { + self.balance_id = ::std::option::Option::None; + } + + pub fn has_balance_id(&self) -> bool { + self.balance_id.is_some() + } + + // Param is passed by value, moved + pub fn set_balance_id(&mut self, v: ::std::vec::Vec) { + self.balance_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_balance_id(&mut self) -> &mut ::std::vec::Vec { + if self.balance_id.is_none() { + self.balance_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.balance_id.as_mut().unwrap() + } + + // Take field + pub fn take_balance_id(&mut self) -> ::std::vec::Vec { + self.balance_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source_account", + |m: &StellarClaimClaimableBalanceOp| { &m.source_account }, + |m: &mut StellarClaimClaimableBalanceOp| { &mut m.source_account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "balance_id", + |m: &StellarClaimClaimableBalanceOp| { &m.balance_id }, + |m: &mut StellarClaimClaimableBalanceOp| { &mut m.balance_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarClaimClaimableBalanceOp", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarClaimClaimableBalanceOp { + const NAME: &'static str = "StellarClaimClaimableBalanceOp"; + + fn is_initialized(&self) -> bool { + if self.balance_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source_account = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.balance_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source_account.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.balance_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source_account.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.balance_id.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarClaimClaimableBalanceOp { + StellarClaimClaimableBalanceOp::new() + } + + fn clear(&mut self) { + self.source_account = ::std::option::Option::None; + self.balance_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarClaimClaimableBalanceOp { + static instance: StellarClaimClaimableBalanceOp = StellarClaimClaimableBalanceOp { + source_account: ::std::option::Option::None, + balance_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarClaimClaimableBalanceOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarClaimClaimableBalanceOp").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarClaimClaimableBalanceOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarClaimClaimableBalanceOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarSignedTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct StellarSignedTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignedTx.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignedTx.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarSignedTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StellarSignedTx { + fn default() -> &'a StellarSignedTx { + ::default_instance() + } +} + +impl StellarSignedTx { + pub fn new() -> StellarSignedTx { + ::std::default::Default::default() + } + + // required bytes public_key = 1; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes signature = 2; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &StellarSignedTx| { &m.public_key }, + |m: &mut StellarSignedTx| { &mut m.public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &StellarSignedTx| { &m.signature }, + |m: &mut StellarSignedTx| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "StellarSignedTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for StellarSignedTx { + const NAME: &'static str = "StellarSignedTx"; + + fn is_initialized(&self) -> bool { + if self.public_key.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> StellarSignedTx { + StellarSignedTx::new() + } + + fn clear(&mut self) { + self.public_key = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StellarSignedTx { + static instance: StellarSignedTx = StellarSignedTx { + public_key: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for StellarSignedTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarSignedTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StellarSignedTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StellarSignedTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.stellar.StellarAssetType) +pub enum StellarAssetType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarAssetType.NATIVE) + NATIVE = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarAssetType.ALPHANUM4) + ALPHANUM4 = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarAssetType.ALPHANUM12) + ALPHANUM12 = 2, +} + +impl ::protobuf::Enum for StellarAssetType { + const NAME: &'static str = "StellarAssetType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(StellarAssetType::NATIVE), + 1 => ::std::option::Option::Some(StellarAssetType::ALPHANUM4), + 2 => ::std::option::Option::Some(StellarAssetType::ALPHANUM12), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "NATIVE" => ::std::option::Option::Some(StellarAssetType::NATIVE), + "ALPHANUM4" => ::std::option::Option::Some(StellarAssetType::ALPHANUM4), + "ALPHANUM12" => ::std::option::Option::Some(StellarAssetType::ALPHANUM12), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [StellarAssetType] = &[ + StellarAssetType::NATIVE, + StellarAssetType::ALPHANUM4, + StellarAssetType::ALPHANUM12, + ]; +} + +impl ::protobuf::EnumFull for StellarAssetType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("StellarAssetType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for StellarAssetType { + fn default() -> Self { + StellarAssetType::NATIVE + } +} + +impl StellarAssetType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("StellarAssetType") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x16messages-stellar.proto\x12\x1ahw.trezor.messages.stellar\"|\n\x0cS\ + tellarAsset\x12@\n\x04type\x18\x01\x20\x02(\x0e2,.hw.trezor.messages.ste\ + llar.StellarAssetTypeR\x04type\x12\x12\n\x04code\x18\x02\x20\x01(\tR\x04\ + code\x12\x16\n\x06issuer\x18\x03\x20\x01(\tR\x06issuer\"o\n\x11StellarGe\ + tAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0c\ + show_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\ + \x18\x03\x20\x01(\x08R\x08chunkify\"*\n\x0eStellarAddress\x12\x18\n\x07a\ + ddress\x18\x01\x20\x02(\tR\x07address\"\xa6\x04\n\rStellarSignTx\x12\x1b\ + \n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12-\n\x12network_passphra\ + se\x18\x03\x20\x02(\tR\x11networkPassphrase\x12%\n\x0esource_account\x18\ + \x04\x20\x02(\tR\rsourceAccount\x12\x10\n\x03fee\x18\x05\x20\x02(\rR\x03\ + fee\x12'\n\x0fsequence_number\x18\x06\x20\x02(\x04R\x0esequenceNumber\ + \x12)\n\x10timebounds_start\x18\x08\x20\x02(\rR\x0ftimeboundsStart\x12%\ + \n\x0etimebounds_end\x18\t\x20\x02(\rR\rtimeboundsEnd\x12V\n\tmemo_type\ + \x18\n\x20\x02(\x0e29.hw.trezor.messages.stellar.StellarSignTx.StellarMe\ + moTypeR\x08memoType\x12\x1b\n\tmemo_text\x18\x0b\x20\x01(\tR\x08memoText\ + \x12\x17\n\x07memo_id\x18\x0c\x20\x01(\x04R\x06memoId\x12\x1b\n\tmemo_ha\ + sh\x18\r\x20\x01(\x0cR\x08memoHash\x12%\n\x0enum_operations\x18\x0e\x20\ + \x02(\rR\rnumOperations\"C\n\x0fStellarMemoType\x12\x08\n\x04NONE\x10\0\ + \x12\x08\n\x04TEXT\x10\x01\x12\x06\n\x02ID\x10\x02\x12\x08\n\x04HASH\x10\ + \x03\x12\n\n\x06RETURN\x10\x04\"\x14\n\x12StellarTxOpRequest\"\xc2\x01\n\ + \x10StellarPaymentOp\x12%\n\x0esource_account\x18\x01\x20\x01(\tR\rsourc\ + eAccount\x12/\n\x13destination_account\x18\x02\x20\x02(\tR\x12destinatio\ + nAccount\x12>\n\x05asset\x18\x03\x20\x02(\x0b2(.hw.trezor.messages.stell\ + ar.StellarAssetR\x05asset\x12\x16\n\x06amount\x18\x04\x20\x02(\x12R\x06a\ + mount\"\x8b\x01\n\x16StellarCreateAccountOp\x12%\n\x0esource_account\x18\ + \x01\x20\x01(\tR\rsourceAccount\x12\x1f\n\x0bnew_account\x18\x02\x20\x02\ + (\tR\nnewAccount\x12)\n\x10starting_balance\x18\x03\x20\x02(\x12R\x0fsta\ + rtingBalance\"\xa5\x03\n!StellarPathPaymentStrictReceiveOp\x12%\n\x0esou\ + rce_account\x18\x01\x20\x01(\tR\rsourceAccount\x12G\n\nsend_asset\x18\ + \x02\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\tsendAsset\ + \x12\x19\n\x08send_max\x18\x03\x20\x02(\x12R\x07sendMax\x12/\n\x13destin\ + ation_account\x18\x04\x20\x02(\tR\x12destinationAccount\x12U\n\x11destin\ + ation_asset\x18\x05\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAss\ + etR\x10destinationAsset\x12-\n\x12destination_amount\x18\x06\x20\x02(\ + \x12R\x11destinationAmount\x12>\n\x05paths\x18\x07\x20\x03(\x0b2(.hw.tre\ + zor.messages.stellar.StellarAssetR\x05paths\"\xa2\x03\n\x1eStellarPathPa\ + ymentStrictSendOp\x12%\n\x0esource_account\x18\x01\x20\x01(\tR\rsourceAc\ + count\x12G\n\nsend_asset\x18\x02\x20\x02(\x0b2(.hw.trezor.messages.stell\ + ar.StellarAssetR\tsendAsset\x12\x1f\n\x0bsend_amount\x18\x03\x20\x02(\ + \x12R\nsendAmount\x12/\n\x13destination_account\x18\x04\x20\x02(\tR\x12d\ + estinationAccount\x12U\n\x11destination_asset\x18\x05\x20\x02(\x0b2(.hw.\ + trezor.messages.stellar.StellarAssetR\x10destinationAsset\x12'\n\x0fdest\ + ination_min\x18\x06\x20\x02(\x12R\x0edestinationMin\x12>\n\x05paths\x18\ + \x07\x20\x03(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\x05paths\"\ + \xc2\x02\n\x18StellarManageSellOfferOp\x12%\n\x0esource_account\x18\x01\ + \x20\x01(\tR\rsourceAccount\x12M\n\rselling_asset\x18\x02\x20\x02(\x0b2(\ + .hw.trezor.messages.stellar.StellarAssetR\x0csellingAsset\x12K\n\x0cbuyi\ + ng_asset\x18\x03\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\ + \x0bbuyingAsset\x12\x16\n\x06amount\x18\x04\x20\x02(\x12R\x06amount\x12\ + \x17\n\x07price_n\x18\x05\x20\x02(\rR\x06priceN\x12\x17\n\x07price_d\x18\ + \x06\x20\x02(\rR\x06priceD\x12\x19\n\x08offer_id\x18\x07\x20\x02(\x04R\ + \x07offerId\"\xc1\x02\n\x17StellarManageBuyOfferOp\x12%\n\x0esource_acco\ + unt\x18\x01\x20\x01(\tR\rsourceAccount\x12M\n\rselling_asset\x18\x02\x20\ + \x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\x0csellingAsset\x12\ + K\n\x0cbuying_asset\x18\x03\x20\x02(\x0b2(.hw.trezor.messages.stellar.St\ + ellarAssetR\x0bbuyingAsset\x12\x16\n\x06amount\x18\x04\x20\x02(\x12R\x06\ + amount\x12\x17\n\x07price_n\x18\x05\x20\x02(\rR\x06priceN\x12\x17\n\x07p\ + rice_d\x18\x06\x20\x02(\rR\x06priceD\x12\x19\n\x08offer_id\x18\x07\x20\ + \x02(\x04R\x07offerId\"\xae\x02\n\x1fStellarCreatePassiveSellOfferOp\x12\ + %\n\x0esource_account\x18\x01\x20\x01(\tR\rsourceAccount\x12M\n\rselling\ + _asset\x18\x02\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\ + \x0csellingAsset\x12K\n\x0cbuying_asset\x18\x03\x20\x02(\x0b2(.hw.trezor\ + .messages.stellar.StellarAssetR\x0bbuyingAsset\x12\x16\n\x06amount\x18\ + \x04\x20\x02(\x12R\x06amount\x12\x17\n\x07price_n\x18\x05\x20\x02(\rR\ + \x06priceN\x12\x17\n\x07price_d\x18\x06\x20\x02(\rR\x06priceD\"\xdd\x04\ + \n\x13StellarSetOptionsOp\x12%\n\x0esource_account\x18\x01\x20\x01(\tR\r\ + sourceAccount\x12B\n\x1dinflation_destination_account\x18\x02\x20\x01(\t\ + R\x1binflationDestinationAccount\x12\x1f\n\x0bclear_flags\x18\x03\x20\ + \x01(\rR\nclearFlags\x12\x1b\n\tset_flags\x18\x04\x20\x01(\rR\x08setFlag\ + s\x12#\n\rmaster_weight\x18\x05\x20\x01(\rR\x0cmasterWeight\x12#\n\rlow_\ + threshold\x18\x06\x20\x01(\rR\x0clowThreshold\x12)\n\x10medium_threshold\ + \x18\x07\x20\x01(\rR\x0fmediumThreshold\x12%\n\x0ehigh_threshold\x18\x08\ + \x20\x01(\rR\rhighThreshold\x12\x1f\n\x0bhome_domain\x18\t\x20\x01(\tR\n\ + homeDomain\x12b\n\x0bsigner_type\x18\n\x20\x01(\x0e2A.hw.trezor.messages\ + .stellar.StellarSetOptionsOp.StellarSignerTypeR\nsignerType\x12\x1d\n\ns\ + igner_key\x18\x0b\x20\x01(\x0cR\tsignerKey\x12#\n\rsigner_weight\x18\x0c\ + \x20\x01(\rR\x0csignerWeight\"8\n\x11StellarSignerType\x12\x0b\n\x07ACCO\ + UNT\x10\0\x12\x0c\n\x08PRE_AUTH\x10\x01\x12\x08\n\x04HASH\x10\x02\"\x93\ + \x01\n\x14StellarChangeTrustOp\x12%\n\x0esource_account\x18\x01\x20\x01(\ + \tR\rsourceAccount\x12>\n\x05asset\x18\x02\x20\x02(\x0b2(.hw.trezor.mess\ + ages.stellar.StellarAssetR\x05asset\x12\x14\n\x05limit\x18\x03\x20\x02(\ + \x04R\x05limit\"\xf6\x01\n\x13StellarAllowTrustOp\x12%\n\x0esource_accou\ + nt\x18\x01\x20\x01(\tR\rsourceAccount\x12'\n\x0ftrusted_account\x18\x02\ + \x20\x02(\tR\x0etrustedAccount\x12K\n\nasset_type\x18\x03\x20\x02(\x0e2,\ + .hw.trezor.messages.stellar.StellarAssetTypeR\tassetType\x12\x1d\n\nasse\ + t_code\x18\x04\x20\x01(\tR\tassetCode\x12#\n\ris_authorized\x18\x05\x20\ + \x02(\x08R\x0cisAuthorized\"o\n\x15StellarAccountMergeOp\x12%\n\x0esourc\ + e_account\x18\x01\x20\x01(\tR\rsourceAccount\x12/\n\x13destination_accou\ + nt\x18\x02\x20\x02(\tR\x12destinationAccount\"d\n\x13StellarManageDataOp\ + \x12%\n\x0esource_account\x18\x01\x20\x01(\tR\rsourceAccount\x12\x10\n\ + \x03key\x18\x02\x20\x02(\tR\x03key\x12\x14\n\x05value\x18\x03\x20\x01(\ + \x0cR\x05value\"W\n\x15StellarBumpSequenceOp\x12%\n\x0esource_account\ + \x18\x01\x20\x01(\tR\rsourceAccount\x12\x17\n\x07bump_to\x18\x02\x20\x02\ + (\x04R\x06bumpTo\"f\n\x1eStellarClaimClaimableBalanceOp\x12%\n\x0esource\ + _account\x18\x01\x20\x01(\tR\rsourceAccount\x12\x1d\n\nbalance_id\x18\ + \x02\x20\x02(\x0cR\tbalanceId\"N\n\x0fStellarSignedTx\x12\x1d\n\npublic_\ + key\x18\x01\x20\x02(\x0cR\tpublicKey\x12\x1c\n\tsignature\x18\x02\x20\ + \x02(\x0cR\tsignature*=\n\x10StellarAssetType\x12\n\n\x06NATIVE\x10\0\ + \x12\r\n\tALPHANUM4\x10\x01\x12\x0e\n\nALPHANUM12\x10\x02B;\n#com.satosh\ + ilabs.trezor.lib.protobufB\x14TrezorMessageStellar\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(20); + messages.push(StellarAsset::generated_message_descriptor_data()); + messages.push(StellarGetAddress::generated_message_descriptor_data()); + messages.push(StellarAddress::generated_message_descriptor_data()); + messages.push(StellarSignTx::generated_message_descriptor_data()); + messages.push(StellarTxOpRequest::generated_message_descriptor_data()); + messages.push(StellarPaymentOp::generated_message_descriptor_data()); + messages.push(StellarCreateAccountOp::generated_message_descriptor_data()); + messages.push(StellarPathPaymentStrictReceiveOp::generated_message_descriptor_data()); + messages.push(StellarPathPaymentStrictSendOp::generated_message_descriptor_data()); + messages.push(StellarManageSellOfferOp::generated_message_descriptor_data()); + messages.push(StellarManageBuyOfferOp::generated_message_descriptor_data()); + messages.push(StellarCreatePassiveSellOfferOp::generated_message_descriptor_data()); + messages.push(StellarSetOptionsOp::generated_message_descriptor_data()); + messages.push(StellarChangeTrustOp::generated_message_descriptor_data()); + messages.push(StellarAllowTrustOp::generated_message_descriptor_data()); + messages.push(StellarAccountMergeOp::generated_message_descriptor_data()); + messages.push(StellarManageDataOp::generated_message_descriptor_data()); + messages.push(StellarBumpSequenceOp::generated_message_descriptor_data()); + messages.push(StellarClaimClaimableBalanceOp::generated_message_descriptor_data()); + messages.push(StellarSignedTx::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(3); + enums.push(StellarAssetType::generated_enum_descriptor_data()); + enums.push(stellar_sign_tx::StellarMemoType::generated_enum_descriptor_data()); + enums.push(stellar_set_options_op::StellarSignerType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_tezos.rs b/wallet/trezor-client/src/protos/generated/messages_tezos.rs new file mode 100644 index 0000000000..772554fe5a --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_tezos.rs @@ -0,0 +1,4584 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-tezos.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosGetAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TezosGetAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetAddress.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetAddress.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetAddress.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosGetAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TezosGetAddress { + fn default() -> &'a TezosGetAddress { + ::default_instance() + } +} + +impl TezosGetAddress { + pub fn new() -> TezosGetAddress { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &TezosGetAddress| { &m.address_n }, + |m: &mut TezosGetAddress| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &TezosGetAddress| { &m.show_display }, + |m: &mut TezosGetAddress| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &TezosGetAddress| { &m.chunkify }, + |m: &mut TezosGetAddress| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosGetAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TezosGetAddress { + const NAME: &'static str = "TezosGetAddress"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosGetAddress { + TezosGetAddress::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosGetAddress { + static instance: TezosGetAddress = TezosGetAddress { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TezosGetAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosGetAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TezosGetAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TezosGetAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosAddress) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TezosAddress { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosAddress.address) + pub address: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosAddress.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TezosAddress { + fn default() -> &'a TezosAddress { + ::default_instance() + } +} + +impl TezosAddress { + pub fn new() -> TezosAddress { + ::std::default::Default::default() + } + + // required string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &TezosAddress| { &m.address }, + |m: &mut TezosAddress| { &mut m.address }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosAddress", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TezosAddress { + const NAME: &'static str = "TezosAddress"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosAddress { + TezosAddress::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosAddress { + static instance: TezosAddress = TezosAddress { + address: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TezosAddress { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosAddress").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TezosAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TezosAddress { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosGetPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TezosGetPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetPublicKey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetPublicKey.show_display) + pub show_display: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetPublicKey.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosGetPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TezosGetPublicKey { + fn default() -> &'a TezosGetPublicKey { + ::default_instance() + } +} + +impl TezosGetPublicKey { + pub fn new() -> TezosGetPublicKey { + ::std::default::Default::default() + } + + // optional bool show_display = 2; + + pub fn show_display(&self) -> bool { + self.show_display.unwrap_or(false) + } + + pub fn clear_show_display(&mut self) { + self.show_display = ::std::option::Option::None; + } + + pub fn has_show_display(&self) -> bool { + self.show_display.is_some() + } + + // Param is passed by value, moved + pub fn set_show_display(&mut self, v: bool) { + self.show_display = ::std::option::Option::Some(v); + } + + // optional bool chunkify = 3; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &TezosGetPublicKey| { &m.address_n }, + |m: &mut TezosGetPublicKey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "show_display", + |m: &TezosGetPublicKey| { &m.show_display }, + |m: &mut TezosGetPublicKey| { &mut m.show_display }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &TezosGetPublicKey| { &m.chunkify }, + |m: &mut TezosGetPublicKey| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosGetPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TezosGetPublicKey { + const NAME: &'static str = "TezosGetPublicKey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.show_display = ::std::option::Option::Some(is.read_bool()?); + }, + 24 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.show_display { + my_size += 1 + 1; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.show_display { + os.write_bool(2, v)?; + } + if let Some(v) = self.chunkify { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosGetPublicKey { + TezosGetPublicKey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.show_display = ::std::option::Option::None; + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosGetPublicKey { + static instance: TezosGetPublicKey = TezosGetPublicKey { + address_n: ::std::vec::Vec::new(), + show_display: ::std::option::Option::None, + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TezosGetPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosGetPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TezosGetPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TezosGetPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosPublicKey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TezosPublicKey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosPublicKey.public_key) + pub public_key: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosPublicKey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TezosPublicKey { + fn default() -> &'a TezosPublicKey { + ::default_instance() + } +} + +impl TezosPublicKey { + pub fn new() -> TezosPublicKey { + ::std::default::Default::default() + } + + // required string public_key = 1; + + pub fn public_key(&self) -> &str { + match self.public_key.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::string::String) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::string::String { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::string::String::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::string::String { + self.public_key.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &TezosPublicKey| { &m.public_key }, + |m: &mut TezosPublicKey| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosPublicKey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TezosPublicKey { + const NAME: &'static str = "TezosPublicKey"; + + fn is_initialized(&self) -> bool { + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.public_key = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.public_key.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosPublicKey { + TezosPublicKey::new() + } + + fn clear(&mut self) { + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosPublicKey { + static instance: TezosPublicKey = TezosPublicKey { + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TezosPublicKey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosPublicKey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TezosPublicKey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TezosPublicKey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TezosSignTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.branch) + pub branch: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.reveal) + pub reveal: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.transaction) + pub transaction: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.origination) + pub origination: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.delegation) + pub delegation: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.proposal) + pub proposal: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.ballot) + pub ballot: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.chunkify) + pub chunkify: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TezosSignTx { + fn default() -> &'a TezosSignTx { + ::default_instance() + } +} + +impl TezosSignTx { + pub fn new() -> TezosSignTx { + ::std::default::Default::default() + } + + // required bytes branch = 2; + + pub fn branch(&self) -> &[u8] { + match self.branch.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_branch(&mut self) { + self.branch = ::std::option::Option::None; + } + + pub fn has_branch(&self) -> bool { + self.branch.is_some() + } + + // Param is passed by value, moved + pub fn set_branch(&mut self, v: ::std::vec::Vec) { + self.branch = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_branch(&mut self) -> &mut ::std::vec::Vec { + if self.branch.is_none() { + self.branch = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.branch.as_mut().unwrap() + } + + // Take field + pub fn take_branch(&mut self) -> ::std::vec::Vec { + self.branch.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool chunkify = 9; + + pub fn chunkify(&self) -> bool { + self.chunkify.unwrap_or(false) + } + + pub fn clear_chunkify(&mut self) { + self.chunkify = ::std::option::Option::None; + } + + pub fn has_chunkify(&self) -> bool { + self.chunkify.is_some() + } + + // Param is passed by value, moved + pub fn set_chunkify(&mut self, v: bool) { + self.chunkify = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &TezosSignTx| { &m.address_n }, + |m: &mut TezosSignTx| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "branch", + |m: &TezosSignTx| { &m.branch }, + |m: &mut TezosSignTx| { &mut m.branch }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosRevealOp>( + "reveal", + |m: &TezosSignTx| { &m.reveal }, + |m: &mut TezosSignTx| { &mut m.reveal }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosTransactionOp>( + "transaction", + |m: &TezosSignTx| { &m.transaction }, + |m: &mut TezosSignTx| { &mut m.transaction }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosOriginationOp>( + "origination", + |m: &TezosSignTx| { &m.origination }, + |m: &mut TezosSignTx| { &mut m.origination }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosDelegationOp>( + "delegation", + |m: &TezosSignTx| { &m.delegation }, + |m: &mut TezosSignTx| { &mut m.delegation }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosProposalOp>( + "proposal", + |m: &TezosSignTx| { &m.proposal }, + |m: &mut TezosSignTx| { &mut m.proposal }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosBallotOp>( + "ballot", + |m: &TezosSignTx| { &m.ballot }, + |m: &mut TezosSignTx| { &mut m.ballot }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "chunkify", + |m: &TezosSignTx| { &m.chunkify }, + |m: &mut TezosSignTx| { &mut m.chunkify }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TezosSignTx { + const NAME: &'static str = "TezosSignTx"; + + fn is_initialized(&self) -> bool { + if self.branch.is_none() { + return false; + } + for v in &self.reveal { + if !v.is_initialized() { + return false; + } + }; + for v in &self.transaction { + if !v.is_initialized() { + return false; + } + }; + for v in &self.origination { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delegation { + if !v.is_initialized() { + return false; + } + }; + for v in &self.proposal { + if !v.is_initialized() { + return false; + } + }; + for v in &self.ballot { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.branch = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.reveal)?; + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.transaction)?; + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.origination)?; + }, + 50 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.delegation)?; + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.proposal)?; + }, + 66 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.ballot)?; + }, + 72 => { + self.chunkify = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.branch.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.reveal.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.transaction.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.origination.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.delegation.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.proposal.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.ballot.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.chunkify { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.branch.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.reveal.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.transaction.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.origination.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.delegation.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; + } + if let Some(v) = self.proposal.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.ballot.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; + } + if let Some(v) = self.chunkify { + os.write_bool(9, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosSignTx { + TezosSignTx::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.branch = ::std::option::Option::None; + self.reveal.clear(); + self.transaction.clear(); + self.origination.clear(); + self.delegation.clear(); + self.proposal.clear(); + self.ballot.clear(); + self.chunkify = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosSignTx { + static instance: TezosSignTx = TezosSignTx { + address_n: ::std::vec::Vec::new(), + branch: ::std::option::Option::None, + reveal: ::protobuf::MessageField::none(), + transaction: ::protobuf::MessageField::none(), + origination: ::protobuf::MessageField::none(), + delegation: ::protobuf::MessageField::none(), + proposal: ::protobuf::MessageField::none(), + ballot: ::protobuf::MessageField::none(), + chunkify: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TezosSignTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosSignTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TezosSignTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TezosSignTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `TezosSignTx` +pub mod tezos_sign_tx { + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosContractID) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosContractID { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.tag) + pub tag: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.hash) + pub hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosContractID { + fn default() -> &'a TezosContractID { + ::default_instance() + } + } + + impl TezosContractID { + pub fn new() -> TezosContractID { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType tag = 1; + + pub fn tag(&self) -> tezos_contract_id::TezosContractType { + match self.tag { + Some(e) => e.enum_value_or(tezos_contract_id::TezosContractType::Implicit), + None => tezos_contract_id::TezosContractType::Implicit, + } + } + + pub fn clear_tag(&mut self) { + self.tag = ::std::option::Option::None; + } + + pub fn has_tag(&self) -> bool { + self.tag.is_some() + } + + // Param is passed by value, moved + pub fn set_tag(&mut self, v: tezos_contract_id::TezosContractType) { + self.tag = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // required bytes hash = 2; + + pub fn hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "tag", + |m: &TezosContractID| { &m.tag }, + |m: &mut TezosContractID| { &mut m.tag }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hash", + |m: &TezosContractID| { &m.hash }, + |m: &mut TezosContractID| { &mut m.hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosContractID", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosContractID { + const NAME: &'static str = "TezosContractID"; + + fn is_initialized(&self) -> bool { + if self.tag.is_none() { + return false; + } + if self.hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.tag = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.tag { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.tag { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.hash.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosContractID { + TezosContractID::new() + } + + fn clear(&mut self) { + self.tag = ::std::option::Option::None; + self.hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosContractID { + static instance: TezosContractID = TezosContractID { + tag: ::std::option::Option::None, + hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosContractID { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosContractID").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosContractID { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosContractID { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `TezosContractID` + pub mod tezos_contract_id { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType) + pub enum TezosContractType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType.Implicit) + Implicit = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType.Originated) + Originated = 1, + } + + impl ::protobuf::Enum for TezosContractType { + const NAME: &'static str = "TezosContractType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(TezosContractType::Implicit), + 1 => ::std::option::Option::Some(TezosContractType::Originated), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Implicit" => ::std::option::Option::Some(TezosContractType::Implicit), + "Originated" => ::std::option::Option::Some(TezosContractType::Originated), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [TezosContractType] = &[ + TezosContractType::Implicit, + TezosContractType::Originated, + ]; + } + + impl ::protobuf::EnumFull for TezosContractType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("TezosSignTx.TezosContractID.TezosContractType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for TezosContractType { + fn default() -> Self { + TezosContractType::Implicit + } + } + + impl TezosContractType { + pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("TezosSignTx.TezosContractID.TezosContractType") + } + } + } + + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosRevealOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.source) + pub source: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.counter) + pub counter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.gas_limit) + pub gas_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.storage_limit) + pub storage_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosRevealOp { + fn default() -> &'a TezosRevealOp { + ::default_instance() + } + } + + impl TezosRevealOp { + pub fn new() -> TezosRevealOp { + ::std::default::Default::default() + } + + // required bytes source = 7; + + pub fn source(&self) -> &[u8] { + match self.source.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_source(&mut self) { + self.source = ::std::option::Option::None; + } + + pub fn has_source(&self) -> bool { + self.source.is_some() + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::vec::Vec) { + self.source = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { + if self.source.is_none() { + self.source = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.source.as_mut().unwrap() + } + + // Take field + pub fn take_source(&mut self) -> ::std::vec::Vec { + self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 fee = 2; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // required uint64 counter = 3; + + pub fn counter(&self) -> u64 { + self.counter.unwrap_or(0) + } + + pub fn clear_counter(&mut self) { + self.counter = ::std::option::Option::None; + } + + pub fn has_counter(&self) -> bool { + self.counter.is_some() + } + + // Param is passed by value, moved + pub fn set_counter(&mut self, v: u64) { + self.counter = ::std::option::Option::Some(v); + } + + // required uint64 gas_limit = 4; + + pub fn gas_limit(&self) -> u64 { + self.gas_limit.unwrap_or(0) + } + + pub fn clear_gas_limit(&mut self) { + self.gas_limit = ::std::option::Option::None; + } + + pub fn has_gas_limit(&self) -> bool { + self.gas_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_gas_limit(&mut self, v: u64) { + self.gas_limit = ::std::option::Option::Some(v); + } + + // required uint64 storage_limit = 5; + + pub fn storage_limit(&self) -> u64 { + self.storage_limit.unwrap_or(0) + } + + pub fn clear_storage_limit(&mut self) { + self.storage_limit = ::std::option::Option::None; + } + + pub fn has_storage_limit(&self) -> bool { + self.storage_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_storage_limit(&mut self, v: u64) { + self.storage_limit = ::std::option::Option::Some(v); + } + + // required bytes public_key = 6; + + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source", + |m: &TezosRevealOp| { &m.source }, + |m: &mut TezosRevealOp| { &mut m.source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &TezosRevealOp| { &m.fee }, + |m: &mut TezosRevealOp| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "counter", + |m: &TezosRevealOp| { &m.counter }, + |m: &mut TezosRevealOp| { &mut m.counter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "gas_limit", + |m: &TezosRevealOp| { &m.gas_limit }, + |m: &mut TezosRevealOp| { &mut m.gas_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "storage_limit", + |m: &TezosRevealOp| { &m.storage_limit }, + |m: &mut TezosRevealOp| { &mut m.storage_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "public_key", + |m: &TezosRevealOp| { &m.public_key }, + |m: &mut TezosRevealOp| { &mut m.public_key }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosRevealOp", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosRevealOp { + const NAME: &'static str = "TezosRevealOp"; + + fn is_initialized(&self) -> bool { + if self.source.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + if self.counter.is_none() { + return false; + } + if self.gas_limit.is_none() { + return false; + } + if self.storage_limit.is_none() { + return false; + } + if self.public_key.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 58 => { + self.source = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.counter = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 50 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.counter { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.gas_limit { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.storage_limit { + my_size += ::protobuf::rt::uint64_size(5, v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source.as_ref() { + os.write_bytes(7, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(2, v)?; + } + if let Some(v) = self.counter { + os.write_uint64(3, v)?; + } + if let Some(v) = self.gas_limit { + os.write_uint64(4, v)?; + } + if let Some(v) = self.storage_limit { + os.write_uint64(5, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosRevealOp { + TezosRevealOp::new() + } + + fn clear(&mut self) { + self.source = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.counter = ::std::option::Option::None; + self.gas_limit = ::std::option::Option::None; + self.storage_limit = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosRevealOp { + static instance: TezosRevealOp = TezosRevealOp { + source: ::std::option::Option::None, + fee: ::std::option::Option::None, + counter: ::std::option::Option::None, + gas_limit: ::std::option::Option::None, + storage_limit: ::std::option::Option::None, + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosRevealOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosRevealOp").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosRevealOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosRevealOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosTransactionOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.source) + pub source: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.counter) + pub counter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.gas_limit) + pub gas_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.storage_limit) + pub storage_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.amount) + pub amount: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.destination) + pub destination: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.parameters) + pub parameters: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.parameters_manager) + pub parameters_manager: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosTransactionOp { + fn default() -> &'a TezosTransactionOp { + ::default_instance() + } + } + + impl TezosTransactionOp { + pub fn new() -> TezosTransactionOp { + ::std::default::Default::default() + } + + // required bytes source = 9; + + pub fn source(&self) -> &[u8] { + match self.source.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_source(&mut self) { + self.source = ::std::option::Option::None; + } + + pub fn has_source(&self) -> bool { + self.source.is_some() + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::vec::Vec) { + self.source = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { + if self.source.is_none() { + self.source = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.source.as_mut().unwrap() + } + + // Take field + pub fn take_source(&mut self) -> ::std::vec::Vec { + self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 fee = 2; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // required uint64 counter = 3; + + pub fn counter(&self) -> u64 { + self.counter.unwrap_or(0) + } + + pub fn clear_counter(&mut self) { + self.counter = ::std::option::Option::None; + } + + pub fn has_counter(&self) -> bool { + self.counter.is_some() + } + + // Param is passed by value, moved + pub fn set_counter(&mut self, v: u64) { + self.counter = ::std::option::Option::Some(v); + } + + // required uint64 gas_limit = 4; + + pub fn gas_limit(&self) -> u64 { + self.gas_limit.unwrap_or(0) + } + + pub fn clear_gas_limit(&mut self) { + self.gas_limit = ::std::option::Option::None; + } + + pub fn has_gas_limit(&self) -> bool { + self.gas_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_gas_limit(&mut self, v: u64) { + self.gas_limit = ::std::option::Option::Some(v); + } + + // required uint64 storage_limit = 5; + + pub fn storage_limit(&self) -> u64 { + self.storage_limit.unwrap_or(0) + } + + pub fn clear_storage_limit(&mut self) { + self.storage_limit = ::std::option::Option::None; + } + + pub fn has_storage_limit(&self) -> bool { + self.storage_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_storage_limit(&mut self, v: u64) { + self.storage_limit = ::std::option::Option::Some(v); + } + + // required uint64 amount = 6; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + // optional bytes parameters = 8; + + pub fn parameters(&self) -> &[u8] { + match self.parameters.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_parameters(&mut self) { + self.parameters = ::std::option::Option::None; + } + + pub fn has_parameters(&self) -> bool { + self.parameters.is_some() + } + + // Param is passed by value, moved + pub fn set_parameters(&mut self, v: ::std::vec::Vec) { + self.parameters = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_parameters(&mut self) -> &mut ::std::vec::Vec { + if self.parameters.is_none() { + self.parameters = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.parameters.as_mut().unwrap() + } + + // Take field + pub fn take_parameters(&mut self) -> ::std::vec::Vec { + self.parameters.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source", + |m: &TezosTransactionOp| { &m.source }, + |m: &mut TezosTransactionOp| { &mut m.source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &TezosTransactionOp| { &m.fee }, + |m: &mut TezosTransactionOp| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "counter", + |m: &TezosTransactionOp| { &m.counter }, + |m: &mut TezosTransactionOp| { &mut m.counter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "gas_limit", + |m: &TezosTransactionOp| { &m.gas_limit }, + |m: &mut TezosTransactionOp| { &mut m.gas_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "storage_limit", + |m: &TezosTransactionOp| { &m.storage_limit }, + |m: &mut TezosTransactionOp| { &mut m.storage_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TezosTransactionOp| { &m.amount }, + |m: &mut TezosTransactionOp| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, TezosContractID>( + "destination", + |m: &TezosTransactionOp| { &m.destination }, + |m: &mut TezosTransactionOp| { &mut m.destination }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "parameters", + |m: &TezosTransactionOp| { &m.parameters }, + |m: &mut TezosTransactionOp| { &mut m.parameters }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_transaction_op::TezosParametersManager>( + "parameters_manager", + |m: &TezosTransactionOp| { &m.parameters_manager }, + |m: &mut TezosTransactionOp| { &mut m.parameters_manager }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosTransactionOp", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosTransactionOp { + const NAME: &'static str = "TezosTransactionOp"; + + fn is_initialized(&self) -> bool { + if self.source.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + if self.counter.is_none() { + return false; + } + if self.gas_limit.is_none() { + return false; + } + if self.storage_limit.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + if self.destination.is_none() { + return false; + } + for v in &self.destination { + if !v.is_initialized() { + return false; + } + }; + for v in &self.parameters_manager { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 74 => { + self.source = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.counter = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 48 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination)?; + }, + 66 => { + self.parameters = ::std::option::Option::Some(is.read_bytes()?); + }, + 82 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.parameters_manager)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source.as_ref() { + my_size += ::protobuf::rt::bytes_size(9, &v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.counter { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.gas_limit { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.storage_limit { + my_size += ::protobuf::rt::uint64_size(5, v); + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(6, v); + } + if let Some(v) = self.destination.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.parameters.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + if let Some(v) = self.parameters_manager.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source.as_ref() { + os.write_bytes(9, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(2, v)?; + } + if let Some(v) = self.counter { + os.write_uint64(3, v)?; + } + if let Some(v) = self.gas_limit { + os.write_uint64(4, v)?; + } + if let Some(v) = self.storage_limit { + os.write_uint64(5, v)?; + } + if let Some(v) = self.amount { + os.write_uint64(6, v)?; + } + if let Some(v) = self.destination.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.parameters.as_ref() { + os.write_bytes(8, v)?; + } + if let Some(v) = self.parameters_manager.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosTransactionOp { + TezosTransactionOp::new() + } + + fn clear(&mut self) { + self.source = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.counter = ::std::option::Option::None; + self.gas_limit = ::std::option::Option::None; + self.storage_limit = ::std::option::Option::None; + self.amount = ::std::option::Option::None; + self.destination.clear(); + self.parameters = ::std::option::Option::None; + self.parameters_manager.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosTransactionOp { + static instance: TezosTransactionOp = TezosTransactionOp { + source: ::std::option::Option::None, + fee: ::std::option::Option::None, + counter: ::std::option::Option::None, + gas_limit: ::std::option::Option::None, + storage_limit: ::std::option::Option::None, + amount: ::std::option::Option::None, + destination: ::protobuf::MessageField::none(), + parameters: ::std::option::Option::None, + parameters_manager: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosTransactionOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosTransactionOp").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosTransactionOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosTransactionOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `TezosTransactionOp` + pub mod tezos_transaction_op { + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosParametersManager { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.set_delegate) + pub set_delegate: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.cancel_delegate) + pub cancel_delegate: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.transfer) + pub transfer: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosParametersManager { + fn default() -> &'a TezosParametersManager { + ::default_instance() + } + } + + impl TezosParametersManager { + pub fn new() -> TezosParametersManager { + ::std::default::Default::default() + } + + // optional bytes set_delegate = 1; + + pub fn set_delegate(&self) -> &[u8] { + match self.set_delegate.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_set_delegate(&mut self) { + self.set_delegate = ::std::option::Option::None; + } + + pub fn has_set_delegate(&self) -> bool { + self.set_delegate.is_some() + } + + // Param is passed by value, moved + pub fn set_set_delegate(&mut self, v: ::std::vec::Vec) { + self.set_delegate = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_set_delegate(&mut self) -> &mut ::std::vec::Vec { + if self.set_delegate.is_none() { + self.set_delegate = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.set_delegate.as_mut().unwrap() + } + + // Take field + pub fn take_set_delegate(&mut self) -> ::std::vec::Vec { + self.set_delegate.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool cancel_delegate = 2; + + pub fn cancel_delegate(&self) -> bool { + self.cancel_delegate.unwrap_or(false) + } + + pub fn clear_cancel_delegate(&mut self) { + self.cancel_delegate = ::std::option::Option::None; + } + + pub fn has_cancel_delegate(&self) -> bool { + self.cancel_delegate.is_some() + } + + // Param is passed by value, moved + pub fn set_cancel_delegate(&mut self, v: bool) { + self.cancel_delegate = ::std::option::Option::Some(v); + } + + pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "set_delegate", + |m: &TezosParametersManager| { &m.set_delegate }, + |m: &mut TezosParametersManager| { &mut m.set_delegate }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "cancel_delegate", + |m: &TezosParametersManager| { &m.cancel_delegate }, + |m: &mut TezosParametersManager| { &mut m.cancel_delegate }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_parameters_manager::TezosManagerTransfer>( + "transfer", + |m: &TezosParametersManager| { &m.transfer }, + |m: &mut TezosParametersManager| { &mut m.transfer }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosTransactionOp.TezosParametersManager", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosParametersManager { + const NAME: &'static str = "TezosParametersManager"; + + fn is_initialized(&self) -> bool { + for v in &self.transfer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.set_delegate = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.cancel_delegate = ::std::option::Option::Some(is.read_bool()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.set_delegate.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.cancel_delegate { + my_size += 1 + 1; + } + if let Some(v) = self.transfer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.set_delegate.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.cancel_delegate { + os.write_bool(2, v)?; + } + if let Some(v) = self.transfer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosParametersManager { + TezosParametersManager::new() + } + + fn clear(&mut self) { + self.set_delegate = ::std::option::Option::None; + self.cancel_delegate = ::std::option::Option::None; + self.transfer.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosParametersManager { + static instance: TezosParametersManager = TezosParametersManager { + set_delegate: ::std::option::Option::None, + cancel_delegate: ::std::option::Option::None, + transfer: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosParametersManager { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosTransactionOp.TezosParametersManager").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosParametersManager { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosParametersManager { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `TezosParametersManager` + pub mod tezos_parameters_manager { + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosManagerTransfer { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer.destination) + pub destination: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer.amount) + pub amount: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosManagerTransfer { + fn default() -> &'a TezosManagerTransfer { + ::default_instance() + } + } + + impl TezosManagerTransfer { + pub fn new() -> TezosManagerTransfer { + ::std::default::Default::default() + } + + // required uint64 amount = 2; + + pub fn amount(&self) -> u64 { + self.amount.unwrap_or(0) + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: u64) { + self.amount = ::std::option::Option::Some(v); + } + + pub(in super::super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::TezosContractID>( + "destination", + |m: &TezosManagerTransfer| { &m.destination }, + |m: &mut TezosManagerTransfer| { &mut m.destination }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &TezosManagerTransfer| { &m.amount }, + |m: &mut TezosManagerTransfer| { &mut m.amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosManagerTransfer { + const NAME: &'static str = "TezosManagerTransfer"; + + fn is_initialized(&self) -> bool { + if self.destination.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + for v in &self.destination { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination)?; + }, + 16 => { + self.amount = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.destination.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.amount { + my_size += ::protobuf::rt::uint64_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.destination.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.amount { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosManagerTransfer { + TezosManagerTransfer::new() + } + + fn clear(&mut self) { + self.destination.clear(); + self.amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosManagerTransfer { + static instance: TezosManagerTransfer = TezosManagerTransfer { + destination: ::protobuf::MessageField::none(), + amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosManagerTransfer { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosManagerTransfer { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosManagerTransfer { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + } + } + + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosOriginationOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.source) + pub source: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.counter) + pub counter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.gas_limit) + pub gas_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.storage_limit) + pub storage_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.manager_pubkey) + pub manager_pubkey: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.balance) + pub balance: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.spendable) + pub spendable: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.delegatable) + pub delegatable: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.delegate) + pub delegate: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.script) + pub script: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosOriginationOp { + fn default() -> &'a TezosOriginationOp { + ::default_instance() + } + } + + impl TezosOriginationOp { + pub fn new() -> TezosOriginationOp { + ::std::default::Default::default() + } + + // required bytes source = 12; + + pub fn source(&self) -> &[u8] { + match self.source.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_source(&mut self) { + self.source = ::std::option::Option::None; + } + + pub fn has_source(&self) -> bool { + self.source.is_some() + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::vec::Vec) { + self.source = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { + if self.source.is_none() { + self.source = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.source.as_mut().unwrap() + } + + // Take field + pub fn take_source(&mut self) -> ::std::vec::Vec { + self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 fee = 2; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // required uint64 counter = 3; + + pub fn counter(&self) -> u64 { + self.counter.unwrap_or(0) + } + + pub fn clear_counter(&mut self) { + self.counter = ::std::option::Option::None; + } + + pub fn has_counter(&self) -> bool { + self.counter.is_some() + } + + // Param is passed by value, moved + pub fn set_counter(&mut self, v: u64) { + self.counter = ::std::option::Option::Some(v); + } + + // required uint64 gas_limit = 4; + + pub fn gas_limit(&self) -> u64 { + self.gas_limit.unwrap_or(0) + } + + pub fn clear_gas_limit(&mut self) { + self.gas_limit = ::std::option::Option::None; + } + + pub fn has_gas_limit(&self) -> bool { + self.gas_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_gas_limit(&mut self, v: u64) { + self.gas_limit = ::std::option::Option::Some(v); + } + + // required uint64 storage_limit = 5; + + pub fn storage_limit(&self) -> u64 { + self.storage_limit.unwrap_or(0) + } + + pub fn clear_storage_limit(&mut self) { + self.storage_limit = ::std::option::Option::None; + } + + pub fn has_storage_limit(&self) -> bool { + self.storage_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_storage_limit(&mut self, v: u64) { + self.storage_limit = ::std::option::Option::Some(v); + } + + // optional bytes manager_pubkey = 6; + + pub fn manager_pubkey(&self) -> &[u8] { + match self.manager_pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_manager_pubkey(&mut self) { + self.manager_pubkey = ::std::option::Option::None; + } + + pub fn has_manager_pubkey(&self) -> bool { + self.manager_pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_manager_pubkey(&mut self, v: ::std::vec::Vec) { + self.manager_pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_manager_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.manager_pubkey.is_none() { + self.manager_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.manager_pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_manager_pubkey(&mut self) -> ::std::vec::Vec { + self.manager_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 balance = 7; + + pub fn balance(&self) -> u64 { + self.balance.unwrap_or(0) + } + + pub fn clear_balance(&mut self) { + self.balance = ::std::option::Option::None; + } + + pub fn has_balance(&self) -> bool { + self.balance.is_some() + } + + // Param is passed by value, moved + pub fn set_balance(&mut self, v: u64) { + self.balance = ::std::option::Option::Some(v); + } + + // optional bool spendable = 8; + + pub fn spendable(&self) -> bool { + self.spendable.unwrap_or(false) + } + + pub fn clear_spendable(&mut self) { + self.spendable = ::std::option::Option::None; + } + + pub fn has_spendable(&self) -> bool { + self.spendable.is_some() + } + + // Param is passed by value, moved + pub fn set_spendable(&mut self, v: bool) { + self.spendable = ::std::option::Option::Some(v); + } + + // optional bool delegatable = 9; + + pub fn delegatable(&self) -> bool { + self.delegatable.unwrap_or(false) + } + + pub fn clear_delegatable(&mut self) { + self.delegatable = ::std::option::Option::None; + } + + pub fn has_delegatable(&self) -> bool { + self.delegatable.is_some() + } + + // Param is passed by value, moved + pub fn set_delegatable(&mut self, v: bool) { + self.delegatable = ::std::option::Option::Some(v); + } + + // optional bytes delegate = 10; + + pub fn delegate(&self) -> &[u8] { + match self.delegate.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_delegate(&mut self) { + self.delegate = ::std::option::Option::None; + } + + pub fn has_delegate(&self) -> bool { + self.delegate.is_some() + } + + // Param is passed by value, moved + pub fn set_delegate(&mut self, v: ::std::vec::Vec) { + self.delegate = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delegate(&mut self) -> &mut ::std::vec::Vec { + if self.delegate.is_none() { + self.delegate = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.delegate.as_mut().unwrap() + } + + // Take field + pub fn take_delegate(&mut self) -> ::std::vec::Vec { + self.delegate.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes script = 11; + + pub fn script(&self) -> &[u8] { + match self.script.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_script(&mut self) { + self.script = ::std::option::Option::None; + } + + pub fn has_script(&self) -> bool { + self.script.is_some() + } + + // Param is passed by value, moved + pub fn set_script(&mut self, v: ::std::vec::Vec) { + self.script = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_script(&mut self) -> &mut ::std::vec::Vec { + if self.script.is_none() { + self.script = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.script.as_mut().unwrap() + } + + // Take field + pub fn take_script(&mut self) -> ::std::vec::Vec { + self.script.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(11); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source", + |m: &TezosOriginationOp| { &m.source }, + |m: &mut TezosOriginationOp| { &mut m.source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &TezosOriginationOp| { &m.fee }, + |m: &mut TezosOriginationOp| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "counter", + |m: &TezosOriginationOp| { &m.counter }, + |m: &mut TezosOriginationOp| { &mut m.counter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "gas_limit", + |m: &TezosOriginationOp| { &m.gas_limit }, + |m: &mut TezosOriginationOp| { &mut m.gas_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "storage_limit", + |m: &TezosOriginationOp| { &m.storage_limit }, + |m: &mut TezosOriginationOp| { &mut m.storage_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "manager_pubkey", + |m: &TezosOriginationOp| { &m.manager_pubkey }, + |m: &mut TezosOriginationOp| { &mut m.manager_pubkey }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "balance", + |m: &TezosOriginationOp| { &m.balance }, + |m: &mut TezosOriginationOp| { &mut m.balance }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "spendable", + |m: &TezosOriginationOp| { &m.spendable }, + |m: &mut TezosOriginationOp| { &mut m.spendable }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "delegatable", + |m: &TezosOriginationOp| { &m.delegatable }, + |m: &mut TezosOriginationOp| { &mut m.delegatable }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "delegate", + |m: &TezosOriginationOp| { &m.delegate }, + |m: &mut TezosOriginationOp| { &mut m.delegate }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "script", + |m: &TezosOriginationOp| { &m.script }, + |m: &mut TezosOriginationOp| { &mut m.script }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosOriginationOp", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosOriginationOp { + const NAME: &'static str = "TezosOriginationOp"; + + fn is_initialized(&self) -> bool { + if self.source.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + if self.counter.is_none() { + return false; + } + if self.gas_limit.is_none() { + return false; + } + if self.storage_limit.is_none() { + return false; + } + if self.balance.is_none() { + return false; + } + if self.script.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 98 => { + self.source = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.counter = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 50 => { + self.manager_pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + 56 => { + self.balance = ::std::option::Option::Some(is.read_uint64()?); + }, + 64 => { + self.spendable = ::std::option::Option::Some(is.read_bool()?); + }, + 72 => { + self.delegatable = ::std::option::Option::Some(is.read_bool()?); + }, + 82 => { + self.delegate = ::std::option::Option::Some(is.read_bytes()?); + }, + 90 => { + self.script = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source.as_ref() { + my_size += ::protobuf::rt::bytes_size(12, &v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.counter { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.gas_limit { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.storage_limit { + my_size += ::protobuf::rt::uint64_size(5, v); + } + if let Some(v) = self.manager_pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.balance { + my_size += ::protobuf::rt::uint64_size(7, v); + } + if let Some(v) = self.spendable { + my_size += 1 + 1; + } + if let Some(v) = self.delegatable { + my_size += 1 + 1; + } + if let Some(v) = self.delegate.as_ref() { + my_size += ::protobuf::rt::bytes_size(10, &v); + } + if let Some(v) = self.script.as_ref() { + my_size += ::protobuf::rt::bytes_size(11, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source.as_ref() { + os.write_bytes(12, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(2, v)?; + } + if let Some(v) = self.counter { + os.write_uint64(3, v)?; + } + if let Some(v) = self.gas_limit { + os.write_uint64(4, v)?; + } + if let Some(v) = self.storage_limit { + os.write_uint64(5, v)?; + } + if let Some(v) = self.manager_pubkey.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.balance { + os.write_uint64(7, v)?; + } + if let Some(v) = self.spendable { + os.write_bool(8, v)?; + } + if let Some(v) = self.delegatable { + os.write_bool(9, v)?; + } + if let Some(v) = self.delegate.as_ref() { + os.write_bytes(10, v)?; + } + if let Some(v) = self.script.as_ref() { + os.write_bytes(11, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosOriginationOp { + TezosOriginationOp::new() + } + + fn clear(&mut self) { + self.source = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.counter = ::std::option::Option::None; + self.gas_limit = ::std::option::Option::None; + self.storage_limit = ::std::option::Option::None; + self.manager_pubkey = ::std::option::Option::None; + self.balance = ::std::option::Option::None; + self.spendable = ::std::option::Option::None; + self.delegatable = ::std::option::Option::None; + self.delegate = ::std::option::Option::None; + self.script = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosOriginationOp { + static instance: TezosOriginationOp = TezosOriginationOp { + source: ::std::option::Option::None, + fee: ::std::option::Option::None, + counter: ::std::option::Option::None, + gas_limit: ::std::option::Option::None, + storage_limit: ::std::option::Option::None, + manager_pubkey: ::std::option::Option::None, + balance: ::std::option::Option::None, + spendable: ::std::option::Option::None, + delegatable: ::std::option::Option::None, + delegate: ::std::option::Option::None, + script: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosOriginationOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosOriginationOp").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosOriginationOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosOriginationOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosDelegationOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.source) + pub source: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.fee) + pub fee: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.counter) + pub counter: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.gas_limit) + pub gas_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.storage_limit) + pub storage_limit: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.delegate) + pub delegate: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosDelegationOp { + fn default() -> &'a TezosDelegationOp { + ::default_instance() + } + } + + impl TezosDelegationOp { + pub fn new() -> TezosDelegationOp { + ::std::default::Default::default() + } + + // required bytes source = 7; + + pub fn source(&self) -> &[u8] { + match self.source.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_source(&mut self) { + self.source = ::std::option::Option::None; + } + + pub fn has_source(&self) -> bool { + self.source.is_some() + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::vec::Vec) { + self.source = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { + if self.source.is_none() { + self.source = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.source.as_mut().unwrap() + } + + // Take field + pub fn take_source(&mut self) -> ::std::vec::Vec { + self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 fee = 2; + + pub fn fee(&self) -> u64 { + self.fee.unwrap_or(0) + } + + pub fn clear_fee(&mut self) { + self.fee = ::std::option::Option::None; + } + + pub fn has_fee(&self) -> bool { + self.fee.is_some() + } + + // Param is passed by value, moved + pub fn set_fee(&mut self, v: u64) { + self.fee = ::std::option::Option::Some(v); + } + + // required uint64 counter = 3; + + pub fn counter(&self) -> u64 { + self.counter.unwrap_or(0) + } + + pub fn clear_counter(&mut self) { + self.counter = ::std::option::Option::None; + } + + pub fn has_counter(&self) -> bool { + self.counter.is_some() + } + + // Param is passed by value, moved + pub fn set_counter(&mut self, v: u64) { + self.counter = ::std::option::Option::Some(v); + } + + // required uint64 gas_limit = 4; + + pub fn gas_limit(&self) -> u64 { + self.gas_limit.unwrap_or(0) + } + + pub fn clear_gas_limit(&mut self) { + self.gas_limit = ::std::option::Option::None; + } + + pub fn has_gas_limit(&self) -> bool { + self.gas_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_gas_limit(&mut self, v: u64) { + self.gas_limit = ::std::option::Option::Some(v); + } + + // required uint64 storage_limit = 5; + + pub fn storage_limit(&self) -> u64 { + self.storage_limit.unwrap_or(0) + } + + pub fn clear_storage_limit(&mut self) { + self.storage_limit = ::std::option::Option::None; + } + + pub fn has_storage_limit(&self) -> bool { + self.storage_limit.is_some() + } + + // Param is passed by value, moved + pub fn set_storage_limit(&mut self, v: u64) { + self.storage_limit = ::std::option::Option::Some(v); + } + + // required bytes delegate = 6; + + pub fn delegate(&self) -> &[u8] { + match self.delegate.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_delegate(&mut self) { + self.delegate = ::std::option::Option::None; + } + + pub fn has_delegate(&self) -> bool { + self.delegate.is_some() + } + + // Param is passed by value, moved + pub fn set_delegate(&mut self, v: ::std::vec::Vec) { + self.delegate = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delegate(&mut self) -> &mut ::std::vec::Vec { + if self.delegate.is_none() { + self.delegate = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.delegate.as_mut().unwrap() + } + + // Take field + pub fn take_delegate(&mut self) -> ::std::vec::Vec { + self.delegate.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source", + |m: &TezosDelegationOp| { &m.source }, + |m: &mut TezosDelegationOp| { &mut m.source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fee", + |m: &TezosDelegationOp| { &m.fee }, + |m: &mut TezosDelegationOp| { &mut m.fee }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "counter", + |m: &TezosDelegationOp| { &m.counter }, + |m: &mut TezosDelegationOp| { &mut m.counter }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "gas_limit", + |m: &TezosDelegationOp| { &m.gas_limit }, + |m: &mut TezosDelegationOp| { &mut m.gas_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "storage_limit", + |m: &TezosDelegationOp| { &m.storage_limit }, + |m: &mut TezosDelegationOp| { &mut m.storage_limit }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "delegate", + |m: &TezosDelegationOp| { &m.delegate }, + |m: &mut TezosDelegationOp| { &mut m.delegate }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosDelegationOp", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosDelegationOp { + const NAME: &'static str = "TezosDelegationOp"; + + fn is_initialized(&self) -> bool { + if self.source.is_none() { + return false; + } + if self.fee.is_none() { + return false; + } + if self.counter.is_none() { + return false; + } + if self.gas_limit.is_none() { + return false; + } + if self.storage_limit.is_none() { + return false; + } + if self.delegate.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 58 => { + self.source = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.fee = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.counter = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 40 => { + self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); + }, + 50 => { + self.delegate = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + if let Some(v) = self.fee { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.counter { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.gas_limit { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.storage_limit { + my_size += ::protobuf::rt::uint64_size(5, v); + } + if let Some(v) = self.delegate.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source.as_ref() { + os.write_bytes(7, v)?; + } + if let Some(v) = self.fee { + os.write_uint64(2, v)?; + } + if let Some(v) = self.counter { + os.write_uint64(3, v)?; + } + if let Some(v) = self.gas_limit { + os.write_uint64(4, v)?; + } + if let Some(v) = self.storage_limit { + os.write_uint64(5, v)?; + } + if let Some(v) = self.delegate.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosDelegationOp { + TezosDelegationOp::new() + } + + fn clear(&mut self) { + self.source = ::std::option::Option::None; + self.fee = ::std::option::Option::None; + self.counter = ::std::option::Option::None; + self.gas_limit = ::std::option::Option::None; + self.storage_limit = ::std::option::Option::None; + self.delegate = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosDelegationOp { + static instance: TezosDelegationOp = TezosDelegationOp { + source: ::std::option::Option::None, + fee: ::std::option::Option::None, + counter: ::std::option::Option::None, + gas_limit: ::std::option::Option::None, + storage_limit: ::std::option::Option::None, + delegate: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosDelegationOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosDelegationOp").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosDelegationOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosDelegationOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosProposalOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.source) + pub source: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.period) + pub period: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.proposals) + pub proposals: ::std::vec::Vec<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosProposalOp { + fn default() -> &'a TezosProposalOp { + ::default_instance() + } + } + + impl TezosProposalOp { + pub fn new() -> TezosProposalOp { + ::std::default::Default::default() + } + + // required bytes source = 1; + + pub fn source(&self) -> &[u8] { + match self.source.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_source(&mut self) { + self.source = ::std::option::Option::None; + } + + pub fn has_source(&self) -> bool { + self.source.is_some() + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::vec::Vec) { + self.source = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { + if self.source.is_none() { + self.source = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.source.as_mut().unwrap() + } + + // Take field + pub fn take_source(&mut self) -> ::std::vec::Vec { + self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 period = 2; + + pub fn period(&self) -> u64 { + self.period.unwrap_or(0) + } + + pub fn clear_period(&mut self) { + self.period = ::std::option::Option::None; + } + + pub fn has_period(&self) -> bool { + self.period.is_some() + } + + // Param is passed by value, moved + pub fn set_period(&mut self, v: u64) { + self.period = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source", + |m: &TezosProposalOp| { &m.source }, + |m: &mut TezosProposalOp| { &mut m.source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "period", + |m: &TezosProposalOp| { &m.period }, + |m: &mut TezosProposalOp| { &mut m.period }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "proposals", + |m: &TezosProposalOp| { &m.proposals }, + |m: &mut TezosProposalOp| { &mut m.proposals }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosProposalOp", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosProposalOp { + const NAME: &'static str = "TezosProposalOp"; + + fn is_initialized(&self) -> bool { + if self.source.is_none() { + return false; + } + if self.period.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.period = ::std::option::Option::Some(is.read_uint64()?); + }, + 34 => { + self.proposals.push(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.period { + my_size += ::protobuf::rt::uint64_size(2, v); + } + for value in &self.proposals { + my_size += ::protobuf::rt::bytes_size(4, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.period { + os.write_uint64(2, v)?; + } + for v in &self.proposals { + os.write_bytes(4, &v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosProposalOp { + TezosProposalOp::new() + } + + fn clear(&mut self) { + self.source = ::std::option::Option::None; + self.period = ::std::option::Option::None; + self.proposals.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosProposalOp { + static instance: TezosProposalOp = TezosProposalOp { + source: ::std::option::Option::None, + period: ::std::option::Option::None, + proposals: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosProposalOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosProposalOp").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosProposalOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosProposalOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct TezosBallotOp { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.source) + pub source: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.period) + pub period: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.proposal) + pub proposal: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.ballot) + pub ballot: ::std::option::Option<::protobuf::EnumOrUnknown>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a TezosBallotOp { + fn default() -> &'a TezosBallotOp { + ::default_instance() + } + } + + impl TezosBallotOp { + pub fn new() -> TezosBallotOp { + ::std::default::Default::default() + } + + // required bytes source = 1; + + pub fn source(&self) -> &[u8] { + match self.source.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_source(&mut self) { + self.source = ::std::option::Option::None; + } + + pub fn has_source(&self) -> bool { + self.source.is_some() + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::vec::Vec) { + self.source = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { + if self.source.is_none() { + self.source = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.source.as_mut().unwrap() + } + + // Take field + pub fn take_source(&mut self) -> ::std::vec::Vec { + self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 period = 2; + + pub fn period(&self) -> u64 { + self.period.unwrap_or(0) + } + + pub fn clear_period(&mut self) { + self.period = ::std::option::Option::None; + } + + pub fn has_period(&self) -> bool { + self.period.is_some() + } + + // Param is passed by value, moved + pub fn set_period(&mut self, v: u64) { + self.period = ::std::option::Option::Some(v); + } + + // required bytes proposal = 3; + + pub fn proposal(&self) -> &[u8] { + match self.proposal.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_proposal(&mut self) { + self.proposal = ::std::option::Option::None; + } + + pub fn has_proposal(&self) -> bool { + self.proposal.is_some() + } + + // Param is passed by value, moved + pub fn set_proposal(&mut self, v: ::std::vec::Vec) { + self.proposal = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_proposal(&mut self) -> &mut ::std::vec::Vec { + if self.proposal.is_none() { + self.proposal = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.proposal.as_mut().unwrap() + } + + // Take field + pub fn take_proposal(&mut self) -> ::std::vec::Vec { + self.proposal.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required .hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType ballot = 4; + + pub fn ballot(&self) -> tezos_ballot_op::TezosBallotType { + match self.ballot { + Some(e) => e.enum_value_or(tezos_ballot_op::TezosBallotType::Yay), + None => tezos_ballot_op::TezosBallotType::Yay, + } + } + + pub fn clear_ballot(&mut self) { + self.ballot = ::std::option::Option::None; + } + + pub fn has_ballot(&self) -> bool { + self.ballot.is_some() + } + + // Param is passed by value, moved + pub fn set_ballot(&mut self, v: tezos_ballot_op::TezosBallotType) { + self.ballot = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "source", + |m: &TezosBallotOp| { &m.source }, + |m: &mut TezosBallotOp| { &mut m.source }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "period", + |m: &TezosBallotOp| { &m.period }, + |m: &mut TezosBallotOp| { &mut m.period }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "proposal", + |m: &TezosBallotOp| { &m.proposal }, + |m: &mut TezosBallotOp| { &mut m.proposal }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ballot", + |m: &TezosBallotOp| { &m.ballot }, + |m: &mut TezosBallotOp| { &mut m.ballot }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignTx.TezosBallotOp", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for TezosBallotOp { + const NAME: &'static str = "TezosBallotOp"; + + fn is_initialized(&self) -> bool { + if self.source.is_none() { + return false; + } + if self.period.is_none() { + return false; + } + if self.proposal.is_none() { + return false; + } + if self.ballot.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.source = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.period = ::std::option::Option::Some(is.read_uint64()?); + }, + 26 => { + self.proposal = ::std::option::Option::Some(is.read_bytes()?); + }, + 32 => { + self.ballot = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.source.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.period { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.proposal.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.ballot { + my_size += ::protobuf::rt::int32_size(4, v.value()); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.source.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.period { + os.write_uint64(2, v)?; + } + if let Some(v) = self.proposal.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.ballot { + os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosBallotOp { + TezosBallotOp::new() + } + + fn clear(&mut self) { + self.source = ::std::option::Option::None; + self.period = ::std::option::Option::None; + self.proposal = ::std::option::Option::None; + self.ballot = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosBallotOp { + static instance: TezosBallotOp = TezosBallotOp { + source: ::std::option::Option::None, + period: ::std::option::Option::None, + proposal: ::std::option::Option::None, + ballot: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for TezosBallotOp { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosBallotOp").unwrap()).clone() + } + } + + impl ::std::fmt::Display for TezosBallotOp { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for TezosBallotOp { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + /// Nested message and enums of message `TezosBallotOp` + pub mod tezos_ballot_op { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType) + pub enum TezosBallotType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType.Yay) + Yay = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType.Nay) + Nay = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType.Pass) + Pass = 2, + } + + impl ::protobuf::Enum for TezosBallotType { + const NAME: &'static str = "TezosBallotType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(TezosBallotType::Yay), + 1 => ::std::option::Option::Some(TezosBallotType::Nay), + 2 => ::std::option::Option::Some(TezosBallotType::Pass), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Yay" => ::std::option::Option::Some(TezosBallotType::Yay), + "Nay" => ::std::option::Option::Some(TezosBallotType::Nay), + "Pass" => ::std::option::Option::Some(TezosBallotType::Pass), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [TezosBallotType] = &[ + TezosBallotType::Yay, + TezosBallotType::Nay, + TezosBallotType::Pass, + ]; + } + + impl ::protobuf::EnumFull for TezosBallotType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("TezosSignTx.TezosBallotOp.TezosBallotType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for TezosBallotType { + fn default() -> Self { + TezosBallotType::Yay + } + } + + impl TezosBallotType { + pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("TezosSignTx.TezosBallotOp.TezosBallotType") + } + } + } +} + +// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignedTx) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct TezosSignedTx { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignedTx.signature) + pub signature: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignedTx.sig_op_contents) + pub sig_op_contents: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignedTx.operation_hash) + pub operation_hash: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignedTx.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a TezosSignedTx { + fn default() -> &'a TezosSignedTx { + ::default_instance() + } +} + +impl TezosSignedTx { + pub fn new() -> TezosSignedTx { + ::std::default::Default::default() + } + + // required string signature = 1; + + pub fn signature(&self) -> &str { + match self.signature.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::string::String) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::string::String { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::string::String::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::string::String { + self.signature.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes sig_op_contents = 2; + + pub fn sig_op_contents(&self) -> &[u8] { + match self.sig_op_contents.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_sig_op_contents(&mut self) { + self.sig_op_contents = ::std::option::Option::None; + } + + pub fn has_sig_op_contents(&self) -> bool { + self.sig_op_contents.is_some() + } + + // Param is passed by value, moved + pub fn set_sig_op_contents(&mut self, v: ::std::vec::Vec) { + self.sig_op_contents = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sig_op_contents(&mut self) -> &mut ::std::vec::Vec { + if self.sig_op_contents.is_none() { + self.sig_op_contents = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.sig_op_contents.as_mut().unwrap() + } + + // Take field + pub fn take_sig_op_contents(&mut self) -> ::std::vec::Vec { + self.sig_op_contents.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string operation_hash = 3; + + pub fn operation_hash(&self) -> &str { + match self.operation_hash.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_operation_hash(&mut self) { + self.operation_hash = ::std::option::Option::None; + } + + pub fn has_operation_hash(&self) -> bool { + self.operation_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_operation_hash(&mut self, v: ::std::string::String) { + self.operation_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_operation_hash(&mut self) -> &mut ::std::string::String { + if self.operation_hash.is_none() { + self.operation_hash = ::std::option::Option::Some(::std::string::String::new()); + } + self.operation_hash.as_mut().unwrap() + } + + // Take field + pub fn take_operation_hash(&mut self) -> ::std::string::String { + self.operation_hash.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &TezosSignedTx| { &m.signature }, + |m: &mut TezosSignedTx| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sig_op_contents", + |m: &TezosSignedTx| { &m.sig_op_contents }, + |m: &mut TezosSignedTx| { &mut m.sig_op_contents }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "operation_hash", + |m: &TezosSignedTx| { &m.operation_hash }, + |m: &mut TezosSignedTx| { &mut m.operation_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "TezosSignedTx", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for TezosSignedTx { + const NAME: &'static str = "TezosSignedTx"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + if self.sig_op_contents.is_none() { + return false; + } + if self.operation_hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.sig_op_contents = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.operation_hash = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.sig_op_contents.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.operation_hash.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.sig_op_contents.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.operation_hash.as_ref() { + os.write_string(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> TezosSignedTx { + TezosSignedTx::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.sig_op_contents = ::std::option::Option::None; + self.operation_hash = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static TezosSignedTx { + static instance: TezosSignedTx = TezosSignedTx { + signature: ::std::option::Option::None, + sig_op_contents: ::std::option::Option::None, + operation_hash: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for TezosSignedTx { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosSignedTx").unwrap()).clone() + } +} + +impl ::std::fmt::Display for TezosSignedTx { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TezosSignedTx { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x14messages-tezos.proto\x12\x18hw.trezor.messages.tezos\"m\n\x0fTezos\ + GetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ + \x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunk\ + ify\x18\x03\x20\x01(\x08R\x08chunkify\"(\n\x0cTezosAddress\x12\x18\n\x07\ + address\x18\x01\x20\x02(\tR\x07address\"o\n\x11TezosGetPublicKey\x12\x1b\ + \n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cshow_display\x18\ + \x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\x18\x03\x20\x01(\ + \x08R\x08chunkify\"/\n\x0eTezosPublicKey\x12\x1d\n\npublic_key\x18\x01\ + \x20\x02(\tR\tpublicKey\"\xc0\x14\n\x0bTezosSignTx\x12\x1b\n\taddress_n\ + \x18\x01\x20\x03(\rR\x08addressN\x12\x16\n\x06branch\x18\x02\x20\x02(\ + \x0cR\x06branch\x12K\n\x06reveal\x18\x03\x20\x01(\x0b23.hw.trezor.messag\ + es.tezos.TezosSignTx.TezosRevealOpR\x06reveal\x12Z\n\x0btransaction\x18\ + \x04\x20\x01(\x0b28.hw.trezor.messages.tezos.TezosSignTx.TezosTransactio\ + nOpR\x0btransaction\x12Z\n\x0borigination\x18\x05\x20\x01(\x0b28.hw.trez\ + or.messages.tezos.TezosSignTx.TezosOriginationOpR\x0borigination\x12W\n\ + \ndelegation\x18\x06\x20\x01(\x0b27.hw.trezor.messages.tezos.TezosSignTx\ + .TezosDelegationOpR\ndelegation\x12Q\n\x08proposal\x18\x07\x20\x01(\x0b2\ + 5.hw.trezor.messages.tezos.TezosSignTx.TezosProposalOpR\x08proposal\x12K\ + \n\x06ballot\x18\x08\x20\x01(\x0b23.hw.trezor.messages.tezos.TezosSignTx\ + .TezosBallotOpR\x06ballot\x12\x1a\n\x08chunkify\x18\t\x20\x01(\x08R\x08c\ + hunkify\x1a\xb3\x01\n\x0fTezosContractID\x12Y\n\x03tag\x18\x01\x20\x02(\ + \x0e2G.hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContrac\ + tTypeR\x03tag\x12\x12\n\x04hash\x18\x02\x20\x02(\x0cR\x04hash\"1\n\x11Te\ + zosContractType\x12\x0c\n\x08Implicit\x10\0\x12\x0e\n\nOriginated\x10\ + \x01\x1a\xb4\x01\n\rTezosRevealOp\x12\x16\n\x06source\x18\x07\x20\x02(\ + \x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\x18\n\ + \x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\x18\ + \x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02(\ + \x04R\x0cstorageLimit\x12\x1d\n\npublic_key\x18\x06\x20\x02(\x0cR\tpubli\ + cKey\x1a\x9f\x06\n\x12TezosTransactionOp\x12\x16\n\x06source\x18\t\x20\ + \x02(\x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\ + \x18\n\x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\ + \x18\x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02\ + (\x04R\x0cstorageLimit\x12\x16\n\x06amount\x18\x06\x20\x02(\x04R\x06amou\ + nt\x12W\n\x0bdestination\x18\x07\x20\x02(\x0b25.hw.trezor.messages.tezos\ + .TezosSignTx.TezosContractIDR\x0bdestination\x12\x1e\n\nparameters\x18\ + \x08\x20\x01(\x0cR\nparameters\x12~\n\x12parameters_manager\x18\n\x20\ + \x01(\x0b2O.hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.Tezo\ + sParametersManagerR\x11parametersManager\x1a\xf1\x02\n\x16TezosParameter\ + sManager\x12!\n\x0cset_delegate\x18\x01\x20\x01(\x0cR\x0bsetDelegate\x12\ + '\n\x0fcancel_delegate\x18\x02\x20\x01(\x08R\x0ecancelDelegate\x12\x80\ + \x01\n\x08transfer\x18\x03\x20\x01(\x0b2d.hw.trezor.messages.tezos.Tezos\ + SignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransferR\ + \x08transfer\x1a\x87\x01\n\x14TezosManagerTransfer\x12W\n\x0bdestination\ + \x18\x01\x20\x02(\x0b25.hw.trezor.messages.tezos.TezosSignTx.TezosContra\ + ctIDR\x0bdestination\x12\x16\n\x06amount\x18\x02\x20\x02(\x04R\x06amount\ + \x1a\xcf\x02\n\x12TezosOriginationOp\x12\x16\n\x06source\x18\x0c\x20\x02\ + (\x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\x18\n\ + \x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\x18\ + \x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02(\ + \x04R\x0cstorageLimit\x12%\n\x0emanager_pubkey\x18\x06\x20\x01(\x0cR\rma\ + nagerPubkey\x12\x18\n\x07balance\x18\x07\x20\x02(\x04R\x07balance\x12\ + \x1c\n\tspendable\x18\x08\x20\x01(\x08R\tspendable\x12\x20\n\x0bdelegata\ + ble\x18\t\x20\x01(\x08R\x0bdelegatable\x12\x1a\n\x08delegate\x18\n\x20\ + \x01(\x0cR\x08delegate\x12\x16\n\x06script\x18\x0b\x20\x02(\x0cR\x06scri\ + pt\x1a\xb5\x01\n\x11TezosDelegationOp\x12\x16\n\x06source\x18\x07\x20\ + \x02(\x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\ + \x18\n\x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\ + \x18\x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02\ + (\x04R\x0cstorageLimit\x12\x1a\n\x08delegate\x18\x06\x20\x02(\x0cR\x08de\ + legate\x1a_\n\x0fTezosProposalOp\x12\x16\n\x06source\x18\x01\x20\x02(\ + \x0cR\x06source\x12\x16\n\x06period\x18\x02\x20\x02(\x04R\x06period\x12\ + \x1c\n\tproposals\x18\x04\x20\x03(\x0cR\tproposals\x1a\xe7\x01\n\rTezosB\ + allotOp\x12\x16\n\x06source\x18\x01\x20\x02(\x0cR\x06source\x12\x16\n\ + \x06period\x18\x02\x20\x02(\x04R\x06period\x12\x1a\n\x08proposal\x18\x03\ + \x20\x02(\x0cR\x08proposal\x12[\n\x06ballot\x18\x04\x20\x02(\x0e2C.hw.tr\ + ezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotTypeR\x06ballot\ + \"-\n\x0fTezosBallotType\x12\x07\n\x03Yay\x10\0\x12\x07\n\x03Nay\x10\x01\ + \x12\x08\n\x04Pass\x10\x02\"|\n\rTezosSignedTx\x12\x1c\n\tsignature\x18\ + \x01\x20\x02(\tR\tsignature\x12&\n\x0fsig_op_contents\x18\x02\x20\x02(\ + \x0cR\rsigOpContents\x12%\n\x0eoperation_hash\x18\x03\x20\x02(\tR\ropera\ + tionHashB9\n#com.satoshilabs.trezor.lib.protobufB\x12TrezorMessageTezos\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(15); + messages.push(TezosGetAddress::generated_message_descriptor_data()); + messages.push(TezosAddress::generated_message_descriptor_data()); + messages.push(TezosGetPublicKey::generated_message_descriptor_data()); + messages.push(TezosPublicKey::generated_message_descriptor_data()); + messages.push(TezosSignTx::generated_message_descriptor_data()); + messages.push(TezosSignedTx::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::TezosContractID::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::TezosRevealOp::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::TezosTransactionOp::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::TezosOriginationOp::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::TezosDelegationOp::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::TezosProposalOp::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::TezosBallotOp::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::tezos_transaction_op::TezosParametersManager::generated_message_descriptor_data()); + messages.push(tezos_sign_tx::tezos_transaction_op::tezos_parameters_manager::TezosManagerTransfer::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(2); + enums.push(tezos_sign_tx::tezos_contract_id::TezosContractType::generated_enum_descriptor_data()); + enums.push(tezos_sign_tx::tezos_ballot_op::TezosBallotType::generated_enum_descriptor_data()); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/generated/messages_webauthn.rs b/wallet/trezor-client/src/protos/generated/messages_webauthn.rs new file mode 100644 index 0000000000..6276d730db --- /dev/null +++ b/wallet/trezor-client/src/protos/generated/messages_webauthn.rs @@ -0,0 +1,1257 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.12.4 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-webauthn.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnListResidentCredentials) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct WebAuthnListResidentCredentials { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnListResidentCredentials.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a WebAuthnListResidentCredentials { + fn default() -> &'a WebAuthnListResidentCredentials { + ::default_instance() + } +} + +impl WebAuthnListResidentCredentials { + pub fn new() -> WebAuthnListResidentCredentials { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WebAuthnListResidentCredentials", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for WebAuthnListResidentCredentials { + const NAME: &'static str = "WebAuthnListResidentCredentials"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WebAuthnListResidentCredentials { + WebAuthnListResidentCredentials::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static WebAuthnListResidentCredentials { + static instance: WebAuthnListResidentCredentials = WebAuthnListResidentCredentials { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for WebAuthnListResidentCredentials { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnListResidentCredentials").unwrap()).clone() + } +} + +impl ::std::fmt::Display for WebAuthnListResidentCredentials { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WebAuthnListResidentCredentials { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnAddResidentCredential) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct WebAuthnAddResidentCredential { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnAddResidentCredential.credential_id) + pub credential_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnAddResidentCredential.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a WebAuthnAddResidentCredential { + fn default() -> &'a WebAuthnAddResidentCredential { + ::default_instance() + } +} + +impl WebAuthnAddResidentCredential { + pub fn new() -> WebAuthnAddResidentCredential { + ::std::default::Default::default() + } + + // optional bytes credential_id = 1; + + pub fn credential_id(&self) -> &[u8] { + match self.credential_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_credential_id(&mut self) { + self.credential_id = ::std::option::Option::None; + } + + pub fn has_credential_id(&self) -> bool { + self.credential_id.is_some() + } + + // Param is passed by value, moved + pub fn set_credential_id(&mut self, v: ::std::vec::Vec) { + self.credential_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_credential_id(&mut self) -> &mut ::std::vec::Vec { + if self.credential_id.is_none() { + self.credential_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.credential_id.as_mut().unwrap() + } + + // Take field + pub fn take_credential_id(&mut self) -> ::std::vec::Vec { + self.credential_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "credential_id", + |m: &WebAuthnAddResidentCredential| { &m.credential_id }, + |m: &mut WebAuthnAddResidentCredential| { &mut m.credential_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WebAuthnAddResidentCredential", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for WebAuthnAddResidentCredential { + const NAME: &'static str = "WebAuthnAddResidentCredential"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.credential_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.credential_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.credential_id.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WebAuthnAddResidentCredential { + WebAuthnAddResidentCredential::new() + } + + fn clear(&mut self) { + self.credential_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static WebAuthnAddResidentCredential { + static instance: WebAuthnAddResidentCredential = WebAuthnAddResidentCredential { + credential_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for WebAuthnAddResidentCredential { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnAddResidentCredential").unwrap()).clone() + } +} + +impl ::std::fmt::Display for WebAuthnAddResidentCredential { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WebAuthnAddResidentCredential { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnRemoveResidentCredential) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct WebAuthnRemoveResidentCredential { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnRemoveResidentCredential.index) + pub index: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnRemoveResidentCredential.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a WebAuthnRemoveResidentCredential { + fn default() -> &'a WebAuthnRemoveResidentCredential { + ::default_instance() + } +} + +impl WebAuthnRemoveResidentCredential { + pub fn new() -> WebAuthnRemoveResidentCredential { + ::std::default::Default::default() + } + + // optional uint32 index = 1; + + pub fn index(&self) -> u32 { + self.index.unwrap_or(0) + } + + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u32) { + self.index = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "index", + |m: &WebAuthnRemoveResidentCredential| { &m.index }, + |m: &mut WebAuthnRemoveResidentCredential| { &mut m.index }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WebAuthnRemoveResidentCredential", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for WebAuthnRemoveResidentCredential { + const NAME: &'static str = "WebAuthnRemoveResidentCredential"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.index = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.index { + my_size += ::protobuf::rt::uint32_size(1, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.index { + os.write_uint32(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WebAuthnRemoveResidentCredential { + WebAuthnRemoveResidentCredential::new() + } + + fn clear(&mut self) { + self.index = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static WebAuthnRemoveResidentCredential { + static instance: WebAuthnRemoveResidentCredential = WebAuthnRemoveResidentCredential { + index: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for WebAuthnRemoveResidentCredential { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnRemoveResidentCredential").unwrap()).clone() + } +} + +impl ::std::fmt::Display for WebAuthnRemoveResidentCredential { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WebAuthnRemoveResidentCredential { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnCredentials) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct WebAuthnCredentials { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.credentials) + pub credentials: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnCredentials.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a WebAuthnCredentials { + fn default() -> &'a WebAuthnCredentials { + ::default_instance() + } +} + +impl WebAuthnCredentials { + pub fn new() -> WebAuthnCredentials { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "credentials", + |m: &WebAuthnCredentials| { &m.credentials }, + |m: &mut WebAuthnCredentials| { &mut m.credentials }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WebAuthnCredentials", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for WebAuthnCredentials { + const NAME: &'static str = "WebAuthnCredentials"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.credentials.push(is.read_message()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.credentials { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.credentials { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WebAuthnCredentials { + WebAuthnCredentials::new() + } + + fn clear(&mut self) { + self.credentials.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static WebAuthnCredentials { + static instance: WebAuthnCredentials = WebAuthnCredentials { + credentials: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for WebAuthnCredentials { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnCredentials").unwrap()).clone() + } +} + +impl ::std::fmt::Display for WebAuthnCredentials { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WebAuthnCredentials { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `WebAuthnCredentials` +pub mod web_authn_credentials { + // @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct WebAuthnCredential { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.index) + pub index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.id) + pub id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.rp_id) + pub rp_id: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.rp_name) + pub rp_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.user_id) + pub user_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.user_name) + pub user_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.user_display_name) + pub user_display_name: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.creation_time) + pub creation_time: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.hmac_secret) + pub hmac_secret: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.use_sign_count) + pub use_sign_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.algorithm) + pub algorithm: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.curve) + pub curve: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a WebAuthnCredential { + fn default() -> &'a WebAuthnCredential { + ::default_instance() + } + } + + impl WebAuthnCredential { + pub fn new() -> WebAuthnCredential { + ::std::default::Default::default() + } + + // optional uint32 index = 1; + + pub fn index(&self) -> u32 { + self.index.unwrap_or(0) + } + + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u32) { + self.index = ::std::option::Option::Some(v); + } + + // optional bytes id = 2; + + pub fn id(&self) -> &[u8] { + match self.id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::vec::Vec) { + self.id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::vec::Vec { + if self.id.is_none() { + self.id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.id.as_mut().unwrap() + } + + // Take field + pub fn take_id(&mut self) -> ::std::vec::Vec { + self.id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string rp_id = 3; + + pub fn rp_id(&self) -> &str { + match self.rp_id.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_rp_id(&mut self) { + self.rp_id = ::std::option::Option::None; + } + + pub fn has_rp_id(&self) -> bool { + self.rp_id.is_some() + } + + // Param is passed by value, moved + pub fn set_rp_id(&mut self, v: ::std::string::String) { + self.rp_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_rp_id(&mut self) -> &mut ::std::string::String { + if self.rp_id.is_none() { + self.rp_id = ::std::option::Option::Some(::std::string::String::new()); + } + self.rp_id.as_mut().unwrap() + } + + // Take field + pub fn take_rp_id(&mut self) -> ::std::string::String { + self.rp_id.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string rp_name = 4; + + pub fn rp_name(&self) -> &str { + match self.rp_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_rp_name(&mut self) { + self.rp_name = ::std::option::Option::None; + } + + pub fn has_rp_name(&self) -> bool { + self.rp_name.is_some() + } + + // Param is passed by value, moved + pub fn set_rp_name(&mut self, v: ::std::string::String) { + self.rp_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_rp_name(&mut self) -> &mut ::std::string::String { + if self.rp_name.is_none() { + self.rp_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.rp_name.as_mut().unwrap() + } + + // Take field + pub fn take_rp_name(&mut self) -> ::std::string::String { + self.rp_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes user_id = 5; + + pub fn user_id(&self) -> &[u8] { + match self.user_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_user_id(&mut self) { + self.user_id = ::std::option::Option::None; + } + + pub fn has_user_id(&self) -> bool { + self.user_id.is_some() + } + + // Param is passed by value, moved + pub fn set_user_id(&mut self, v: ::std::vec::Vec) { + self.user_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_user_id(&mut self) -> &mut ::std::vec::Vec { + if self.user_id.is_none() { + self.user_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.user_id.as_mut().unwrap() + } + + // Take field + pub fn take_user_id(&mut self) -> ::std::vec::Vec { + self.user_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional string user_name = 6; + + pub fn user_name(&self) -> &str { + match self.user_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_user_name(&mut self) { + self.user_name = ::std::option::Option::None; + } + + pub fn has_user_name(&self) -> bool { + self.user_name.is_some() + } + + // Param is passed by value, moved + pub fn set_user_name(&mut self, v: ::std::string::String) { + self.user_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_user_name(&mut self) -> &mut ::std::string::String { + if self.user_name.is_none() { + self.user_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.user_name.as_mut().unwrap() + } + + // Take field + pub fn take_user_name(&mut self) -> ::std::string::String { + self.user_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string user_display_name = 7; + + pub fn user_display_name(&self) -> &str { + match self.user_display_name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_user_display_name(&mut self) { + self.user_display_name = ::std::option::Option::None; + } + + pub fn has_user_display_name(&self) -> bool { + self.user_display_name.is_some() + } + + // Param is passed by value, moved + pub fn set_user_display_name(&mut self, v: ::std::string::String) { + self.user_display_name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_user_display_name(&mut self) -> &mut ::std::string::String { + if self.user_display_name.is_none() { + self.user_display_name = ::std::option::Option::Some(::std::string::String::new()); + } + self.user_display_name.as_mut().unwrap() + } + + // Take field + pub fn take_user_display_name(&mut self) -> ::std::string::String { + self.user_display_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 creation_time = 8; + + pub fn creation_time(&self) -> u32 { + self.creation_time.unwrap_or(0) + } + + pub fn clear_creation_time(&mut self) { + self.creation_time = ::std::option::Option::None; + } + + pub fn has_creation_time(&self) -> bool { + self.creation_time.is_some() + } + + // Param is passed by value, moved + pub fn set_creation_time(&mut self, v: u32) { + self.creation_time = ::std::option::Option::Some(v); + } + + // optional bool hmac_secret = 9; + + pub fn hmac_secret(&self) -> bool { + self.hmac_secret.unwrap_or(false) + } + + pub fn clear_hmac_secret(&mut self) { + self.hmac_secret = ::std::option::Option::None; + } + + pub fn has_hmac_secret(&self) -> bool { + self.hmac_secret.is_some() + } + + // Param is passed by value, moved + pub fn set_hmac_secret(&mut self, v: bool) { + self.hmac_secret = ::std::option::Option::Some(v); + } + + // optional bool use_sign_count = 10; + + pub fn use_sign_count(&self) -> bool { + self.use_sign_count.unwrap_or(false) + } + + pub fn clear_use_sign_count(&mut self) { + self.use_sign_count = ::std::option::Option::None; + } + + pub fn has_use_sign_count(&self) -> bool { + self.use_sign_count.is_some() + } + + // Param is passed by value, moved + pub fn set_use_sign_count(&mut self, v: bool) { + self.use_sign_count = ::std::option::Option::Some(v); + } + + // optional sint32 algorithm = 11; + + pub fn algorithm(&self) -> i32 { + self.algorithm.unwrap_or(0) + } + + pub fn clear_algorithm(&mut self) { + self.algorithm = ::std::option::Option::None; + } + + pub fn has_algorithm(&self) -> bool { + self.algorithm.is_some() + } + + // Param is passed by value, moved + pub fn set_algorithm(&mut self, v: i32) { + self.algorithm = ::std::option::Option::Some(v); + } + + // optional sint32 curve = 12; + + pub fn curve(&self) -> i32 { + self.curve.unwrap_or(0) + } + + pub fn clear_curve(&mut self) { + self.curve = ::std::option::Option::None; + } + + pub fn has_curve(&self) -> bool { + self.curve.is_some() + } + + // Param is passed by value, moved + pub fn set_curve(&mut self, v: i32) { + self.curve = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(12); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "index", + |m: &WebAuthnCredential| { &m.index }, + |m: &mut WebAuthnCredential| { &mut m.index }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "id", + |m: &WebAuthnCredential| { &m.id }, + |m: &mut WebAuthnCredential| { &mut m.id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "rp_id", + |m: &WebAuthnCredential| { &m.rp_id }, + |m: &mut WebAuthnCredential| { &mut m.rp_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "rp_name", + |m: &WebAuthnCredential| { &m.rp_name }, + |m: &mut WebAuthnCredential| { &mut m.rp_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "user_id", + |m: &WebAuthnCredential| { &m.user_id }, + |m: &mut WebAuthnCredential| { &mut m.user_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "user_name", + |m: &WebAuthnCredential| { &m.user_name }, + |m: &mut WebAuthnCredential| { &mut m.user_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "user_display_name", + |m: &WebAuthnCredential| { &m.user_display_name }, + |m: &mut WebAuthnCredential| { &mut m.user_display_name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "creation_time", + |m: &WebAuthnCredential| { &m.creation_time }, + |m: &mut WebAuthnCredential| { &mut m.creation_time }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "hmac_secret", + |m: &WebAuthnCredential| { &m.hmac_secret }, + |m: &mut WebAuthnCredential| { &mut m.hmac_secret }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "use_sign_count", + |m: &WebAuthnCredential| { &m.use_sign_count }, + |m: &mut WebAuthnCredential| { &mut m.use_sign_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "algorithm", + |m: &WebAuthnCredential| { &m.algorithm }, + |m: &mut WebAuthnCredential| { &mut m.algorithm }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "curve", + |m: &WebAuthnCredential| { &m.curve }, + |m: &mut WebAuthnCredential| { &mut m.curve }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "WebAuthnCredentials.WebAuthnCredential", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for WebAuthnCredential { + const NAME: &'static str = "WebAuthnCredential"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.index = ::std::option::Option::Some(is.read_uint32()?); + }, + 18 => { + self.id = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.rp_id = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.rp_name = ::std::option::Option::Some(is.read_string()?); + }, + 42 => { + self.user_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.user_name = ::std::option::Option::Some(is.read_string()?); + }, + 58 => { + self.user_display_name = ::std::option::Option::Some(is.read_string()?); + }, + 64 => { + self.creation_time = ::std::option::Option::Some(is.read_uint32()?); + }, + 72 => { + self.hmac_secret = ::std::option::Option::Some(is.read_bool()?); + }, + 80 => { + self.use_sign_count = ::std::option::Option::Some(is.read_bool()?); + }, + 88 => { + self.algorithm = ::std::option::Option::Some(is.read_sint32()?); + }, + 96 => { + self.curve = ::std::option::Option::Some(is.read_sint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.index { + my_size += ::protobuf::rt::uint32_size(1, v); + } + if let Some(v) = self.id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.rp_id.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.rp_name.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.user_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.user_name.as_ref() { + my_size += ::protobuf::rt::string_size(6, &v); + } + if let Some(v) = self.user_display_name.as_ref() { + my_size += ::protobuf::rt::string_size(7, &v); + } + if let Some(v) = self.creation_time { + my_size += ::protobuf::rt::uint32_size(8, v); + } + if let Some(v) = self.hmac_secret { + my_size += 1 + 1; + } + if let Some(v) = self.use_sign_count { + my_size += 1 + 1; + } + if let Some(v) = self.algorithm { + my_size += ::protobuf::rt::sint32_size(11, v); + } + if let Some(v) = self.curve { + my_size += ::protobuf::rt::sint32_size(12, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.index { + os.write_uint32(1, v)?; + } + if let Some(v) = self.id.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.rp_id.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.rp_name.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.user_id.as_ref() { + os.write_bytes(5, v)?; + } + if let Some(v) = self.user_name.as_ref() { + os.write_string(6, v)?; + } + if let Some(v) = self.user_display_name.as_ref() { + os.write_string(7, v)?; + } + if let Some(v) = self.creation_time { + os.write_uint32(8, v)?; + } + if let Some(v) = self.hmac_secret { + os.write_bool(9, v)?; + } + if let Some(v) = self.use_sign_count { + os.write_bool(10, v)?; + } + if let Some(v) = self.algorithm { + os.write_sint32(11, v)?; + } + if let Some(v) = self.curve { + os.write_sint32(12, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> WebAuthnCredential { + WebAuthnCredential::new() + } + + fn clear(&mut self) { + self.index = ::std::option::Option::None; + self.id = ::std::option::Option::None; + self.rp_id = ::std::option::Option::None; + self.rp_name = ::std::option::Option::None; + self.user_id = ::std::option::Option::None; + self.user_name = ::std::option::Option::None; + self.user_display_name = ::std::option::Option::None; + self.creation_time = ::std::option::Option::None; + self.hmac_secret = ::std::option::Option::None; + self.use_sign_count = ::std::option::Option::None; + self.algorithm = ::std::option::Option::None; + self.curve = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static WebAuthnCredential { + static instance: WebAuthnCredential = WebAuthnCredential { + index: ::std::option::Option::None, + id: ::std::option::Option::None, + rp_id: ::std::option::Option::None, + rp_name: ::std::option::Option::None, + user_id: ::std::option::Option::None, + user_name: ::std::option::Option::None, + user_display_name: ::std::option::Option::None, + creation_time: ::std::option::Option::None, + hmac_secret: ::std::option::Option::None, + use_sign_count: ::std::option::Option::None, + algorithm: ::std::option::Option::None, + curve: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for WebAuthnCredential { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("WebAuthnCredentials.WebAuthnCredential").unwrap()).clone() + } + } + + impl ::std::fmt::Display for WebAuthnCredential { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for WebAuthnCredential { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x17messages-webauthn.proto\x12\x1bhw.trezor.messages.webauthn\"!\n\ + \x1fWebAuthnListResidentCredentials\"D\n\x1dWebAuthnAddResidentCredentia\ + l\x12#\n\rcredential_id\x18\x01\x20\x01(\x0cR\x0ccredentialId\"8\n\x20We\ + bAuthnRemoveResidentCredential\x12\x14\n\x05index\x18\x01\x20\x01(\rR\ + \x05index\"\xe9\x03\n\x13WebAuthnCredentials\x12e\n\x0bcredentials\x18\ + \x01\x20\x03(\x0b2C.hw.trezor.messages.webauthn.WebAuthnCredentials.WebA\ + uthnCredentialR\x0bcredentials\x1a\xea\x02\n\x12WebAuthnCredential\x12\ + \x14\n\x05index\x18\x01\x20\x01(\rR\x05index\x12\x0e\n\x02id\x18\x02\x20\ + \x01(\x0cR\x02id\x12\x13\n\x05rp_id\x18\x03\x20\x01(\tR\x04rpId\x12\x17\ + \n\x07rp_name\x18\x04\x20\x01(\tR\x06rpName\x12\x17\n\x07user_id\x18\x05\ + \x20\x01(\x0cR\x06userId\x12\x1b\n\tuser_name\x18\x06\x20\x01(\tR\x08use\ + rName\x12*\n\x11user_display_name\x18\x07\x20\x01(\tR\x0fuserDisplayName\ + \x12#\n\rcreation_time\x18\x08\x20\x01(\rR\x0ccreationTime\x12\x1f\n\x0b\ + hmac_secret\x18\t\x20\x01(\x08R\nhmacSecret\x12$\n\x0euse_sign_count\x18\ + \n\x20\x01(\x08R\x0cuseSignCount\x12\x1c\n\talgorithm\x18\x0b\x20\x01(\ + \x11R\talgorithm\x12\x14\n\x05curve\x18\x0c\x20\x01(\x11R\x05curveB<\n#c\ + om.satoshilabs.trezor.lib.protobufB\x15TrezorMessageWebAuthn\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(5); + messages.push(WebAuthnListResidentCredentials::generated_message_descriptor_data()); + messages.push(WebAuthnAddResidentCredential::generated_message_descriptor_data()); + messages.push(WebAuthnRemoveResidentCredential::generated_message_descriptor_data()); + messages.push(WebAuthnCredentials::generated_message_descriptor_data()); + messages.push(web_authn_credentials::WebAuthnCredential::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/wallet/trezor-client/src/protos/mod.rs b/wallet/trezor-client/src/protos/mod.rs new file mode 100644 index 0000000000..0f0a68126b --- /dev/null +++ b/wallet/trezor-client/src/protos/mod.rs @@ -0,0 +1,44 @@ +//! Bindings for Trezor protobufs. + +// Note: we do not use the generated `mod.rs` because we want to feature-gate some modules manually. +// This significantly improves compile times. +// See https://github.com/joshieDo/rust-trezor-api/pull/9 for more details. +#[allow(ambiguous_glob_reexports, unreachable_pub)] +#[allow(clippy::all)] +mod generated { + macro_rules! modules { + ($($($feature:literal =>)? $module:ident)+) => {$( + $(#[cfg(feature = $feature)])? + mod $module; + $(#[cfg(feature = $feature)])? + pub use self::$module::*; + )+}; + } + + modules! { + messages + messages_bootloader + messages_common + messages_crypto + messages_debug + messages_management + + "bitcoin" => messages_bitcoin + "ethereum" => messages_ethereum + "ethereum" => messages_ethereum_eip712 + "ethereum" => messages_ethereum_definitions + "binance" => messages_binance + "cardano" => messages_cardano + "eos" => messages_eos + "monero" => messages_monero + "nem" => messages_nem + "ripple" => messages_ripple + "solana" => messages_solana + "stellar" => messages_stellar + "tezos" => messages_tezos + "webauthn" => messages_webauthn + "mintlayer" => messages_mintlayer + } +} + +pub use generated::*; diff --git a/wallet/trezor-client/src/transport/error.rs b/wallet/trezor-client/src/transport/error.rs new file mode 100644 index 0000000000..282ae16f65 --- /dev/null +++ b/wallet/trezor-client/src/transport/error.rs @@ -0,0 +1,49 @@ +//! # Error Handling + +/// Trezor error. +#[derive(Debug, thiserror::Error)] +pub enum Error { + /// [rusb] error. + #[error(transparent)] + Usb(#[from] rusb::Error), + + /// [std::io] error. + #[error(transparent)] + IO(#[from] std::io::Error), + + /// The device to connect to was not found. + #[error("the device to connect to was not found")] + DeviceNotFound, + + /// The device is no longer available. + #[error("the device is no longer available")] + DeviceDisconnected, + + /// The device produced a data chunk of unexpected size. + #[error("the device produced a data chunk of unexpected size")] + UnexpectedChunkSizeFromDevice(usize), + + /// Timeout expired while reading from device. + #[error("timeout expired while reading from device")] + DeviceReadTimeout, + + /// The device sent a chunk with a wrong magic value. + #[error("the device sent a chunk with a wrong magic value")] + DeviceBadMagic, + + /// The device sent a message with a wrong session id. + #[error("the device sent a message with a wrong session id")] + DeviceBadSessionId, + + /// The device sent an unexpected sequence number. + #[error("the device sent an unexpected sequence number")] + DeviceUnexpectedSequenceNumber, + + /// Received a non-existing message type from the device. + #[error("received a non-existing message type from the device")] + InvalidMessageType(u32), + + /// Unable to determine device serial number. + #[error("unable to determine device serial number")] + NoDeviceSerial, +} diff --git a/wallet/trezor-client/src/transport/mod.rs b/wallet/trezor-client/src/transport/mod.rs new file mode 100644 index 0000000000..ee08c9e76c --- /dev/null +++ b/wallet/trezor-client/src/transport/mod.rs @@ -0,0 +1,85 @@ +use super::{AvailableDevice, Model}; +use crate::protos::MessageType; +use std::fmt; + +pub mod error; +pub mod protocol; +pub mod udp; +pub mod webusb; + +/// An available transport for a Trezor device, containing any of the different supported +/// transports. +#[derive(Debug)] +pub enum AvailableDeviceTransport { + WebUsb(webusb::AvailableWebUsbTransport), + Udp(udp::AvailableUdpTransport), +} + +impl fmt::Display for AvailableDeviceTransport { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AvailableDeviceTransport::WebUsb(ref t) => write!(f, "{}", t), + AvailableDeviceTransport::Udp(ref t) => write!(f, "{}", t), + } + } +} + +/// A protobuf message accompanied by the message type. This type is used to pass messages over the +/// transport and used to contain messages received from the transport. +pub struct ProtoMessage(pub MessageType, pub Vec); + +impl ProtoMessage { + pub fn new(mt: MessageType, payload: Vec) -> ProtoMessage { + ProtoMessage(mt, payload) + } + pub fn message_type(&self) -> MessageType { + self.0 + } + pub fn payload(&self) -> &[u8] { + &self.1 + } + pub fn into_payload(self) -> Vec { + self.1 + } + + /// Take the payload from the ProtoMessage and parse it to a protobuf message. + pub fn into_message(self) -> Result { + protobuf::Message::parse_from_bytes(&self.into_payload()) + } +} + +/// The transport interface that is implemented by the different ways to communicate with a Trezor +/// device. +pub trait Transport: Sync + Send { + fn session_begin(&mut self) -> Result<(), error::Error>; + fn session_end(&mut self) -> Result<(), error::Error>; + + fn write_message(&mut self, message: ProtoMessage) -> Result<(), error::Error>; + fn read_message(&mut self) -> Result; +} + +/// A delegation method to connect an available device transport. It delegates to the different +/// transport types. +pub fn connect(available_device: &AvailableDevice) -> Result, error::Error> { + match available_device.transport { + AvailableDeviceTransport::WebUsb(_) => webusb::WebUsbTransport::connect(available_device), + AvailableDeviceTransport::Udp(_) => udp::UdpTransport::connect(available_device), + } +} + +// A collection of transport-global constants. +mod constants { + pub(crate) const DEV_TREZOR_LEGACY: (u16, u16) = (0x534C, 0x0001); + pub(crate) const DEV_TREZOR: (u16, u16) = (0x1209, 0x53C1); + pub(crate) const DEV_TREZOR_BOOTLOADER: (u16, u16) = (0x1209, 0x53C0); +} + +/// Derive the Trezor model from the USB device. +pub(crate) fn derive_model(dev_id: (u16, u16)) -> Option { + match dev_id { + constants::DEV_TREZOR_LEGACY => Some(Model::TrezorLegacy), + constants::DEV_TREZOR => Some(Model::Trezor), + constants::DEV_TREZOR_BOOTLOADER => Some(Model::TrezorBootloader), + _ => None, + } +} diff --git a/wallet/trezor-client/src/transport/protocol.rs b/wallet/trezor-client/src/transport/protocol.rs new file mode 100644 index 0000000000..fd9376f266 --- /dev/null +++ b/wallet/trezor-client/src/transport/protocol.rs @@ -0,0 +1,214 @@ +use crate::{ + protos::MessageType, + transport::{error::Error, ProtoMessage}, +}; +use byteorder::{BigEndian, ByteOrder}; +use protobuf::Enum; +use std::cmp; + +/// A link represents a serial connection to send and receive byte chunks from and to a device. +pub trait Link { + fn write_chunk(&mut self, chunk: Vec) -> Result<(), Error>; + fn read_chunk(&mut self) -> Result, Error>; +} + +/// A protocol is used to encode messages in chunks that can be sent to the device and to parse +/// chunks into messages. +pub trait Protocol { + fn session_begin(&mut self) -> Result<(), Error>; + fn session_end(&mut self) -> Result<(), Error>; + fn write(&mut self, message: ProtoMessage) -> Result<(), Error>; + fn read(&mut self) -> Result; +} + +/// The length of the chunks sent. +const REPLEN: usize = 64; + +/// V2 of the binary protocol. +/// This version is currently not in use by any device and is subject to change. +#[allow(dead_code)] +pub struct ProtocolV2 { + pub link: L, + pub session_id: u32, +} + +impl Protocol for ProtocolV2 { + fn session_begin(&mut self) -> Result<(), Error> { + let mut chunk = vec![0; REPLEN]; + chunk[0] = 0x03; + self.link.write_chunk(chunk)?; + let resp = self.link.read_chunk()?; + if resp[0] != 0x03 { + println!( + "bad magic in v2 session_begin: {:x} instead of 0x03", + resp[0] + ); + return Err(Error::DeviceBadMagic); + } + self.session_id = BigEndian::read_u32(&resp[1..5]); + Ok(()) + } + + fn session_end(&mut self) -> Result<(), Error> { + assert!(self.session_id != 0); + let mut chunk = vec![0; REPLEN]; + chunk[0] = 0x04; + BigEndian::write_u32(&mut chunk[1..5], self.session_id); + self.link.write_chunk(chunk)?; + let resp = self.link.read_chunk()?; + if resp[0] != 0x04 { + println!("bad magic in v2 session_end: {:x} instead of 0x04", resp[0]); + return Err(Error::DeviceBadMagic); + } + self.session_id = 0; + Ok(()) + } + + fn write(&mut self, message: ProtoMessage) -> Result<(), Error> { + assert!(self.session_id != 0); + + // First generate the total payload, then write it to the transport in chunks. + let mut data = vec![0; 8]; + BigEndian::write_u32(&mut data[0..4], message.message_type() as u32); + BigEndian::write_u32(&mut data[4..8], message.payload().len() as u32); + data.extend(message.into_payload()); + + let mut cur: usize = 0; + let mut seq: isize = -1; + while cur < data.len() { + // Build header. + let mut chunk = if seq < 0 { + let mut header = vec![0; 5]; + header[0] = 0x01; + BigEndian::write_u32(&mut header[1..5], self.session_id); + header + } else { + let mut header = vec![0; 9]; + header[0] = 0x01; + BigEndian::write_u32(&mut header[1..5], self.session_id); + BigEndian::write_u32(&mut header[5..9], seq as u32); + header + }; + seq += 1; + + // Fill remainder. + let end = cmp::min(cur + (REPLEN - chunk.len()), data.len()); + chunk.extend(&data[cur..end]); + cur = end; + debug_assert!(chunk.len() <= REPLEN); + chunk.resize(REPLEN, 0); + + self.link.write_chunk(chunk)?; + } + + Ok(()) + } + + fn read(&mut self) -> Result { + debug_assert!(self.session_id != 0); + + let chunk = self.link.read_chunk()?; + if chunk[0] != 0x01 { + println!("bad magic in v2 read: {:x} instead of 0x01", chunk[0]); + return Err(Error::DeviceBadMagic); + } + if BigEndian::read_u32(&chunk[1..5]) != self.session_id { + return Err(Error::DeviceBadSessionId); + } + let message_type_id = BigEndian::read_u32(&chunk[5..9]); + let message_type = MessageType::from_i32(message_type_id as i32) + .ok_or(Error::InvalidMessageType(message_type_id))?; + let data_length = BigEndian::read_u32(&chunk[9..13]) as usize; + + let mut data: Vec = chunk[13..].into(); + let mut seq = 0; + while data.len() < data_length { + let chunk = self.link.read_chunk()?; + if chunk[0] != 0x02 { + println!( + "bad magic in v2 session_begin: {:x} instead of 0x02", + chunk[0] + ); + return Err(Error::DeviceBadMagic); + } + if BigEndian::read_u32(&chunk[1..5]) != self.session_id { + return Err(Error::DeviceBadSessionId); + } + if BigEndian::read_u32(&chunk[5..9]) != seq as u32 { + return Err(Error::DeviceUnexpectedSequenceNumber); + } + seq += 1; + + data.extend(&chunk[9..]); + } + + Ok(ProtoMessage(message_type, data[0..data_length].into())) + } +} + +/// The original binary protocol. +pub struct ProtocolV1 { + pub link: L, +} + +impl Protocol for ProtocolV1 { + fn session_begin(&mut self) -> Result<(), Error> { + Ok(()) // no sessions + } + + fn session_end(&mut self) -> Result<(), Error> { + Ok(()) // no sessions + } + + fn write(&mut self, message: ProtoMessage) -> Result<(), Error> { + // First generate the total payload, then write it to the transport in chunks. + let mut data = vec![0; 8]; + data[0] = 0x23; + data[1] = 0x23; + BigEndian::write_u16(&mut data[2..4], message.message_type() as u16); + BigEndian::write_u32(&mut data[4..8], message.payload().len() as u32); + data.extend(message.into_payload()); + + let mut cur: usize = 0; + while cur < data.len() { + let mut chunk = vec![0x3f]; + let end = cmp::min(cur + (REPLEN - 1), data.len()); + chunk.extend(&data[cur..end]); + cur = end; + debug_assert!(chunk.len() <= REPLEN); + chunk.resize(REPLEN, 0); + + self.link.write_chunk(chunk)?; + } + + Ok(()) + } + + fn read(&mut self) -> Result { + let chunk = self.link.read_chunk()?; + if chunk[0] != 0x3f || chunk[1] != 0x23 || chunk[2] != 0x23 { + println!( + "bad magic in v1 read: {:x}{:x}{:x} instead of 0x3f2323", + chunk[0], chunk[1], chunk[2] + ); + return Err(Error::DeviceBadMagic); + } + let message_type_id = BigEndian::read_u16(&chunk[3..5]) as u32; + let message_type = MessageType::from_i32(message_type_id as i32) + .ok_or(Error::InvalidMessageType(message_type_id))?; + let data_length = BigEndian::read_u32(&chunk[5..9]) as usize; + let mut data: Vec = chunk[9..].into(); + + while data.len() < data_length { + let chunk = self.link.read_chunk()?; + if chunk[0] != 0x3f { + println!("bad magic in v1 read: {:x} instead of 0x3f", chunk[0]); + return Err(Error::DeviceBadMagic); + } + + data.extend(&chunk[1..]); + } + + Ok(ProtoMessage(message_type, data[0..data_length].into())) + } +} diff --git a/wallet/trezor-client/src/transport/udp.rs b/wallet/trezor-client/src/transport/udp.rs new file mode 100644 index 0000000000..b70ef5bf66 --- /dev/null +++ b/wallet/trezor-client/src/transport/udp.rs @@ -0,0 +1,159 @@ +use super::{ + error::Error, + protocol::{Link, Protocol, ProtocolV1}, + AvailableDeviceTransport, ProtoMessage, Transport, +}; +use crate::{AvailableDevice, Model}; +use std::{fmt, net::UdpSocket, result::Result, time::Duration}; + +// A collection of constants related to the Emulator Ports. +mod constants { + pub(crate) const DEFAULT_HOST: &str = "127.0.0.1"; + pub(crate) const DEFAULT_PORT: &str = "21324"; + pub(crate) const DEFAULT_DEBUG_PORT: &str = "21325"; + pub(crate) const LOCAL_LISTENER: &str = "127.0.0.1:0"; +} + +use constants::{DEFAULT_DEBUG_PORT, DEFAULT_HOST, DEFAULT_PORT, LOCAL_LISTENER}; + +/// The chunk size for the serial protocol. +const CHUNK_SIZE: usize = 64; + +const READ_TIMEOUT_MS: u64 = 100000; +const WRITE_TIMEOUT_MS: u64 = 100000; + +/// An available transport for connecting with a device. +#[derive(Debug)] +pub struct AvailableUdpTransport { + pub host: String, + pub port: String, +} + +impl fmt::Display for AvailableUdpTransport { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "udp:{}:{}", self.host, self.port) + } +} + +/// An actual serial HID USB link to a device over which bytes can be sent. +struct UdpLink { + socket: UdpSocket, + device: (String, String), +} +// No need to implement drop as every member is owned + +impl Link for UdpLink { + fn write_chunk(&mut self, chunk: Vec) -> Result<(), Error> { + debug_assert_eq!(CHUNK_SIZE, chunk.len()); + let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); + self.socket.set_write_timeout(Some(timeout))?; + if let Err(e) = self.socket.send(&chunk) { + return Err(e.into()); + } + Ok(()) + } + + fn read_chunk(&mut self) -> Result, Error> { + let mut chunk = vec![0; CHUNK_SIZE]; + let timeout = Duration::from_millis(READ_TIMEOUT_MS); + self.socket.set_read_timeout(Some(timeout))?; + + let n = self.socket.recv(&mut chunk)?; + if n == CHUNK_SIZE { + Ok(chunk) + } else { + Err(Error::DeviceReadTimeout) + } + } +} + +impl UdpLink { + fn open(path: &str) -> Result { + let mut parts = path.split(':'); + let link = Self { + socket: UdpSocket::bind(LOCAL_LISTENER)?, + device: ( + parts.next().expect("Incorrect Path").to_owned(), + parts.next().expect("Incorrect Path").to_owned(), + ), + }; + link.socket.connect(path)?; + Ok(link) + } + + // Ping the port and compare against expected response + fn ping(&self) -> Result { + let mut resp = [0; CHUNK_SIZE]; + self.socket.send("PINGPING".as_bytes())?; + let size = self.socket.recv(&mut resp)?; + Ok(&resp[..size] == "PONGPONG".as_bytes()) + } +} + +/// An implementation of the Transport interface for UDP devices. +pub struct UdpTransport { + protocol: ProtocolV1, +} + +impl UdpTransport { + pub fn find_devices(debug: bool, path: Option<&str>) -> Result, Error> { + let mut devices = Vec::new(); + let mut dest = String::new(); + match path { + Some(p) => p.clone_into(&mut dest), + None => { + dest.push_str(DEFAULT_HOST); + dest.push(':'); + dest.push_str(if debug { + DEFAULT_DEBUG_PORT + } else { + DEFAULT_PORT + }); + } + }; + let link = UdpLink::open(&dest)?; + if link.ping()? { + devices.push(AvailableDevice { + model: Model::TrezorEmulator, + debug, + transport: AvailableDeviceTransport::Udp(AvailableUdpTransport { + host: link.device.0, + port: link.device.1, + }), + }); + } + Ok(devices) + } + + /// Connect to a device over the UDP transport. + pub fn connect(device: &AvailableDevice) -> Result, Error> { + let transport = match device.transport { + AvailableDeviceTransport::Udp(ref t) => t, + _ => panic!("passed wrong AvailableDevice in UdpTransport::connect"), + }; + let mut path = String::new(); + path.push_str(&transport.host); + path.push(':'); + path.push_str(&transport.port); + let link = UdpLink::open(&path)?; + Ok(Box::new(UdpTransport { + protocol: ProtocolV1 { link }, + })) + } +} + +impl super::Transport for UdpTransport { + fn session_begin(&mut self) -> Result<(), Error> { + self.protocol.session_begin() + } + fn session_end(&mut self) -> Result<(), Error> { + self.protocol.session_end() + } + + fn write_message(&mut self, message: ProtoMessage) -> Result<(), Error> { + self.protocol.write(message) + } + fn read_message(&mut self) -> Result { + self.protocol.read() + } +} diff --git a/wallet/trezor-client/src/transport/webusb.rs b/wallet/trezor-client/src/transport/webusb.rs new file mode 100644 index 0000000000..635f048ecb --- /dev/null +++ b/wallet/trezor-client/src/transport/webusb.rs @@ -0,0 +1,173 @@ +use crate::{ + transport::{ + derive_model, + error::Error, + protocol::{Link, Protocol, ProtocolV1}, + AvailableDeviceTransport, ProtoMessage, Transport, + }, + AvailableDevice, +}; +use rusb::*; +use std::{fmt, result::Result, time::Duration}; + +// A collection of constants related to the WebUsb protocol. +mod constants { + pub(crate) const CONFIG_ID: u8 = 0; + pub(crate) const INTERFACE_DESCRIPTOR: u8 = 0; + pub(crate) const LIBUSB_CLASS_VENDOR_SPEC: u8 = 0xff; + + pub(crate) const INTERFACE: u8 = 0; + pub(crate) const INTERFACE_DEBUG: u8 = 1; + pub(crate) const ENDPOINT: u8 = 1; + pub(crate) const ENDPOINT_DEBUG: u8 = 2; + pub(crate) const READ_ENDPOINT_MASK: u8 = 0x80; +} + +/// The chunk size for the serial protocol. +const CHUNK_SIZE: usize = 64; + +const READ_TIMEOUT_MS: u64 = 100000; +const WRITE_TIMEOUT_MS: u64 = 100000; + +/// An available transport for connecting with a device. +#[derive(Debug)] +pub struct AvailableWebUsbTransport { + pub bus: u8, + pub address: u8, +} + +impl fmt::Display for AvailableWebUsbTransport { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "WebUSB ({}:{})", self.bus, self.address) + } +} + +/// An actual serial USB link to a device over which bytes can be sent. +pub struct WebUsbLink { + handle: DeviceHandle, + endpoint: u8, +} + +impl Link for WebUsbLink { + fn write_chunk(&mut self, chunk: Vec) -> Result<(), Error> { + debug_assert_eq!(CHUNK_SIZE, chunk.len()); + let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); + if let Err(e) = self.handle.write_interrupt(self.endpoint, &chunk, timeout) { + return Err(e.into()); + } + Ok(()) + } + + fn read_chunk(&mut self) -> Result, Error> { + let mut chunk = vec![0; CHUNK_SIZE]; + let endpoint = constants::READ_ENDPOINT_MASK | self.endpoint; + let timeout = Duration::from_millis(READ_TIMEOUT_MS); + + let n = self.handle.read_interrupt(endpoint, &mut chunk, timeout)?; + if n == CHUNK_SIZE { + Ok(chunk) + } else { + Err(Error::DeviceReadTimeout) + } + } +} + +/// An implementation of the Transport interface for WebUSB devices. +pub struct WebUsbTransport { + protocol: ProtocolV1, +} + +impl WebUsbTransport { + pub fn find_devices(debug: bool) -> Result, Error> { + let mut devices = Vec::new(); + + for dev in rusb::devices().unwrap().iter() { + let desc = dev.device_descriptor()?; + let dev_id = (desc.vendor_id(), desc.product_id()); + + let model = match derive_model(dev_id) { + Some(m) => m, + None => continue, + }; + + // Check something with interface class code like python-trezor does. + let class_code = dev + .config_descriptor(constants::CONFIG_ID)? + .interfaces() + .find(|i| i.number() == constants::INTERFACE) + .ok_or(rusb::Error::Other)? + .descriptors() + .find(|d| d.setting_number() == constants::INTERFACE_DESCRIPTOR) + .ok_or(rusb::Error::Other)? + .class_code(); + if class_code != constants::LIBUSB_CLASS_VENDOR_SPEC { + continue; + } + + devices.push(AvailableDevice { + model, + debug, + transport: AvailableDeviceTransport::WebUsb(AvailableWebUsbTransport { + bus: dev.bus_number(), + address: dev.address(), + }), + }); + } + Ok(devices) + } + + /// Connect to a device over the WebUSB transport. + pub fn connect(device: &AvailableDevice) -> Result, Error> { + let transport = match &device.transport { + AvailableDeviceTransport::WebUsb(t) => t, + _ => panic!("passed wrong AvailableDevice in WebUsbTransport::connect"), + }; + + let interface = match device.debug { + false => constants::INTERFACE, + true => constants::INTERFACE_DEBUG, + }; + + // Go over the devices again to match the desired device. + let dev = rusb::devices()? + .iter() + .find(|dev| dev.bus_number() == transport.bus && dev.address() == transport.address) + .ok_or(Error::DeviceDisconnected)?; + // Check if there is not another device connected on this bus. + let dev_desc = dev.device_descriptor()?; + let dev_id = (dev_desc.vendor_id(), dev_desc.product_id()); + if derive_model(dev_id).as_ref() != Some(&device.model) { + return Err(Error::DeviceDisconnected); + } + let handle = dev.open()?; + handle.claim_interface(interface)?; + + Ok(Box::new(WebUsbTransport { + protocol: ProtocolV1 { + link: WebUsbLink { + handle, + endpoint: match device.debug { + false => constants::ENDPOINT, + true => constants::ENDPOINT_DEBUG, + }, + }, + }, + })) + } +} + +impl super::Transport for WebUsbTransport { + fn session_begin(&mut self) -> Result<(), Error> { + self.protocol.session_begin() + } + fn session_end(&mut self) -> Result<(), Error> { + self.protocol.session_end() + } + + fn write_message(&mut self, message: ProtoMessage) -> Result<(), Error> { + self.protocol.write(message) + } + fn read_message(&mut self) -> Result { + self.protocol.read() + } +} diff --git a/wallet/trezor-client/src/utils.rs b/wallet/trezor-client/src/utils.rs new file mode 100644 index 0000000000..c248599700 --- /dev/null +++ b/wallet/trezor-client/src/utils.rs @@ -0,0 +1,73 @@ +use crate::error::{Error, Result}; +use bitcoin::{ + address, + address::Payload, + bip32, + blockdata::script::Script, + hashes::{sha256d, Hash}, + psbt, + secp256k1::ecdsa::{RecoverableSignature, RecoveryId}, + Address, Network, +}; + +/// Retrieve an address from the given script. +pub fn address_from_script(script: &Script, network: Network) -> Option { + let payload = Payload::from_script(script).ok()?; + Some(Address::new(network, payload)) +} + +/// Find the (first if multiple) PSBT input that refers to the given txid. +pub fn psbt_find_input(psbt: &psbt::Psbt, txid: sha256d::Hash) -> Result<&psbt::Input> { + let inputs = &psbt.unsigned_tx.input; + let idx = inputs + .iter() + .position(|tx| *tx.previous_output.txid.as_raw_hash() == txid) + .ok_or(Error::TxRequestUnknownTxid(txid))?; + psbt.inputs.get(idx).ok_or(Error::TxRequestInvalidIndex(idx)) +} + +/// Get a hash from a reverse byte representation. +pub fn from_rev_bytes(rev_bytes: &[u8]) -> Option { + let mut bytes = rev_bytes.to_vec(); + bytes.reverse(); + sha256d::Hash::from_slice(&bytes).ok() +} + +/// Get the reverse byte representation of a hash. +pub fn to_rev_bytes(hash: &sha256d::Hash) -> [u8; 32] { + let mut bytes = hash.to_byte_array(); + bytes.reverse(); + bytes +} + +/// Parse a Bitcoin Core-style 65-byte recoverable signature. +pub fn parse_recoverable_signature( + sig: &[u8], +) -> Result { + if sig.len() != 65 { + return Err(bitcoin::secp256k1::Error::InvalidSignature); + } + + // Bitcoin Core sets the first byte to `27 + rec + (fCompressed ? 4 : 0)`. + let rec_id = RecoveryId::from_i32(if sig[0] >= 31 { + (sig[0] - 31) as i32 + } else { + (sig[0] - 27) as i32 + })?; + + RecoverableSignature::from_compact(&sig[1..], rec_id) +} + +/// Convert a bitcoin network constant to the Trezor-compatible coin_name string. +pub fn coin_name(network: Network) -> Result { + match network { + Network::Bitcoin => Ok("Bitcoin".to_owned()), + Network::Testnet => Ok("Testnet".to_owned()), + _ => Err(Error::UnsupportedNetwork), + } +} + +/// Convert a BIP-32 derivation path into a `Vec`. +pub fn convert_path(path: &bip32::DerivationPath) -> Vec { + path.into_iter().map(|i| u32::from(*i)).collect() +} From 1cafef7ff4c118c06a1974c60a152ab757c572d5 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 1 Jul 2024 09:46:14 +0200 Subject: [PATCH 06/48] refactor signer provider for creating wallet accounts --- Cargo.lock | 2 + do_checks.sh | 1 - node-gui/Cargo.toml | 2 + node-gui/backend/src/backend_impl.rs | 101 +-- wallet/src/key_chain/account_key_chain/mod.rs | 9 - wallet/src/key_chain/master_key_chain/mod.rs | 1 + wallet/src/signer/mod.rs | 15 +- wallet/src/signer/software_signer/mod.rs | 59 +- wallet/src/signer/trezor_signer/mod.rs | 19 +- wallet/src/signer/trezor_signer/tests.rs | 24 +- wallet/src/wallet/mod.rs | 187 ++-- wallet/src/wallet/tests.rs | 107 ++- wallet/trezor-client/examples/change_pin.rs | 31 - wallet/trezor-client/examples/features.rs | 101 --- wallet/trezor-client/examples/find.rs | 11 - wallet/trezor-client/examples/interaction.rs | 57 -- wallet/trezor-client/examples/sign_message.rs | 40 - wallet/trezor-client/examples/sign_tx.rs | 119 --- wallet/trezor-client/examples/solana.rs | 17 - wallet/types/src/seed_phrase.rs | 1 + wallet/wallet-cli-lib/src/cli_event_loop.rs | 23 +- wallet/wallet-controller/src/lib.rs | 259 +++--- wallet/wallet-controller/src/read.rs | 202 +++-- .../src/synced_controller.rs | 825 ++++++++++++------ .../src/handles_client/mod.rs | 12 +- wallet/wallet-rpc-lib/src/lib.rs | 32 +- wallet/wallet-rpc-lib/src/rpc/mod.rs | 42 +- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 9 +- wallet/wallet-rpc-lib/src/service/handle.rs | 18 +- wallet/wallet-rpc-lib/src/service/mod.rs | 12 +- wallet/wallet-rpc-lib/src/service/worker.rs | 50 +- wallet/wallet-rpc-lib/tests/utils.rs | 31 +- 32 files changed, 1211 insertions(+), 1208 deletions(-) delete mode 100644 wallet/trezor-client/examples/change_pin.rs delete mode 100644 wallet/trezor-client/examples/features.rs delete mode 100644 wallet/trezor-client/examples/find.rs delete mode 100644 wallet/trezor-client/examples/interaction.rs delete mode 100644 wallet/trezor-client/examples/sign_message.rs delete mode 100644 wallet/trezor-client/examples/sign_tx.rs delete mode 100644 wallet/trezor-client/examples/solana.rs diff --git a/Cargo.lock b/Cargo.lock index 608dea5487..ab77960318 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4858,6 +4858,7 @@ dependencies = [ "serde_json", "serde_with", "serialization", + "storage", "subsystem", "test-utils", "thiserror", @@ -4868,6 +4869,7 @@ dependencies = [ "wallet-controller", "wallet-rpc-client", "wallet-rpc-lib", + "wallet-storage", "wallet-types", ] diff --git a/do_checks.sh b/do_checks.sh index 70fb41a84a..5066fb964e 100755 --- a/do_checks.sh +++ b/do_checks.sh @@ -28,7 +28,6 @@ cargo clippy --all-features --workspace --all-targets -- \ cargo clippy --all-features --workspace --lib --bins --examples -- \ -A clippy::all \ -D clippy::float_arithmetic \ - -D clippy::unwrap_used \ -D clippy::dbg_macro \ -D clippy::items_after_statements \ -D clippy::fallible_impl_from \ diff --git a/node-gui/Cargo.toml b/node-gui/Cargo.toml index 714a97cb30..6a4161476c 100644 --- a/node-gui/Cargo.toml +++ b/node-gui/Cargo.toml @@ -17,12 +17,14 @@ node-gui-backend = { path = "./backend" } node-lib = { path = "../node-lib" } node-comm = { path = "../wallet/wallet-node-client" } p2p = { path = "../p2p" } +storage = { path = "../storage" } serialization = { path = "../serialization" } utils = { path = "../utils" } wallet = { path = "../wallet" } wallet-controller = { path = "../wallet/wallet-controller" } wallet-types = { path = "../wallet/types" } wallet-cli-commands = { path = "../wallet/wallet-cli-commands"} +wallet-storage = { path = "../wallet/storage" } anyhow.workspace = true chrono.workspace = true diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index 25c7cc32bd..4c4164b5ce 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -30,12 +30,7 @@ use tokio::{ sync::mpsc::{UnboundedReceiver, UnboundedSender}, task::JoinHandle, }; -use wallet::{ - account::transaction_list::TransactionList, - signer::{software_signer::SoftwareSignerProvider, SignerProvider}, - wallet::Error, - WalletError, -}; +use wallet::{account::transaction_list::TransactionList, wallet::Error, WalletError}; use wallet_cli_commands::{ get_repl_command, parse_input, CommandHandler, ConsoleCommand, ManageableWalletCommand, WalletCommand, @@ -74,12 +69,12 @@ const IN_TOP_X_MB: usize = 5; enum GuiHotColdController { Hot( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, ), Cold( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, ), } @@ -91,9 +86,7 @@ struct WalletData { } impl WalletData { - fn hot_wallet( - &mut self, - ) -> Option<&mut WalletRpc> { + fn hot_wallet(&mut self) -> Option<&mut WalletRpc> { match &mut self.controller { GuiHotColdController::Hot(w, _) => Some(w), GuiHotColdController::Cold(_, _) => None, @@ -212,13 +205,12 @@ impl Backend { } } - async fn get_account_info( - controller: &WalletRpc, + async fn get_account_info( + controller: &WalletRpc, account_index: U31, ) -> Result<(AccountId, AccountInfo), BackendError> where T: NodeInterface + Clone + Send + Sync + Debug + 'static, - P: SignerProvider + Clone + Send + Sync + Debug + 'static, { let name = controller .wallet_info() @@ -294,7 +286,6 @@ impl Backend { &mnemonic, import, wallet_events, - SoftwareSignerProvider::new(), ) .await?; @@ -311,14 +302,7 @@ impl Backend { let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); let (wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self - .create_wallet( - client, - file_path.clone(), - &mnemonic, - import, - wallet_events, - SoftwareSignerProvider::new(), - ) + .create_wallet(client, file_path.clone(), &mnemonic, import, wallet_events) .await?; let wallet_data = WalletData { @@ -351,18 +335,17 @@ impl Backend { Ok(wallet_info) } - async fn create_wallet( + async fn create_wallet( &mut self, handles_client: N, file_path: PathBuf, mnemonic: &wallet::wallet::Mnemonic, import: ImportOrCreate, wallet_events: GuiWalletEvents, - signer_provider: P, ) -> Result< ( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, (Id, BlockHeight), BTreeMap, BTreeMap, @@ -371,7 +354,6 @@ impl Backend { > where N: NodeInterface + Clone + Debug + Send + Sync + 'static, - P: SignerProvider + Clone + Send + Sync + Debug + 'static, { let wallet_service = WalletService::start( self.chain_config.clone(), @@ -379,19 +361,13 @@ impl Backend { false, vec![], handles_client, - signer_provider.clone(), ) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; let wallet_handle = wallet_service.handle(); let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); - let wallet_rpc = WalletRpc::new( - wallet_handle, - node_rpc.clone(), - chain_config.clone(), - signer_provider, - ); + let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); wallet_rpc .create_wallet( file_path, @@ -476,14 +452,7 @@ impl Backend { best_block, accounts_info, accounts_data, - ) = self - .open_wallet( - handles_client, - file_path.clone(), - wallet_events, - SoftwareSignerProvider::new(), - ) - .await?; + ) = self.open_wallet(handles_client, file_path.clone(), wallet_events).await?; let wallet_data = WalletData { controller: GuiHotColdController::Hot(wallet_rpc, command_handler), @@ -504,14 +473,7 @@ impl Backend { best_block, accounts_info, accounts_data, - ) = self - .open_wallet( - client, - file_path.clone(), - wallet_events, - SoftwareSignerProvider::new(), - ) - .await?; + ) = self.open_wallet(client, file_path.clone(), wallet_events).await?; let wallet_data = WalletData { controller: GuiHotColdController::Cold(wallet_rpc, command_handler), @@ -541,16 +503,15 @@ impl Backend { Ok(wallet_info) } - async fn open_wallet( + async fn open_wallet( &mut self, handles_client: N, file_path: PathBuf, wallet_events: GuiWalletEvents, - signer_provider: P, ) -> Result< ( - WalletRpc, - CommandHandler>, + WalletRpc, + CommandHandler>, EncryptionState, (Id, BlockHeight), BTreeMap, @@ -560,7 +521,6 @@ impl Backend { > where N: NodeInterface + Clone + Debug + Send + Sync + 'static, - P: SignerProvider + Clone + Debug + Send + Sync + 'static, { let wallet_service = WalletService::start( self.chain_config.clone(), @@ -568,19 +528,13 @@ impl Backend { false, vec![], handles_client, - signer_provider.clone(), ) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; let wallet_handle = wallet_service.handle(); let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); - let wallet_rpc = WalletRpc::new( - wallet_handle, - node_rpc.clone(), - chain_config.clone(), - signer_provider, - ); + let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); wallet_rpc .open_wallet(file_path, None, false) .await @@ -735,7 +689,7 @@ impl Backend { fn hot_wallet( &mut self, wallet_id: WalletId, - ) -> Result<&mut WalletRpc, BackendError> { + ) -> Result<&mut WalletRpc, BackendError> { self.wallets .get_mut(&wallet_id) .ok_or(BackendError::UnknownWalletIndex(wallet_id))? @@ -1305,13 +1259,12 @@ impl Backend { } } -async fn get_account_balance( - controller: &WalletRpc, +async fn get_account_balance( + controller: &WalletRpc, account_index: U31, ) -> Result where N: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Clone + Send + Sync + 'static, { controller .get_balance( @@ -1323,14 +1276,13 @@ where .map_err(|e| BackendError::WalletError(e.to_string())) } -async fn encrypt_action( +async fn encrypt_action( action: EncryptionAction, - controller: &mut WalletRpc, + controller: &mut WalletRpc, wallet_id: WalletId, ) -> Result<(WalletId, EncryptionState), BackendError> where T: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Clone + Send + Sync + 'static, { match action { EncryptionAction::SetPassword(password) => controller @@ -1353,15 +1305,14 @@ where .map_err(|err| BackendError::WalletError(err.to_string())) } -async fn select_acc_and_execute_cmd( - c: &mut CommandHandler>, +async fn select_acc_and_execute_cmd( + c: &mut CommandHandler>, account_id: AccountId, command: ManageableWalletCommand, chain_config: &ChainConfig, ) -> Result where N: NodeInterface + Clone + Send + Sync + 'static + Debug, - P: SignerProvider + Clone + Send + Sync + 'static + Debug, { c.handle_manageable_wallet_command( chain_config, diff --git a/wallet/src/key_chain/account_key_chain/mod.rs b/wallet/src/key_chain/account_key_chain/mod.rs index 1876df76cf..714ffb86b0 100644 --- a/wallet/src/key_chain/account_key_chain/mod.rs +++ b/wallet/src/key_chain/account_key_chain/mod.rs @@ -53,9 +53,6 @@ pub struct AccountKeyChainImpl { /// The account public key from which all the addresses are derived account_public_key: ConstValue, - /// The account vrf public key from which all the pool addresses are derived - account_vrf_public_key: ConstValue, - /// Key chains for receiving and change funds sub_chains: WithPurpose, @@ -142,7 +139,6 @@ impl AccountKeyChainImpl { chain_config, account_index, account_public_key: account_pubkey.into(), - account_vrf_public_key: account_vrf_pub_key.into(), sub_chains, vrf_chain, standalone_watch_only_keys: BTreeMap::new(), @@ -234,7 +230,6 @@ impl AccountKeyChainImpl { chain_config, account_index: account_info.account_index(), account_public_key: pubkey_id, - account_vrf_public_key: vrf_chain.get_account_vrf_public_key().clone().into(), sub_chains, vrf_chain, standalone_watch_only_keys, @@ -256,10 +251,6 @@ impl AccountKeyChainImpl { self.account_public_key.as_ref() } - pub fn account_vrf_public_key(&self) -> &ExtendedVRFPublicKey { - self.account_vrf_public_key.as_ref() - } - /// Return the next unused address and don't mark it as issued pub fn next_unused_address( &mut self, diff --git a/wallet/src/key_chain/master_key_chain/mod.rs b/wallet/src/key_chain/master_key_chain/mod.rs index 06c4af0888..60fe1e4442 100644 --- a/wallet/src/key_chain/master_key_chain/mod.rs +++ b/wallet/src/key_chain/master_key_chain/mod.rs @@ -29,6 +29,7 @@ use wallet_types::seed_phrase::{SerializableSeedPhrase, StoreSeedPhrase}; use super::DEFAULT_VRF_KEY_KIND; +#[derive(Clone, Debug)] pub struct MasterKeyChain { /// The specific chain this KeyChain is based on, this will affect the address format chain_config: Arc, diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index b0a9d05c8c..05b0927f71 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -24,10 +24,13 @@ use common::chain::{ ChainConfig, Destination, SignedTransactionIntent, SignedTransactionIntentError, Transaction, }; use crypto::key::hdkd::{derivable::DerivationError, u31::U31}; -use wallet_storage::WalletStorageReadUnlocked; +use wallet_storage::{WalletStorageReadUnlocked, WalletStorageWriteUnlocked}; use wallet_types::signature_status::SignatureStatus; -use crate::key_chain::{AccountKeyChains, KeyChainError}; +use crate::{ + key_chain::{AccountKeyChains, KeyChainError}, + Account, WalletResult, +}; pub mod software_signer; #[cfg(feature = "trezor")] @@ -99,4 +102,12 @@ pub trait SignerProvider { type S: Signer; fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S; + + fn make_new_account( + &mut self, + chain_config: Arc, + account_index: U31, + name: Option, + db_tx: &mut impl WalletStorageWriteUnlocked, + ) -> WalletResult; } diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index 953dd9d530..5d71f0911c 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -44,10 +44,16 @@ use crypto::key::{ }; use itertools::Itertools; use randomness::make_true_rng; -use wallet_storage::WalletStorageReadUnlocked; -use wallet_types::signature_status::SignatureStatus; +use wallet_storage::{ + StoreTxRwUnlocked, WalletStorageReadLocked, WalletStorageReadUnlocked, + WalletStorageWriteUnlocked, +}; +use wallet_types::{seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus}; -use crate::key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}; +use crate::{ + key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}, + Account, WalletResult, +}; use super::{Signer, SignerError, SignerProvider, SignerResult}; @@ -404,11 +410,35 @@ fn get_private_key( } #[derive(Clone, Debug)] -pub struct SoftwareSignerProvider; +pub struct SoftwareSignerProvider { + master_key_chain: MasterKeyChain, +} impl SoftwareSignerProvider { - pub fn new() -> Self { - Self {} + pub fn new_from_mnemonic( + chain_config: Arc, + db_tx: &mut StoreTxRwUnlocked, + mnemonic_str: &str, + passphrase: Option<&str>, + save_seed_phrase: StoreSeedPhrase, + ) -> SignerResult { + let master_key_chain = MasterKeyChain::new_from_mnemonic( + chain_config, + db_tx, + mnemonic_str, + passphrase, + save_seed_phrase, + )?; + + Ok(Self { master_key_chain }) + } + + pub fn load_from_database( + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + ) -> SignerResult { + let master_key_chain = MasterKeyChain::new_from_existing_database(chain_config, db_tx)?; + Ok(Self { master_key_chain }) } } @@ -418,6 +448,23 @@ impl SignerProvider for SoftwareSignerProvider { fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S { SoftwareSigner::new(chain_config, account_index) } + + fn make_new_account( + &mut self, + chain_config: Arc, + next_account_index: U31, + name: Option, + db_tx: &mut impl WalletStorageWriteUnlocked, + ) -> WalletResult { + let lookahead_size = db_tx.get_lookahead_size()?; + let account_key_chain = self.master_key_chain.create_account_key_chain( + db_tx, + next_account_index, + lookahead_size, + )?; + + Account::new(chain_config, db_tx, account_key_chain, name) + } } #[cfg(test)] diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index be518e7414..dea711549f 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -46,10 +46,13 @@ use trezor_client::{ protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, Trezor, }; -use wallet_storage::WalletStorageReadUnlocked; +use wallet_storage::{WalletStorageReadUnlocked, WalletStorageWriteUnlocked}; use wallet_types::signature_status::SignatureStatus; -use crate::key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}; +use crate::{ + key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}, + Account, WalletResult, +}; use super::{Signer, SignerError, SignerProvider, SignerResult}; @@ -274,7 +277,7 @@ impl Signer for TrezorSigner { .into_iter() .multiunzip(); - Ok((ptx.new_witnesses(witnesses), prev_statuses, new_statuses)) + Ok((ptx.with_witnesses(witnesses), prev_statuses, new_statuses)) } fn sign_challenge( @@ -438,6 +441,16 @@ impl SignerProvider for TrezorSignerProvider { fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S { TrezorSigner::new(chain_config, account_index, self.client.clone()) } + + fn make_new_account( + &mut self, + _chain_config: Arc, + _account_index: U31, + _name: Option, + _db_tx: &mut impl WalletStorageWriteUnlocked, + ) -> WalletResult { + unimplemented!("hehe"); + } } #[cfg(test)] diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index bafdddb26b..690a9e88f8 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -17,12 +17,11 @@ use std::ops::{Add, Div, Mul, Sub}; use std::{cell::RefCell, rc::Rc}; use super::*; -use crate::destination_getters::get_tx_output_destination; +use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::output_value::OutputValue; -use common::chain::signature::verify_signature; use common::chain::{Transaction, TxInput}; use common::primitives::{Amount, Id, H256}; use randomness::{Rng, RngCore}; @@ -141,14 +140,27 @@ fn sign_transaction(#[case] seed: Seed) { let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); eprintln!("num inputs in tx: {}", inputs.len()); - assert!(ptx.is_fully_signed(&chain_config)); + assert!(ptx.all_signatures_available()); - let sig_tx = ptx.into_signed_tx(&chain_config).unwrap(); + let sig_tx = ptx.into_signed_tx().unwrap(); let utxos_ref = utxos.iter().map(Some).collect::>(); for i in 0..sig_tx.inputs().len() { - let destination = get_tx_output_destination(utxos_ref[i].unwrap(), &|_| None).unwrap(); - verify_signature(&chain_config, &destination, &sig_tx, &utxos_ref, i).unwrap(); + let destination = get_tx_output_destination( + utxos_ref[i].unwrap(), + &|_| None, + HtlcSpendingCondition::Skip, + ) + .unwrap(); + + tx_verifier::input_check::signature_only_check::verify_tx_signature( + &chain_config, + &destination, + &sig_tx, + &utxos_ref, + i, + ) + .unwrap(); } } diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index de1dee673d..19d1c90548 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -69,13 +69,13 @@ use tx_verifier::{check_transaction, CheckTransactionError}; use utils::ensure; pub use wallet_storage::Error; use wallet_storage::{ - DefaultBackend, Store, StoreTxRw, StoreTxRwUnlocked, TransactionRoLocked, TransactionRwLocked, - TransactionRwUnlocked, Transactional, WalletStorageReadLocked, WalletStorageReadUnlocked, - WalletStorageWriteLocked, WalletStorageWriteUnlocked, + DefaultBackend, Store, StoreTxRo, StoreTxRw, StoreTxRwUnlocked, TransactionRoLocked, + TransactionRwLocked, TransactionRwUnlocked, Transactional, WalletStorageReadLocked, + WalletStorageReadUnlocked, WalletStorageWriteLocked, WalletStorageWriteUnlocked, }; use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; use wallet_types::chain_info::ChainInfo; -use wallet_types::seed_phrase::{SerializableSeedPhrase, StoreSeedPhrase}; +use wallet_types::seed_phrase::SerializableSeedPhrase; use wallet_types::signature_status::SignatureStatus; use wallet_types::utxo_types::{UtxoStates, UtxoTypes}; use wallet_types::wallet_tx::{TxData, TxState}; @@ -266,7 +266,6 @@ pub enum WalletPoolsFilter { pub struct Wallet { chain_config: Arc, db: Store, - key_chain: MasterKeyChain, accounts: BTreeMap, latest_median_time: BlockTimestamp, next_unused_account: (U31, Account), @@ -292,90 +291,57 @@ where B: storage::Backend + 'static, P: SignerProvider, { - #[allow(clippy::too_many_arguments)] - pub fn create_new_wallet( + pub fn create_new_wallet) -> WalletResult

>( chain_config: Arc, db: Store, - mnemonic: &str, - passphrase: Option<&str>, - save_seed_phrase: StoreSeedPhrase, best_block: (BlockHeight, Id), wallet_type: WalletType, - signer_provider: P, + signer_provider: F, ) -> WalletResult { - let mut wallet = Self::new_wallet( - chain_config, - db, - mnemonic, - passphrase, - save_seed_phrase, - wallet_type, - signer_provider, - )?; + let mut wallet = Self::new_wallet(chain_config, db, wallet_type, signer_provider)?; wallet.set_best_block(best_block.0, best_block.1)?; Ok(wallet) } - pub fn recover_wallet( + pub fn recover_wallet) -> WalletResult

>( chain_config: Arc, db: Store, - mnemonic: &str, - passphrase: Option<&str>, - save_seed_phrase: StoreSeedPhrase, wallet_type: WalletType, - signer_provider: P, + signer_provider: F, ) -> WalletResult { - Self::new_wallet( - chain_config, - db, - mnemonic, - passphrase, - save_seed_phrase, - wallet_type, - signer_provider, - ) + Self::new_wallet(chain_config, db, wallet_type, signer_provider) } - fn new_wallet( + fn new_wallet) -> WalletResult

>( chain_config: Arc, db: Store, - mnemonic: &str, - passphrase: Option<&str>, - save_seed_phrase: StoreSeedPhrase, wallet_type: WalletType, - signer_provider: P, + signer_provider: F, ) -> WalletResult { let mut db_tx = db.transaction_rw_unlocked(None)?; - let key_chain = MasterKeyChain::new_from_mnemonic( - chain_config.clone(), - &mut db_tx, - mnemonic, - passphrase, - save_seed_phrase, - )?; - db_tx.set_storage_version(CURRENT_WALLET_VERSION)?; db_tx.set_chain_info(&ChainInfo::new(chain_config.as_ref()))?; db_tx.set_lookahead_size(LOOKAHEAD_SIZE)?; db_tx.set_wallet_type(wallet_type)?; + let mut signer_provider = signer_provider(&mut db_tx)?; let default_account = Wallet::::create_next_unused_account( U31::ZERO, chain_config.clone(), - &key_chain, &mut db_tx, None, + &mut signer_provider, )?; let next_unused_account = Wallet::::create_next_unused_account( U31::ONE, chain_config.clone(), - &key_chain, &mut db_tx, None, + &mut signer_provider, )?; db_tx.commit()?; @@ -384,7 +350,6 @@ where let wallet = Wallet { chain_config, db, - key_chain, accounts: [default_account].into(), latest_median_time, next_unused_account, @@ -397,7 +362,11 @@ where /// Migrate the wallet DB from version 1 to version 2 /// * save the chain info in the DB based on the chain type specified by the user /// * reset transactions - fn migration_v2(db: &Store, chain_config: Arc) -> WalletResult<()> { + fn migration_v2( + db: &Store, + chain_config: Arc, + signer_provider: &mut P, + ) -> WalletResult<()> { let mut db_tx = db.transaction_rw_unlocked(None)?; // set new chain info to the one provided by the user assuming it is the correct one db_tx.set_chain_info(&ChainInfo::new(chain_config.as_ref()))?; @@ -407,7 +376,7 @@ where Self::reset_wallet_transactions(chain_config.clone(), &mut db_tx)?; // Create the next unused account - Self::migrate_next_unused_account(chain_config, &mut db_tx)?; + Self::migrate_next_unused_account(chain_config, &mut db_tx, signer_provider)?; db_tx.set_storage_version(WALLET_VERSION_V2)?; db_tx.commit()?; @@ -538,47 +507,58 @@ where } /// Check the wallet DB version and perform any migrations needed - fn check_and_migrate_db Result<(), WalletError>>( + fn check_and_migrate_db< + F: Fn(u32) -> Result<(), WalletError>, + F2: FnOnce(&StoreTxRo) -> WalletResult

, + >( db: &Store, chain_config: Arc, pre_migration: F, wallet_type: WalletType, - ) -> WalletResult<()> { + signer_provider: F2, + ) -> WalletResult

{ let version = db.transaction_ro()?.get_storage_version()?; + ensure!( + version != WALLET_VERSION_UNINITIALIZED, + WalletError::WalletNotInitialized + ); + let mut signer_provider = signer_provider(&db.transaction_ro()?)?; - match version { - WALLET_VERSION_UNINITIALIZED => return Err(WalletError::WalletNotInitialized), - WALLET_VERSION_V1 => { - pre_migration(WALLET_VERSION_V1)?; - Self::migration_v2(db, chain_config.clone())?; - } - WALLET_VERSION_V2 => { - pre_migration(WALLET_VERSION_V2)?; - Self::migration_v3(db, chain_config.clone())?; - } - WALLET_VERSION_V3 => { - pre_migration(WALLET_VERSION_V3)?; - Self::migration_v4(db)?; - } - WALLET_VERSION_V4 => { - pre_migration(WALLET_VERSION_V4)?; - Self::migration_v5(db, chain_config.clone())?; - } - WALLET_VERSION_V5 => { - pre_migration(WALLET_VERSION_V5)?; - Self::migration_v6(db, chain_config.clone())?; - } - WALLET_VERSION_V6 => { - pre_migration(WALLET_VERSION_V6)?; - Self::migration_v7(db, chain_config.clone(), wallet_type)?; - } - CURRENT_WALLET_VERSION => return Ok(()), - unsupported_version => { - return Err(WalletError::UnsupportedWalletVersion(unsupported_version)) + loop { + let version = db.transaction_ro()?.get_storage_version()?; + + match version { + WALLET_VERSION_UNINITIALIZED => return Err(WalletError::WalletNotInitialized), + WALLET_VERSION_V1 => { + pre_migration(WALLET_VERSION_V1)?; + Self::migration_v2(db, chain_config.clone(), &mut signer_provider)?; + } + WALLET_VERSION_V2 => { + pre_migration(WALLET_VERSION_V2)?; + Self::migration_v3(db, chain_config.clone())?; + } + WALLET_VERSION_V3 => { + pre_migration(WALLET_VERSION_V3)?; + Self::migration_v4(db)?; + } + WALLET_VERSION_V4 => { + pre_migration(WALLET_VERSION_V4)?; + Self::migration_v5(db, chain_config.clone())?; + } + WALLET_VERSION_V5 => { + pre_migration(WALLET_VERSION_V5)?; + Self::migration_v6(db, chain_config.clone())?; + } + WALLET_VERSION_V6 => { + pre_migration(WALLET_VERSION_V6)?; + Self::migration_v7(db, chain_config.clone(), wallet_type)?; + } + CURRENT_WALLET_VERSION => return Ok(signer_provider), + unsupported_version => { + return Err(WalletError::UnsupportedWalletVersion(unsupported_version)) + } } } - - Self::check_and_migrate_db(db, chain_config, pre_migration, wallet_type) } fn validate_chain_info( @@ -705,8 +685,8 @@ where fn migrate_next_unused_account( chain_config: Arc, db_tx: &mut impl WalletStorageWriteUnlocked, + signer_provider: &mut P, ) -> Result<(), WalletError> { - let key_chain = MasterKeyChain::new_from_existing_database(chain_config.clone(), db_tx)?; let accounts_info = db_tx.get_accounts_info()?; let mut accounts: BTreeMap = accounts_info .keys() @@ -723,26 +703,35 @@ where Wallet::::create_next_unused_account( next_account_index, chain_config.clone(), - &key_chain, db_tx, None, + signer_provider, )?; Ok(()) } - pub fn load_wallet WalletResult<()>>( + pub fn load_wallet< + F: Fn(u32) -> WalletResult<()>, + F2: FnOnce(&StoreTxRo) -> WalletResult

, + >( chain_config: Arc, mut db: Store, password: Option, pre_migration: F, wallet_type: WalletType, force_change_wallet_type: bool, - signer_provider: P, + signer_provider: F2, ) -> WalletResult { if let Some(password) = password { db.unlock_private_keys(&password)?; } - Self::check_and_migrate_db(&db, chain_config.clone(), pre_migration, wallet_type)?; + let signer_provider = Self::check_and_migrate_db( + &db, + chain_config.clone(), + pre_migration, + wallet_type, + signer_provider, + )?; if force_change_wallet_type { Self::force_migrate_wallet_type(wallet_type, &db, chain_config.clone())?; } @@ -753,8 +742,6 @@ where Self::validate_chain_info(chain_config.as_ref(), &db_tx, wallet_type)?; - let key_chain = MasterKeyChain::new_from_existing_database(chain_config.clone(), &db_tx)?; - let accounts_info = db_tx.get_accounts_info()?; let mut accounts: BTreeMap = accounts_info @@ -777,7 +764,6 @@ where Ok(Wallet { chain_config, db, - key_chain, accounts, latest_median_time, next_unused_account, @@ -862,20 +848,21 @@ where fn create_next_unused_account( next_account_index: U31, chain_config: Arc, - master_key_chain: &MasterKeyChain, db_tx: &mut impl WalletStorageWriteUnlocked, name: Option, + signer_provider: &mut P, ) -> WalletResult<(U31, Account)> { ensure!( name.as_ref().map_or(true, |name| !name.is_empty()), WalletError::EmptyAccountName ); - let lookahead_size = db_tx.get_lookahead_size()?; - let account_key_chain = - master_key_chain.create_account_key_chain(db_tx, next_account_index, lookahead_size)?; - - let account = Account::new(chain_config, db_tx, account_key_chain, name)?; + let account = signer_provider.make_new_account( + chain_config.clone(), + next_account_index, + name, + db_tx, + )?; Ok((next_account_index, account)) } @@ -909,9 +896,9 @@ where let mut next_unused_account = Self::create_next_unused_account( next_account_index, self.chain_config.clone(), - &self.key_chain, &mut db_tx, None, + &mut self.signer_provider, )?; self.next_unused_account.1.set_name(name.clone(), &mut db_tx)?; diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 2bada033d7..50cf719768 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -54,7 +54,7 @@ use test_utils::random::{make_seedable_rng, Seed}; use wallet_storage::{schema, WalletStorageEncryptionRead}; use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, - seed_phrase::PassPhrase, + seed_phrase::{PassPhrase, StoreSeedPhrase}, utxo_types::{UtxoState, UtxoType}, Currency, }; @@ -268,7 +268,12 @@ fn verify_wallet_balance( |_| Ok(()), WalletType::Hot, false, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::load_from_database( + chain_config.clone(), + db_tx, + )?) + }, ) .unwrap(); @@ -289,14 +294,19 @@ fn create_wallet_with_mnemonic(chain_config: Arc, mnemonic: &str) - let db = create_wallet_in_memory().unwrap(); let genesis_block_id = chain_config.genesis_block_id(); Wallet::create_new_wallet( - chain_config, + chain_config.clone(), db, - mnemonic, - None, - StoreSeedPhrase::DoNotStore, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config, + db_tx, + mnemonic, + None, + StoreSeedPhrase::DoNotStore, + )?) + }, ) .unwrap() } @@ -350,6 +360,7 @@ fn test_balance_from_genesis( fn wallet_creation_in_memory() { let chain_config = Arc::new(create_regtest()); let empty_db = create_wallet_in_memory().unwrap(); + let chain_config2 = chain_config.clone(); // fail to load an empty wallet match Wallet::load_wallet( @@ -359,7 +370,12 @@ fn wallet_creation_in_memory() { |_| Ok(()), WalletType::Hot, false, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::load_from_database( + chain_config2, + db_tx, + )?) + }, ) { Ok(_) => panic!("Wallet loading should fail"), Err(err) => assert_eq!(err, WalletError::WalletNotInitialized), @@ -371,13 +387,18 @@ fn wallet_creation_in_memory() { // successfully load a wallet from initialized db let _wallet = Wallet::load_wallet( - chain_config, + chain_config.clone(), initialized_db, None, |_| Ok(()), WalletType::Hot, false, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::load_from_database( + chain_config.clone(), + db_tx, + )?) + }, ) .unwrap(); } @@ -407,12 +428,17 @@ fn wallet_migration_to_v2(#[case] seed: Seed) { let mut wallet = Wallet::create_new_wallet( Arc::clone(&chain_config), db, - MNEMONIC, - None, - StoreSeedPhrase::DoNotStore, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + )?) + }, ) .unwrap(); verify_wallet_balance(&chain_config, &wallet, genesis_amount); @@ -463,7 +489,12 @@ fn wallet_migration_to_v2(#[case] seed: Seed) { |_| Ok(()), WalletType::Hot, false, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::load_from_database( + chain_config.clone(), + db_tx, + )?) + }, ) .unwrap(); @@ -507,12 +538,17 @@ fn wallet_seed_phrase_retrieval(#[case] seed: Seed) { let mut wallet = Wallet::create_new_wallet( Arc::clone(&chain_config), db, - MNEMONIC, - wallet_passphrase.as_ref().map(|p| p.as_ref()), - StoreSeedPhrase::Store, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + MNEMONIC, + wallet_passphrase.as_ref().map(|p| p.as_ref()), + StoreSeedPhrase::Store, + )?) + }, ) .unwrap(); @@ -597,12 +633,17 @@ fn wallet_seed_phrase_check_address() { let mut wallet = Wallet::create_new_wallet( Arc::clone(&chain_config), db, - MNEMONIC, - wallet_passphrase.as_ref().map(|p| p.as_ref()), - StoreSeedPhrase::Store, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + MNEMONIC, + wallet_passphrase.as_ref().map(|p| p.as_ref()), + StoreSeedPhrase::Store, + )?) + }, ) .unwrap(); @@ -618,12 +659,17 @@ fn wallet_seed_phrase_check_address() { let mut wallet = Wallet::create_new_wallet( Arc::clone(&chain_config), db, - MNEMONIC, - wallet_passphrase.as_ref().map(|p| p.as_ref()), - StoreSeedPhrase::Store, (BlockHeight::new(0), genesis_block_id), WalletType::Hot, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + MNEMONIC, + wallet_passphrase.as_ref().map(|p| p.as_ref()), + StoreSeedPhrase::Store, + )?) + }, ) .unwrap(); @@ -927,7 +973,12 @@ fn test_wallet_accounts( |_| Ok(()), WalletType::Hot, false, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::load_from_database( + chain_config.clone(), + db_tx, + )?) + }, ) .unwrap(); let accounts = wallet.account_indexes().cloned().collect::>(); diff --git a/wallet/trezor-client/examples/change_pin.rs b/wallet/trezor-client/examples/change_pin.rs deleted file mode 100644 index 59ed37257c..0000000000 --- a/wallet/trezor-client/examples/change_pin.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::io; - -fn read_pin() -> String { - println!("Enter PIN"); - let mut pin = String::new(); - if io::stdin().read_line(&mut pin).unwrap() != 5 { - println!("must enter pin, received: {}", pin); - } - // trim newline - pin[..4].to_owned() -} - -fn do_main() -> Result<(), trezor_client::Error> { - // init with debugging - let mut trezor = trezor_client::unique(true)?; - trezor.init_device(None)?; - - let old_pin = trezor.change_pin(false)?.button_request()?.ack()?.pin_matrix_request()?; - - let new_pin1 = old_pin.ack_pin(read_pin())?.pin_matrix_request()?; - - let new_pin2 = new_pin1.ack_pin(read_pin())?.pin_matrix_request()?; - - new_pin2.ack_pin(read_pin())?.ok()?; - - Ok(()) -} - -fn main() { - do_main().unwrap() -} diff --git a/wallet/trezor-client/examples/features.rs b/wallet/trezor-client/examples/features.rs deleted file mode 100644 index 00bc185cc6..0000000000 --- a/wallet/trezor-client/examples/features.rs +++ /dev/null @@ -1,101 +0,0 @@ -use std::io; - -fn convert_path_from_str(derivation: &str) -> Vec { - let derivation = derivation.to_string(); - let elements = derivation.split('/').skip(1).collect::>(); - - let mut path = vec![]; - for derivation_index in elements { - let hardened = derivation_index.contains('\''); - let mut index = derivation_index.replace('\'', "").parse::().unwrap(); - if hardened { - index |= 0x80000000; - } - path.push(index); - } - - path -} - -fn device_selector() -> trezor_client::Trezor { - let mut devices = trezor_client::find_devices(false); - - if devices.is_empty() { - panic!("No devices connected"); - } else if devices.len() == 1 { - devices.remove(0).connect().expect("connection error") - } else { - println!("Choose device:"); - for (i, dev) in devices.iter().enumerate() { - println!("{}: {}", i + 1, dev); - } - println!("Enter device number: "); - let mut inp = String::new(); - io::stdin().read_line(&mut inp).expect("stdin error"); - let idx: usize = inp[..inp.len() - 1].parse().expect("invalid number"); - assert!(idx < devices.len(), "Index out of range"); - devices.remove(idx).connect().unwrap() - } -} - -fn do_main() -> Result<(), trezor_client::Error> { - // init with debugging - tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); - - let mut trezor = device_selector(); - trezor.init_device(None)?; - let f = trezor.features().expect("no features").clone(); - - println!("Features:"); - println!("vendor: {}", f.vendor()); - println!( - "version: {}.{}.{}", - f.major_version(), - f.minor_version(), - f.patch_version() - ); - println!("device id: {}", f.device_id()); - println!("label: {}", f.label()); - println!("is initialized: {}", f.initialized()); - println!("pin protection: {}", f.pin_protection()); - println!("passphrase protection: {}", f.passphrase_protection()); - println!( - "{:?}", - trezor.ethereum_get_address(convert_path_from_str("m/44'/60'/1'/0/0")).unwrap() - ); - drop(trezor); - - let mut trezor2 = device_selector(); - - trezor2.init_device(Some(f.session_id().to_vec()))?; - - println!( - "{:?}", - trezor2.ethereum_get_address(convert_path_from_str("m/44'/60'/1'/0/0")).unwrap() - ); - //optional bool bootloader_mode = 5; // is device in bootloader mode? - //optional string language = 9; // device language - //optional bytes revision = 13; // SCM revision of firmware - //optional bytes bootloader_hash = 14; // hash of the bootloader - //optional bool imported = 15; // was storage imported from an external source? - //optional bool pin_cached = 16; // is PIN already cached in session? - //optional bool passphrase_cached = 17; // is passphrase already cached in session? - //optional bool firmware_present = 18; // is valid firmware loaded? - //optional bool needs_backup = 19; // does storage need backup? (equals to - // Storage.needs_backup) optional uint32 flags = 20; // device flags (equals - // to Storage.flags) optional string model = 21; // device hardware model - //optional uint32 fw_major = 22; // reported firmware version if in bootloader - // mode optional uint32 fw_minor = 23; // reported firmware version if in - // bootloader mode optional uint32 fw_patch = 24; // reported firmware version - // if in bootloader mode optional string fw_vendor = 25; // reported firmware - // vendor if in bootloader mode optional bytes fw_vendor_keys = 26; // reported - // firmware vendor keys (their hash) optional bool unfinished_backup = 27; // report - // unfinished backup (equals to Storage.unfinished_backup) optional bool no_backup = 28; - // // report no backup (equals to Storage.no_backup) - - Ok(()) -} - -fn main() { - do_main().unwrap() -} diff --git a/wallet/trezor-client/examples/find.rs b/wallet/trezor-client/examples/find.rs deleted file mode 100644 index b538fa95da..0000000000 --- a/wallet/trezor-client/examples/find.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn main() { - let trezors = trezor_client::find_devices(false); - println!("Found {} devices: ", trezors.len()); - for t in trezors.into_iter() { - println!("- {}", t); - { - let mut client = t.connect().unwrap(); - println!("{:?}", client.initialize(None).unwrap()); - } - } -} diff --git a/wallet/trezor-client/examples/interaction.rs b/wallet/trezor-client/examples/interaction.rs deleted file mode 100644 index 9931ecc7d7..0000000000 --- a/wallet/trezor-client/examples/interaction.rs +++ /dev/null @@ -1,57 +0,0 @@ -use std::io; - -use bitcoin::{bip32, network::Network, Address}; -use trezor_client::{Error, TrezorMessage, TrezorResponse}; - -fn handle_interaction(resp: TrezorResponse) -> Result { - match resp { - TrezorResponse::Ok(res) => Ok(res), - TrezorResponse::Failure(_) => resp.ok(), // assering ok() returns the failure error - TrezorResponse::ButtonRequest(req) => handle_interaction(req.ack()?), - TrezorResponse::PinMatrixRequest(req) => { - println!("Enter PIN"); - let mut pin = String::new(); - if io::stdin().read_line(&mut pin).unwrap() != 5 { - println!("must enter pin, received: {}", pin); - } - // trim newline - handle_interaction(req.ack_pin(pin[..4].to_owned())?) - } - TrezorResponse::PassphraseRequest(req) => { - println!("Enter passphrase"); - let mut pass = String::new(); - io::stdin().read_line(&mut pass).unwrap(); - // trim newline - handle_interaction(req.ack_passphrase(pass[..pass.len() - 1].to_owned())?) - } - } -} - -fn do_main() -> Result<(), trezor_client::Error> { - // init with debugging - let mut trezor = trezor_client::unique(true)?; - trezor.init_device(None)?; - - let xpub = handle_interaction( - trezor.get_public_key( - &vec![ - bip32::ChildNumber::from_hardened_idx(0).unwrap(), - bip32::ChildNumber::from_hardened_idx(0).unwrap(), - bip32::ChildNumber::from_hardened_idx(0).unwrap(), - ] - .into(), - trezor_client::protos::InputScriptType::SPENDADDRESS, - Network::Testnet, - true, - )?, - )?; - println!("{}", xpub); - println!("{:?}", xpub); - println!("{}", Address::p2pkh(&xpub.to_pub(), Network::Testnet)); - - Ok(()) -} - -fn main() { - do_main().unwrap() -} diff --git a/wallet/trezor-client/examples/sign_message.rs b/wallet/trezor-client/examples/sign_message.rs deleted file mode 100644 index 8e373685b3..0000000000 --- a/wallet/trezor-client/examples/sign_message.rs +++ /dev/null @@ -1,40 +0,0 @@ -use std::str::FromStr; - -use bitcoin::{bip32::DerivationPath, network::Network, Address}; -use trezor_client::{client::common::handle_interaction, InputScriptType}; - -fn main() { - tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); - - // init with debugging - let mut trezor = trezor_client::unique(false).unwrap(); - trezor.init_device(None).unwrap(); - - let pubkey = handle_interaction( - trezor - .get_public_key( - &DerivationPath::from_str("m/44h/1h/0h/0/0").unwrap(), - trezor_client::protos::InputScriptType::SPENDADDRESS, - Network::Testnet, - true, - ) - .unwrap(), - ) - .unwrap(); - let addr = Address::p2pkh(&pubkey.to_pub(), Network::Testnet); - println!("address: {}", addr); - - let (addr, signature) = handle_interaction( - trezor - .sign_message( - "regel het".to_owned(), - &DerivationPath::from_str("m/44h/1h/0h/0/0").unwrap(), - InputScriptType::SPENDADDRESS, - Network::Testnet, - ) - .unwrap(), - ) - .unwrap(); - println!("Addr from device: {}", addr); - println!("Signature: {:?}", signature); -} diff --git a/wallet/trezor-client/examples/sign_tx.rs b/wallet/trezor-client/examples/sign_tx.rs deleted file mode 100644 index 69aa3ed3e7..0000000000 --- a/wallet/trezor-client/examples/sign_tx.rs +++ /dev/null @@ -1,119 +0,0 @@ -use std::io::{self, Write}; - -use bitcoin::{ - bip32, blockdata::script::Builder, consensus::encode::Decodable, network::Network, psbt, - transaction::Version, Address, Amount, Sequence, Transaction, TxIn, TxOut, -}; - -use trezor_client::{Error, SignTxProgress, TrezorMessage, TrezorResponse}; - -fn handle_interaction(resp: TrezorResponse) -> T { - match resp { - TrezorResponse::Ok(res) => res, - // assering ok() returns the failure error - TrezorResponse::Failure(_) => resp.ok().unwrap(), - TrezorResponse::ButtonRequest(req) => handle_interaction(req.ack().unwrap()), - TrezorResponse::PinMatrixRequest(req) => { - println!("Enter PIN"); - let mut pin = String::new(); - if io::stdin().read_line(&mut pin).unwrap() != 5 { - println!("must enter pin, received: {}", pin); - } - // trim newline - handle_interaction(req.ack_pin(pin[..4].to_owned()).unwrap()) - } - TrezorResponse::PassphraseRequest(req) => { - println!("Enter passphrase"); - let mut pass = String::new(); - io::stdin().read_line(&mut pass).unwrap(); - // trim newline - handle_interaction(req.ack_passphrase(pass[..pass.len() - 1].to_owned()).unwrap()) - } - } -} - -fn tx_progress( - psbt: &mut psbt::Psbt, - progress: SignTxProgress, - raw_tx: &mut Vec, -) -> Result<(), Error> { - if let Some(part) = progress.get_serialized_tx_part() { - raw_tx.write_all(part).unwrap(); - } - - if !progress.finished() { - let progress = handle_interaction(progress.ack_psbt(psbt, Network::Testnet).unwrap()); - tx_progress(psbt, progress, raw_tx) - } else { - Ok(()) - } -} - -fn main() { - tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); - - // init with debugging - let mut trezor = trezor_client::unique(false).unwrap(); - trezor.init_device(None).unwrap(); - - let pubkey = handle_interaction( - trezor - .get_public_key( - &vec![ - bip32::ChildNumber::from_hardened_idx(0).unwrap(), - bip32::ChildNumber::from_hardened_idx(0).unwrap(), - bip32::ChildNumber::from_hardened_idx(1).unwrap(), - ] - .into(), - trezor_client::protos::InputScriptType::SPENDADDRESS, - Network::Testnet, - true, - ) - .unwrap(), - ); - let addr = Address::p2pkh(&pubkey.to_pub(), Network::Testnet); - println!("address: {}", addr); - - let mut psbt = psbt::Psbt { - unsigned_tx: Transaction { - version: Version::ONE, - lock_time: bitcoin::absolute::LockTime::from_consensus(0), - input: vec![TxIn { - previous_output: "c5bdb27907b78ce03f94e4bf2e94f7a39697b9074b79470019e3dbc76a10ecb6:0".parse().unwrap(), - sequence: Sequence(0xffffffff), - script_sig: Builder::new().into_script(), - witness: Default::default(), - }], - output: vec![TxOut { - value: Amount::from_sat(14245301), - script_pubkey: addr.script_pubkey(), - }], - }, - inputs: vec![psbt::Input { - non_witness_utxo: Some(Transaction::consensus_decode(&mut &hex::decode("020000000001011eb5a3e65946f88b00d67b321e5fd980b32a2316fb1fc9b712baa6a1033a04e30100000017160014f0f81ee77d552b4c81497451d1abf5c22ce8e352feffffff02b55dd900000000001976a9142c3cf5686f47c1de9cc90b4255cc2a1ef8c01b3188acfb0391ae6800000017a914a3a79e37ad366d9bf9471b28a9a8f64b50de0c968702483045022100c0aa7b262967fc2803c8a9f38f26682edba7cafb7d4870ebdc116040ad5338b502205dfebd08e993af2e6aa3118a438ad70ed9f6e09bc6abfd21f8f2957af936bc070121031f4e69fcf110bb31f019321834c0948b5487f2782489f370f66dc20f7ac767ca8bf81500").unwrap()[..]).unwrap()), - ..Default::default() - }], - outputs: vec![ - psbt::Output { - ..Default::default() - }, - ], - proprietary: Default::default(), - unknown: Default::default(), - version: 0, - xpub: Default::default(), - }; - - println!("psbt before: {:?}", psbt); - println!("unsigned txid: {}", psbt.unsigned_tx.txid()); - println!( - "unsigned tx: {}", - hex::encode(bitcoin::consensus::encode::serialize(&psbt.unsigned_tx)) - ); - - let mut raw_tx = Vec::new(); - let progress = handle_interaction(trezor.sign_tx(&psbt, Network::Testnet).unwrap()); - tx_progress(&mut psbt, progress, &mut raw_tx).unwrap(); - - println!("signed tx: {}", hex::encode(raw_tx)); -} diff --git a/wallet/trezor-client/examples/solana.rs b/wallet/trezor-client/examples/solana.rs deleted file mode 100644 index 9f943c082b..0000000000 --- a/wallet/trezor-client/examples/solana.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::str::FromStr; - -use bitcoin::bip32::DerivationPath; -use trezor_client::utils::convert_path; - -fn do_main() -> Result<(), trezor_client::Error> { - let mut trezor = trezor_client::unique(false)?; - trezor.init_device(None)?; - let path = DerivationPath::from_str("m/44'/501'/0'/0'").expect("Hardended Derivation Path"); - let solana_address = trezor.solana_get_address(convert_path(&path))?; - println!("solana address: {:?}", solana_address); - Ok(()) -} - -fn main() { - do_main().unwrap() -} diff --git a/wallet/types/src/seed_phrase.rs b/wallet/types/src/seed_phrase.rs index e4aa6a5f8b..d5078917b8 100644 --- a/wallet/types/src/seed_phrase.rs +++ b/wallet/types/src/seed_phrase.rs @@ -17,6 +17,7 @@ use serialization::{Decode, Encode}; pub const MNEMONIC_24_WORDS_ENTROPY_SIZE: usize = 32; +#[derive(Clone, Copy, Debug)] pub enum StoreSeedPhrase { Store, DoNotStore, diff --git a/wallet/wallet-cli-lib/src/cli_event_loop.rs b/wallet/wallet-cli-lib/src/cli_event_loop.rs index e994f70741..a18ac644d9 100644 --- a/wallet/wallet-cli-lib/src/cli_event_loop.rs +++ b/wallet/wallet-cli-lib/src/cli_event_loop.rs @@ -17,7 +17,6 @@ use std::{fmt::Debug, sync::Arc}; use common::chain::ChainConfig; use tokio::sync::{mpsc, oneshot}; -use wallet::signer::software_signer::SoftwareSignerProvider; use wallet_cli_commands::{CommandHandler, ConsoleCommand, ManageableWalletCommand}; use wallet_rpc_client::{handles_client::WalletRpcHandlesClient, rpc_client::ClientWalletRpc}; use wallet_rpc_lib::types::{ControllerConfig, NodeInterface}; @@ -59,28 +58,16 @@ pub async fn run( node_rpc, wallet_rpc_config, } => { - let signer_provider = SoftwareSignerProvider::new(); - let wallet_service = WalletService::start( - chain_config.clone(), - None, - false, - vec![], - node_rpc, - signer_provider.clone(), - ) - .await - .map_err(|err| WalletCliError::InvalidConfig(err.to_string()))?; + let wallet_service = + WalletService::start(chain_config.clone(), None, false, vec![], node_rpc) + .await + .map_err(|err| WalletCliError::InvalidConfig(err.to_string()))?; let wallet_handle = wallet_service.handle(); let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); - let wallet_rpc = WalletRpc::new( - wallet_handle, - node_rpc.clone(), - chain_config.clone(), - signer_provider, - ); + let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); let server_rpc = if let Some(rpc_config) = wallet_rpc_config { let builder = rpc::Builder::new(rpc_config.bind_addr, rpc_config.auth_credentials) .with_method_list("list_methods") diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 4af320c874..7dad829abe 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -85,7 +85,7 @@ use wallet::{ TransactionToSign, }, destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, - signer::SignerProvider, + signer::software_signer::SoftwareSignerProvider, wallet::WalletPoolsFilter, wallet_events::WalletEvents, Wallet, WalletError, WalletResult, @@ -157,42 +157,43 @@ pub struct ControllerConfig { pub broadcast_to_mempool: bool, } -pub struct Controller { +pub enum WalletType2 { + Software(Wallet), + Trezor(Wallet), +} + +pub struct Controller { chain_config: Arc, rpc_client: T, - wallet: Wallet, + wallet: WalletType2, staking_started: BTreeSet, wallet_events: W, } -impl std::fmt::Debug - for Controller -{ +impl std::fmt::Debug for Controller { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Controller").finish() } } -pub type RpcController = Controller; -pub type HandlesController = - Controller; -pub type ColdController = - Controller; +pub type RpcController = Controller; +pub type HandlesController = + Controller; +pub type ColdController = Controller; -impl Controller +impl Controller where T: NodeInterface + Clone + Send + Sync + 'static, W: WalletEvents, - P: SignerProvider, { pub async fn new( chain_config: Arc, rpc_client: T, - wallet: Wallet, + wallet: WalletType2, wallet_events: W, ) -> Result> { let mut controller = Self { @@ -212,7 +213,7 @@ where pub fn new_unsynced( chain_config: Arc, rpc_client: T, - wallet: Wallet, + wallet: WalletType2, wallet_events: W, ) -> Self { Self { @@ -233,8 +234,7 @@ where whether_to_store_seed_phrase: StoreSeedPhrase, best_block: (BlockHeight, Id), wallet_type: WalletType, - signer_provider: P, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { utils::ensure!( !file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -248,16 +248,22 @@ where let wallet = wallet::Wallet::create_new_wallet( Arc::clone(&chain_config), db, - &mnemonic.to_string(), - passphrase, - whether_to_store_seed_phrase, best_block, wallet_type, - signer_provider, + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + &mnemonic.to_string(), + passphrase, + whether_to_store_seed_phrase, + )?) + }, ) .map_err(ControllerError::WalletError)?; - Ok(wallet) + //TODO: add support for hardware wallet creation + Ok(WalletType2::Software(wallet)) } pub fn recover_wallet( @@ -267,8 +273,7 @@ where passphrase: Option<&str>, whether_to_store_seed_phrase: StoreSeedPhrase, wallet_type: WalletType, - signer_provider: P, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { utils::ensure!( !file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -279,18 +284,20 @@ where let db = wallet::wallet::open_or_create_wallet_file(file_path) .map_err(ControllerError::WalletError)?; - let wallet = wallet::Wallet::recover_wallet( - Arc::clone(&chain_config), - db, - &mnemonic.to_string(), - passphrase, - whether_to_store_seed_phrase, - wallet_type, - signer_provider, - ) - .map_err(ControllerError::WalletError)?; + let wallet = + wallet::Wallet::recover_wallet(Arc::clone(&chain_config), db, wallet_type, |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + &mnemonic.to_string(), + passphrase, + whether_to_store_seed_phrase, + )?) + }) + .map_err(ControllerError::WalletError)?; - Ok(wallet) + //TODO: add support for hardware wallet creation + Ok(WalletType2::Software(wallet)) } fn make_backup_wallet_file(file_path: impl AsRef, version: u32) -> WalletResult<()> { @@ -326,8 +333,7 @@ where password: Option, wallet_type: WalletType, force_change_wallet_type: bool, - signer_provider: P, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { utils::ensure!( file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -346,32 +352,45 @@ where |version| Self::make_backup_wallet_file(file_path.as_ref(), version), wallet_type, force_change_wallet_type, - signer_provider, + |db_tx| { + Ok(SoftwareSignerProvider::load_from_database( + chain_config.clone(), + db_tx, + )?) + }, ) .map_err(ControllerError::WalletError)?; - Ok(wallet) + Ok(WalletType2::Software(wallet)) } pub fn seed_phrase(&self) -> Result, ControllerError> { - self.wallet - .seed_phrase() - .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.seed_phrase(), + WalletType2::Trezor(w) => w.seed_phrase(), + } + .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) + .map_err(ControllerError::WalletError) } /// Delete the seed phrase if stored in the database pub fn delete_seed_phrase(&self) -> Result, ControllerError> { - self.wallet - .delete_seed_phrase() - .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.delete_seed_phrase(), + WalletType2::Trezor(w) => w.delete_seed_phrase(), + } + .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) + .map_err(ControllerError::WalletError) } /// Rescan the blockchain /// Resets the wallet to the genesis block pub fn reset_wallet_to_genesis(&mut self) -> Result<(), ControllerError> { - self.wallet.reset_wallet_to_genesis().map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.reset_wallet_to_genesis(), + WalletType2::Trezor(w) => w.reset_wallet_to_genesis(), + } + .map_err(ControllerError::WalletError) } /// Encrypts the wallet using the specified `password`, or removes the existing encryption if `password` is `None`. @@ -384,7 +403,11 @@ where /// /// This method returns an error if the wallet is locked pub fn encrypt_wallet(&mut self, password: &Option) -> Result<(), ControllerError> { - self.wallet.encrypt_wallet(password).map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.encrypt_wallet(password), + WalletType2::Trezor(w) => w.encrypt_wallet(password), + } + .map_err(ControllerError::WalletError) } /// Unlocks the wallet using the specified password. @@ -397,7 +420,11 @@ where /// /// This method returns an error if the password is incorrect pub fn unlock_wallet(&mut self, password: &String) -> Result<(), ControllerError> { - self.wallet.unlock_wallet(password).map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.unlock_wallet(password), + WalletType2::Trezor(w) => w.unlock_wallet(password), + } + .map_err(ControllerError::WalletError) } /// Locks the wallet by making the encrypted private keys inaccessible. @@ -410,7 +437,11 @@ where self.staking_started.is_empty(), ControllerError::StakingRunning ); - self.wallet.lock_wallet().map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.lock_wallet(), + WalletType2::Trezor(w) => w.lock_wallet(), + } + .map_err(ControllerError::WalletError) } /// Sets the lookahead size for key generation @@ -425,13 +456,18 @@ where ) -> Result<(), ControllerError> { utils::ensure!(lookahead_size > 0, ControllerError::InvalidLookaheadSize); - self.wallet - .set_lookahead_size(lookahead_size, force_reduce) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.set_lookahead_size(lookahead_size, force_reduce), + WalletType2::Trezor(w) => w.set_lookahead_size(lookahead_size, force_reduce), + } + .map_err(ControllerError::WalletError) } pub fn wallet_info(&self) -> WalletInfo { - let (wallet_id, account_names) = self.wallet.wallet_info(); + let (wallet_id, account_names) = match &self.wallet { + WalletType2::Software(w) => w.wallet_info(), + WalletType2::Trezor(w) => w.wallet_info(), + }; WalletInfo { wallet_id, account_names, @@ -473,10 +509,11 @@ where transaction_ids: Vec>, packing_strategy: PackingStrategy, ) -> Result> { - let pos_data = self - .wallet - .get_pos_gen_block_data(account_index, pool_id) - .map_err(ControllerError::WalletError)?; + let pos_data = match &self.wallet { + WalletType2::Software(w) => w.get_pos_gen_block_data(account_index, pool_id), + WalletType2::Trezor(w) => w.get_pos_gen_block_data(account_index, pool_id), + } + .map_err(ControllerError::WalletError)?; let public_key = self .rpc_client @@ -513,10 +550,11 @@ where transaction_ids: Vec>, packing_strategy: PackingStrategy, ) -> Result> { - let pools = self - .wallet - .get_pool_ids(account_index, WalletPoolsFilter::Stake) - .map_err(ControllerError::WalletError)?; + let pools = match &self.wallet { + WalletType2::Software(w) => w.get_pool_ids(account_index, WalletPoolsFilter::Stake), + WalletType2::Trezor(w) => w.get_pool_ids(account_index, WalletPoolsFilter::Stake), + } + .map_err(ControllerError::WalletError)?; let mut last_error = ControllerError::NoStakingPool; for (pool_id, _) in pools { @@ -582,10 +620,11 @@ where seconds_to_check_for_height: u64, check_all_timestamps_between_blocks: bool, ) -> Result>, ControllerError> { - let pos_data = self - .wallet - .get_pos_gen_block_data_by_pool_id(pool_id) - .map_err(ControllerError::WalletError)?; + let pos_data = match &self.wallet { + WalletType2::Software(w) => w.get_pos_gen_block_data_by_pool_id(pool_id), + WalletType2::Trezor(w) => w.get_pos_gen_block_data_by_pool_id(pool_id), + } + .map_err(ControllerError::WalletError)?; let input_data = PoSTimestampSearchInputData::new(pool_id, pos_data.vrf_private_key().clone()); @@ -611,7 +650,11 @@ where &mut self, name: Option, ) -> Result<(U31, Option), ControllerError> { - self.wallet.create_next_account(name).map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.create_next_account(name), + WalletType2::Trezor(w) => w.create_next_account(name), + } + .map_err(ControllerError::WalletError) } pub fn update_account_name( @@ -619,9 +662,11 @@ where account_index: U31, name: Option, ) -> Result<(U31, Option), ControllerError> { - self.wallet - .set_account_name(account_index, name) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.set_account_name(account_index, name), + WalletType2::Trezor(w) => w.set_account_name(account_index, name), + } + .map_err(ControllerError::WalletError) } pub fn stop_staking(&mut self, account_index: U31) -> Result<(), ControllerError> { @@ -635,27 +680,34 @@ where } pub fn best_block(&self) -> (Id, BlockHeight) { - *self - .wallet - .get_best_block() - .values() - .min_by_key(|(_block_id, block_height)| block_height) - .expect("there must be at least one account") + *match &self.wallet { + WalletType2::Software(w) => w.get_best_block(), + WalletType2::Trezor(w) => w.get_best_block(), + } + .values() + .min_by_key(|(_block_id, block_height)| block_height) + .expect("there must be at least one account") } pub async fn get_stake_pool_balances( &self, account_index: U31, ) -> Result, ControllerError> { - let stake_pool_utxos = self - .wallet - .get_utxos( + let stake_pool_utxos = match &self.wallet { + WalletType2::Software(w) => w.get_utxos( account_index, UtxoType::CreateStakePool | UtxoType::ProduceBlockFromStake, UtxoState::Confirmed.into(), WithLocked::Unlocked, - ) - .map_err(ControllerError::WalletError)?; + ), + WalletType2::Trezor(w) => w.get_utxos( + account_index, + UtxoType::CreateStakePool | UtxoType::ProduceBlockFromStake, + UtxoState::Confirmed.into(), + WithLocked::Unlocked, + ), + } + .map_err(ControllerError::WalletError)?; let pool_ids = stake_pool_utxos.into_iter().filter_map(|(_, utxo, _)| match utxo { TxOutput::ProduceBlockFromStake(_, pool_id) | TxOutput::CreateStakePool(pool_id, _) => { Some(pool_id) @@ -687,13 +739,14 @@ where /// Synchronize the wallet to the current node tip height and return pub async fn sync_once(&mut self) -> Result<(), ControllerError> { - let res = sync::sync_once( - &self.chain_config, - &self.rpc_client, - &mut self.wallet, - &self.wallet_events, - ) - .await?; + let res = match &mut self.wallet { + WalletType2::Software(w) => { + sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events).await + } + WalletType2::Trezor(w) => { + sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events).await + } + }?; match res { InSync::Synced => Ok(()), @@ -702,12 +755,14 @@ where } pub async fn try_sync_once(&mut self) -> Result<(), ControllerError> { - sync::sync_once( - &self.chain_config, - &self.rpc_client, - &mut self.wallet, - &self.wallet_events, - ) + match &mut self.wallet { + WalletType2::Software(w) => { + sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events) + } + WalletType2::Trezor(w) => { + sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events) + } + } .await?; Ok(()) @@ -717,7 +772,7 @@ where &mut self, account_index: U31, config: ControllerConfig, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { self.sync_once().await?; Ok(SyncedController::new( &mut self.wallet, @@ -733,7 +788,7 @@ where pub fn readonly_controller( &self, account_index: U31, - ) -> ReadOnlyController<'_, T, DefaultBackend, P> { + ) -> ReadOnlyController<'_, T, DefaultBackend> { ReadOnlyController::new( &self.wallet, self.rpc_client.clone(), @@ -1066,7 +1121,10 @@ where async fn fetch_utxo(&self, input: &UtxoOutPoint) -> Result> { // search locally for the unspent utxo - if let Some(out) = self.wallet.find_unspent_utxo_with_destination(input) { + if let Some(out) = match &self.wallet { + WalletType2::Software(w) => w.find_unspent_utxo_with_destination(input), + WalletType2::Trezor(w) => w.find_unspent_utxo_with_destination(input), + } { return Ok(out.0); } @@ -1141,7 +1199,10 @@ where /// Rebroadcast not confirmed transactions async fn rebroadcast_txs(&mut self, rebroadcast_txs_again_at: &mut Time) { if get_time() >= *rebroadcast_txs_again_at { - let txs = self.wallet.get_transactions_to_be_broadcast(); + let txs = match &self.wallet { + WalletType2::Software(w) => w.get_transactions_to_be_broadcast(), + WalletType2::Trezor(w) => w.get_transactions_to_be_broadcast(), + }; match txs { Err(error) => { log::error!("Fetching transactions for rebroadcasting failed: {error}"); diff --git a/wallet/wallet-controller/src/read.rs b/wallet/wallet-controller/src/read.rs index 837dfb7890..c37d61082b 100644 --- a/wallet/wallet-controller/src/read.rs +++ b/wallet/wallet-controller/src/read.rs @@ -30,10 +30,11 @@ use futures::{stream::FuturesUnordered, FutureExt, TryStreamExt}; use node_comm::node_traits::NodeInterface; use utils::tap_log::TapLog; use wallet::{ - account::{transaction_list::TransactionList, DelegationData, PoolData, TxInfo}, - signer::SignerProvider, + account::{ + currency_grouper::Currency, transaction_list::TransactionList, DelegationData, PoolData, + TxInfo, + }, wallet::WalletPoolsFilter, - Wallet, }; use wallet_types::{ account_info::StandaloneAddresses, @@ -45,11 +46,11 @@ use wallet_types::{ use crate::{ types::{AccountStandaloneKeyDetails, Balances, CreatedBlockInfo}, - ControllerError, + ControllerError, WalletType2, }; -pub struct ReadOnlyController<'a, T, B: storage::Backend + 'static, P> { - wallet: &'a Wallet, +pub struct ReadOnlyController<'a, T, B: storage::Backend + 'static> { + wallet: &'a WalletType2, rpc_client: T, chain_config: &'a ChainConfig, account_index: U31, @@ -58,14 +59,13 @@ pub struct ReadOnlyController<'a, T, B: storage::Backend + 'static, P> { /// A Map between the derived child number and the Address with whether it is marked as used or not type MapAddressWithUsage = BTreeMap, bool)>; -impl<'a, T, B, P> ReadOnlyController<'a, T, B, P> +impl<'a, T, B> ReadOnlyController<'a, T, B> where T: NodeInterface, B: storage::Backend + 'static, - P: SignerProvider, { pub fn new( - wallet: &'a Wallet, + wallet: &'a WalletType2, rpc_client: T, chain_config: &'a ChainConfig, account_index: U31, @@ -87,9 +87,11 @@ where utxo_states: UtxoStates, with_locked: WithLocked, ) -> Result, ControllerError> { - self.wallet - .get_balance(self.account_index, utxo_states, with_locked) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_balance(self.account_index, utxo_states, with_locked), + WalletType2::Trezor(w) => w.get_balance(self.account_index, utxo_states, with_locked), + } + .map_err(ControllerError::WalletError) } pub async fn get_decimal_balance( @@ -107,12 +109,16 @@ where utxo_states: UtxoStates, with_locked: WithLocked, ) -> Result, ControllerError> { - self.wallet - .get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) - .map(|utxos| { - utxos.into_iter().map(|(outpoint, output, _)| (outpoint, output)).collect() - }) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => { + w.get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) + } + WalletType2::Trezor(w) => { + w.get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) + } + } + .map(|utxos| utxos.into_iter().map(|(outpoint, output, _)| (outpoint, output)).collect()) + .map_err(ControllerError::WalletError) } pub fn get_utxos( @@ -121,18 +127,24 @@ where utxo_states: UtxoStates, with_locked: WithLocked, ) -> Result, ControllerError> { - self.wallet - .get_utxos(self.account_index, utxo_types, utxo_states, with_locked) - .map(|utxos| { - utxos.into_iter().map(|(outpoint, output, _)| (outpoint, output)).collect() - }) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => { + w.get_utxos(self.account_index, utxo_types, utxo_states, with_locked) + } + WalletType2::Trezor(w) => { + w.get_utxos(self.account_index, utxo_types, utxo_states, with_locked) + } + } + .map(|utxos| utxos.into_iter().map(|(outpoint, output, _)| (outpoint, output)).collect()) + .map_err(ControllerError::WalletError) } pub fn pending_transactions(&self) -> Result>, ControllerError> { - self.wallet - .pending_transactions(self.account_index) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.pending_transactions(self.account_index), + WalletType2::Trezor(w) => w.pending_transactions(self.account_index), + } + .map_err(ControllerError::WalletError) } pub fn mainchain_transactions( @@ -140,9 +152,15 @@ where destination: Option, limit: usize, ) -> Result, ControllerError> { - self.wallet - .mainchain_transactions(self.account_index, destination, limit) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => { + w.mainchain_transactions(self.account_index, destination, limit) + } + WalletType2::Trezor(w) => { + w.mainchain_transactions(self.account_index, destination, limit) + } + } + .map_err(ControllerError::WalletError) } pub fn get_transaction_list( @@ -150,46 +168,58 @@ where skip: usize, count: usize, ) -> Result> { - self.wallet - .get_transaction_list(self.account_index, skip, count) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_transaction_list(self.account_index, skip, count), + WalletType2::Trezor(w) => w.get_transaction_list(self.account_index, skip, count), + } + .map_err(ControllerError::WalletError) } pub fn get_transaction( &self, transaction_id: Id, ) -> Result<&TxData, ControllerError> { - self.wallet - .get_transaction(self.account_index, transaction_id) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_transaction(self.account_index, transaction_id), + WalletType2::Trezor(w) => w.get_transaction(self.account_index, transaction_id), + } + .map_err(ControllerError::WalletError) } pub fn get_all_issued_addresses( &self, ) -> Result>, ControllerError> { - self.wallet - .get_all_issued_addresses(self.account_index) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_all_issued_addresses(self.account_index), + WalletType2::Trezor(w) => w.get_all_issued_addresses(self.account_index), + } + .map_err(ControllerError::WalletError) } pub fn get_all_issued_vrf_public_keys( &self, ) -> Result, ControllerError> { - self.wallet - .get_all_issued_vrf_public_keys(self.account_index) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_all_issued_vrf_public_keys(self.account_index), + WalletType2::Trezor(w) => w.get_all_issued_vrf_public_keys(self.account_index), + } + .map_err(ControllerError::WalletError) } pub fn get_legacy_vrf_public_key(&self) -> Result, ControllerError> { - self.wallet - .get_legacy_vrf_public_key(self.account_index) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_legacy_vrf_public_key(self.account_index), + WalletType2::Trezor(w) => w.get_legacy_vrf_public_key(self.account_index), + } + .map_err(ControllerError::WalletError) } pub fn get_addresses_usage(&self) -> Result<&'a KeychainUsageState, ControllerError> { - self.wallet - .get_addresses_usage(self.account_index) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_addresses_usage(self.account_index), + WalletType2::Trezor(w) => w.get_addresses_usage(self.account_index), + } + .map_err(ControllerError::WalletError) } /// Get all addresses with usage information @@ -214,9 +244,11 @@ where /// Get all standalone addresses with their labels pub fn get_standalone_addresses(&self) -> Result> { - self.wallet - .get_all_standalone_addresses(self.account_index) - .map_err(ControllerError::WalletError) + match &self.wallet { + WalletType2::Software(w) => w.get_all_standalone_addresses(self.account_index), + WalletType2::Trezor(w) => w.get_all_standalone_addresses(self.account_index), + } + .map_err(ControllerError::WalletError) } /// Get all standalone addresses with their labels and balances @@ -224,10 +256,15 @@ where &self, address: Destination, ) -> Result> { - let (address, balances, details) = self - .wallet - .get_all_standalone_address_details(self.account_index, address) - .map_err(ControllerError::WalletError)?; + let (address, balances, details) = match &self.wallet { + WalletType2::Software(w) => { + w.get_all_standalone_address_details(self.account_index, address) + } + WalletType2::Trezor(w) => { + w.get_all_standalone_address_details(self.account_index, address) + } + } + .map_err(ControllerError::WalletError)?; let balances = super::into_balances(&self.rpc_client, self.chain_config, balances).await?; @@ -267,10 +304,11 @@ where &self, filter: WalletPoolsFilter, ) -> Result, ControllerError> { - let pools = self - .wallet - .get_pool_ids(self.account_index, filter) - .map_err(ControllerError::WalletError)?; + let pools = match &self.wallet { + WalletType2::Software(w) => w.get_pool_ids(self.account_index, filter), + WalletType2::Trezor(w) => w.get_pool_ids(self.account_index, filter), + } + .map_err(ControllerError::WalletError)?; let tasks: FuturesUnordered<_> = pools .into_iter() @@ -315,10 +353,11 @@ where pub async fn get_delegations( &self, ) -> Result, ControllerError> { - let delegations = self - .wallet - .get_delegations(self.account_index) - .map_err(ControllerError::WalletError)?; + let delegations = match &self.wallet { + WalletType2::Software(w) => w.get_delegations(self.account_index), + WalletType2::Trezor(w) => w.get_delegations(self.account_index), + } + .map_err(ControllerError::WalletError)?; let tasks: FuturesUnordered<_> = delegations .into_iter() @@ -338,24 +377,25 @@ where } pub fn get_created_blocks(&self) -> Result, ControllerError> { - self.wallet - .get_created_blocks(self.account_index) - .map_err(ControllerError::WalletError) - .map(|blocks| { - blocks - .into_iter() - .map(|(height, id, pool_id)| { - let pool_id = - Address::new(self.chain_config, pool_id).expect("addressable"); - - CreatedBlockInfo { - height, - id, - pool_id: pool_id.to_string(), - } - }) - .collect() - }) + match &self.wallet { + WalletType2::Software(w) => w.get_created_blocks(self.account_index), + WalletType2::Trezor(w) => w.get_created_blocks(self.account_index), + } + .map_err(ControllerError::WalletError) + .map(|blocks| { + blocks + .into_iter() + .map(|(height, id, pool_id)| { + let pool_id = Address::new(self.chain_config, pool_id).expect("addressable"); + + CreatedBlockInfo { + height, + id, + pool_id: pool_id.to_string(), + } + }) + .collect() + }) } async fn get_delegation_share( diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 14956e42d3..dd980eb189 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -51,10 +51,9 @@ use wallet::{ make_address_output, make_address_output_token, make_create_delegation_output, make_data_deposit_output, SelectedInputs, StakePoolDataArguments, }, - signer::SignerProvider, wallet::WalletPoolsFilter, wallet_events::WalletEvents, - Wallet, WalletError, WalletResult, + WalletError, WalletResult, }; use wallet_types::{ signature_status::SignatureStatus, @@ -66,11 +65,11 @@ use wallet_types::{ use crate::{ into_balances, types::{Balances, GenericCurrencyTransfer}, - ControllerConfig, ControllerError, + ControllerConfig, ControllerError, WalletType2, }; -pub struct SyncedController<'a, T, W, B: storage::Backend + 'static, P> { - wallet: &'a mut Wallet, +pub struct SyncedController<'a, T, W, B: storage::Backend + 'static> { + wallet: &'a mut WalletType2, rpc_client: T, chain_config: &'a ChainConfig, wallet_events: &'a W, @@ -79,15 +78,14 @@ pub struct SyncedController<'a, T, W, B: storage::Backend + 'static, P> { config: ControllerConfig, } -impl<'a, T, W, B, P> SyncedController<'a, T, W, B, P> +impl<'a, T, W, B> SyncedController<'a, T, W, B> where B: storage::Backend + 'static, - P: SignerProvider, T: NodeInterface, W: WalletEvents, { pub fn new( - wallet: &'a mut Wallet, + wallet: &'a mut WalletType2, rpc_client: T, chain_config: &'a ChainConfig, wallet_events: &'a W, @@ -133,10 +131,11 @@ where &self, input_utxos: &[UtxoOutPoint], ) -> Result<(), ControllerError> { - let token_ids = self - .wallet - .find_used_tokens(self.account_index, input_utxos) - .map_err(ControllerError::WalletError)?; + let token_ids = match &self.wallet { + WalletType2::Software(w) => w.find_used_tokens(self.account_index, input_utxos), + WalletType2::Trezor(w) => w.find_used_tokens(self.account_index, input_utxos), + } + .map_err(ControllerError::WalletError)?; for token_info in self.fetch_token_infos(token_ids).await? { match token_info { @@ -153,11 +152,15 @@ where &self, token_info: &RPCFungibleTokenInfo, ) -> Result<(), ControllerError> { - self.wallet - .get_token_unconfirmed_info(self.account_index, token_info) - .map_err(ControllerError::WalletError)? - .check_can_be_used() - .map_err(ControllerError::WalletError)?; + match &self.wallet { + WalletType2::Software(w) => { + w.get_token_unconfirmed_info(self.account_index, token_info) + } + WalletType2::Trezor(w) => w.get_token_unconfirmed_info(self.account_index, token_info), + } + .map_err(ControllerError::WalletError)? + .check_can_be_used() + .map_err(ControllerError::WalletError)?; Ok(()) } @@ -173,12 +176,17 @@ where let token_info = self.get_token_info(token_id).await?; let ok_to_use = match token_info { - RPCTokenInfo::FungibleToken(token_info) => self - .wallet - .get_token_unconfirmed_info(self.account_index, &token_info) - .map_err(ControllerError::WalletError)? - .check_can_be_used() - .is_ok(), + RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { + WalletType2::Software(w) => { + w.get_token_unconfirmed_info(self.account_index, &token_info) + } + WalletType2::Trezor(w) => { + w.get_token_unconfirmed_info(self.account_index, &token_info) + } + } + .map_err(ControllerError::WalletError)? + .check_can_be_used() + .is_ok(), RPCTokenInfo::NonFungibleToken(_) => true, }; if ok_to_use { @@ -195,9 +203,11 @@ where &mut self, tx_id: Id, ) -> Result<(), ControllerError> { - self.wallet - .abandon_transaction(self.account_index, tx_id) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.abandon_transaction(self.account_index, tx_id), + WalletType2::Trezor(w) => w.abandon_transaction(self.account_index, tx_id), + } + .map_err(ControllerError::WalletError) } pub fn standalone_address_label_rename( @@ -205,9 +215,15 @@ where address: Destination, label: Option, ) -> Result<(), ControllerError> { - self.wallet - .standalone_address_label_rename(self.account_index, address, label) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => { + w.standalone_address_label_rename(self.account_index, address, label) + } + WalletType2::Trezor(w) => { + w.standalone_address_label_rename(self.account_index, address, label) + } + } + .map_err(ControllerError::WalletError) } pub fn add_standalone_address( @@ -215,9 +231,13 @@ where address: PublicKeyHash, label: Option, ) -> Result<(), ControllerError> { - self.wallet - .add_standalone_address(self.account_index, address, label) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => { + w.add_standalone_address(self.account_index, address, label) + } + WalletType2::Trezor(w) => w.add_standalone_address(self.account_index, address, label), + } + .map_err(ControllerError::WalletError) } pub fn add_standalone_private_key( @@ -225,9 +245,15 @@ where private_key: PrivateKey, label: Option, ) -> Result<(), ControllerError> { - self.wallet - .add_standalone_private_key(self.account_index, private_key, label) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => { + w.add_standalone_private_key(self.account_index, private_key, label) + } + WalletType2::Trezor(w) => { + w.add_standalone_private_key(self.account_index, private_key, label) + } + } + .map_err(ControllerError::WalletError) } pub fn add_standalone_multisig( @@ -235,34 +261,46 @@ where challenge: ClassicMultisigChallenge, label: Option, ) -> Result> { - self.wallet - .add_standalone_multisig(self.account_index, challenge, label) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => { + w.add_standalone_multisig(self.account_index, challenge, label) + } + WalletType2::Trezor(w) => { + w.add_standalone_multisig(self.account_index, challenge, label) + } + } + .map_err(ControllerError::WalletError) } pub fn new_address( &mut self, ) -> Result<(ChildNumber, Address), ControllerError> { - self.wallet - .get_new_address(self.account_index) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.get_new_address(self.account_index), + WalletType2::Trezor(w) => w.get_new_address(self.account_index), + } + .map_err(ControllerError::WalletError) } pub fn find_public_key( &mut self, address: Destination, ) -> Result> { - self.wallet - .find_public_key(self.account_index, address) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.find_public_key(self.account_index, address), + WalletType2::Trezor(w) => w.find_public_key(self.account_index, address), + } + .map_err(ControllerError::WalletError) } pub fn new_vrf_key( &mut self, ) -> Result<(ChildNumber, Address), ControllerError> { - self.wallet - .get_vrf_key(self.account_index) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.get_vrf_key(self.account_index), + WalletType2::Trezor(w) => w.get_vrf_key(self.account_index), + } + .map_err(ControllerError::WalletError) } pub async fn issue_new_token( @@ -277,21 +315,36 @@ where self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.issue_new_token( - account_index, - TokenIssuance::V1(TokenIssuanceV1 { - token_ticker, - number_of_decimals, - metadata_uri, - total_supply: token_total_supply, - authority: address.into_object(), - is_freezable, - }), - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.issue_new_token( + account_index, + TokenIssuance::V1(TokenIssuanceV1 { + token_ticker, + number_of_decimals, + metadata_uri, + total_supply: token_total_supply, + authority: address.into_object(), + is_freezable, + }), + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.issue_new_token( + account_index, + TokenIssuance::V1(TokenIssuanceV1 { + token_ticker, + number_of_decimals, + metadata_uri, + total_supply: token_total_supply, + authority: address.into_object(), + is_freezable, + }), + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -305,15 +358,24 @@ where self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.issue_new_nft( - account_index, - address, - metadata, - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.issue_new_nft( + account_index, + address, + metadata, + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.issue_new_nft( + account_index, + address, + metadata, + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -329,18 +391,28 @@ where &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - wallet.mint_tokens( - account_index, - token_info, - amount, - address, - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.mint_tokens( + account_index, + token_info, + amount, + address, + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.mint_tokens( + account_index, + token_info, + amount, + address, + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -354,17 +426,26 @@ where &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - wallet.unmint_tokens( - account_index, - token_info, - amount, - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.unmint_tokens( + account_index, + token_info, + amount, + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.unmint_tokens( + account_index, + token_info, + amount, + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -378,16 +459,24 @@ where &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - wallet.lock_token_supply( - account_index, - token_info, - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.lock_token_supply( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.lock_token_supply( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -404,16 +493,25 @@ where &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { - wallet.freeze_token( - account_index, - token_info, - is_token_unfreezable, - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.freeze_token( + account_index, + token_info, + is_token_unfreezable, + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.freeze_token( + account_index, + token_info, + is_token_unfreezable, + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -428,15 +526,23 @@ where &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { - wallet.unfreeze_token( - account_index, - token_info, - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.unfreeze_token( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.unfreeze_token( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -453,16 +559,25 @@ where &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { - wallet.change_token_authority( - account_index, - token_info, - address, - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.change_token_authority( + account_index, + token_info, + address, + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.change_token_authority( + account_index, + token_info, + address, + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -502,16 +617,26 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_transaction_to_addresses( - account_index, - outputs, - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_transaction_to_addresses( + account_index, + outputs, + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.create_transaction_to_addresses( + account_index, + outputs, + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -533,16 +658,26 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(selected_utxos), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(selected_utxos), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(selected_utxos), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -555,15 +690,21 @@ where destination_address: Destination, from_addresses: BTreeSet, ) -> Result> { - let selected_utxos = self - .wallet - .get_utxos( + let selected_utxos = match &self.wallet { + WalletType2::Software(w) => w.get_utxos( self.account_index, UtxoType::Transfer | UtxoType::LockThenTransfer | UtxoType::IssueNft, UtxoState::Confirmed | UtxoState::Inactive, WithLocked::Unlocked, - ) - .map_err(ControllerError::WalletError)?; + ), + WalletType2::Trezor(w) => w.get_utxos( + self.account_index, + UtxoType::Transfer | UtxoType::LockThenTransfer | UtxoType::IssueNft, + UtxoState::Confirmed | UtxoState::Inactive, + WithLocked::Unlocked, + ), + } + .map_err(ControllerError::WalletError)?; let filtered_inputs = self .filter_out_utxos_with_frozen_tokens(selected_utxos) @@ -578,14 +719,22 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_sweep_transaction( - account_index, - destination_address, - filtered_inputs, - current_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_sweep_transaction( + account_index, + destination_address, + filtered_inputs, + current_fee_rate, + ), + WalletType2::Trezor(w) => w.create_sweep_transaction( + account_index, + destination_address, + filtered_inputs, + current_fee_rate, + ), + } }, ) .await @@ -598,11 +747,12 @@ where destination_address: Address, delegation_id: DelegationId, ) -> Result> { - let pool_id = self - .wallet - .get_delegation(self.account_index, delegation_id) - .map_err(ControllerError::WalletError)? - .pool_id; + let pool_id = match &self.wallet { + WalletType2::Software(w) => w.get_delegation(self.account_index, delegation_id), + WalletType2::Trezor(w) => w.get_delegation(self.account_index, delegation_id), + } + .map_err(ControllerError::WalletError)? + .pool_id; let delegation_share = self .rpc_client @@ -616,15 +766,24 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_sweep_from_delegation_transaction( - account_index, - destination_address, - delegation_id, - delegation_share, - current_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_sweep_from_delegation_transaction( + account_index, + destination_address, + delegation_id, + delegation_share, + current_fee_rate, + ), + WalletType2::Trezor(w) => w.create_sweep_from_delegation_transaction( + account_index, + destination_address, + delegation_id, + delegation_share, + current_fee_rate, + ), + } }, ) .await @@ -663,9 +822,8 @@ where let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; - let (req, fees) = self - .wallet - .create_unsigned_transaction_to_addresses( + let (req, fees) = match &mut self.wallet { + WalletType2::Software(w) => w.create_unsigned_transaction_to_addresses( self.account_index, [output], selected_inputs, @@ -673,8 +831,18 @@ where [(Currency::Coin, change_address)].into(), current_fee_rate, consolidate_fee_rate, - ) - .map_err(ControllerError::WalletError)?; + ), + WalletType2::Trezor(w) => w.create_unsigned_transaction_to_addresses( + self.account_index, + [output], + selected_inputs, + None, + [(Currency::Coin, change_address)].into(), + current_fee_rate, + consolidate_fee_rate, + ), + } + .map_err(ControllerError::WalletError)?; let fees = into_balances(&self.rpc_client, self.chain_config, fees).await?; @@ -745,15 +913,21 @@ where let mut inputs = inputs; let mut change_addresses = change_addresses; - let all_utxos = self - .wallet - .get_utxos( + let all_utxos = match &self.wallet { + WalletType2::Software(w) => w.get_utxos( self.account_index, UtxoType::Transfer | UtxoType::LockThenTransfer, UtxoState::Confirmed | UtxoState::InMempool | UtxoState::Inactive, WithLocked::Unlocked, - ) - .map_err(ControllerError::WalletError)?; + ), + WalletType2::Trezor(w) => w.get_utxos( + self.account_index, + UtxoType::Transfer | UtxoType::LockThenTransfer, + UtxoState::Confirmed | UtxoState::InMempool | UtxoState::Inactive, + WithLocked::Unlocked, + ), + } + .map_err(ControllerError::WalletError)?; let all_coin_utxos = all_utxos .into_iter() @@ -811,9 +985,8 @@ where let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; - let (tx, fees) = self - .wallet - .create_unsigned_transaction_to_addresses( + let (tx, fees) = match &mut self.wallet { + WalletType2::Software(w) => w.create_unsigned_transaction_to_addresses( self.account_index, outputs, selected_inputs, @@ -821,8 +994,18 @@ where change_addresses, current_fee_rate, consolidate_fee_rate, - ) - .map_err(ControllerError::WalletError)?; + ), + WalletType2::Trezor(w) => w.create_unsigned_transaction_to_addresses( + self.account_index, + outputs, + selected_inputs, + Some(CoinSelectionAlgo::Randomize), + change_addresses, + current_fee_rate, + consolidate_fee_rate, + ), + } + .map_err(ControllerError::WalletError)?; let fees = into_balances(&self.rpc_client, self.chain_config, fees).await?; @@ -841,14 +1024,22 @@ where self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_delegation( - account_index, - vec![output], - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_delegation( + account_index, + vec![output], + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.create_delegation( + account_index, + vec![output], + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -865,16 +1056,26 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -888,11 +1089,12 @@ where amount: Amount, delegation_id: DelegationId, ) -> Result> { - let pool_id = self - .wallet - .get_delegation(self.account_index, delegation_id) - .map_err(ControllerError::WalletError)? - .pool_id; + let pool_id = match &self.wallet { + WalletType2::Software(w) => w.get_delegation(self.account_index, delegation_id), + WalletType2::Trezor(w) => w.get_delegation(self.account_index, delegation_id), + } + .map_err(ControllerError::WalletError)? + .pool_id; let delegation_share = self .rpc_client @@ -906,16 +1108,26 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_transaction_to_addresses_from_delegation( - account_index, - address, - amount, - delegation_id, - delegation_share, - current_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_transaction_to_addresses_from_delegation( + account_index, + address, + amount, + delegation_id, + delegation_share, + current_fee_rate, + ), + WalletType2::Trezor(w) => w.create_transaction_to_addresses_from_delegation( + account_index, + address, + amount, + delegation_id, + delegation_share, + current_fee_rate, + ), + } }, ) .await @@ -934,18 +1146,28 @@ where &token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - wallet.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + WalletType2::Trezor(w) => w.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + ), + } }, ) .await @@ -993,19 +1215,32 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.create_stake_pool_tx( - account_index, - current_fee_rate, - consolidate_fee_rate, - StakePoolDataArguments { - amount, - margin_ratio_per_thousand, - cost_per_block, - decommission_key, - }, - ) + match wallet { + WalletType2::Software(w) => w.create_stake_pool_tx( + account_index, + current_fee_rate, + consolidate_fee_rate, + StakePoolDataArguments { + amount, + margin_ratio_per_thousand, + cost_per_block, + decommission_key, + }, + ), + WalletType2::Trezor(w) => w.create_stake_pool_tx( + account_index, + current_fee_rate, + consolidate_fee_rate, + StakePoolDataArguments { + amount, + margin_ratio_per_thousand, + cost_per_block, + decommission_key, + }, + ), + } }, ) .await @@ -1029,15 +1264,24 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut Wallet, + wallet: &mut WalletType2, account_index: U31| { - wallet.decommission_stake_pool( - account_index, - pool_id, - staker_balance, - output_address, - current_fee_rate, - ) + match wallet { + WalletType2::Software(w) => w.decommission_stake_pool( + account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ), + WalletType2::Trezor(w) => w.decommission_stake_pool( + account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ), + } }, ) .await @@ -1060,15 +1304,23 @@ where let (current_fee_rate, _) = self.get_current_and_consolidation_fee_rate().await?; - self.wallet - .decommission_stake_pool_request( + match &mut self.wallet { + WalletType2::Software(w) => w.decommission_stake_pool_request( self.account_index, pool_id, staker_balance, output_address, current_fee_rate, - ) - .map_err(ControllerError::WalletError) + ), + WalletType2::Trezor(w) => w.decommission_stake_pool_request( + self.account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ), + } + .map_err(ControllerError::WalletError) } pub async fn create_htlc_tx( @@ -1079,13 +1331,22 @@ where let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; - let result = self.wallet.create_htlc_tx( - self.account_index, - output_value, - htlc, - current_fee_rate, - consolidate_fee_rate, - )?; + let result = match self.wallet { + WalletType2::Software(w) => w.create_htlc_tx( + self.account_index, + output_value, + htlc, + current_fee_rate, + consolidate_fee_rate, + )?, + WalletType2::Trezor(w) => w.create_htlc_tx( + self.account_index, + output_value, + htlc, + current_fee_rate, + consolidate_fee_rate, + )?, + }; Ok(result) } @@ -1165,12 +1426,21 @@ where /// Checks if the wallet has stake pools and marks this account for staking. pub fn start_staking(&mut self) -> Result<(), ControllerError> { - utils::ensure!(!self.wallet.is_locked(), ControllerError::WalletIsLocked); + utils::ensure!( + !match &self.wallet { + WalletType2::Software(w) => w.is_locked(), + WalletType2::Trezor(w) => w.is_locked(), + }, + ControllerError::WalletIsLocked + ); // Make sure that account_index is valid and that pools exist - let pool_ids = self - .wallet - .get_pool_ids(self.account_index, WalletPoolsFilter::Stake) - .map_err(ControllerError::WalletError)?; + let pool_ids = match &mut self.wallet { + WalletType2::Software(w) => { + w.get_pool_ids(self.account_index, WalletPoolsFilter::Stake) + } + WalletType2::Trezor(w) => w.get_pool_ids(self.account_index, WalletPoolsFilter::Stake), + } + .map_err(ControllerError::WalletError)?; utils::ensure!(!pool_ids.is_empty(), ControllerError::NoStakingPool); log::info!("Start staking, account_index: {}", self.account_index); self.staking_started.insert(self.account_index); @@ -1190,9 +1460,11 @@ where ), ControllerError, > { - self.wallet - .sign_raw_transaction(self.account_index, tx) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.sign_raw_transaction(self.account_index, tx), + WalletType2::Trezor(w) => w.sign_raw_transaction(self.account_index, tx), + } + .map_err(ControllerError::WalletError) } pub fn sign_challenge( @@ -1200,15 +1472,21 @@ where challenge: &[u8], destination: &Destination, ) -> Result> { - self.wallet - .sign_challenge(self.account_index, challenge, destination) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => { + w.sign_challenge(self.account_index, challenge, destination) + } + WalletType2::Trezor(w) => w.sign_challenge(self.account_index, challenge, destination), + } + .map_err(ControllerError::WalletError) } pub fn add_unconfirmed_tx(&mut self, tx: SignedTransaction) -> Result<(), ControllerError> { - self.wallet - .add_unconfirmed_tx(tx, self.wallet_events) - .map_err(ControllerError::WalletError) + match &mut self.wallet { + WalletType2::Software(w) => w.add_unconfirmed_tx(tx, self.wallet_events), + WalletType2::Trezor(w) => w.add_unconfirmed_tx(tx, self.wallet_events), + } + .map_err(ControllerError::WalletError) } async fn get_current_and_consolidation_fee_rate( @@ -1229,9 +1507,15 @@ where &mut self, tx: SignedTransaction, ) -> Result> { - self.wallet - .add_account_unconfirmed_tx(self.account_index, tx.clone(), self.wallet_events) - .map_err(ControllerError::WalletError)?; + match &mut self.wallet { + WalletType2::Software(w) => { + w.add_account_unconfirmed_tx(self.account_index, tx.clone(), self.wallet_events) + } + WalletType2::Trezor(w) => { + w.add_account_unconfirmed_tx(self.account_index, tx.clone(), self.wallet_events) + } + } + .map_err(ControllerError::WalletError)?; self.rpc_client .submit_transaction(tx.clone(), Default::default()) @@ -1256,7 +1540,7 @@ where /// Create a transaction and broadcast it async fn create_and_send_tx< - F: FnOnce(FeeRate, FeeRate, &mut Wallet, U31) -> WalletResult, + F: FnOnce(FeeRate, FeeRate, &mut WalletType2, U31) -> WalletResult, >( &mut self, tx_maker: F, @@ -1285,17 +1569,22 @@ where F: FnOnce( FeeRate, FeeRate, - &mut Wallet, + &mut WalletType2, U31, &UnconfirmedTokenInfo, ) -> WalletResult, { // make sure we can use the token before create an tx using it let token_freezable_info = match token_info { - RPCTokenInfo::FungibleToken(token_info) => self - .wallet - .get_token_unconfirmed_info(self.account_index, token_info) - .map_err(ControllerError::WalletError)?, + RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { + WalletType2::Software(w) => { + w.get_token_unconfirmed_info(self.account_index, token_info) + } + WalletType2::Trezor(w) => { + w.get_token_unconfirmed_info(self.account_index, token_info) + } + } + .map_err(ControllerError::WalletError)?, RPCTokenInfo::NonFungibleToken(info) => { UnconfirmedTokenInfo::NonFungibleToken(info.token_id) } @@ -1339,7 +1628,7 @@ where /// e.g. newly issued token, nft or delegation id async fn create_and_send_tx_with_id< ID, - F: FnOnce(FeeRate, FeeRate, &mut Wallet, U31) -> WalletResult<(ID, SignedTransaction)>, + F: FnOnce(FeeRate, FeeRate, &mut WalletType2, U31) -> WalletResult<(ID, SignedTransaction)>, >( &mut self, tx_maker: F, diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 01bb414c4a..6c5077af43 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -57,8 +57,8 @@ use crate::wallet_rpc_traits::{ FromRpcInput, PartialOrSignedTx, SignRawTransactionResult, WalletInterface, }; -pub struct WalletRpcHandlesClient { - wallet_rpc: WalletRpc, +pub struct WalletRpcHandlesClient { + wallet_rpc: WalletRpc, server_rpc: Option, } @@ -77,12 +77,11 @@ pub enum WalletRpcHandlesClientError { AddressError(#[from] AddressError), } -impl WalletRpcHandlesClient +impl WalletRpcHandlesClient where N: NodeInterface + Clone + Send + Sync + 'static + Debug, - P: SignerProvider + Clone + Send + Sync + 'static, { - pub fn new(wallet_rpc: WalletRpc, server_rpc: Option) -> Self { + pub fn new(wallet_rpc: WalletRpc, server_rpc: Option) -> Self { Self { wallet_rpc, server_rpc, @@ -91,10 +90,9 @@ where } #[async_trait::async_trait] -impl WalletInterface for WalletRpcHandlesClient +impl WalletInterface for WalletRpcHandlesClient where N: NodeInterface + Clone + Send + Sync + 'static + Debug, - P: SignerProvider + Clone + Send + Sync + 'static, { type Error = WalletRpcHandlesClientError; diff --git a/wallet/wallet-rpc-lib/src/lib.rs b/wallet/wallet-rpc-lib/src/lib.rs index 6a94325dfa..70c62484cc 100644 --- a/wallet/wallet-rpc-lib/src/lib.rs +++ b/wallet/wallet-rpc-lib/src/lib.rs @@ -26,7 +26,6 @@ pub use service::{ CreatedWallet, Event, EventStream, TxState, WalletHandle, /* WalletResult, */ WalletService, }; -use wallet::signer::{software_signer::SoftwareSignerProvider, SignerProvider}; use wallet_controller::{NodeInterface, NodeRpcClient}; use std::{fmt::Debug, time::Duration}; @@ -77,27 +76,15 @@ pub async fn run( StartupError::WalletService(service::InitError::::NodeRpc(err)) })?; - let (wallet_service, rpc_server) = start_services( - wallet_config, - rpc_config, - node_rpc, - false, - SoftwareSignerProvider::new(), - ) - .await?; + let (wallet_service, rpc_server) = + start_services(wallet_config, rpc_config, node_rpc, false).await?; wait_for_shutdown(wallet_service, rpc_server).await; } NodeRpc::ColdWallet => { let node_rpc = wallet_controller::make_cold_wallet_rpc_client(wallet_config.chain_config.clone()); - let (wallet_service, rpc_server) = start_services( - wallet_config, - rpc_config, - node_rpc, - true, - SoftwareSignerProvider::new(), - ) - .await?; + let (wallet_service, rpc_server) = + start_services(wallet_config, rpc_config, node_rpc, true).await?; wait_for_shutdown(wallet_service, rpc_server).await; } } @@ -105,16 +92,14 @@ pub async fn run( Ok(()) } -pub async fn start_services( +pub async fn start_services( wallet_config: WalletServiceConfig, rpc_config: WalletRpcConfig, node_rpc: N, cold_wallet: bool, - signer_provider: P, -) -> Result<(WalletService, rpc::Rpc), StartupError> +) -> Result<(WalletService, rpc::Rpc), StartupError> where N: NodeInterface + Clone + Sync + Send + 'static + Debug, - P: SignerProvider + Clone + Send + Sync + 'static, { // Start the wallet service let wallet_service = WalletService::start( @@ -123,7 +108,6 @@ where wallet_config.force_change_wallet_type, wallet_config.start_staking_for_account, node_rpc, - signer_provider.clone(), ) .await?; @@ -138,7 +122,6 @@ where rpc_config, chain_config, cold_wallet, - signer_provider, ) .await .map_err(StartupError::Rpc)? @@ -148,10 +131,9 @@ where } /// Run a wallet daemon with RPC interface -pub async fn wait_for_shutdown(wallet_service: WalletService, rpc_server: rpc::Rpc) +pub async fn wait_for_shutdown(wallet_service: WalletService, rpc_server: rpc::Rpc) where N: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Clone + Send + Sync + 'static, { // Start the wallet service let wallet_handle = wallet_service.handle(); diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index 3c2f2c833e..15e7875795 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -94,31 +94,23 @@ use self::types::{ }; #[derive(Clone)] -pub struct WalletRpc { - wallet: WalletHandle, +pub struct WalletRpc { + wallet: WalletHandle, node: N, chain_config: Arc, - signer_provider: P, } type WRpcResult = Result>; -impl WalletRpc +impl WalletRpc where N: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Clone + Sync + Send + 'static, { - pub fn new( - wallet: WalletHandle, - node: N, - chain_config: Arc, - signer_provider: P, - ) -> Self { + pub fn new(wallet: WalletHandle, node: N, chain_config: Arc) -> Self { Self { wallet, node, chain_config, - signer_provider, } } @@ -142,19 +134,11 @@ where passphrase: Option, skip_syncing: bool, ) -> WRpcResult { - let signer_provider = self.signer_provider.clone(); self.wallet .manage_async(move |wallet_manager| { Box::pin(async move { wallet_manager - .create_wallet( - path, - store_seed_phrase, - mnemonic, - passphrase, - skip_syncing, - signer_provider, - ) + .create_wallet(path, store_seed_phrase, mnemonic, passphrase, skip_syncing) .await }) }) @@ -167,18 +151,12 @@ where password: Option, force_migrate_wallet_type: bool, ) -> WRpcResult<(), N> { - let signer_provider = self.signer_provider.clone(); Ok(self .wallet .manage_async(move |wallet_manager| { Box::pin(async move { wallet_manager - .open_wallet( - wallet_path, - password, - force_migrate_wallet_type, - signer_provider, - ) + .open_wallet(wallet_path, password, force_migrate_wallet_type) .await }) }) @@ -2261,24 +2239,22 @@ where } } -pub async fn start( - wallet_handle: WalletHandle, +pub async fn start( + wallet_handle: WalletHandle, node_rpc: N, config: WalletRpcConfig, chain_config: Arc, cold_wallet: bool, - signer_provider: P, ) -> anyhow::Result where N: NodeInterface + Clone + Send + Sync + 'static + Debug, - P: SignerProvider + Clone + Send + Sync + 'static, { let WalletRpcConfig { bind_addr, auth_credentials, } = config; - let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc, chain_config, signer_provider); + let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc, chain_config); let builder = rpc::Builder::new(bind_addr, auth_credentials) .with_method_list("list_methods") .register(ColdWalletRpcServer::into_rpc(wallet_rpc.clone())); diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index 11c815c4dc..4bb5990bf4 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -58,10 +58,9 @@ use crate::{ use super::types::{NewOrder, RpcHashedTimelockContract}; #[async_trait::async_trait] -impl WalletEventsRpcServer for WalletRpc +impl WalletEventsRpcServer for WalletRpc where N: NodeInterface + Clone + Send + Sync + 'static + Debug, - P: SignerProvider + Clone + Send + Sync + 'static, { async fn subscribe_wallet_events( &self, @@ -73,10 +72,9 @@ where } #[async_trait::async_trait] -impl ColdWalletRpcServer for WalletRpc +impl ColdWalletRpcServer for WalletRpc where N: NodeInterface + Clone + Send + Sync + 'static + Debug, - P: SignerProvider + Clone + Send + Sync + 'static, { async fn shutdown(&self) -> rpc::RpcResult<()> { rpc::handle_result(self.shutdown()) @@ -308,10 +306,9 @@ where } #[async_trait::async_trait] -impl WalletRpcServer for WalletRpc +impl WalletRpcServer for WalletRpc where N: NodeInterface + Clone + Send + Sync + 'static + Debug, - P: SignerProvider + Clone + Sync + Send + 'static, { async fn rescan(&self) -> rpc::RpcResult<()> { rpc::handle_result(self.rescan().await) diff --git a/wallet/wallet-rpc-lib/src/service/handle.rs b/wallet/wallet-rpc-lib/src/service/handle.rs index b4bc0ff06e..d90278326d 100644 --- a/wallet/wallet-rpc-lib/src/service/handle.rs +++ b/wallet/wallet-rpc-lib/src/service/handle.rs @@ -18,7 +18,6 @@ use futures::future::{BoxFuture, Future}; use utils::shallow_clone::ShallowClone; -use wallet::signer::SignerProvider; use wallet_controller::NodeInterface; use crate::{ @@ -30,17 +29,16 @@ pub use crate::service::worker::EventStream; /// Wallet handle allows the user to control the wallet service, perform queries etc. #[derive(Clone)] -pub struct WalletHandle(worker::CommandSender); +pub struct WalletHandle(worker::CommandSender); -impl WalletHandle +impl WalletHandle where N: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Clone + Sync + Send + 'static, { /// Asynchronous wallet service call pub fn call_async> + Send + 'static>( &self, - action: impl FnOnce(&mut WalletController) -> BoxFuture> + Send + 'static, + action: impl FnOnce(&mut WalletController) -> BoxFuture> + Send + 'static, ) -> impl Future>, SubmitError>> { let (tx, rx) = tokio::sync::oneshot::channel(); let command = WalletCommand::Call(Box::new(move |opt_controller| match opt_controller { @@ -63,7 +61,7 @@ where /// Wallet service call pub fn call> + Send + 'static>( &self, - action: impl FnOnce(&mut WalletController) -> Result + Send + 'static, + action: impl FnOnce(&mut WalletController) -> Result + Send + 'static, ) -> impl Future>, SubmitError>> { self.call_async(|controller| { let res = action(controller); @@ -73,7 +71,7 @@ where pub fn manage_async( &self, - action_fn: impl FnOnce(&mut WalletWorker) -> BoxFuture + Send + 'static, + action_fn: impl FnOnce(&mut WalletWorker) -> BoxFuture + Send + 'static, ) -> impl Future> { let (tx, rx) = tokio::sync::oneshot::channel(); let command = WalletCommand::Manage(Box::new(move |wallet_manager| { @@ -111,16 +109,16 @@ where self.0.closed().await } - fn send_raw(&self, cmd: WalletCommand) -> Result<(), SubmitError> { + fn send_raw(&self, cmd: WalletCommand) -> Result<(), SubmitError> { self.0.send(cmd).map_err(|_| SubmitError::Send) } } -pub fn create(sender: worker::CommandSender) -> WalletHandle { +pub fn create(sender: worker::CommandSender) -> WalletHandle { WalletHandle(sender) } -impl ShallowClone for WalletHandle { +impl ShallowClone for WalletHandle { fn shallow_clone(&self) -> Self { Self(worker::CommandSender::clone(&self.0)) } diff --git a/wallet/wallet-rpc-lib/src/service/mod.rs b/wallet/wallet-rpc-lib/src/service/mod.rs index a0f41ab152..8580b0ace5 100644 --- a/wallet/wallet-rpc-lib/src/service/mod.rs +++ b/wallet/wallet-rpc-lib/src/service/mod.rs @@ -25,7 +25,6 @@ use utils::shallow_clone::ShallowClone; pub use events::{Event, TxState}; pub use handle::{EventStream, SubmitError, WalletHandle}; -use wallet::signer::SignerProvider; use wallet_controller::{ControllerConfig, NodeInterface}; pub use worker::{CreatedWallet, WalletController, WalletControllerError}; @@ -34,9 +33,9 @@ use events::WalletServiceEvents; // pub type WalletResult = Result; /// Wallet service -pub struct WalletService { +pub struct WalletService { task: tokio::task::JoinHandle<()>, - command_tx: worker::CommandSender, + command_tx: worker::CommandSender, node_rpc: N, chain_config: Arc, } @@ -51,10 +50,9 @@ pub enum InitError { Controller(#[from] WalletControllerError), } -impl WalletService +impl WalletService where N: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Clone + Send + Sync + 'static, { pub async fn start( chain_config: Arc, @@ -62,7 +60,6 @@ where force_change_wallet_type: bool, start_staking_for_account: Vec, node_rpc: N, - signer_provider: P, ) -> Result> { let (wallet_events, events_rx) = WalletServiceEvents::new(); let (command_tx, command_rx) = tokio::sync::mpsc::unbounded_channel(); @@ -77,7 +74,6 @@ where wallet_password, node_rpc.is_cold_wallet_node(), force_change_wallet_type, - signer_provider, )? }; @@ -129,7 +125,7 @@ where } /// Get wallet service handle - pub fn handle(&self) -> WalletHandle { + pub fn handle(&self) -> WalletHandle { handle::create(worker::CommandSender::clone(&self.command_tx)) } diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index b8c3957b83..ba09c7eae5 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -21,7 +21,6 @@ use tokio::{sync::mpsc, task::JoinHandle}; use logging::log; use utils_networking::broadcaster::Broadcaster; -use wallet::signer::SignerProvider; use wallet::wallet::Mnemonic; use wallet_controller::{ControllerError, NodeInterface}; use wallet_types::seed_phrase::StoreSeedPhrase; @@ -32,23 +31,22 @@ use crate::Event; use super::WalletServiceEvents; -pub type WalletController = - wallet_controller::RpcController; +pub type WalletController = wallet_controller::RpcController; pub type WalletControllerError = wallet_controller::ControllerError; -pub type CommandReceiver = mpsc::UnboundedReceiver>; -pub type CommandSender = mpsc::UnboundedSender>; +pub type CommandReceiver = mpsc::UnboundedReceiver>; +pub type CommandSender = mpsc::UnboundedSender>; pub type EventStream = utils_networking::broadcaster::Receiver; -type CommandFn = dyn Send + FnOnce(&mut Option>) -> BoxFuture<()>; -type ManageFn = dyn Send + FnOnce(&mut WalletWorker) -> BoxFuture<()>; +type CommandFn = dyn Send + FnOnce(&mut Option>) -> BoxFuture<()>; +type ManageFn = dyn Send + FnOnce(&mut WalletWorker) -> BoxFuture<()>; /// Commands to control the wallet task -pub enum WalletCommand { +pub enum WalletCommand { /// Make the controller perform an action - Call(Box>), + Call(Box>), /// Manage the Wallet itself, i.e. Create/Open/Close - Manage(Box>), + Manage(Box>), /// Shutdown the wallet service task Stop, @@ -60,9 +58,9 @@ pub enum CreatedWallet { } /// Represents the wallet worker task. It handles external commands and keeps the wallet in sync. -pub struct WalletWorker { - controller: Option>, - command_rx: CommandReceiver, +pub struct WalletWorker { + controller: Option>, + command_rx: CommandReceiver, chain_config: Arc, node_rpc: N, events_bcast: Broadcaster, @@ -70,16 +68,15 @@ pub struct WalletWorker { wallet_events: WalletServiceEvents, } -impl WalletWorker +impl WalletWorker where N: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Sync + Send + 'static, { fn new( - controller: Option>, + controller: Option>, chain_config: Arc, node_rpc: N, - command_rx: CommandReceiver, + command_rx: CommandReceiver, events_rx: mpsc::UnboundedReceiver, wallet_events: WalletServiceEvents, ) -> Self { @@ -128,10 +125,7 @@ where } } - pub async fn process_command( - &mut self, - command: Option>, - ) -> ControlFlow<()> { + pub async fn process_command(&mut self, command: Option>) -> ControlFlow<()> { match command { Some(WalletCommand::Call(call)) => { call(&mut self.controller).await; @@ -163,7 +157,6 @@ where wallet_path: PathBuf, password: Option, force_migrate_wallet_type: bool, - signer_provider: P, ) -> Result<(), ControllerError> { utils::ensure!( self.controller.is_none(), @@ -176,7 +169,6 @@ where password, self.node_rpc.is_cold_wallet_node(), force_migrate_wallet_type, - signer_provider, )?; let controller = WalletController::new( @@ -198,7 +190,6 @@ where mnemonic: Option, passphrase: Option, skip_syncing: bool, - signer_provider: P, ) -> Result> { utils::ensure!( self.controller.is_none(), @@ -224,7 +215,6 @@ where whether_to_store_seed_phrase, (info.best_block_height, info.best_block_id), self.node_rpc.is_cold_wallet_node(), - signer_provider, ) } else { WalletController::recover_wallet( @@ -234,7 +224,6 @@ where passphrase_ref, whether_to_store_seed_phrase, self.node_rpc.is_cold_wallet_node(), - signer_provider, ) } .map_err(RpcError::Controller)?; @@ -262,7 +251,7 @@ where } async fn background_task( - controller_opt: &mut Option>, + controller_opt: &mut Option>, ) -> Result> { match controller_opt.as_mut() { Some(controller) => controller.run().await, @@ -271,16 +260,15 @@ where } } -impl WalletWorker +impl WalletWorker where N: NodeInterface + Clone + Send + Sync + 'static, - P: SignerProvider + Sync + Send + 'static, { pub fn spawn( - controller: Option>, + controller: Option>, chain_config: Arc, node_rpc: N, - command_rx: CommandReceiver, + command_rx: CommandReceiver, events_rx: mpsc::UnboundedReceiver, wallet_events: WalletServiceEvents, ) -> JoinHandle<()> { diff --git a/wallet/wallet-rpc-lib/tests/utils.rs b/wallet/wallet-rpc-lib/tests/utils.rs index b2f90407e7..a54cda825b 100644 --- a/wallet/wallet-rpc-lib/tests/utils.rs +++ b/wallet/wallet-rpc-lib/tests/utils.rs @@ -34,13 +34,13 @@ pub use randomness::Rng; pub use rpc::test_support::{ClientT, Subscription, SubscriptionClientT}; pub use serde_json::Value as JsonValue; pub use test_utils::random::{make_seedable_rng, Seed}; -use wallet_types::wallet_type::WalletType; +use wallet_types::{seed_phrase::StoreSeedPhrase, wallet_type::WalletType}; pub const ACCOUNT0_ARG: AccountArg = AccountArg(0); pub const ACCOUNT1_ARG: AccountArg = AccountArg(1); pub struct TestFramework { - pub wallet_service: WalletService, + pub wallet_service: WalletService, pub shutdown_trigger: subsystem::ShutdownTrigger, pub node_manager_task: subsystem::ManagerJoinHandle, pub test_root: TestRoot, @@ -68,12 +68,17 @@ impl TestFramework { let _wallet = wallet::Wallet::create_new_wallet( Arc::clone(&chain_config), db, - wallet_test_node::MNEMONIC, - None, - wallet_types::seed_phrase::StoreSeedPhrase::DoNotStore, (BlockHeight::new(0), chain_config.genesis_block_id()), WalletType::Hot, - SoftwareSignerProvider::new(), + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + wallet_test_node::MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + )?) + }, ) .unwrap(); @@ -127,15 +132,9 @@ impl TestFramework { .await .unwrap(); - wallet_rpc_lib::start_services( - ws_config, - rpc_config, - node_rpc, - false, - SoftwareSignerProvider::new(), - ) - .await - .unwrap() + wallet_rpc_lib::start_services(ws_config, rpc_config, node_rpc, false) + .await + .unwrap() }; TestFramework { @@ -163,7 +162,7 @@ impl TestFramework { rpc::new_ws_client(rpc_addr, rpc_auth).await.unwrap() } - pub fn handle(&self) -> WalletHandle { + pub fn handle(&self) -> WalletHandle { self.wallet_service.handle() } From 413f331e7cd5371596d046924cad233cbd8e1909 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 2 Jul 2024 12:39:56 +0200 Subject: [PATCH 07/48] Add trezor hardware wallet Account implementation --- Cargo.lock | 4 +- crypto/src/key/extended.rs | 6 + crypto/src/key/secp256k1/extended_keys.rs | 12 + wallet/Cargo.toml | 5 + wallet/src/account/mod.rs | 339 ++++++------ wallet/src/account/transaction_list/mod.rs | 18 +- wallet/src/key_chain/account_key_chain/mod.rs | 523 ++++++++++-------- wallet/src/key_chain/master_key_chain/mod.rs | 7 +- wallet/src/key_chain/mod.rs | 184 +++++- wallet/src/key_chain/tests.rs | 4 +- wallet/src/key_chain/vrf_key_chain/mod.rs | 260 +++++---- wallet/src/signer/mod.rs | 16 +- wallet/src/signer/software_signer/mod.rs | 19 +- wallet/src/signer/trezor_signer/mod.rs | 88 ++- wallet/src/signer/trezor_signer/tests.rs | 3 +- wallet/src/wallet/mod.rs | 245 ++++---- wallet/trezor-client/src/client/mintlayer.rs | 2 +- wallet/wallet-controller/src/lib.rs | 38 +- wallet/wallet-controller/src/read.rs | 73 ++- .../src/synced_controller.rs | 101 ++-- 20 files changed, 1214 insertions(+), 733 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ab77960318..09eb889db8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4827,6 +4827,7 @@ dependencies = [ "p2p", "rfd", "serialization", + "storage", "strum", "thiserror", "tokio", @@ -4834,6 +4835,7 @@ dependencies = [ "wallet", "wallet-cli-commands", "wallet-controller", + "wallet-storage", "wallet-types", "winres", ] @@ -4858,7 +4860,6 @@ dependencies = [ "serde_json", "serde_with", "serialization", - "storage", "subsystem", "test-utils", "thiserror", @@ -4869,7 +4870,6 @@ dependencies = [ "wallet-controller", "wallet-rpc-client", "wallet-rpc-lib", - "wallet-storage", "wallet-types", ] diff --git a/crypto/src/key/extended.rs b/crypto/src/key/extended.rs index 718c08e20b..34d67905ad 100644 --- a/crypto/src/key/extended.rs +++ b/crypto/src/key/extended.rs @@ -122,6 +122,12 @@ impl ExtendedPublicKey { } } + pub fn from_hardware_public_key(public_key: Secp256k1ExtendedPublicKey) -> Self { + Self { + pub_key: ExtendedPublicKeyHolder::Secp256k1Schnorr(public_key), + } + } + pub fn into_public_key(self) -> PublicKey { match self.pub_key { ExtendedPublicKeyHolder::Secp256k1Schnorr(k) => k.into_public_key().into(), diff --git a/crypto/src/key/secp256k1/extended_keys.rs b/crypto/src/key/secp256k1/extended_keys.rs index bc87202b7a..d639f44f34 100644 --- a/crypto/src/key/secp256k1/extended_keys.rs +++ b/crypto/src/key/secp256k1/extended_keys.rs @@ -200,6 +200,18 @@ impl Secp256k1ExtendedPublicKey { .into(), } } + + pub fn from_hardware_wallet( + derivation_path: DerivationPath, + chain_code: ChainCode, + public_key: Secp256k1PublicKey, + ) -> Self { + Self { + derivation_path, + chain_code, + public_key, + } + } } impl Derivable for Secp256k1ExtendedPublicKey { diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index ead6bc6780..f7553b46af 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -41,3 +41,8 @@ test-utils = { path = "../test-utils" } rstest.workspace = true tempfile.workspace = true + +[features] +trezor = ["trezor-client"] + +default = ["trezor"] diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index 08d9781e25..f2ee24fadd 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -43,7 +43,7 @@ use wallet_types::with_locked::WithLocked; use crate::account::utxo_selector::{select_coins, OutputGroup}; use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; -use crate::key_chain::{AccountKeyChainImpl, KeyChainError}; +use crate::key_chain::{AccountKeyChains, KeyChainError, VRFAccountKeyChains}; use crate::send_request::{ make_address_output, make_address_output_from_delegation, make_address_output_token, make_decommission_stake_pool_output, make_mint_token_outputs, make_stake_output, @@ -112,48 +112,21 @@ impl TransactionToSign { } } -pub struct Account { +pub struct Account { chain_config: Arc, - key_chain: AccountKeyChainImpl, + key_chain: K, output_cache: OutputCache, account_info: AccountInfo, } -impl Account { - pub fn load_from_database( - chain_config: Arc, - db_tx: &impl WalletStorageReadLocked, - id: &AccountId, - ) -> WalletResult { - let mut account_infos = db_tx.get_accounts_info()?; - let account_info = - account_infos.remove(id).ok_or(KeyChainError::NoAccountFound(id.clone()))?; - - let key_chain = AccountKeyChainImpl::load_from_database( - chain_config.clone(), - db_tx, - id, - &account_info, - )?; - - let txs = db_tx.get_transactions(&key_chain.get_account_id())?; - let output_cache = OutputCache::new(txs)?; - - Ok(Account { - chain_config, - key_chain, - output_cache, - account_info, - }) - } - +impl Account { /// Create a new account by providing a key chain pub fn new( chain_config: Arc, db_tx: &mut impl WalletStorageWriteLocked, - key_chain: AccountKeyChainImpl, + key_chain: K, name: Option, - ) -> WalletResult { + ) -> WalletResult { let account_id = key_chain.get_account_id(); let account_info = AccountInfo::new( @@ -181,7 +154,29 @@ impl Account { Ok(account) } - pub fn key_chain(&self) -> &AccountKeyChainImpl { + pub fn load_from_database( + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + id: &AccountId, + ) -> WalletResult { + let mut account_infos = db_tx.get_accounts_info()?; + let account_info = + account_infos.remove(id).ok_or(KeyChainError::NoAccountFound(id.clone()))?; + + let key_chain = K::load_from_database(chain_config.clone(), db_tx, id, &account_info)?; + + let txs = db_tx.get_transactions(&key_chain.get_account_id())?; + let output_cache = OutputCache::new(txs)?; + + Ok(Account { + chain_config, + key_chain, + output_cache, + account_info, + }) + } + + pub fn key_chain(&self) -> &K { &self.key_chain } @@ -851,31 +846,18 @@ impl Account { Ok(req) } - fn get_vrf_public_key( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - ) -> WalletResult { - Ok(self.key_chain.issue_vrf_key(db_tx)?.1.into_public_key()) - } - - pub fn get_pool_ids( - &self, - filter: WalletPoolsFilter, - db_tx: &impl WalletStorageReadUnlocked, - ) -> Vec<(PoolId, PoolData)> { + pub fn get_pool_ids(&self, filter: WalletPoolsFilter) -> Vec<(PoolId, PoolData)> { self.output_cache .pool_ids() .into_iter() .filter(|(_, pool_data)| match filter { WalletPoolsFilter::All => true, - WalletPoolsFilter::Decommission => self - .key_chain - .get_private_key_for_destination(&pool_data.decommission_key, db_tx) - .map_or(false, |res| res.is_some()), - WalletPoolsFilter::Stake => self - .key_chain - .get_private_key_for_destination(&pool_data.stake_destination, db_tx) - .map_or(false, |res| res.is_some()), + WalletPoolsFilter::Decommission => { + self.key_chain.is_destination_mine(&pool_data.decommission_key) + } + WalletPoolsFilter::Stake => { + self.key_chain.is_destination_mine(&pool_data.stake_destination) + } }) .collect() } @@ -917,64 +899,6 @@ impl Account { }) } - pub fn create_stake_pool_tx( - &mut self, - db_tx: &mut impl WalletStorageWriteUnlocked, - stake_pool_arguments: StakePoolDataArguments, - median_time: BlockTimestamp, - fee_rate: CurrentFeeRate, - ) -> WalletResult { - // TODO: Use other accounts here - let staker = Destination::PublicKey( - self.key_chain.issue_key(db_tx, KeyPurpose::ReceiveFunds)?.into_public_key(), - ); - let vrf_public_key = self.get_vrf_public_key(db_tx)?; - - // the first UTXO is needed in advance to calculate pool_id, so just make a dummy one - // and then replace it with when we can calculate the pool_id - let dummy_pool_id = PoolId::new(Uint256::from_u64(0).into()); - let dummy_stake_output = - make_stake_output(dummy_pool_id, stake_pool_arguments, staker, vrf_public_key); - let request = SendRequest::new().with_outputs([dummy_stake_output]); - let mut request = self.select_inputs_for_send_request( - request, - SelectedInputs::Utxos(vec![]), - None, - BTreeMap::new(), - db_tx, - median_time, - fee_rate, - None, - )?; - - let input0_outpoint = crate::utils::get_first_utxo_outpoint(request.inputs())?; - let new_pool_id = pos_accounting::make_pool_id(input0_outpoint); - - // update the dummy_pool_id with the new pool_id - let old_pool_id = request - .get_outputs_mut() - .iter_mut() - .find_map(|out| match out { - TxOutput::CreateStakePool(pool_id, _) if *pool_id == dummy_pool_id => Some(pool_id), - TxOutput::CreateStakePool(_, _) - | TxOutput::Burn(_) - | TxOutput::Transfer(_, _) - | TxOutput::DelegateStaking(_, _) - | TxOutput::LockThenTransfer(_, _, _) - | TxOutput::CreateDelegationId(_, _) - | TxOutput::ProduceBlockFromStake(_, _) - | TxOutput::IssueFungibleToken(_) - | TxOutput::IssueNft(_, _, _) - | TxOutput::DataDeposit(_) - | TxOutput::Htlc(_, _) - | TxOutput::CreateOrder(_) => None, - }) - .expect("find output with dummy_pool_id"); - *old_pool_id = new_pool_id; - - Ok(request) - } - pub fn create_htlc_tx( &mut self, db_tx: &mut impl WalletStorageWriteUnlocked, @@ -1405,41 +1329,6 @@ impl Account { self.output_cache.pool_data(pool_id).is_ok() } - pub fn get_pos_gen_block_data( - &self, - db_tx: &impl WalletStorageReadUnlocked, - pool_id: PoolId, - ) -> WalletResult { - let pool_data = self.output_cache.pool_data(pool_id)?; - let kernel_input: TxInput = pool_data.utxo_outpoint.clone().into(); - let stake_destination = &pool_data.stake_destination; - let kernel_input_utxo = - self.output_cache.get_txo(&pool_data.utxo_outpoint).expect("must exist"); - - let stake_private_key = self - .key_chain - .get_private_key_for_destination(stake_destination, db_tx)? - .ok_or(WalletError::KeyChainError(KeyChainError::NoPrivateKeyFound))?; - - let vrf_private_key = self - .key_chain - .get_vrf_private_key_for_public_key(&pool_data.vrf_public_key, db_tx)? - .ok_or(WalletError::KeyChainError( - KeyChainError::NoVRFPrivateKeyFound, - ))? - .private_key(); - - let data = PoSGenerateBlockInputData::new( - stake_private_key, - vrf_private_key, - pool_id, - vec![kernel_input], - vec![kernel_input_utxo.clone()], - ); - - Ok(data) - } - pub fn tx_to_partially_signed_tx( &self, tx: Transaction, @@ -1592,22 +1481,6 @@ impl Account { Ok(self.key_chain.issue_address(db_tx, purpose)?) } - /// Get a new vrf key that hasn't been used before - pub fn get_new_vrf_key( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - ) -> WalletResult<(ChildNumber, Address)> { - Ok( - self.key_chain.issue_vrf_key(db_tx).map(|(child_number, vrf_key)| { - ( - child_number, - Address::new(&self.chain_config, vrf_key.public_key().clone()) - .expect("addressable"), - ) - })?, - ) - } - /// Get the corresponding public key for a given public key hash pub fn find_corresponding_pub_key( &self, @@ -1667,16 +1540,6 @@ impl Account { Ok((address, amounts_by_currency, standalone_key)) } - pub fn get_all_issued_vrf_public_keys( - &self, - ) -> BTreeMap, bool)> { - self.key_chain.get_all_issued_vrf_public_keys() - } - - pub fn get_legacy_vrf_public_key(&self) -> Address { - self.key_chain.get_legacy_vrf_public_key() - } - pub fn get_addresses_usage(&self) -> &KeychainUsageState { self.key_chain.get_addresses_usage_state() } @@ -2284,7 +2147,7 @@ impl Account { } } -impl common::size_estimation::DestinationInfoProvider for Account { +impl common::size_estimation::DestinationInfoProvider for Account { fn get_multisig_info( &self, destination: &Destination, @@ -2305,6 +2168,134 @@ struct PreselectedInputAmounts { pub burn: Amount, } +impl Account { + fn get_vrf_public_key( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + ) -> WalletResult { + Ok(self.key_chain.issue_vrf_key(db_tx)?.1.into_public_key()) + } + + pub fn get_all_issued_vrf_public_keys( + &self, + ) -> BTreeMap, bool)> { + self.key_chain.get_all_issued_vrf_public_keys() + } + + pub fn get_legacy_vrf_public_key(&self) -> Address { + self.key_chain.get_legacy_vrf_public_key() + } + + /// Get a new vrf key that hasn't been used before + pub fn get_new_vrf_key( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + ) -> WalletResult<(ChildNumber, Address)> { + Ok( + self.key_chain.issue_vrf_key(db_tx).map(|(child_number, vrf_key)| { + ( + child_number, + Address::new(&self.chain_config, vrf_key.public_key().clone()) + .expect("addressable"), + ) + })?, + ) + } + + pub fn get_pos_gen_block_data( + &self, + db_tx: &impl WalletStorageReadUnlocked, + pool_id: PoolId, + ) -> WalletResult { + let pool_data = self.output_cache.pool_data(pool_id)?; + let kernel_input: TxInput = pool_data.utxo_outpoint.clone().into(); + let stake_destination = &pool_data.stake_destination; + let kernel_input_utxo = + self.output_cache.get_txo(&pool_data.utxo_outpoint).expect("must exist"); + + let stake_private_key = self + .key_chain + .get_private_key_for_destination(stake_destination, db_tx)? + .ok_or(WalletError::KeyChainError(KeyChainError::NoPrivateKeyFound))?; + + let vrf_private_key = self + .key_chain + .get_vrf_private_key_for_public_key(&pool_data.vrf_public_key, db_tx)? + .ok_or(WalletError::KeyChainError( + KeyChainError::NoVRFPrivateKeyFound, + ))? + .private_key(); + + let data = PoSGenerateBlockInputData::new( + stake_private_key, + vrf_private_key, + pool_id, + vec![kernel_input], + vec![kernel_input_utxo.clone()], + ); + + Ok(data) + } + + pub fn create_stake_pool_tx( + &mut self, + db_tx: &mut impl WalletStorageWriteUnlocked, + stake_pool_arguments: StakePoolDataArguments, + median_time: BlockTimestamp, + fee_rate: CurrentFeeRate, + ) -> WalletResult { + // TODO: Use other accounts here + let staker = Destination::PublicKey( + self.key_chain.issue_key(db_tx, KeyPurpose::ReceiveFunds)?.into_public_key(), + ); + let vrf_public_key = self.get_vrf_public_key(db_tx)?; + + // the first UTXO is needed in advance to calculate pool_id, so just make a dummy one + // and then replace it with when we can calculate the pool_id + let dummy_pool_id = PoolId::new(Uint256::from_u64(0).into()); + let dummy_stake_output = + make_stake_output(dummy_pool_id, stake_pool_arguments, staker, vrf_public_key); + let request = SendRequest::new().with_outputs([dummy_stake_output]); + let mut request = self.select_inputs_for_send_request( + request, + SelectedInputs::Utxos(vec![]), + None, + BTreeMap::new(), + db_tx, + median_time, + fee_rate, + None, + )?; + + let input0_outpoint = crate::utils::get_first_utxo_outpoint(request.inputs())?; + let new_pool_id = pos_accounting::make_pool_id(input0_outpoint); + + // update the dummy_pool_id with the new pool_id + let old_pool_id = request + .get_outputs_mut() + .iter_mut() + .find_map(|out| match out { + TxOutput::CreateStakePool(pool_id, _) if *pool_id == dummy_pool_id => Some(pool_id), + TxOutput::CreateStakePool(_, _) + | TxOutput::Burn(_) + | TxOutput::Transfer(_, _) + | TxOutput::DelegateStaking(_, _) + | TxOutput::LockThenTransfer(_, _, _) + | TxOutput::CreateDelegationId(_, _) + | TxOutput::ProduceBlockFromStake(_, _) + | TxOutput::IssueFungibleToken(_) + | TxOutput::IssueNft(_, _, _) + | TxOutput::DataDeposit(_) + | TxOutput::Htlc(_, _) + | TxOutput::CreateOrder(_) => None, + }) + .expect("find output with dummy_pool_id"); + *old_pool_id = new_pool_id; + + Ok(request) + } +} + /// There are some preselected inputs like the Token account inputs with a nonce /// that need to be included in the request /// Here we group them up by currency and sum the total amount and fee they bring to the diff --git a/wallet/src/account/transaction_list/mod.rs b/wallet/src/account/transaction_list/mod.rs index a4bb4705af..0d4089f2fc 100644 --- a/wallet/src/account/transaction_list/mod.rs +++ b/wallet/src/account/transaction_list/mod.rs @@ -23,10 +23,10 @@ use serde::Serialize; use wallet_types::{ currency::Currency, wallet_tx::{TxData, TxState}, - KeyPurpose, WalletTx, + WalletTx, }; -use crate::{key_chain::AccountKeyChainImpl, WalletError, WalletResult}; +use crate::{key_chain::AccountKeyChains, WalletError, WalletResult}; use super::{currency_grouper::group_outputs, output_cache::OutputCache}; @@ -110,11 +110,11 @@ fn compare_tx_ref(a: &TxRef, b: &TxRef) -> Ordering { } } -fn own_output(key_chain: &AccountKeyChainImpl, output: &TxOutput) -> bool { +fn own_output(key_chain: &impl AccountKeyChains, output: &TxOutput) -> bool { match output { - TxOutput::Transfer(_, dest) | TxOutput::LockThenTransfer(_, dest, _) => KeyPurpose::ALL - .iter() - .any(|purpose| key_chain.get_leaf_key_chain(*purpose).is_destination_mine(dest)), + TxOutput::Transfer(_, dest) | TxOutput::LockThenTransfer(_, dest, _) => { + key_chain.is_destination_mine(dest) + } TxOutput::Burn(_) | TxOutput::CreateStakePool(_, _) | TxOutput::ProduceBlockFromStake(_, _) @@ -129,7 +129,7 @@ fn own_output(key_chain: &AccountKeyChainImpl, output: &TxOutput) -> bool { } fn own_input<'a>( - key_chain: &AccountKeyChainImpl, + key_chain: &impl AccountKeyChains, output_cache: &'a OutputCache, input: &TxInput, ) -> Option<&'a TxOutput> { @@ -146,7 +146,7 @@ fn own_input<'a>( } fn get_transaction( - key_chain: &AccountKeyChainImpl, + key_chain: &impl AccountKeyChains, output_cache: &OutputCache, tx_data: &TxData, ) -> WalletResult { @@ -213,7 +213,7 @@ fn get_transaction( } pub fn get_transaction_list( - key_chain: &AccountKeyChainImpl, + key_chain: &impl AccountKeyChains, output_cache: &OutputCache, skip: usize, count: usize, diff --git a/wallet/src/key_chain/account_key_chain/mod.rs b/wallet/src/key_chain/account_key_chain/mod.rs index 714ffb86b0..3316de7a76 100644 --- a/wallet/src/key_chain/account_key_chain/mod.rs +++ b/wallet/src/key_chain/account_key_chain/mod.rs @@ -23,7 +23,6 @@ use common::chain::{ChainConfig, Destination}; use crypto::key::extended::{ExtendedPrivateKey, ExtendedPublicKey}; use crypto::key::hdkd::child_number::ChildNumber; use crypto::key::hdkd::derivable::Derivable; -use crypto::key::hdkd::derivation_path::DerivationPath; use crypto::key::hdkd::u31::U31; use crypto::key::{PrivateKey, PublicKey}; use crypto::vrf::{ExtendedVRFPrivateKey, ExtendedVRFPublicKey, VRFPublicKey}; @@ -41,11 +40,13 @@ use wallet_types::account_info::{ use wallet_types::keys::KeyPurpose; use wallet_types::{AccountId, AccountInfo, KeychainUsageState}; -use super::vrf_key_chain::VrfKeySoftChain; -use super::{make_path_to_vrf_key, AccountKeyChains, MasterKeyChain, VRF_INDEX}; +use super::vrf_key_chain::{EmptyVrfKeyChain, VrfKeyChain, VrfKeySoftChain}; +use super::{ + make_path_to_vrf_key, AccountKeyChains, MasterKeyChain, VRFAccountKeyChains, VRF_INDEX, +}; /// This key chain contains a pool of pre-generated keys and addresses for the usage in a wallet -pub struct AccountKeyChainImpl { +pub struct AccountKeyChainImpl { chain_config: Arc, account_index: U31, @@ -57,7 +58,7 @@ pub struct AccountKeyChainImpl { sub_chains: WithPurpose, /// VRF key chain - vrf_chain: VrfKeySoftChain, + vrf_chain: V, /// Standalone watch only keys added by the user not derived from this account's chain standalone_watch_only_keys: BTreeMap, @@ -72,7 +73,7 @@ pub struct AccountKeyChainImpl { lookahead_size: ConstValue, } -impl AccountKeyChainImpl { +impl AccountKeyChainImpl { pub fn new_from_root_key( chain_config: Arc, db_tx: &mut impl WalletStorageWriteLocked, @@ -80,7 +81,7 @@ impl AccountKeyChainImpl { root_vrf_key: ExtendedVRFPrivateKey, account_index: U31, lookahead_size: u32, - ) -> KeyChainResult { + ) -> KeyChainResult { let account_path = make_account_path(&chain_config, account_index); let account_privkey = root_key.derive_absolute_path(&account_path)?; @@ -135,7 +136,7 @@ impl AccountKeyChainImpl { ); vrf_chain.save_usage_state(db_tx)?; - let mut new_account = AccountKeyChainImpl { + let mut new_account = Self { chain_config, account_index, account_public_key: account_pubkey.into(), @@ -151,7 +152,61 @@ impl AccountKeyChainImpl { Ok(new_account) } +} + +impl AccountKeyChainImpl { + pub fn new_from_hardware_key( + chain_config: Arc, + db_tx: &mut impl WalletStorageWriteLocked, + account_pubkey: ExtendedPublicKey, + account_index: U31, + lookahead_size: u32, + ) -> KeyChainResult { + let account_id = AccountId::new_from_xpub(&account_pubkey); + let receiving_key_chain = LeafKeySoftChain::new_empty( + chain_config.clone(), + account_id.clone(), + KeyPurpose::ReceiveFunds, + account_pubkey + .clone() + .derive_child(KeyPurpose::ReceiveFunds.get_deterministic_index())?, + ); + receiving_key_chain.save_usage_state(db_tx)?; + + let change_key_chain = LeafKeySoftChain::new_empty( + chain_config.clone(), + account_id.clone(), + KeyPurpose::Change, + account_pubkey + .clone() + .derive_child(KeyPurpose::Change.get_deterministic_index())?, + ); + change_key_chain.save_usage_state(db_tx)?; + + let sub_chains = WithPurpose::new(receiving_key_chain, change_key_chain); + + let vrf_chain = EmptyVrfKeyChain {}; + + let mut new_account = Self { + chain_config, + account_index, + account_public_key: account_pubkey.into(), + sub_chains, + vrf_chain, + standalone_watch_only_keys: BTreeMap::new(), + standalone_multisig_keys: BTreeMap::new(), + standalone_private_keys: BTreeMap::new(), + lookahead_size: lookahead_size.into(), + }; + + new_account.top_up_all(db_tx)?; + + Ok(new_account) + } +} + +impl AccountKeyChainImpl { fn derive_account_private_key( &self, db_tx: &impl WalletStorageReadUnlocked, @@ -173,8 +228,58 @@ impl AccountKeyChainImpl { Ok(root_key) } + /// Get the private key that corresponds to the provided public key + fn get_private_key( + parent_key: &ExtendedPrivateKey, + requested_key: &ExtendedPublicKey, + ) -> KeyChainResult { + let derived_key = + parent_key.clone().derive_absolute_path(requested_key.get_derivation_path())?; + if &derived_key.to_public_key() == requested_key { + Ok(derived_key) + } else { + Err(KeyChainError::KeysNotInSameHierarchy) + } + } + + /// Get the private key that corresponds to the provided public key + fn get_vrf_private_key( + parent_key: &ExtendedVRFPrivateKey, + requested_key: &ExtendedVRFPublicKey, + ) -> KeyChainResult { + let derived_key = + parent_key.clone().derive_absolute_path(requested_key.get_derivation_path())?; + if &derived_key.to_public_key() == requested_key { + Ok(derived_key) + } else { + Err(KeyChainError::KeysNotInSameHierarchy) + } + } + + pub fn derive_private_key( + &self, + requested_key: &ExtendedPublicKey, + db_tx: &impl WalletStorageReadUnlocked, + ) -> KeyChainResult { + let xpriv = self.derive_account_private_key(db_tx)?; + Self::get_private_key(&xpriv, requested_key) + } + + /// Get the leaf key chain for a particular key purpose + pub fn get_leaf_key_chain(&self, purpose: KeyPurpose) -> &LeafKeySoftChain { + self.sub_chains.get_for(purpose) + } + + /// Get the mutable leaf key chain for a particular key purpose. This is used internally with + /// database persistence done externally. + fn get_leaf_key_chain_mut(&mut self, purpose: KeyPurpose) -> &mut LeafKeySoftChain { + self.sub_chains.mut_for(purpose) + } +} + +impl AccountKeyChains for AccountKeyChainImpl { /// Load the key chain from the database - pub fn load_from_database( + fn load_from_database( chain_config: Arc, db_tx: &impl WalletStorageReadLocked, id: &AccountId, @@ -189,7 +294,7 @@ impl AccountKeyChainImpl { id, )?; - let vrf_chain = VrfKeySoftChain::load_keys( + let vrf_chain = V::load_from_database( chain_config.clone(), db_tx, id, @@ -226,7 +331,7 @@ impl AccountKeyChainImpl { }) .collect(); - Ok(AccountKeyChainImpl { + Ok(Self { chain_config, account_index: account_info.account_index(), account_public_key: pubkey_id, @@ -238,21 +343,43 @@ impl AccountKeyChainImpl { lookahead_size: account_info.lookahead_size().into(), }) } + fn find_public_key(&self, destination: &Destination) -> Option { + for purpose in KeyPurpose::ALL { + let leaf_key = self.get_leaf_key_chain(purpose); + if let Some(xpub) = leaf_key + .get_child_num_from_destination(destination) + .and_then(|child_num| leaf_key.get_derived_xpub(child_num)) + { + return Some(super::FoundPubKey::Hierarchy(xpub.clone())); + } + } + + self.standalone_private_keys + .get(destination) + .map(|(_, acc_public_key)| super::FoundPubKey::Standalone(acc_public_key.clone())) + } + + fn find_multisig_challenge( + &self, + destination: &Destination, + ) -> Option<&ClassicMultisigChallenge> { + self.get_multisig_challenge(destination) + } - pub fn account_index(&self) -> U31 { + fn account_index(&self) -> U31 { self.account_index } - pub fn get_account_id(&self) -> AccountId { + fn get_account_id(&self) -> AccountId { AccountId::new_from_xpub(&self.account_public_key) } - pub fn account_public_key(&self) -> &ExtendedPublicKey { + fn account_public_key(&self) -> &ExtendedPublicKey { self.account_public_key.as_ref() } /// Return the next unused address and don't mark it as issued - pub fn next_unused_address( + fn next_unused_address( &mut self, db_tx: &mut impl WalletStorageWriteLocked, purpose: KeyPurpose, @@ -262,7 +389,7 @@ impl AccountKeyChainImpl { } /// Issue a new address that hasn't been used before - pub fn issue_address( + fn issue_address( &mut self, db_tx: &mut impl WalletStorageWriteLocked, purpose: KeyPurpose, @@ -274,7 +401,7 @@ impl AccountKeyChainImpl { } /// Issue a new derived key that hasn't been used before - pub fn issue_key( + fn issue_key( &mut self, db_tx: &mut impl WalletStorageWriteLocked, purpose: KeyPurpose, @@ -285,18 +412,9 @@ impl AccountKeyChainImpl { Ok(key) } - /// Issue a new derived vrf key that hasn't been used before - pub fn issue_vrf_key( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - ) -> KeyChainResult<(ChildNumber, ExtendedVRFPublicKey)> { - let lookahead_size = self.lookahead_size(); - self.vrf_chain.issue_new(db_tx, lookahead_size) - } - /// Reload the sub chain keys from DB to restore the cache /// Should be called after issuing a new key but not using committing it to the DB - pub fn reload_keys(&mut self, db_tx: &impl WalletStorageReadLocked) -> KeyChainResult<()> { + fn reload_keys(&mut self, db_tx: &impl WalletStorageReadLocked) -> KeyChainResult<()> { self.sub_chains = LeafKeySoftChain::load_leaf_keys( self.chain_config.clone(), &self.account_public_key, @@ -304,7 +422,7 @@ impl AccountKeyChainImpl { &self.get_account_id(), )?; - self.vrf_chain = VrfKeySoftChain::load_keys( + self.vrf_chain = V::load_from_database( self.chain_config.clone(), db_tx, &self.get_account_id(), @@ -314,148 +432,29 @@ impl AccountKeyChainImpl { Ok(()) } - /// Get the private key that corresponds to the provided public key - fn get_private_key( - parent_key: &ExtendedPrivateKey, - requested_key: &ExtendedPublicKey, - ) -> KeyChainResult { - let derived_key = - parent_key.clone().derive_absolute_path(requested_key.get_derivation_path())?; - if &derived_key.to_public_key() == requested_key { - Ok(derived_key) - } else { - Err(KeyChainError::KeysNotInSameHierarchy) - } - } - - /// Get the private key that corresponds to the provided public key - fn get_vrf_private_key( - parent_key: &ExtendedVRFPrivateKey, - requested_key: &ExtendedVRFPublicKey, - ) -> KeyChainResult { - let derived_key = - parent_key.clone().derive_absolute_path(requested_key.get_derivation_path())?; - if &derived_key.to_public_key() == requested_key { - Ok(derived_key) - } else { - Err(KeyChainError::KeysNotInSameHierarchy) - } - } - - pub fn derive_private_key( - &self, - requested_key: &ExtendedPublicKey, - db_tx: &impl WalletStorageReadUnlocked, - ) -> KeyChainResult { - let xpriv = self.derive_account_private_key(db_tx)?; - Self::get_private_key(&xpriv, requested_key) - } - - pub fn get_private_key_for_destination( - &self, - destination: &Destination, - db_tx: &impl WalletStorageReadUnlocked, - ) -> KeyChainResult> { - let xpriv = self.derive_account_private_key(db_tx)?; - for purpose in KeyPurpose::ALL { - let leaf_key = self.get_leaf_key_chain(purpose); - if let Some(xpub) = leaf_key - .get_child_num_from_destination(destination) - .and_then(|child_num| leaf_key.get_derived_xpub(child_num)) - { - return Self::get_private_key(&xpriv, xpub).map(|pk| Some(pk.private_key())); - } - } - - let standalone_pk = self - .standalone_private_keys - .get(destination) - .map(|(_, acc_public_key)| db_tx.get_account_standalone_private_key(acc_public_key)) - .transpose()? - .flatten(); - - Ok(standalone_pk) - } - - pub fn get_multisig_challenge( - &self, - destination: &Destination, - ) -> Option<&ClassicMultisigChallenge> { - self.standalone_multisig_keys - .get(destination) - .map(|multisig| &multisig.challenge) - } - - pub fn get_private_key_for_path( - &self, - path: &DerivationPath, - db_tx: &impl WalletStorageReadUnlocked, - ) -> KeyChainResult { - let xpriv = self.derive_account_private_key(db_tx)?; - xpriv.derive_absolute_path(path).map_err(KeyChainError::Derivation) - } - - pub fn get_vrf_private_key_for_public_key( - &self, - public_key: &VRFPublicKey, - db_tx: &impl WalletStorageReadUnlocked, - ) -> KeyChainResult> { - let xpriv = self.derive_account_private_vrf_key(db_tx)?; - - if let Some(xpub) = self.vrf_chain.get_derived_xpub_from_public_key(public_key) { - return Self::get_vrf_private_key(&xpriv, xpub).map(Option::Some); - } - Ok(None) - } - - pub fn get_private_vrf_key_for_path( - &self, - path: &DerivationPath, - db_tx: &impl WalletStorageReadUnlocked, - ) -> KeyChainResult { - let xpriv = self.derive_account_private_vrf_key(db_tx)?; - xpriv.derive_absolute_path(path).map_err(KeyChainError::Derivation) - } - - /// Get the leaf key chain for a particular key purpose - pub fn get_leaf_key_chain(&self, purpose: KeyPurpose) -> &LeafKeySoftChain { - self.sub_chains.get_for(purpose) - } - - /// Get the mutable leaf key chain for a particular key purpose. This is used internally with - /// database persistence done externally. - fn get_leaf_key_chain_mut(&mut self, purpose: KeyPurpose) -> &mut LeafKeySoftChain { - self.sub_chains.mut_for(purpose) - } - - /// Get the vrf key chain for - pub fn get_vrf_key_chain(&self) -> &VrfKeySoftChain { - &self.vrf_chain - } - // Return true if the provided destination belongs to this key chain - pub fn is_destination_mine(&self, destination: &Destination) -> bool { + fn is_destination_mine(&self, destination: &Destination) -> bool { KeyPurpose::ALL .iter() .any(|p| self.get_leaf_key_chain(*p).is_destination_mine(destination)) } // Return true if the provided public key belongs to this key chain - pub fn is_public_key_mine(&self, public_key: &PublicKey) -> bool { + fn is_public_key_mine(&self, public_key: &PublicKey) -> bool { KeyPurpose::ALL .iter() .any(|purpose| self.get_leaf_key_chain(*purpose).is_public_key_mine(public_key)) } // Return true if the provided public key hash belongs to this key chain - pub fn is_public_key_hash_mine(&self, pubkey_hash: &PublicKeyHash) -> bool { + fn is_public_key_hash_mine(&self, pubkey_hash: &PublicKeyHash) -> bool { KeyPurpose::ALL .iter() .any(|purpose| self.get_leaf_key_chain(*purpose).is_public_key_hash_mine(pubkey_hash)) } // Return true if the provided public key hash is one the standalone added keys - pub fn is_public_key_hash_watched(&self, pubkey_hash: PublicKeyHash) -> bool { + fn is_public_key_hash_watched(&self, pubkey_hash: PublicKeyHash) -> bool { let dest = Destination::PublicKeyHash(pubkey_hash); self.standalone_watch_only_keys.contains_key(&dest) || self.standalone_private_keys.contains_key(&dest) @@ -463,12 +462,89 @@ impl AccountKeyChainImpl { // Return true if the provided public key hash belongs to this key chain // or is one the standalone added keys - pub fn is_public_key_hash_mine_or_watched(&self, pubkey_hash: PublicKeyHash) -> bool { + fn is_public_key_hash_mine_or_watched(&self, pubkey_hash: PublicKeyHash) -> bool { self.is_public_key_hash_mine(&pubkey_hash) || self.is_public_key_hash_watched(pubkey_hash) } + /// Find the corresponding public key for a given public key hash + fn get_public_key_from_public_key_hash( + &self, + pubkey_hash: &PublicKeyHash, + ) -> Option { + KeyPurpose::ALL.iter().find_map(|purpose| { + self.get_leaf_key_chain(*purpose) + .get_public_key_from_public_key_hash(pubkey_hash) + }) + } + + /// Derive addresses until there are lookahead unused ones + fn top_up_all(&mut self, db_tx: &mut impl WalletStorageWriteLocked) -> KeyChainResult<()> { + let lookahead_size = self.lookahead_size(); + KeyPurpose::ALL.iter().try_for_each(|purpose| { + self.get_leaf_key_chain_mut(*purpose).top_up(db_tx, lookahead_size) + })?; + self.vrf_chain.top_up(lookahead_size) + } + + fn lookahead_size(&self) -> u32 { + *self.lookahead_size + } + + /// Marks a public key as being used. Returns true if a key was found and set to used. + fn mark_public_key_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + public_key: &PublicKey, + ) -> KeyChainResult { + let lookahead_size = self.lookahead_size(); + for purpose in KeyPurpose::ALL { + let leaf_keys = self.get_leaf_key_chain_mut(purpose); + if leaf_keys.mark_pubkey_as_used(db_tx, public_key, lookahead_size)? { + return Ok(true); + } + } + Ok(false) + } + + fn mark_public_key_hash_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + pub_key_hash: &PublicKeyHash, + ) -> KeyChainResult { + let lookahead_size = self.lookahead_size(); + for purpose in KeyPurpose::ALL { + let leaf_keys = self.get_leaf_key_chain_mut(purpose); + if leaf_keys.mark_pub_key_hash_as_used(db_tx, pub_key_hash, lookahead_size)? { + return Ok(true); + } + } + Ok(false) + } + + /// Marks a vrf public key as being used. Returns true if a key was found and set to used. + fn mark_vrf_public_key_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + public_key: &VRFPublicKey, + ) -> KeyChainResult { + let lookahead_size = self.lookahead_size(); + if self.vrf_chain.mark_pubkey_as_used(db_tx, public_key, lookahead_size)? { + return Ok(true); + } + Ok(false) + } + + fn get_multisig_challenge( + &self, + destination: &Destination, + ) -> Option<&ClassicMultisigChallenge> { + self.standalone_multisig_keys + .get(destination) + .map(|multisig| &multisig.challenge) + } + /// Add, rename or delete a label for a standalone address not from the keys derived from this account - pub fn standalone_address_label_rename( + fn standalone_address_label_rename( &mut self, db_tx: &mut impl WalletStorageWriteLocked, new_address: Destination, @@ -495,7 +571,7 @@ impl AccountKeyChainImpl { } /// Adds a new public key hash to be watched, standalone from the keys derived from this account - pub fn add_standalone_watch_only_address( + fn add_standalone_watch_only_address( &mut self, db_tx: &mut impl WalletStorageWriteLocked, new_address: PublicKeyHash, @@ -517,7 +593,7 @@ impl AccountKeyChainImpl { } /// Adds a new private key to be watched, standalone from the keys derived from this account - pub fn add_standalone_private_key( + fn add_standalone_private_key( &mut self, db_tx: &mut impl WalletStorageWriteUnlocked, new_private_key: PrivateKey, @@ -542,7 +618,7 @@ impl AccountKeyChainImpl { } /// Adds a multisig to be watched - pub fn add_standalone_multisig( + fn add_standalone_multisig( &mut self, db_tx: &mut impl WalletStorageWriteLocked, challenge: ClassicMultisigChallenge, @@ -564,79 +640,11 @@ impl AccountKeyChainImpl { Ok(multisig_pkh) } - /// Find the corresponding public key for a given public key hash - pub fn get_public_key_from_public_key_hash( - &self, - pubkey_hash: &PublicKeyHash, - ) -> Option { - KeyPurpose::ALL.iter().find_map(|purpose| { - self.get_leaf_key_chain(*purpose) - .get_public_key_from_public_key_hash(pubkey_hash) - }) - } - - /// Derive addresses until there are lookahead unused ones - pub fn top_up_all(&mut self, db_tx: &mut impl WalletStorageWriteLocked) -> KeyChainResult<()> { - let lookahead_size = self.lookahead_size(); - KeyPurpose::ALL.iter().try_for_each(|purpose| { - self.get_leaf_key_chain_mut(*purpose).top_up(db_tx, lookahead_size) - })?; - self.vrf_chain.top_up(lookahead_size) - } - - pub fn lookahead_size(&self) -> u32 { - *self.lookahead_size - } - - /// Marks a public key as being used. Returns true if a key was found and set to used. - pub fn mark_public_key_as_used( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - public_key: &PublicKey, - ) -> KeyChainResult { - let lookahead_size = self.lookahead_size(); - for purpose in KeyPurpose::ALL { - let leaf_keys = self.get_leaf_key_chain_mut(purpose); - if leaf_keys.mark_pubkey_as_used(db_tx, public_key, lookahead_size)? { - return Ok(true); - } - } - Ok(false) - } - - pub fn mark_public_key_hash_as_used( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - pub_key_hash: &PublicKeyHash, - ) -> KeyChainResult { - let lookahead_size = self.lookahead_size(); - for purpose in KeyPurpose::ALL { - let leaf_keys = self.get_leaf_key_chain_mut(purpose); - if leaf_keys.mark_pub_key_hash_as_used(db_tx, pub_key_hash, lookahead_size)? { - return Ok(true); - } - } - Ok(false) - } - - /// Marks a vrf public key as being used. Returns true if a key was found and set to used. - pub fn mark_vrf_public_key_as_used( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - public_key: &VRFPublicKey, - ) -> KeyChainResult { - let lookahead_size = self.lookahead_size(); - if self.vrf_chain.mark_pubkey_as_used(db_tx, public_key, lookahead_size)? { - return Ok(true); - } - Ok(false) - } - - pub fn get_all_issued_addresses(&self) -> BTreeMap> { + fn get_all_issued_addresses(&self) -> BTreeMap> { self.get_leaf_key_chain(KeyPurpose::ReceiveFunds).get_all_issued_addresses() } - pub fn get_all_standalone_addresses(&self) -> StandaloneAddresses { + fn get_all_standalone_addresses(&self) -> StandaloneAddresses { StandaloneAddresses { watch_only_addresses: self.standalone_watch_only_keys.clone().into_iter().collect(), multisig_addresses: self.standalone_multisig_keys.clone().into_iter().collect(), @@ -654,7 +662,7 @@ impl AccountKeyChainImpl { } } - pub fn get_all_standalone_address_details( + fn get_all_standalone_address_details( &self, address: Destination, ) -> Option<(Destination, StandaloneAddressDetails)> { @@ -670,43 +678,68 @@ impl AccountKeyChainImpl { } } - pub fn get_all_issued_vrf_public_keys( + fn get_addresses_usage_state(&self) -> &KeychainUsageState { + self.get_leaf_key_chain(KeyPurpose::ReceiveFunds).usage_state() + } +} + +impl VRFAccountKeyChains for AccountKeyChainImpl { + /// Issue a new derived vrf key that hasn't been used before + fn issue_vrf_key( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + ) -> KeyChainResult<(ChildNumber, ExtendedVRFPublicKey)> { + let lookahead_size = self.lookahead_size(); + self.vrf_chain.issue_new(db_tx, lookahead_size) + } + + fn get_vrf_private_key_for_public_key( + &self, + public_key: &VRFPublicKey, + db_tx: &impl WalletStorageReadUnlocked, + ) -> KeyChainResult> { + let xpriv = self.derive_account_private_vrf_key(db_tx)?; + + if let Some(xpub) = self.vrf_chain.get_derived_xpub_from_public_key(public_key) { + return Self::get_vrf_private_key(&xpriv, xpub).map(Option::Some); + } + Ok(None) + } + + fn get_all_issued_vrf_public_keys( &self, ) -> BTreeMap, bool)> { self.vrf_chain.get_all_issued_keys() } - pub fn get_legacy_vrf_public_key(&self) -> Address { + fn get_legacy_vrf_public_key(&self) -> Address { self.vrf_chain.get_legacy_vrf_public_key() } - pub fn get_addresses_usage_state(&self) -> &KeychainUsageState { - self.get_leaf_key_chain(KeyPurpose::ReceiveFunds).usage_state() - } -} - -impl AccountKeyChains for AccountKeyChainImpl { - fn find_public_key(&self, destination: &Destination) -> Option { + fn get_private_key_for_destination( + &self, + destination: &Destination, + db_tx: &impl WalletStorageReadUnlocked, + ) -> KeyChainResult> { + let xpriv = self.derive_account_private_key(db_tx)?; for purpose in KeyPurpose::ALL { let leaf_key = self.get_leaf_key_chain(purpose); if let Some(xpub) = leaf_key .get_child_num_from_destination(destination) .and_then(|child_num| leaf_key.get_derived_xpub(child_num)) { - return Some(super::FoundPubKey::Hierarchy(xpub.clone())); + return Self::get_private_key(&xpriv, xpub).map(|pk| Some(pk.private_key())); } } - self.standalone_private_keys + let standalone_pk = self + .standalone_private_keys .get(destination) - .map(|(_, acc_public_key)| super::FoundPubKey::Standalone(acc_public_key.clone())) - } + .map(|(_, acc_public_key)| db_tx.get_account_standalone_private_key(acc_public_key)) + .transpose()? + .flatten(); - fn find_multisig_challenge( - &self, - destination: &Destination, - ) -> Option<&ClassicMultisigChallenge> { - self.get_multisig_challenge(destination) + Ok(standalone_pk) } } diff --git a/wallet/src/key_chain/master_key_chain/mod.rs b/wallet/src/key_chain/master_key_chain/mod.rs index 60fe1e4442..a93eb60b92 100644 --- a/wallet/src/key_chain/master_key_chain/mod.rs +++ b/wallet/src/key_chain/master_key_chain/mod.rs @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::key_chain::account_key_chain::AccountKeyChainImpl; use crate::key_chain::{KeyChainError, KeyChainResult, DEFAULT_KEY_KIND}; use common::chain::ChainConfig; use crypto::key::extended::ExtendedPrivateKey; @@ -27,7 +26,7 @@ use wallet_storage::{ }; use wallet_types::seed_phrase::{SerializableSeedPhrase, StoreSeedPhrase}; -use super::DEFAULT_VRF_KEY_KIND; +use super::{AccountKeyChainImplSoftware, DEFAULT_VRF_KEY_KIND}; #[derive(Clone, Debug)] pub struct MasterKeyChain { @@ -135,10 +134,10 @@ impl MasterKeyChain { db_tx: &mut impl WalletStorageWriteUnlocked, account_index: U31, lookahead_size: u32, - ) -> KeyChainResult { + ) -> KeyChainResult { let root_key = Self::load_root_key(db_tx)?; let root_vrf_key = Self::load_root_vrf_key(db_tx)?; - AccountKeyChainImpl::new_from_root_key( + AccountKeyChainImplSoftware::new_from_root_key( self.chain_config.clone(), db_tx, root_key, diff --git a/wallet/src/key_chain/mod.rs b/wallet/src/key_chain/mod.rs index a3e0dc4df0..a18faa1f29 100644 --- a/wallet/src/key_chain/mod.rs +++ b/wallet/src/key_chain/mod.rs @@ -32,24 +32,34 @@ mod master_key_chain; mod vrf_key_chain; mod with_purpose; +use std::collections::BTreeMap; +use std::sync::Arc; + pub use account_key_chain::AccountKeyChainImpl; use common::chain::classic_multisig::ClassicMultisigChallenge; use crypto::key::hdkd::u31::U31; -use crypto::key::PublicKey; -use crypto::vrf::VRFKeyKind; +use crypto::key::{PrivateKey, PublicKey}; +use crypto::vrf::{ExtendedVRFPrivateKey, ExtendedVRFPublicKey, VRFKeyKind, VRFPublicKey}; pub use master_key_chain::MasterKeyChain; -use common::address::pubkeyhash::PublicKeyHashError; -use common::address::{AddressError, RpcAddress}; +use common::address::pubkeyhash::{PublicKeyHash, PublicKeyHashError}; +use common::address::{Address, AddressError, RpcAddress}; use common::chain::config::BIP44_PATH; use common::chain::{ChainConfig, Destination}; use crypto::key::extended::{ExtendedKeyKind, ExtendedPublicKey}; use crypto::key::hdkd::child_number::ChildNumber; use crypto::key::hdkd::derivable::DerivationError; use crypto::key::hdkd::derivation_path::DerivationPath; +use wallet_storage::{ + WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteLocked, + WalletStorageWriteUnlocked, +}; use wallet_types::account_id::AccountPublicKey; +use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; use wallet_types::keys::{KeyPurpose, KeyPurposeError}; -use wallet_types::AccountId; +use wallet_types::{AccountId, AccountInfo, KeychainUsageState}; + +use self::vrf_key_chain::{EmptyVrfKeyChain, VrfKeySoftChain}; /// The number of nodes in a BIP44 path pub const BIP44_PATH_LENGTH: usize = 5; @@ -122,13 +132,175 @@ impl FoundPubKey { } } -pub trait AccountKeyChains { +pub type AccountKeyChainImplSoftware = AccountKeyChainImpl; +pub type AccountKeyChainImplHardware = AccountKeyChainImpl; + +pub trait AccountKeyChains +where + Self: Sized, +{ + fn load_from_database( + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + id: &AccountId, + account_info: &AccountInfo, + ) -> KeyChainResult; + fn find_public_key(&self, destination: &Destination) -> Option; fn find_multisig_challenge( &self, destination: &Destination, ) -> Option<&ClassicMultisigChallenge>; + + fn account_index(&self) -> U31; + + fn get_account_id(&self) -> AccountId; + + fn account_public_key(&self) -> &ExtendedPublicKey; + + /// Return the next unused address and don't mark it as issued + fn next_unused_address( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + purpose: KeyPurpose, + ) -> KeyChainResult<(ChildNumber, Address)>; + + /// Issue a new address that hasn't been used before + fn issue_address( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + purpose: KeyPurpose, + ) -> KeyChainResult<(ChildNumber, Address)>; + + /// Issue a new derived key that hasn't been used before + fn issue_key( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + purpose: KeyPurpose, + ) -> KeyChainResult; + + /// Reload the sub chain keys from DB to restore the cache + /// Should be called after issuing a new key but not using committing it to the DB + fn reload_keys(&mut self, db_tx: &impl WalletStorageReadLocked) -> KeyChainResult<()>; + + // Return true if the provided destination belongs to this key chain + fn is_destination_mine(&self, destination: &Destination) -> bool; + + // Return true if the provided public key belongs to this key chain + fn is_public_key_mine(&self, public_key: &PublicKey) -> bool; + + // Return true if the provided public key hash belongs to this key chain + fn is_public_key_hash_mine(&self, pubkey_hash: &PublicKeyHash) -> bool; + + // Return true if the provided public key hash is one the standalone added keys + fn is_public_key_hash_watched(&self, pubkey_hash: PublicKeyHash) -> bool; + + // Return true if the provided public key hash belongs to this key chain + // or is one the standalone added keys + fn is_public_key_hash_mine_or_watched(&self, pubkey_hash: PublicKeyHash) -> bool; + + /// Find the corresponding public key for a given public key hash + fn get_public_key_from_public_key_hash(&self, pubkey_hash: &PublicKeyHash) + -> Option; + + /// Derive addresses until there are lookahead unused ones + fn top_up_all(&mut self, db_tx: &mut impl WalletStorageWriteLocked) -> KeyChainResult<()>; + + fn lookahead_size(&self) -> u32; + + /// Marks a public key as being used. Returns true if a key was found and set to used. + fn mark_public_key_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + public_key: &PublicKey, + ) -> KeyChainResult; + + fn mark_public_key_hash_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + pub_key_hash: &PublicKeyHash, + ) -> KeyChainResult; + + /// Marks a vrf public key as being used. Returns true if a key was found and set to used. + fn mark_vrf_public_key_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + public_key: &VRFPublicKey, + ) -> KeyChainResult; + + fn get_multisig_challenge( + &self, + destination: &Destination, + ) -> Option<&ClassicMultisigChallenge>; + + /// Add, rename or delete a label for a standalone address not from the keys derived from this account + fn standalone_address_label_rename( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + new_address: Destination, + new_label: Option, + ) -> KeyChainResult<()>; + + /// Adds a new public key hash to be watched, standalone from the keys derived from this account + fn add_standalone_watch_only_address( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + new_address: PublicKeyHash, + label: Option, + ) -> KeyChainResult<()>; + + /// Adds a new private key to be watched, standalone from the keys derived from this account + fn add_standalone_private_key( + &mut self, + db_tx: &mut impl WalletStorageWriteUnlocked, + new_private_key: PrivateKey, + label: Option, + ) -> KeyChainResult<()>; + + /// Adds a multisig to be watched + fn add_standalone_multisig( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + challenge: ClassicMultisigChallenge, + label: Option, + ) -> KeyChainResult; + + fn get_all_issued_addresses(&self) -> BTreeMap>; + + fn get_all_standalone_addresses(&self) -> StandaloneAddresses; + + fn get_all_standalone_address_details( + &self, + address: Destination, + ) -> Option<(Destination, StandaloneAddressDetails)>; + + fn get_addresses_usage_state(&self) -> &KeychainUsageState; +} + +pub trait VRFAccountKeyChains { + fn issue_vrf_key( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + ) -> KeyChainResult<(ChildNumber, ExtendedVRFPublicKey)>; + + fn get_vrf_private_key_for_public_key( + &self, + public_key: &VRFPublicKey, + db_tx: &impl WalletStorageReadUnlocked, + ) -> KeyChainResult>; + + fn get_all_issued_vrf_public_keys( + &self, + ) -> BTreeMap, bool)>; + + fn get_legacy_vrf_public_key(&self) -> Address; + + fn get_private_key_for_destination( + &self, + destination: &Destination, + db_tx: &impl WalletStorageReadUnlocked, + ) -> KeyChainResult>; } /// Result type used for the key chain diff --git a/wallet/src/key_chain/tests.rs b/wallet/src/key_chain/tests.rs index f129e74bbd..821cc5b60f 100644 --- a/wallet/src/key_chain/tests.rs +++ b/wallet/src/key_chain/tests.rs @@ -172,7 +172,7 @@ fn key_lookahead(#[case] purpose: KeyPurpose) { drop(key_chain); - let mut key_chain = AccountKeyChainImpl::load_from_database( + let mut key_chain = AccountKeyChainImplSoftware::load_from_database( Arc::clone(&chain_config), &db.transaction_ro().unwrap(), &id, @@ -240,7 +240,7 @@ fn top_up_and_lookahead(#[case] purpose: KeyPurpose) { drop(key_chain); - let mut key_chain = AccountKeyChainImpl::load_from_database( + let mut key_chain = AccountKeyChainImplSoftware::load_from_database( chain_config, &db.transaction_ro().unwrap(), &id, diff --git a/wallet/src/key_chain/vrf_key_chain/mod.rs b/wallet/src/key_chain/vrf_key_chain/mod.rs index 26b7f63928..b11da1f6bd 100644 --- a/wallet/src/key_chain/vrf_key_chain/mod.rs +++ b/wallet/src/key_chain/vrf_key_chain/mod.rs @@ -99,72 +99,6 @@ impl VrfKeySoftChain { Ok(vrf_chain) } - pub fn load_keys( - chain_config: Arc, - db_tx: &impl WalletStorageReadLocked, - id: &AccountId, - lookahead_size: u32, - ) -> KeyChainResult { - let AccountVrfKeys { - account_vrf_key, - legacy_vrf_key, - } = db_tx - .get_account_vrf_public_keys(id)? - .ok_or(KeyChainError::CouldNotLoadKeyChain)?; - - let usage = db_tx - .get_vrf_keychain_usage_state(id)? - .ok_or(KeyChainError::CouldNotLoadKeyChain)?; - - let public_keys = (0..=usage.last_issued().map_or(0, |issued| issued.into_u32())) - .map(|index| { - let child_number = ChildNumber::from_index_with_hardened_bit(index); - Ok(( - child_number, - account_vrf_key.clone().derive_child(child_number)?, - )) - }) - .collect::>()?; - - VrfKeySoftChain::new_from_parts( - chain_config.clone(), - id.clone(), - account_vrf_key, - public_keys, - usage, - legacy_vrf_key, - lookahead_size, - ) - } - - pub fn get_account_vrf_public_key(&self) -> &ExtendedVRFPublicKey { - &self.parent_pubkey - } - - /// Issue a new key - pub fn issue_new( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - lookahead_size: u32, - ) -> KeyChainResult<(ChildNumber, ExtendedVRFPublicKey)> { - let new_issued_index = self.get_new_issued_index(lookahead_size)?; - - let key = self.derive_and_add_key(new_issued_index)?; - - let index = ChildNumber::from_normal(new_issued_index); - - logging::log::debug!( - "new vrf address: {}, index: {}", - Address::new(&self.chain_config, key.clone().into_public_key()).expect("addressable"), - new_issued_index, - ); - - self.usage_state.increment_up_to_last_issued(new_issued_index); - self.save_usage_state(db_tx)?; - - Ok((index, key)) - } - /// Persist the usage state to the database pub fn save_usage_state( &self, @@ -248,35 +182,6 @@ impl VrfKeySoftChain { self.derived_public_keys.keys().last().copied() } - /// Derive up `lookahead_size` keys starting from the last used index. If the gap from the last - /// used key to the last derived key is already `lookahead_size`, this method has no effect - pub fn top_up(&mut self, lookahead_size: u32) -> KeyChainResult<()> { - // Find how many keys to derive - let starting_index = match self.get_last_derived_index() { - None => 0, - Some(last_derived_index) => last_derived_index.get_index().into_u32() + 1, - }; - - let up_to_index = match self.last_used() { - None => lookahead_size, - Some(last_used) => last_used.into_u32() + lookahead_size + 1, - }; - - // Derive the needed keys (the loop can be ) - for i in starting_index..up_to_index { - if let Some(index) = U31::from_u32(i) { - self.derive_and_add_key(index)?; - } - } - - Ok(()) - } - - pub fn is_public_key_mine(&self, public_key: &VRFPublicKey) -> bool { - self.public_key_to_index.contains_key(public_key) - || public_key == self.legacy_pubkey.public_key() - } - pub fn get_derived_xpub_from_public_key( &self, pub_key: &VRFPublicKey, @@ -308,20 +213,6 @@ impl VrfKeySoftChain { self.top_up(lookahead_size) } - pub fn mark_pubkey_as_used( - &mut self, - db_tx: &mut impl WalletStorageWriteLocked, - public_key: &VRFPublicKey, - lookahead_size: u32, - ) -> KeyChainResult { - if let Some(child_num) = self.get_child_num_from_public_key(public_key) { - self.mark_child_key_as_used(db_tx, child_num, lookahead_size)?; - Ok(true) - } else { - Ok(false) - } - } - /// Get the index of the last used key or None if no key is used pub fn last_used(&self) -> Option { self.usage_state.last_used() @@ -337,6 +228,30 @@ impl VrfKeySoftChain { .expect("addressable") } + /// Issue a new key + pub fn issue_new( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + lookahead_size: u32, + ) -> KeyChainResult<(ChildNumber, ExtendedVRFPublicKey)> { + let new_issued_index = self.get_new_issued_index(lookahead_size)?; + + let key = self.derive_and_add_key(new_issued_index)?; + + let index = ChildNumber::from_normal(new_issued_index); + + logging::log::debug!( + "new vrf address: {}, index: {}", + Address::new(&self.chain_config, key.clone().into_public_key()).expect("addressable"), + new_issued_index, + ); + + self.usage_state.increment_up_to_last_issued(new_issued_index); + self.save_usage_state(db_tx)?; + + Ok((index, key)) + } + pub fn get_all_issued_keys(&self) -> BTreeMap, bool)> { let last_issued = match self.usage_state.last_issued() { Some(index) => index, @@ -361,8 +276,131 @@ impl VrfKeySoftChain { }) .collect() } +} + +pub trait VrfKeyChain +where + Self: Sized, +{ + fn load_from_database( + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + id: &AccountId, + lookahead_size: u32, + ) -> KeyChainResult; + + /// Derive up `lookahead_size` keys starting from the last used index. If the gap from the last + /// used key to the last derived key is already `lookahead_size`, this method has no effect + fn top_up(&mut self, lookahead_size: u32) -> KeyChainResult<()>; + + fn mark_pubkey_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + public_key: &VRFPublicKey, + lookahead_size: u32, + ) -> KeyChainResult; +} - pub fn usage_state(&self) -> &KeychainUsageState { - &self.usage_state +impl VrfKeyChain for VrfKeySoftChain { + fn load_from_database( + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + id: &AccountId, + lookahead_size: u32, + ) -> KeyChainResult { + let AccountVrfKeys { + account_vrf_key, + legacy_vrf_key, + } = db_tx + .get_account_vrf_public_keys(id)? + .ok_or(KeyChainError::CouldNotLoadKeyChain)?; + + let usage = db_tx + .get_vrf_keychain_usage_state(id)? + .ok_or(KeyChainError::CouldNotLoadKeyChain)?; + + let public_keys = (0..=usage.last_issued().map_or(0, |issued| issued.into_u32())) + .map(|index| { + let child_number = ChildNumber::from_index_with_hardened_bit(index); + Ok(( + child_number, + account_vrf_key.clone().derive_child(child_number)?, + )) + }) + .collect::>()?; + + VrfKeySoftChain::new_from_parts( + chain_config.clone(), + id.clone(), + account_vrf_key, + public_keys, + usage, + legacy_vrf_key, + lookahead_size, + ) + } + + /// Derive up `lookahead_size` keys starting from the last used index. If the gap from the last + /// used key to the last derived key is already `lookahead_size`, this method has no effect + fn top_up(&mut self, lookahead_size: u32) -> KeyChainResult<()> { + // Find how many keys to derive + let starting_index = match self.get_last_derived_index() { + None => 0, + Some(last_derived_index) => last_derived_index.get_index().into_u32() + 1, + }; + + let up_to_index = match self.last_used() { + None => lookahead_size, + Some(last_used) => last_used.into_u32() + lookahead_size + 1, + }; + + // Derive the needed keys (the loop can be ) + for i in starting_index..up_to_index { + if let Some(index) = U31::from_u32(i) { + self.derive_and_add_key(index)?; + } + } + + Ok(()) + } + + fn mark_pubkey_as_used( + &mut self, + db_tx: &mut impl WalletStorageWriteLocked, + public_key: &VRFPublicKey, + lookahead_size: u32, + ) -> KeyChainResult { + if let Some(child_num) = self.get_child_num_from_public_key(public_key) { + self.mark_child_key_as_used(db_tx, child_num, lookahead_size)?; + Ok(true) + } else { + Ok(false) + } + } +} + +pub struct EmptyVrfKeyChain; + +impl VrfKeyChain for EmptyVrfKeyChain { + fn load_from_database( + _chain_config: Arc, + _db_tx: &impl WalletStorageReadLocked, + _id: &AccountId, + _lookahead_size: u32, + ) -> KeyChainResult { + Ok(Self {}) + } + + fn top_up(&mut self, _lookahead_size: u32) -> KeyChainResult<()> { + Ok(()) + } + + fn mark_pubkey_as_used( + &mut self, + _db_tx: &mut impl WalletStorageWriteLocked, + _public_key: &VRFPublicKey, + _lookahead_size: u32, + ) -> KeyChainResult { + Ok(false) } } diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 05b0927f71..6a303893cb 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -24,8 +24,10 @@ use common::chain::{ ChainConfig, Destination, SignedTransactionIntent, SignedTransactionIntentError, Transaction, }; use crypto::key::hdkd::{derivable::DerivationError, u31::U31}; -use wallet_storage::{WalletStorageReadUnlocked, WalletStorageWriteUnlocked}; -use wallet_types::signature_status::SignatureStatus; +use wallet_storage::{ + WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, +}; +use wallet_types::{signature_status::SignatureStatus, AccountId}; use crate::{ key_chain::{AccountKeyChains, KeyChainError}, @@ -100,6 +102,7 @@ pub trait Signer { pub trait SignerProvider { type S: Signer; + type K: AccountKeyChains; fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S; @@ -109,5 +112,12 @@ pub trait SignerProvider { account_index: U31, name: Option, db_tx: &mut impl WalletStorageWriteUnlocked, - ) -> WalletResult; + ) -> WalletResult>; + + fn load_account_from_database( + &self, + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + id: &AccountId, + ) -> WalletResult>; } diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index 5d71f0911c..61362f2452 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -48,10 +48,13 @@ use wallet_storage::{ StoreTxRwUnlocked, WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, }; -use wallet_types::{seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus}; +use wallet_types::{seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, AccountId}; use crate::{ - key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}, + key_chain::{ + make_account_path, AccountKeyChainImplSoftware, AccountKeyChains, FoundPubKey, + MasterKeyChain, + }, Account, WalletResult, }; @@ -444,6 +447,7 @@ impl SoftwareSignerProvider { impl SignerProvider for SoftwareSignerProvider { type S = SoftwareSigner; + type K = AccountKeyChainImplSoftware; fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S { SoftwareSigner::new(chain_config, account_index) @@ -455,7 +459,7 @@ impl SignerProvider for SoftwareSignerProvider { next_account_index: U31, name: Option, db_tx: &mut impl WalletStorageWriteUnlocked, - ) -> WalletResult { + ) -> WalletResult> { let lookahead_size = db_tx.get_lookahead_size()?; let account_key_chain = self.master_key_chain.create_account_key_chain( db_tx, @@ -465,6 +469,15 @@ impl SignerProvider for SoftwareSignerProvider { Account::new(chain_config, db_tx, account_key_chain, name) } + + fn load_account_from_database( + &self, + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + id: &AccountId, + ) -> WalletResult> { + Account::load_from_database(chain_config, db_tx, id) + } } #[cfg(test)] diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index dea711549f..1d26d8d4d7 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -13,7 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{cell::RefCell, collections::BTreeMap, rc::Rc, sync::Arc}; +use std::{ + collections::BTreeMap, + sync::{Arc, Mutex}, +}; use common::{ address::Address, @@ -35,7 +38,8 @@ use common::{ }; use crypto::key::{ extended::{ExtendedPrivateKey, ExtendedPublicKey}, - hdkd::{derivable::Derivable, u31::U31}, + hdkd::{chain_code::ChainCode, derivable::Derivable, u31::U31}, + secp256k1::{extended_keys::Secp256k1ExtendedPublicKey, Secp256k1PublicKey}, PrivateKey, Signature, }; use itertools::Itertools; @@ -46,11 +50,16 @@ use trezor_client::{ protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, Trezor, }; -use wallet_storage::{WalletStorageReadUnlocked, WalletStorageWriteUnlocked}; -use wallet_types::signature_status::SignatureStatus; +use wallet_storage::{ + WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, +}; +use wallet_types::{signature_status::SignatureStatus, AccountId}; use crate::{ - key_chain::{make_account_path, AccountKeyChains, FoundPubKey, MasterKeyChain}, + key_chain::{ + make_account_path, AccountKeyChainImplHardware, AccountKeyChains, FoundPubKey, + MasterKeyChain, + }, Account, WalletResult, }; @@ -59,14 +68,14 @@ use super::{Signer, SignerError, SignerProvider, SignerResult}; pub struct TrezorSigner { chain_config: Arc, account_index: U31, - client: Rc>, + client: Arc>, } impl TrezorSigner { pub fn new( chain_config: Arc, account_index: U31, - client: Rc>, + client: Arc>, ) -> Self { Self { chain_config, @@ -210,8 +219,12 @@ impl Signer for TrezorSigner { let outputs = self.to_trezor_output_msgs(&ptx); let utxos = to_trezor_utxo_msgs(&ptx, key_chain); - let new_signatures = - self.client.borrow_mut().mintlayer_sign_tx(inputs, outputs, utxos).expect(""); + let new_signatures = self + .client + .lock() + .expect("") + .mintlayer_sign_tx(inputs, outputs, utxos) + .expect(""); let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); @@ -418,7 +431,7 @@ fn get_private_key( #[derive(Clone)] pub struct TrezorSignerProvider { - client: Rc>, + client: Arc>, } impl std::fmt::Debug for TrezorSignerProvider { @@ -430,13 +443,14 @@ impl std::fmt::Debug for TrezorSignerProvider { impl TrezorSignerProvider { pub fn new(client: Trezor) -> Self { Self { - client: Rc::new(RefCell::new(client)), + client: Arc::new(Mutex::new(client)), } } } impl SignerProvider for TrezorSignerProvider { type S = TrezorSigner; + type K = AccountKeyChainImplHardware; fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S { TrezorSigner::new(chain_config, account_index, self.client.clone()) @@ -444,12 +458,52 @@ impl SignerProvider for TrezorSignerProvider { fn make_new_account( &mut self, - _chain_config: Arc, - _account_index: U31, - _name: Option, - _db_tx: &mut impl WalletStorageWriteUnlocked, - ) -> WalletResult { - unimplemented!("hehe"); + chain_config: Arc, + account_index: U31, + name: Option, + db_tx: &mut impl WalletStorageWriteUnlocked, + ) -> WalletResult> { + let derivation_path = make_account_path(&chain_config, account_index); + let account_path = + derivation_path.as_slice().iter().map(|c| c.into_encoded_index()).collect(); + + let xpub = self + .client + .lock() + .expect("") + .mintlayer_get_public_key(account_path) + .expect("") + .ok() + .expect(""); + + let chain_code = ChainCode::from(xpub.chain_code.0); + let account_pubkey = Secp256k1ExtendedPublicKey::from_hardware_wallet( + derivation_path, + chain_code, + Secp256k1PublicKey::from_bytes(&xpub.public_key.serialize()).expect(""), + ); + let account_pubkey = ExtendedPublicKey::from_hardware_public_key(account_pubkey); + + let lookahead_size = db_tx.get_lookahead_size()?; + + let key_chain = AccountKeyChainImplHardware::new_from_hardware_key( + chain_config.clone(), + db_tx, + account_pubkey, + account_index, + lookahead_size, + )?; + + Account::new(chain_config, db_tx, key_chain, name) + } + + fn load_account_from_database( + &self, + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + id: &AccountId, + ) -> WalletResult> { + Account::load_from_database(chain_config, db_tx, id) } } diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 690a9e88f8..096d6d3630 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -14,7 +14,6 @@ // limitations under the License. use std::ops::{Add, Div, Mul, Sub}; -use std::{cell::RefCell, rc::Rc}; use super::*; use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; @@ -135,7 +134,7 @@ fn sign_transaction(#[case] seed: Seed) { let mut signer = TrezorSigner::new( chain_config.clone(), DEFAULT_ACCOUNT_INDEX, - Rc::new(RefCell::new(client)), + Arc::new(Mutex::new(client)), ); let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 19d1c90548..24c621b4bf 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -24,8 +24,8 @@ use crate::account::{ UtxoSelectorError, }; use crate::key_chain::{ - make_account_path, make_path_to_vrf_key, KeyChainError, MasterKeyChain, LOOKAHEAD_SIZE, - VRF_INDEX, + make_account_path, make_path_to_vrf_key, AccountKeyChainImplSoftware, KeyChainError, + MasterKeyChain, LOOKAHEAD_SIZE, VRF_INDEX, }; use crate::send_request::{ make_issue_token_outputs, IssueNftArguments, SelectedInputs, StakePoolDataArguments, @@ -263,12 +263,12 @@ pub enum WalletPoolsFilter { Stake, } -pub struct Wallet { +pub struct Wallet { chain_config: Arc, db: Store, - accounts: BTreeMap, + accounts: BTreeMap>, latest_median_time: BlockTimestamp, - next_unused_account: (U31, Account), + next_unused_account: (U31, Account), signer_provider: P, } @@ -424,7 +424,11 @@ where /// Migrate the wallet DB from version 4 to version 5 /// * set vrf key_chain usage - fn migration_v5(db: &Store, chain_config: Arc) -> WalletResult<()> { + fn migration_v5( + db: &Store, + chain_config: Arc, + signer_provider: &P, + ) -> WalletResult<()> { let mut db_tx = db.transaction_rw_unlocked(None)?; for (id, info) in db_tx.get_accounts_info()? { @@ -453,7 +457,11 @@ where )?; } - Self::reset_wallet_transactions_and_load(chain_config.clone(), &mut db_tx)?; + Self::reset_wallet_transactions_and_load( + chain_config.clone(), + &mut db_tx, + signer_provider, + )?; db_tx.set_storage_version(WALLET_VERSION_V5)?; db_tx.commit()?; @@ -543,7 +551,7 @@ where } WALLET_VERSION_V4 => { pre_migration(WALLET_VERSION_V4)?; - Self::migration_v5(db, chain_config.clone())?; + Self::migration_v5(db, chain_config.clone(), &signer_provider)?; } WALLET_VERSION_V5 => { pre_migration(WALLET_VERSION_V5)?; @@ -591,10 +599,11 @@ where fn migrate_hot_to_cold_wallet( db: &Store, chain_config: Arc, + signer_provider: &P, ) -> WalletResult<()> { let mut db_tx = db.transaction_rw(None)?; db_tx.set_wallet_type(WalletType::Cold)?; - Self::reset_wallet_transactions_and_load(chain_config, &mut db_tx)?; + Self::reset_wallet_transactions_and_load(chain_config, &mut db_tx, signer_provider)?; db_tx.commit()?; Ok(()) } @@ -603,12 +612,13 @@ where wallet_type: WalletType, db: &Store, chain_config: Arc, + signer_provider: &P, ) -> Result<(), WalletError> { let current_wallet_type = db.transaction_ro()?.get_wallet_type()?; match (current_wallet_type, wallet_type) { (WalletType::Cold, WalletType::Hot) => Self::migrate_cold_to_hot_wallet(db)?, (WalletType::Hot, WalletType::Cold) => { - Self::migrate_hot_to_cold_wallet(db, chain_config)? + Self::migrate_hot_to_cold_wallet(db, chain_config, signer_provider)? } (WalletType::Cold, WalletType::Cold) => {} (WalletType::Hot, WalletType::Hot) => {} @@ -623,8 +633,11 @@ where "Resetting the wallet to genesis and starting to rescan the blockchain" ); let mut db_tx = self.db.transaction_rw(None)?; - let mut accounts = - Self::reset_wallet_transactions_and_load(self.chain_config.clone(), &mut db_tx)?; + let mut accounts = Self::reset_wallet_transactions_and_load( + self.chain_config.clone(), + &mut db_tx, + &self.signer_provider, + )?; self.next_unused_account = accounts.pop_last().expect("not empty accounts"); self.accounts = accounts; db_tx.commit()?; @@ -665,7 +678,8 @@ where fn reset_wallet_transactions_and_load( chain_config: Arc, db_tx: &mut impl WalletStorageWriteLocked, - ) -> WalletResult> { + signer_provider: &P, + ) -> WalletResult>> { Self::reset_wallet_transactions(chain_config.clone(), db_tx)?; // set all accounts best block to genesis @@ -673,7 +687,8 @@ where .get_accounts_info()? .into_keys() .map(|id| { - let mut account = Account::load_from_database(chain_config.clone(), db_tx, &id)?; + let mut account = + signer_provider.load_account_from_database(chain_config.clone(), db_tx, &id)?; account.top_up_addresses(db_tx)?; account.scan_genesis(db_tx, &WalletEventsNoOp)?; @@ -688,9 +703,11 @@ where signer_provider: &mut P, ) -> Result<(), WalletError> { let accounts_info = db_tx.get_accounts_info()?; - let mut accounts: BTreeMap = accounts_info + let mut accounts: BTreeMap> = accounts_info .keys() - .map(|account_id| Account::load_from_database(chain_config.clone(), db_tx, account_id)) + .map(|account_id| { + signer_provider.load_account_from_database(chain_config.clone(), db_tx, account_id) + }) .collect::, _>>()? .into_iter() .map(|account| (account.account_index(), account)) @@ -733,7 +750,12 @@ where signer_provider, )?; if force_change_wallet_type { - Self::force_migrate_wallet_type(wallet_type, &db, chain_config.clone())?; + Self::force_migrate_wallet_type( + wallet_type, + &db, + chain_config.clone(), + &signer_provider, + )?; } // Please continue to use read-only transaction here. @@ -744,10 +766,14 @@ where let accounts_info = db_tx.get_accounts_info()?; - let mut accounts: BTreeMap = accounts_info + let mut accounts: BTreeMap> = accounts_info .keys() .map(|account_id| { - Account::load_from_database(Arc::clone(&chain_config), &db_tx, account_id) + signer_provider.load_account_from_database( + Arc::clone(&chain_config), + &db_tx, + account_id, + ) }) .collect::, _>>()? .into_iter() @@ -822,8 +848,11 @@ where let mut db_tx = self.db.transaction_rw(None)?; db_tx.set_lookahead_size(lookahead_size)?; - let mut accounts = - Self::reset_wallet_transactions_and_load(self.chain_config.clone(), &mut db_tx)?; + let mut accounts = Self::reset_wallet_transactions_and_load( + self.chain_config.clone(), + &mut db_tx, + &self.signer_provider, + )?; self.next_unused_account = accounts.pop_last().expect("not empty accounts"); self.accounts = accounts; db_tx.commit()?; @@ -851,7 +880,7 @@ where db_tx: &mut impl WalletStorageWriteUnlocked, name: Option, signer_provider: &mut P, - ) -> WalletResult<(U31, Account)> { + ) -> WalletResult<(U31, Account)> { ensure!( name.as_ref().map_or(true, |name| !name.is_empty()), WalletError::EmptyAccountName @@ -939,7 +968,7 @@ where fn for_account_rw( &mut self, account_index: U31, - f: impl FnOnce(&mut Account, &mut StoreTxRw) -> WalletResult, + f: impl FnOnce(&mut Account, &mut StoreTxRw) -> WalletResult, ) -> WalletResult { let mut db_tx = self.db.transaction_rw(None)?; let account = Self::get_account_mut(&mut self.accounts, account_index)?; @@ -955,7 +984,12 @@ where fn for_account_rw_unlocked( &mut self, account_index: U31, - f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked, &ChainConfig, &mut P) -> WalletResult, + f: impl FnOnce( + &mut Account, + &mut StoreTxRwUnlocked, + &ChainConfig, + &mut P, + ) -> WalletResult, ) -> WalletResult { let mut db_tx = self.db.transaction_rw_unlocked(None)?; let account = Self::get_account_mut(&mut self.accounts, account_index)?; @@ -984,7 +1018,10 @@ where fn for_account_rw_unlocked_and_check_tx_generic( &mut self, account_index: U31, - f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked) -> WalletResult<(SendRequest, AddlData)>, + f: impl FnOnce( + &mut Account, + &mut StoreTxRwUnlocked, + ) -> WalletResult<(SendRequest, AddlData)>, error_mapper: impl FnOnce(WalletError) -> WalletError, ) -> WalletResult<(SignedTransaction, AddlData)> { let (_, block_height) = self.get_best_block_for_account(account_index)?; @@ -1038,7 +1075,7 @@ where fn for_account_rw_unlocked_and_check_tx( &mut self, account_index: U31, - f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked) -> WalletResult, + f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked) -> WalletResult, ) -> WalletResult { Ok(self .for_account_rw_unlocked_and_check_tx_generic( @@ -1049,16 +1086,16 @@ where .0) } - fn get_account(&self, account_index: U31) -> WalletResult<&Account> { + fn get_account(&self, account_index: U31) -> WalletResult<&Account> { self.accounts .get(&account_index) .ok_or(WalletError::NoAccountFoundWithIndex(account_index)) } fn get_account_mut( - accounts: &mut BTreeMap, + accounts: &mut BTreeMap>, account_index: U31, - ) -> WalletResult<&mut Account> { + ) -> WalletResult<&mut Account> { accounts .get_mut(&account_index) .ok_or(WalletError::NoAccountFoundWithIndex(account_index)) @@ -1123,7 +1160,7 @@ where &self, outpoint: &UtxoOutPoint, ) -> Option<(TxOutput, Destination)> { - self.accounts.values().find_map(|acc: &Account| { + self.accounts.values().find_map(|acc: &Account| { let current_block_info = BlockInfo { height: acc.best_block().1, timestamp: self.latest_median_time, @@ -1167,8 +1204,7 @@ where account_index: U31, filter: WalletPoolsFilter, ) -> WalletResult> { - let db_tx = self.db.transaction_ro_unlocked()?; - let pool_ids = self.get_account(account_index)?.get_pool_ids(filter, &db_tx); + let pool_ids = self.get_account(account_index)?.get_pool_ids(filter); Ok(pool_ids) } @@ -1249,15 +1285,6 @@ where }) } - pub fn get_vrf_key( - &mut self, - account_index: U31, - ) -> WalletResult<(ChildNumber, Address)> { - self.for_account_rw(account_index, |account, db_tx| { - account.get_new_vrf_key(db_tx) - }) - } - pub fn find_public_key( &mut self, account_index: U31, @@ -1328,22 +1355,6 @@ where account.get_all_standalone_address_details(address, self.latest_median_time) } - pub fn get_all_issued_vrf_public_keys( - &self, - account_index: U31, - ) -> WalletResult, bool)>> { - let account = self.get_account(account_index)?; - Ok(account.get_all_issued_vrf_public_keys()) - } - - pub fn get_legacy_vrf_public_key( - &self, - account_index: U31, - ) -> WalletResult> { - let account = self.get_account(account_index)?; - Ok(account.get_legacy_vrf_public_key()) - } - pub fn get_addresses_usage(&self, account_index: U31) -> WalletResult<&KeychainUsageState> { let account = self.get_account(account_index)?; Ok(account.get_addresses_usage()) @@ -1799,27 +1810,6 @@ where Ok((token_id, signed_transaction)) } - pub fn create_stake_pool_tx( - &mut self, - account_index: U31, - current_fee_rate: FeeRate, - consolidate_fee_rate: FeeRate, - stake_pool_arguments: StakePoolDataArguments, - ) -> WalletResult { - let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.create_stake_pool_tx( - db_tx, - stake_pool_arguments, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) - } - pub fn decommission_stake_pool( &mut self, account_index: U31, @@ -2031,30 +2021,6 @@ where ) } - pub fn get_pos_gen_block_data( - &self, - account_index: U31, - pool_id: PoolId, - ) -> WalletResult { - let db_tx = self.db.transaction_ro_unlocked()?; - self.get_account(account_index)?.get_pos_gen_block_data(&db_tx, pool_id) - } - - pub fn get_pos_gen_block_data_by_pool_id( - &self, - pool_id: PoolId, - ) -> WalletResult { - let db_tx = self.db.transaction_ro_unlocked()?; - - for acc in self.accounts.values() { - if acc.pool_exists(pool_id) { - return acc.get_pos_gen_block_data(&db_tx, pool_id); - } - } - - Err(WalletError::UnknownPoolId(pool_id)) - } - /// Returns the last scanned block hash and height for all accounts. /// Returns genesis block when the wallet is just created. pub fn get_best_block(&self) -> BTreeMap, BlockHeight)> { @@ -2222,5 +2188,80 @@ where } } +impl Wallet +where + B: storage::Backend + 'static, + P: SignerProvider, +{ + pub fn get_vrf_key( + &mut self, + account_index: U31, + ) -> WalletResult<(ChildNumber, Address)> { + self.for_account_rw(account_index, |account, db_tx| { + account.get_new_vrf_key(db_tx) + }) + } + + pub fn get_all_issued_vrf_public_keys( + &self, + account_index: U31, + ) -> WalletResult, bool)>> { + let account = self.get_account(account_index)?; + Ok(account.get_all_issued_vrf_public_keys()) + } + + pub fn get_legacy_vrf_public_key( + &self, + account_index: U31, + ) -> WalletResult> { + let account = self.get_account(account_index)?; + Ok(account.get_legacy_vrf_public_key()) + } + + pub fn create_stake_pool_tx( + &mut self, + account_index: U31, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + stake_pool_arguments: StakePoolDataArguments, + ) -> WalletResult { + let latest_median_time = self.latest_median_time; + self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { + account.create_stake_pool_tx( + db_tx, + stake_pool_arguments, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }) + } + pub fn get_pos_gen_block_data( + &self, + account_index: U31, + pool_id: PoolId, + ) -> WalletResult { + let db_tx = self.db.transaction_ro_unlocked()?; + self.get_account(account_index)?.get_pos_gen_block_data(&db_tx, pool_id) + } + + pub fn get_pos_gen_block_data_by_pool_id( + &self, + pool_id: PoolId, + ) -> WalletResult { + let db_tx = self.db.transaction_ro_unlocked()?; + + for acc in self.accounts.values() { + if acc.pool_exists(pool_id) { + return acc.get_pos_gen_block_data(&db_tx, pool_id); + } + } + + Err(WalletError::UnknownPoolId(pool_id)) + } +} + #[cfg(test)] mod tests; diff --git a/wallet/trezor-client/src/client/mintlayer.rs b/wallet/trezor-client/src/client/mintlayer.rs index 95e413a9ee..9250434a7b 100644 --- a/wallet/trezor-client/src/client/mintlayer.rs +++ b/wallet/trezor-client/src/client/mintlayer.rs @@ -17,7 +17,7 @@ use crate::{ /// A chain code #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct ChainCode([u8; 32]); +pub struct ChainCode(pub [u8; 32]); // impl_array_newtype!(ChainCode, u8, 32); // impl_bytes_newtype!(ChainCode, 32); diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 7dad829abe..2cae227298 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -79,6 +79,8 @@ pub use node_comm::{ rpc_client::NodeRpcClient, }; use randomness::{make_pseudo_rng, make_true_rng, Rng}; +#[cfg(feature = "trezor")] +use wallet::signer::trezor_signer::TrezorSignerProvider; use wallet::{ account::{ currency_grouper::{self}, @@ -90,6 +92,7 @@ use wallet::{ wallet_events::WalletEvents, Wallet, WalletError, WalletResult, }; + pub use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, utxo_types::{UtxoState, UtxoStates, UtxoType, UtxoTypes}, @@ -143,6 +146,8 @@ pub enum ControllerError { InvalidTxOutput(GenericCurrencyTransferToTxOutputConversionError), #[error("The specified token {0} is not a fungible token")] NotFungibleToken(TokenId), + #[error("Unsupported operation for a Hardware wallet")] + UnsupportedHardwareWalletOperation, } #[derive(Clone, Copy)] @@ -159,7 +164,8 @@ pub struct ControllerConfig { pub enum WalletType2 { Software(Wallet), - Trezor(Wallet), + #[cfg(feature = "trezor")] + Trezor(Wallet), } pub struct Controller { @@ -367,6 +373,7 @@ where pub fn seed_phrase(&self) -> Result, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.seed_phrase(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.seed_phrase(), } .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) @@ -377,6 +384,7 @@ where pub fn delete_seed_phrase(&self) -> Result, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.delete_seed_phrase(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.delete_seed_phrase(), } .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) @@ -388,6 +396,7 @@ where pub fn reset_wallet_to_genesis(&mut self) -> Result<(), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.reset_wallet_to_genesis(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.reset_wallet_to_genesis(), } .map_err(ControllerError::WalletError) @@ -405,6 +414,7 @@ where pub fn encrypt_wallet(&mut self, password: &Option) -> Result<(), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.encrypt_wallet(password), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.encrypt_wallet(password), } .map_err(ControllerError::WalletError) @@ -422,6 +432,7 @@ where pub fn unlock_wallet(&mut self, password: &String) -> Result<(), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.unlock_wallet(password), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.unlock_wallet(password), } .map_err(ControllerError::WalletError) @@ -439,6 +450,7 @@ where ); match &mut self.wallet { WalletType2::Software(w) => w.lock_wallet(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.lock_wallet(), } .map_err(ControllerError::WalletError) @@ -458,6 +470,7 @@ where match &mut self.wallet { WalletType2::Software(w) => w.set_lookahead_size(lookahead_size, force_reduce), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.set_lookahead_size(lookahead_size, force_reduce), } .map_err(ControllerError::WalletError) @@ -466,6 +479,7 @@ where pub fn wallet_info(&self) -> WalletInfo { let (wallet_id, account_names) = match &self.wallet { WalletType2::Software(w) => w.wallet_info(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.wallet_info(), }; WalletInfo { @@ -511,7 +525,10 @@ where ) -> Result> { let pos_data = match &self.wallet { WalletType2::Software(w) => w.get_pos_gen_block_data(account_index, pool_id), - WalletType2::Trezor(w) => w.get_pos_gen_block_data(account_index, pool_id), + #[cfg(feature = "trezor")] + WalletType2::Trezor(_) => { + return Err(ControllerError::UnsupportedHardwareWalletOperation) + } } .map_err(ControllerError::WalletError)?; @@ -552,6 +569,7 @@ where ) -> Result> { let pools = match &self.wallet { WalletType2::Software(w) => w.get_pool_ids(account_index, WalletPoolsFilter::Stake), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_pool_ids(account_index, WalletPoolsFilter::Stake), } .map_err(ControllerError::WalletError)?; @@ -622,7 +640,10 @@ where ) -> Result>, ControllerError> { let pos_data = match &self.wallet { WalletType2::Software(w) => w.get_pos_gen_block_data_by_pool_id(pool_id), - WalletType2::Trezor(w) => w.get_pos_gen_block_data_by_pool_id(pool_id), + #[cfg(feature = "trezor")] + WalletType2::Trezor(_) => { + return Err(ControllerError::UnsupportedHardwareWalletOperation) + } } .map_err(ControllerError::WalletError)?; @@ -652,6 +673,7 @@ where ) -> Result<(U31, Option), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.create_next_account(name), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_next_account(name), } .map_err(ControllerError::WalletError) @@ -664,6 +686,7 @@ where ) -> Result<(U31, Option), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.set_account_name(account_index, name), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.set_account_name(account_index, name), } .map_err(ControllerError::WalletError) @@ -682,6 +705,7 @@ where pub fn best_block(&self) -> (Id, BlockHeight) { *match &self.wallet { WalletType2::Software(w) => w.get_best_block(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_best_block(), } .values() @@ -700,6 +724,7 @@ where UtxoState::Confirmed.into(), WithLocked::Unlocked, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_utxos( account_index, UtxoType::CreateStakePool | UtxoType::ProduceBlockFromStake, @@ -743,6 +768,7 @@ where WalletType2::Software(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events).await } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events).await } @@ -758,12 +784,14 @@ where match &mut self.wallet { WalletType2::Software(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events) + .await?; } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events) + .await?; } } - .await?; Ok(()) } @@ -1123,6 +1151,7 @@ where // search locally for the unspent utxo if let Some(out) = match &self.wallet { WalletType2::Software(w) => w.find_unspent_utxo_with_destination(input), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.find_unspent_utxo_with_destination(input), } { return Ok(out.0); @@ -1201,6 +1230,7 @@ where if get_time() >= *rebroadcast_txs_again_at { let txs = match &self.wallet { WalletType2::Software(w) => w.get_transactions_to_be_broadcast(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_transactions_to_be_broadcast(), }; match txs { diff --git a/wallet/wallet-controller/src/read.rs b/wallet/wallet-controller/src/read.rs index c37d61082b..14194a626c 100644 --- a/wallet/wallet-controller/src/read.rs +++ b/wallet/wallet-controller/src/read.rs @@ -89,6 +89,7 @@ where ) -> Result, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.get_balance(self.account_index, utxo_states, with_locked), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_balance(self.account_index, utxo_states, with_locked), } .map_err(ControllerError::WalletError) @@ -113,6 +114,7 @@ where WalletType2::Software(w) => { w.get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) } @@ -131,6 +133,7 @@ where WalletType2::Software(w) => { w.get_utxos(self.account_index, utxo_types, utxo_states, with_locked) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.get_utxos(self.account_index, utxo_types, utxo_states, with_locked) } @@ -142,6 +145,7 @@ where pub fn pending_transactions(&self) -> Result>, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.pending_transactions(self.account_index), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.pending_transactions(self.account_index), } .map_err(ControllerError::WalletError) @@ -156,6 +160,7 @@ where WalletType2::Software(w) => { w.mainchain_transactions(self.account_index, destination, limit) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.mainchain_transactions(self.account_index, destination, limit) } @@ -170,6 +175,7 @@ where ) -> Result> { match &self.wallet { WalletType2::Software(w) => w.get_transaction_list(self.account_index, skip, count), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_transaction_list(self.account_index, skip, count), } .map_err(ControllerError::WalletError) @@ -181,6 +187,7 @@ where ) -> Result<&TxData, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.get_transaction(self.account_index, transaction_id), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_transaction(self.account_index, transaction_id), } .map_err(ControllerError::WalletError) @@ -191,6 +198,7 @@ where ) -> Result>, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.get_all_issued_addresses(self.account_index), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_all_issued_addresses(self.account_index), } .map_err(ControllerError::WalletError) @@ -201,7 +209,10 @@ where ) -> Result, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.get_all_issued_vrf_public_keys(self.account_index), - WalletType2::Trezor(w) => w.get_all_issued_vrf_public_keys(self.account_index), + #[cfg(feature = "trezor")] + WalletType2::Trezor(_) => { + return Err(ControllerError::UnsupportedHardwareWalletOperation) + } } .map_err(ControllerError::WalletError) } @@ -209,7 +220,10 @@ where pub fn get_legacy_vrf_public_key(&self) -> Result, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.get_legacy_vrf_public_key(self.account_index), - WalletType2::Trezor(w) => w.get_legacy_vrf_public_key(self.account_index), + #[cfg(feature = "trezor")] + WalletType2::Trezor(_) => { + return Err(ControllerError::UnsupportedHardwareWalletOperation) + } } .map_err(ControllerError::WalletError) } @@ -217,6 +231,7 @@ where pub fn get_addresses_usage(&self) -> Result<&'a KeychainUsageState, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.get_addresses_usage(self.account_index), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_addresses_usage(self.account_index), } .map_err(ControllerError::WalletError) @@ -246,6 +261,7 @@ where pub fn get_standalone_addresses(&self) -> Result> { match &self.wallet { WalletType2::Software(w) => w.get_all_standalone_addresses(self.account_index), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_all_standalone_addresses(self.account_index), } .map_err(ControllerError::WalletError) @@ -260,6 +276,7 @@ where WalletType2::Software(w) => { w.get_all_standalone_address_details(self.account_index, address) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.get_all_standalone_address_details(self.account_index, address) } @@ -306,6 +323,7 @@ where ) -> Result, ControllerError> { let pools = match &self.wallet { WalletType2::Software(w) => w.get_pool_ids(self.account_index, filter), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_pool_ids(self.account_index, filter), } .map_err(ControllerError::WalletError)?; @@ -354,31 +372,52 @@ where &self, ) -> Result, ControllerError> { let delegations = match &self.wallet { - WalletType2::Software(w) => w.get_delegations(self.account_index), - WalletType2::Trezor(w) => w.get_delegations(self.account_index), - } - .map_err(ControllerError::WalletError)?; + WalletType2::Software(w) => { + let delegations = + w.get_delegations(self.account_index).map_err(ControllerError::WalletError)?; + let tasks: FuturesUnordered<_> = delegations + .into_iter() + .map(|(delegation_id, delegation_data)| { + self.get_delegation_share(delegation_data, *delegation_id).map(|res| { + res.map(|opt| { + opt.map(|(delegation_id, amount)| { + (delegation_id, delegation_data.pool_id, amount) + }) + }) + }) + }) + .collect(); - let tasks: FuturesUnordered<_> = delegations - .into_iter() - .map(|(delegation_id, delegation_data)| { - self.get_delegation_share(delegation_data, *delegation_id).map(|res| { - res.map(|opt| { - opt.map(|(delegation_id, amount)| { - (delegation_id, delegation_data.pool_id, amount) + tasks.try_collect::>().await?.into_iter().flatten().collect() + } + #[cfg(feature = "trezor")] + WalletType2::Trezor(w) => { + let delegations = + w.get_delegations(self.account_index).map_err(ControllerError::WalletError)?; + let tasks: FuturesUnordered<_> = delegations + .into_iter() + .map(|(delegation_id, delegation_data)| { + self.get_delegation_share(delegation_data, *delegation_id).map(|res| { + res.map(|opt| { + opt.map(|(delegation_id, amount)| { + (delegation_id, delegation_data.pool_id, amount) + }) + }) }) }) - }) - }) - .collect(); + .collect(); + + tasks.try_collect::>().await?.into_iter().flatten().collect() + } + }; - let delegations = tasks.try_collect::>().await?.into_iter().flatten().collect(); Ok(delegations) } pub fn get_created_blocks(&self) -> Result, ControllerError> { match &self.wallet { WalletType2::Software(w) => w.get_created_blocks(self.account_index), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_created_blocks(self.account_index), } .map_err(ControllerError::WalletError) diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index dd980eb189..92bae1714a 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -133,6 +133,7 @@ where ) -> Result<(), ControllerError> { let token_ids = match &self.wallet { WalletType2::Software(w) => w.find_used_tokens(self.account_index, input_utxos), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.find_used_tokens(self.account_index, input_utxos), } .map_err(ControllerError::WalletError)?; @@ -156,6 +157,7 @@ where WalletType2::Software(w) => { w.get_token_unconfirmed_info(self.account_index, token_info) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_token_unconfirmed_info(self.account_index, token_info), } .map_err(ControllerError::WalletError)? @@ -180,6 +182,7 @@ where WalletType2::Software(w) => { w.get_token_unconfirmed_info(self.account_index, &token_info) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.get_token_unconfirmed_info(self.account_index, &token_info) } @@ -205,6 +208,7 @@ where ) -> Result<(), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.abandon_transaction(self.account_index, tx_id), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.abandon_transaction(self.account_index, tx_id), } .map_err(ControllerError::WalletError) @@ -219,6 +223,7 @@ where WalletType2::Software(w) => { w.standalone_address_label_rename(self.account_index, address, label) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.standalone_address_label_rename(self.account_index, address, label) } @@ -235,6 +240,7 @@ where WalletType2::Software(w) => { w.add_standalone_address(self.account_index, address, label) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.add_standalone_address(self.account_index, address, label), } .map_err(ControllerError::WalletError) @@ -249,6 +255,7 @@ where WalletType2::Software(w) => { w.add_standalone_private_key(self.account_index, private_key, label) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.add_standalone_private_key(self.account_index, private_key, label) } @@ -265,6 +272,7 @@ where WalletType2::Software(w) => { w.add_standalone_multisig(self.account_index, challenge, label) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.add_standalone_multisig(self.account_index, challenge, label) } @@ -277,6 +285,7 @@ where ) -> Result<(ChildNumber, Address), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.get_new_address(self.account_index), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_new_address(self.account_index), } .map_err(ControllerError::WalletError) @@ -288,6 +297,7 @@ where ) -> Result> { match &mut self.wallet { WalletType2::Software(w) => w.find_public_key(self.account_index, address), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.find_public_key(self.account_index, address), } .map_err(ControllerError::WalletError) @@ -297,10 +307,12 @@ where &mut self, ) -> Result<(ChildNumber, Address), ControllerError> { match &mut self.wallet { - WalletType2::Software(w) => w.get_vrf_key(self.account_index), - WalletType2::Trezor(w) => w.get_vrf_key(self.account_index), + WalletType2::Software(w) => { + w.get_vrf_key(self.account_index).map_err(ControllerError::WalletError) + } + #[cfg(feature = "trezor")] + WalletType2::Trezor(_) => Err(ControllerError::UnsupportedHardwareWalletOperation), } - .map_err(ControllerError::WalletError) } pub async fn issue_new_token( @@ -331,6 +343,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.issue_new_token( account_index, TokenIssuance::V1(TokenIssuanceV1 { @@ -368,6 +381,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.issue_new_nft( account_index, address, @@ -404,6 +418,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.mint_tokens( account_index, token_info, @@ -438,6 +453,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.unmint_tokens( account_index, token_info, @@ -470,6 +486,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.lock_token_supply( account_index, token_info, @@ -504,6 +521,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.freeze_token( account_index, token_info, @@ -536,6 +554,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.unfreeze_token( account_index, token_info, @@ -570,6 +589,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.change_token_authority( account_index, token_info, @@ -628,6 +648,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( account_index, outputs, @@ -669,6 +690,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( account_index, [output], @@ -697,6 +719,7 @@ where UtxoState::Confirmed | UtxoState::Inactive, WithLocked::Unlocked, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_utxos( self.account_index, UtxoType::Transfer | UtxoType::LockThenTransfer | UtxoType::IssueNft, @@ -728,6 +751,7 @@ where filtered_inputs, current_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_sweep_transaction( account_index, destination_address, @@ -749,6 +773,7 @@ where ) -> Result> { let pool_id = match &self.wallet { WalletType2::Software(w) => w.get_delegation(self.account_index, delegation_id), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_delegation(self.account_index, delegation_id), } .map_err(ControllerError::WalletError)? @@ -776,6 +801,7 @@ where delegation_share, current_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_sweep_from_delegation_transaction( account_index, destination_address, @@ -832,6 +858,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_unsigned_transaction_to_addresses( self.account_index, [output], @@ -920,6 +947,7 @@ where UtxoState::Confirmed | UtxoState::InMempool | UtxoState::Inactive, WithLocked::Unlocked, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_utxos( self.account_index, UtxoType::Transfer | UtxoType::LockThenTransfer, @@ -995,6 +1023,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_unsigned_transaction_to_addresses( self.account_index, outputs, @@ -1033,6 +1062,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_delegation( account_index, vec![output], @@ -1067,6 +1097,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( account_index, [output], @@ -1091,6 +1122,7 @@ where ) -> Result> { let pool_id = match &self.wallet { WalletType2::Software(w) => w.get_delegation(self.account_index, delegation_id), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_delegation(self.account_index, delegation_id), } .map_err(ControllerError::WalletError)? @@ -1119,6 +1151,7 @@ where delegation_share, current_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses_from_delegation( account_index, address, @@ -1159,6 +1192,7 @@ where current_fee_rate, consolidate_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( account_index, [output], @@ -1218,28 +1252,23 @@ where wallet: &mut WalletType2, account_index: U31| { match wallet { - WalletType2::Software(w) => w.create_stake_pool_tx( - account_index, - current_fee_rate, - consolidate_fee_rate, - StakePoolDataArguments { - amount, - margin_ratio_per_thousand, - cost_per_block, - decommission_key, - }, - ), - WalletType2::Trezor(w) => w.create_stake_pool_tx( - account_index, - current_fee_rate, - consolidate_fee_rate, - StakePoolDataArguments { - amount, - margin_ratio_per_thousand, - cost_per_block, - decommission_key, - }, - ), + WalletType2::Software(w) => w + .create_stake_pool_tx( + account_index, + current_fee_rate, + consolidate_fee_rate, + StakePoolDataArguments { + amount, + margin_ratio_per_thousand, + cost_per_block, + decommission_key, + }, + ) + .map_err(ControllerError::WalletError), + #[cfg(feature = "trezor")] + WalletType2::Trezor(_) => { + Err(ControllerError::UnsupportedHardwareWalletOperation) + } } }, ) @@ -1274,6 +1303,7 @@ where output_address, current_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.decommission_stake_pool( account_index, pool_id, @@ -1312,6 +1342,7 @@ where output_address, current_fee_rate, ), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.decommission_stake_pool_request( self.account_index, pool_id, @@ -1429,6 +1460,7 @@ where utils::ensure!( !match &self.wallet { WalletType2::Software(w) => w.is_locked(), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.is_locked(), }, ControllerError::WalletIsLocked @@ -1438,6 +1470,7 @@ where WalletType2::Software(w) => { w.get_pool_ids(self.account_index, WalletPoolsFilter::Stake) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.get_pool_ids(self.account_index, WalletPoolsFilter::Stake), } .map_err(ControllerError::WalletError)?; @@ -1462,6 +1495,7 @@ where > { match &mut self.wallet { WalletType2::Software(w) => w.sign_raw_transaction(self.account_index, tx), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.sign_raw_transaction(self.account_index, tx), } .map_err(ControllerError::WalletError) @@ -1476,6 +1510,7 @@ where WalletType2::Software(w) => { w.sign_challenge(self.account_index, challenge, destination) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.sign_challenge(self.account_index, challenge, destination), } .map_err(ControllerError::WalletError) @@ -1484,6 +1519,7 @@ where pub fn add_unconfirmed_tx(&mut self, tx: SignedTransaction) -> Result<(), ControllerError> { match &mut self.wallet { WalletType2::Software(w) => w.add_unconfirmed_tx(tx, self.wallet_events), + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.add_unconfirmed_tx(tx, self.wallet_events), } .map_err(ControllerError::WalletError) @@ -1511,6 +1547,7 @@ where WalletType2::Software(w) => { w.add_account_unconfirmed_tx(self.account_index, tx.clone(), self.wallet_events) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.add_account_unconfirmed_tx(self.account_index, tx.clone(), self.wallet_events) } @@ -1539,12 +1576,14 @@ where } /// Create a transaction and broadcast it - async fn create_and_send_tx< - F: FnOnce(FeeRate, FeeRate, &mut WalletType2, U31) -> WalletResult, - >( + async fn create_and_send_tx( &mut self, tx_maker: F, - ) -> Result> { + ) -> Result> + where + F: FnOnce(FeeRate, FeeRate, &mut WalletType2, U31) -> Result, + ControllerError: From, + { let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; @@ -1553,8 +1592,7 @@ where consolidate_fee_rate, self.wallet, self.account_index, - ) - .map_err(ControllerError::WalletError)?; + )?; self.broadcast_to_mempool_if_needed(tx).await } @@ -1580,6 +1618,7 @@ where WalletType2::Software(w) => { w.get_token_unconfirmed_info(self.account_index, token_info) } + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { w.get_token_unconfirmed_info(self.account_index, token_info) } From 1b1ebcb241a52d79d6902dcc2f5873f3b1f9e62b Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 2 Jul 2024 16:38:14 +0200 Subject: [PATCH 08/48] add cli command arguments for creating trezor wallet --- node-gui/backend/src/backend_impl.rs | 19 +-- wallet/src/signer/mod.rs | 6 +- wallet/src/signer/trezor_signer/mod.rs | 20 ++- wallet/types/src/seed_phrase.rs | 2 +- .../src/command_handler/mod.rs | 11 ++ .../wallet-cli-commands/src/helper_types.rs | 6 + wallet/wallet-cli-commands/src/lib.rs | 7 +- wallet/wallet-controller/src/lib.rs | 121 ++++++++++++------ .../src/synced_controller.rs | 1 + wallet/wallet-controller/src/types/mod.rs | 85 ++++++++++++ .../src/handles_client/mod.rs | 40 ++++-- .../src/rpc_client/client_impl.rs | 6 +- .../src/wallet_rpc_traits.rs | 9 +- wallet/wallet-rpc-lib/src/lib.rs | 5 +- wallet/wallet-rpc-lib/src/rpc/interface.rs | 11 +- wallet/wallet-rpc-lib/src/rpc/mod.rs | 16 +-- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 53 +++++--- wallet/wallet-rpc-lib/src/rpc/types.rs | 31 +++-- wallet/wallet-rpc-lib/src/service/mod.rs | 2 +- wallet/wallet-rpc-lib/src/service/worker.rs | 38 ++---- 20 files changed, 346 insertions(+), 143 deletions(-) diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index 4c4164b5ce..06366f8a7f 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -36,8 +36,9 @@ use wallet_cli_commands::{ WalletCommand, }; use wallet_controller::{ - make_cold_wallet_rpc_client, types::Balances, ControllerConfig, NodeInterface, UtxoState, - WalletHandlesClient, + make_cold_wallet_rpc_client, + types::{Balances, WalletTypeArgs}, + ControllerConfig, NodeInterface, UtxoState, WalletHandlesClient, }; use wallet_rpc_client::handles_client::WalletRpcHandlesClient; use wallet_rpc_lib::{EventStream, WalletRpc, WalletService}; @@ -368,14 +369,14 @@ impl Backend { let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); + let args = WalletTypeArgs::Software { + mnemonic: Some(mnemonic.to_string()), + passphrase: None, + store_seed_phrase: StoreSeedPhrase::Store, + }; + wallet_rpc - .create_wallet( - file_path, - StoreSeedPhrase::Store, - Some(mnemonic.to_string()), - None, - import.skip_syncing(), - ) + .create_wallet(file_path, args, import.skip_syncing()) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; tokio::spawn(forward_events( diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 6a303893cb..800c194a17 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -34,11 +34,13 @@ use crate::{ Account, WalletResult, }; +use self::trezor_signer::TrezorError; + pub mod software_signer; #[cfg(feature = "trezor")] pub mod trezor_signer; -/// KeyChain errors +/// Signer errors #[derive(thiserror::Error, Debug, Eq, PartialEq)] pub enum SignerError { #[error("The provided keys do not belong to the same hierarchy")] @@ -59,6 +61,8 @@ pub enum SignerError { SignedTransactionIntentError(#[from] SignedTransactionIntentError), #[error("{0}")] SerializationError(#[from] serialization::Error), + #[error("Trezor error: {0}")] + TrezorError(#[from] TrezorError), } type SignerResult = Result; diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 1d26d8d4d7..0cbb139fd5 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -45,11 +45,13 @@ use crypto::key::{ use itertools::Itertools; use randomness::make_true_rng; use serialization::Encode; +use trezor_client::find_devices; #[allow(clippy::all)] use trezor_client::{ protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, Trezor, }; +use utils::ensure; use wallet_storage::{ WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, }; @@ -65,6 +67,13 @@ use crate::{ use super::{Signer, SignerError, SignerProvider, SignerResult}; +/// Signer errors +#[derive(thiserror::Error, Debug, Eq, PartialEq)] +pub enum TrezorError { + #[error("No connected Trezor device found")] + NoDeviceFound, +} + pub struct TrezorSigner { chain_config: Arc, account_index: U31, @@ -441,10 +450,15 @@ impl std::fmt::Debug for TrezorSignerProvider { } impl TrezorSignerProvider { - pub fn new(client: Trezor) -> Self { - Self { + pub fn new() -> Result { + let mut devices = find_devices(false); + ensure!(!devices.is_empty(), TrezorError::NoDeviceFound); + + let client = devices.pop().unwrap().connect().unwrap(); + + Ok(Self { client: Arc::new(Mutex::new(client)), - } + }) } } diff --git a/wallet/types/src/seed_phrase.rs b/wallet/types/src/seed_phrase.rs index d5078917b8..b4a78eeff3 100644 --- a/wallet/types/src/seed_phrase.rs +++ b/wallet/types/src/seed_phrase.rs @@ -17,7 +17,7 @@ use serialization::{Decode, Encode}; pub const MNEMONIC_24_WORDS_ENTROPY_SIZE: usize = 32; -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum StoreSeedPhrase { Store, DoNotStore, diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index 04ff40cecd..2a7ff3575d 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -42,10 +42,14 @@ use wallet_rpc_lib::types::{ RpcValidatedSignatures, TokenMetadata, }; +#[cfg(feature = "trezor")] +use crate::helper_types::CLIHardwareWalletType; use crate::{ errors::WalletCliCommandError, helper_types::parse_generic_token_transfer, ManageableWalletCommand, WalletManagementCommand, }; +#[cfg(feature = "trezor")] +use wallet_rpc_lib::types::HardwareWalletType; use self::local_state::WalletWithState; @@ -145,7 +149,13 @@ where mnemonic, whether_to_store_seed_phrase, passphrase, + hardware_wallet, } => { + let hardware_wallet = hardware_wallet.map(|t| match t { + #[cfg(feature = "trezor")] + CLIHardwareWalletType::Trezor => HardwareWalletType::Trezor, + }); + let newly_generated_mnemonic = self .wallet() .await? @@ -154,6 +164,7 @@ where whether_to_store_seed_phrase.to_bool(), mnemonic, passphrase, + hardware_wallet, ) .await?; diff --git a/wallet/wallet-cli-commands/src/helper_types.rs b/wallet/wallet-cli-commands/src/helper_types.rs index d2ab021667..00562c1073 100644 --- a/wallet/wallet-cli-commands/src/helper_types.rs +++ b/wallet/wallet-cli-commands/src/helper_types.rs @@ -434,6 +434,12 @@ impl YesNo { } } +#[derive(Debug, Clone, Copy, ValueEnum)] +pub enum CLIHardwareWalletType { + #[cfg(feature = "trezor")] + Trezor, +} + #[cfg(test)] mod tests { use rstest::rstest; diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index 4db0b1dedf..1dce2f46d0 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -19,7 +19,7 @@ mod helper_types; pub use command_handler::CommandHandler; pub use errors::WalletCliCommandError; -use helper_types::YesNo; +use helper_types::{CLIHardwareWalletType, YesNo}; use rpc::description::{Described, Module}; use wallet_rpc_lib::{types::NodeInterface, ColdWalletRpcDescription, WalletRpcDescription}; @@ -62,6 +62,11 @@ pub enum WalletManagementCommand { /// Passphrase along the mnemonic #[arg(long = "passphrase")] passphrase: Option, + + /// Create a wallet using a connected hardware wallet. Only the public keys will be kept in + /// the software wallet + #[arg(long, conflicts_with_all(["mnemonic", "passphrase", "whether_to_store_seed_phrase"]))] + hardware_wallet: Option, }, #[clap(name = "wallet-open")] diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 2cae227298..c304b1962c 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -45,6 +45,7 @@ use std::{ use types::{ Balances, GenericCurrencyTransferToTxOutputConversionError, InspectTransaction, SeedWithPassPhrase, SignatureStats, TransactionToInspect, ValidatedSignatures, WalletInfo, + WalletTypeArgsComputed, }; use wallet_storage::DefaultBackend; @@ -81,6 +82,9 @@ pub use node_comm::{ use randomness::{make_pseudo_rng, make_true_rng, Rng}; #[cfg(feature = "trezor")] use wallet::signer::trezor_signer::TrezorSignerProvider; +#[cfg(feature = "trezor")] +use wallet::signer::SignerError; + use wallet::{ account::{ currency_grouper::{self}, @@ -231,13 +235,10 @@ where } } - #[allow(clippy::too_many_arguments)] pub fn create_wallet( chain_config: Arc, file_path: impl AsRef, - mnemonic: mnemonic::Mnemonic, - passphrase: Option<&str>, - whether_to_store_seed_phrase: StoreSeedPhrase, + args: WalletTypeArgsComputed, best_block: (BlockHeight, Id), wallet_type: WalletType, ) -> Result, ControllerError> { @@ -251,33 +252,51 @@ where let db = wallet::wallet::open_or_create_wallet_file(file_path) .map_err(ControllerError::WalletError)?; - let wallet = wallet::Wallet::create_new_wallet( - Arc::clone(&chain_config), - db, - best_block, - wallet_type, - |db_tx| { - Ok(SoftwareSignerProvider::new_from_mnemonic( - chain_config.clone(), - db_tx, - &mnemonic.to_string(), - passphrase, - whether_to_store_seed_phrase, - )?) - }, - ) - .map_err(ControllerError::WalletError)?; - - //TODO: add support for hardware wallet creation - Ok(WalletType2::Software(wallet)) + match args { + WalletTypeArgsComputed::Software { + mnemonic, + passphrase, + store_seed_phrase, + } => { + let passphrase_ref = passphrase.as_ref().map(|x| x.as_ref()); + + let wallet = wallet::Wallet::create_new_wallet( + Arc::clone(&chain_config), + db, + best_block, + wallet_type, + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + &mnemonic.to_string(), + passphrase_ref, + store_seed_phrase, + )?) + }, + ) + .map_err(ControllerError::WalletError)?; + Ok(WalletType2::Software(wallet)) + } + #[cfg(feature = "trezor")] + WalletTypeArgsComputed::Trezor => { + let wallet = wallet::Wallet::create_new_wallet( + Arc::clone(&chain_config), + db, + best_block, + wallet_type, + |db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), + ) + .map_err(ControllerError::WalletError)?; + Ok(WalletType2::Trezor(wallet)) + } + } } pub fn recover_wallet( chain_config: Arc, file_path: impl AsRef, - mnemonic: mnemonic::Mnemonic, - passphrase: Option<&str>, - whether_to_store_seed_phrase: StoreSeedPhrase, + args: WalletTypeArgsComputed, wallet_type: WalletType, ) -> Result, ControllerError> { utils::ensure!( @@ -290,20 +309,44 @@ where let db = wallet::wallet::open_or_create_wallet_file(file_path) .map_err(ControllerError::WalletError)?; - let wallet = - wallet::Wallet::recover_wallet(Arc::clone(&chain_config), db, wallet_type, |db_tx| { - Ok(SoftwareSignerProvider::new_from_mnemonic( - chain_config.clone(), - db_tx, - &mnemonic.to_string(), - passphrase, - whether_to_store_seed_phrase, - )?) - }) - .map_err(ControllerError::WalletError)?; - //TODO: add support for hardware wallet creation - Ok(WalletType2::Software(wallet)) + match args { + WalletTypeArgsComputed::Software { + mnemonic, + passphrase, + store_seed_phrase, + } => { + let passphrase_ref = passphrase.as_ref().map(|x| x.as_ref()); + + let wallet = wallet::Wallet::recover_wallet( + Arc::clone(&chain_config), + db, + wallet_type, + |db_tx| { + Ok(SoftwareSignerProvider::new_from_mnemonic( + chain_config.clone(), + db_tx, + &mnemonic.to_string(), + passphrase_ref, + store_seed_phrase, + )?) + }, + ) + .map_err(ControllerError::WalletError)?; + Ok(WalletType2::Software(wallet)) + } + #[cfg(feature = "trezor")] + WalletTypeArgsComputed::Trezor => { + let wallet = wallet::Wallet::recover_wallet( + Arc::clone(&chain_config), + db, + wallet_type, + |db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), + ) + .map_err(ControllerError::WalletError)?; + Ok(WalletType2::Trezor(wallet)) + } + } } fn make_backup_wallet_file(file_path: impl AsRef, version: u32) -> WalletResult<()> { diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 92bae1714a..2115e90fce 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -1370,6 +1370,7 @@ where current_fee_rate, consolidate_fee_rate, )?, + #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_htlc_tx( self.account_index, output_value, diff --git a/wallet/wallet-controller/src/types/mod.rs b/wallet/wallet-controller/src/types/mod.rs index 646af702b0..b5718e11a6 100644 --- a/wallet/wallet-controller/src/types/mod.rs +++ b/wallet/wallet-controller/src/types/mod.rs @@ -22,6 +22,7 @@ mod standalone_key; mod transaction; pub use balances::Balances; +use bip39::{Language, Mnemonic}; pub use block_info::{BlockInfo, CreatedBlockInfo}; pub use common::primitives::amount::RpcAmountOut; use common::{ @@ -38,6 +39,9 @@ pub use transaction::{ InspectTransaction, SignatureStats, TransactionToInspect, ValidatedSignatures, }; use utils::ensure; +use wallet_types::seed_phrase::StoreSeedPhrase; + +use crate::mnemonic; #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, rpc_description::HasValueHint)] pub struct WalletInfo { @@ -140,3 +144,84 @@ impl rpc_description::HasValueHint for GenericCurrencyTransfer { impl rpc_description::HasValueHint for GenericTokenTransfer { const HINT_SER: rpc_description::ValueHint = rpc_description::ValueHint::GENERIC_OBJECT; } + +pub enum CreatedWallet { + UserProvidedMnemonic, + NewlyGeneratedMnemonic(Mnemonic, Option), +} + +pub enum WalletTypeArgs { + Software { + mnemonic: Option, + passphrase: Option, + store_seed_phrase: StoreSeedPhrase, + }, + #[cfg(feature = "trezor")] + Trezor, +} + +impl WalletTypeArgs { + pub fn user_supplied_menmonic(&self) -> bool { + match self { + Self::Software { + mnemonic, + passphrase: _, + store_seed_phrase: _, + } => mnemonic.is_some(), + #[cfg(feature = "trezor")] + Self::Trezor => false, + } + } + + pub fn parse_mnemonic( + self, + ) -> Result<(WalletTypeArgsComputed, CreatedWallet), mnemonic::Error> { + match self { + Self::Software { + mnemonic, + passphrase, + store_seed_phrase, + } => { + let language = Language::English; + let (mnemonic, created_wallet) = match &mnemonic { + Some(mnemonic) => { + let mnemonic = mnemonic::parse_mnemonic(language, mnemonic)?; + (mnemonic, CreatedWallet::UserProvidedMnemonic) + } + None => { + let mnemonic = mnemonic::generate_new_mnemonic(language); + ( + mnemonic.clone(), + CreatedWallet::NewlyGeneratedMnemonic(mnemonic, passphrase.clone()), + ) + } + }; + + Ok(( + WalletTypeArgsComputed::Software { + mnemonic, + passphrase, + store_seed_phrase, + }, + created_wallet, + )) + } + + #[cfg(feature = "trezor")] + Self::Trezor => Ok(( + WalletTypeArgsComputed::Trezor, + CreatedWallet::UserProvidedMnemonic, + )), + } + } +} + +pub enum WalletTypeArgsComputed { + Software { + mnemonic: Mnemonic, + passphrase: Option, + store_seed_phrase: StoreSeedPhrase, + }, + #[cfg(feature = "trezor")] + Trezor, +} diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 6c5077af43..8fd0a7052e 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -33,14 +33,16 @@ use serialization::{hex::HexEncode, hex_encoded::HexEncoded, json_encoded::JsonE use utils_networking::IpOrSocketAddress; use wallet::{account::TxInfo, version::get_version}; use wallet_controller::{ - types::{CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo}, + types::{ + CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo, WalletTypeArgs, + }, ConnectedPeer, ControllerConfig, UtxoState, UtxoType, }; use wallet_rpc_lib::{ types::{ AddressInfo, AddressWithUsageInfo, Balances, BlockInfo, ComposedTransaction, CreatedWallet, - DelegationInfo, LegacyVrfPublicKeyInfo, NewAccountInfo, NewDelegation, NewOrder, - NewTransaction, NftMetadata, NodeVersion, PoolInfo, PublicKeyInfo, + DelegationInfo, HardwareWalletType, LegacyVrfPublicKeyInfo, NewAccountInfo, NewDelegation, + NewOrder, NewTransaction, NftMetadata, NodeVersion, PoolInfo, PublicKeyInfo, RpcHashedTimelockContract, RpcInspectTransaction, RpcStandaloneAddresses, RpcTokenId, SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, StandaloneAddressWithDetails, TokenMetadata, TxOptionsOverrides, UtxoInfo, @@ -124,20 +126,38 @@ where store_seed_phrase: bool, mnemonic: Option, passphrase: Option, + hardware_wallet: Option, ) -> Result { - let whether_to_store_seed_phrase = if store_seed_phrase { + let store_seed_phrase = if store_seed_phrase { StoreSeedPhrase::Store } else { StoreSeedPhrase::DoNotStore }; - self.wallet_rpc - .create_wallet( - path, - whether_to_store_seed_phrase, + + let args = match hardware_wallet { + None => WalletTypeArgs::Software { mnemonic, passphrase, - false, - ) + store_seed_phrase, + }, + #[cfg(feature = "trezor")] + Some(HardwareWalletType::Trezor) => { + ensure!( + mnemonic.is_none() + && passphrase.is_none() + && store_seed_phrase == StoreSeedPhrase::DoNotStore, + RpcError::HardwareWalletWithMnemonic + ); + WalletTypeArgs::Trezor + } + #[cfg(not(feature = "trezor"))] + Some(_) => { + return Err(RpcError::::InvalidHardwareWallet)?; + } + }; + + self.wallet_rpc + .create_wallet(path, args, false) .await .map(Into::into) .map_err(WalletRpcHandlesClientError::WalletRpcError) diff --git a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs index 57543bea0f..bad3b4aba5 100644 --- a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs @@ -44,8 +44,8 @@ use wallet_controller::{ use wallet_rpc_lib::{ types::{ AddressInfo, AddressWithUsageInfo, BlockInfo, ComposedTransaction, CreatedWallet, - DelegationInfo, LegacyVrfPublicKeyInfo, NewAccountInfo, NewDelegation, NewOrder, - NewTransaction, NftMetadata, NodeVersion, PoolInfo, PublicKeyInfo, + DelegationInfo, HardwareWalletType, LegacyVrfPublicKeyInfo, NewAccountInfo, NewDelegation, + NewOrder, NewTransaction, NftMetadata, NodeVersion, PoolInfo, PublicKeyInfo, RpcHashedTimelockContract, RpcInspectTransaction, RpcStandaloneAddresses, RpcTokenId, SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, StandaloneAddressWithDetails, TokenMetadata, TransactionOptions, TxOptionsOverrides, @@ -85,6 +85,7 @@ impl WalletInterface for ClientWalletRpc { store_seed_phrase: bool, mnemonic: Option, passphrase: Option, + hardware_wallet: Option, ) -> Result { ColdWalletRpcClient::create_wallet( &self.http_client, @@ -92,6 +93,7 @@ impl WalletInterface for ClientWalletRpc { store_seed_phrase, mnemonic, passphrase, + hardware_wallet, ) .await .map_err(WalletRpcError::ResponseError) diff --git a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs index 8dd0be2fe6..5b108fb3da 100644 --- a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs +++ b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs @@ -35,10 +35,10 @@ use wallet_controller::{ }; use wallet_rpc_lib::types::{ AddressInfo, AddressWithUsageInfo, Balances, BlockInfo, ComposedTransaction, CreatedWallet, - DelegationInfo, LegacyVrfPublicKeyInfo, NewAccountInfo, NewDelegation, NewOrder, - NewTransaction, NftMetadata, NodeVersion, PoolInfo, PublicKeyInfo, RpcHashedTimelockContract, - RpcInspectTransaction, RpcSignatureStatus, RpcStandaloneAddresses, RpcTokenId, - SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, + DelegationInfo, HardwareWalletType, LegacyVrfPublicKeyInfo, NewAccountInfo, NewDelegation, + NewOrder, NewTransaction, NftMetadata, NodeVersion, PoolInfo, PublicKeyInfo, + RpcHashedTimelockContract, RpcInspectTransaction, RpcSignatureStatus, RpcStandaloneAddresses, + RpcTokenId, SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, StandaloneAddressWithDetails, TokenMetadata, TxOptionsOverrides, UtxoInfo, VrfPublicKeyInfo, }; use wallet_types::with_locked::WithLocked; @@ -72,6 +72,7 @@ pub trait WalletInterface { store_seed_phrase: bool, mnemonic: Option, passphrase: Option, + hardware_wallet: Option, ) -> Result; async fn open_wallet( diff --git a/wallet/wallet-rpc-lib/src/lib.rs b/wallet/wallet-rpc-lib/src/lib.rs index 70c62484cc..4c982b1973 100644 --- a/wallet/wallet-rpc-lib/src/lib.rs +++ b/wallet/wallet-rpc-lib/src/lib.rs @@ -22,10 +22,7 @@ pub use rpc::{ types, ColdWalletRpcClient, ColdWalletRpcDescription, ColdWalletRpcServer, RpcCreds, RpcError, WalletEventsRpcServer, WalletRpc, WalletRpcClient, WalletRpcDescription, WalletRpcServer, }; -pub use service::{ - CreatedWallet, Event, EventStream, TxState, WalletHandle, - /* WalletResult, */ WalletService, -}; +pub use service::{Event, EventStream, TxState, WalletHandle, /* WalletResult, */ WalletService,}; use wallet_controller::{NodeInterface, NodeRpcClient}; use std::{fmt::Debug, time::Duration}; diff --git a/wallet/wallet-rpc-lib/src/rpc/interface.rs b/wallet/wallet-rpc-lib/src/rpc/interface.rs index 058514e7c9..085c2ebf41 100644 --- a/wallet/wallet-rpc-lib/src/rpc/interface.rs +++ b/wallet/wallet-rpc-lib/src/rpc/interface.rs @@ -38,11 +38,11 @@ use wallet_types::with_locked::WithLocked; use crate::types::{ AccountArg, AddressInfo, AddressWithUsageInfo, Balances, ChainInfo, ComposedTransaction, - CreatedWallet, DelegationInfo, HexEncoded, LegacyVrfPublicKeyInfo, MaybeSignedTransaction, - NewAccountInfo, NewDelegation, NewOrder, NewTransaction, NftMetadata, NodeVersion, PoolInfo, - PublicKeyInfo, RpcAmountIn, RpcHashedTimelockContract, RpcInspectTransaction, - RpcStandaloneAddresses, RpcTokenId, RpcUtxoOutpoint, RpcUtxoState, RpcUtxoType, - SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, + CreatedWallet, DelegationInfo, HardwareWalletType, HexEncoded, LegacyVrfPublicKeyInfo, + MaybeSignedTransaction, NewAccountInfo, NewDelegation, NewOrder, NewTransaction, NftMetadata, + NodeVersion, PoolInfo, PublicKeyInfo, RpcAmountIn, RpcHashedTimelockContract, + RpcInspectTransaction, RpcStandaloneAddresses, RpcTokenId, RpcUtxoOutpoint, RpcUtxoState, + RpcUtxoType, SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, StandaloneAddressWithDetails, TokenMetadata, TransactionOptions, TxOptionsOverrides, VrfPublicKeyInfo, }; @@ -74,6 +74,7 @@ trait ColdWalletRpc { store_seed_phrase: bool, mnemonic: Option, passphrase: Option, + hardware_wallet: Option, ) -> rpc::RpcResult; /// Open an exiting wallet by specifying the file location of the wallet file diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index 15e7875795..a413d86b88 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -68,8 +68,8 @@ pub use interface::{ pub use rpc::{rpc_creds::RpcCreds, Rpc}; use wallet_controller::{ types::{ - Balances, BlockInfo, CreatedBlockInfo, GenericTokenTransfer, InspectTransaction, - SeedWithPassPhrase, TransactionToInspect, WalletInfo, + Balances, BlockInfo, CreatedBlockInfo, CreatedWallet, GenericTokenTransfer, + InspectTransaction, SeedWithPassPhrase, TransactionToInspect, WalletInfo, WalletTypeArgs, }, ConnectedPeer, ControllerConfig, ControllerError, NodeInterface, UtxoState, UtxoStates, UtxoType, UtxoTypes, DEFAULT_ACCOUNT_INDEX, @@ -129,18 +129,14 @@ where pub async fn create_wallet( &self, path: PathBuf, - store_seed_phrase: StoreSeedPhrase, - mnemonic: Option, - passphrase: Option, + args: WalletTypeArgs, skip_syncing: bool, ) -> WRpcResult { self.wallet .manage_async(move |wallet_manager| { - Box::pin(async move { - wallet_manager - .create_wallet(path, store_seed_phrase, mnemonic, passphrase, skip_syncing) - .await - }) + Box::pin( + async move { wallet_manager.create_wallet(path, args, skip_syncing).await }, + ) }) .await? } diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index 4bb5990bf4..5f27a2a00f 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -30,10 +30,15 @@ use common::{ use crypto::key::PrivateKey; use p2p_types::{bannable_address::BannableAddress, socket_address::SocketAddress, PeerId}; use serialization::{hex::HexEncode, json_encoded::JsonEncoded}; +#[cfg(feature = "trezor")] +use utils::ensure; use utils_networking::IpOrSocketAddress; use wallet::{account::TxInfo, version::get_version}; use wallet_controller::{ - types::{BlockInfo, CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo}, + types::{ + BlockInfo, CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo, + WalletTypeArgs, + }, ConnectedPeer, ControllerConfig, NodeInterface, UtxoState, UtxoStates, UtxoType, UtxoTypes, }; use wallet_types::{ @@ -44,11 +49,11 @@ use crate::{ rpc::{ColdWalletRpcServer, WalletEventsRpcServer, WalletRpc, WalletRpcServer}, types::{ AccountArg, AddressInfo, AddressWithUsageInfo, Balances, ChainInfo, ComposedTransaction, - CreatedWallet, DelegationInfo, HexEncoded, LegacyVrfPublicKeyInfo, MaybeSignedTransaction, - NewAccountInfo, NewDelegation, NewTransaction, NftMetadata, NodeVersion, PoolInfo, - PublicKeyInfo, RpcAddress, RpcAmountIn, RpcHexString, RpcInspectTransaction, - RpcStandaloneAddresses, RpcTokenId, RpcUtxoOutpoint, RpcUtxoState, RpcUtxoType, - SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, + CreatedWallet, DelegationInfo, HardwareWalletType, HexEncoded, LegacyVrfPublicKeyInfo, + MaybeSignedTransaction, NewAccountInfo, NewDelegation, NewTransaction, NftMetadata, + NodeVersion, PoolInfo, PublicKeyInfo, RpcAddress, RpcAmountIn, RpcHexString, + RpcInspectTransaction, RpcStandaloneAddresses, RpcTokenId, RpcUtxoOutpoint, RpcUtxoState, + RpcUtxoType, SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, StandaloneAddressWithDetails, TokenMetadata, TransactionOptions, TxOptionsOverrides, UtxoInfo, VrfPublicKeyInfo, }, @@ -90,22 +95,40 @@ where store_seed_phrase: bool, mnemonic: Option, passphrase: Option, + hardware_wallet: Option, ) -> rpc::RpcResult { - let whether_to_store_seed_phrase = if store_seed_phrase { + let store_seed_phrase = if store_seed_phrase { StoreSeedPhrase::Store } else { StoreSeedPhrase::DoNotStore }; - rpc::handle_result( - self.create_wallet( - path.into(), - whether_to_store_seed_phrase, + + let args = match hardware_wallet { + None => WalletTypeArgs::Software { mnemonic, passphrase, - false, - ) - .await - .map(Into::::into), + store_seed_phrase, + }, + #[cfg(feature = "trezor")] + Some(HardwareWalletType::Trezor) => { + ensure!( + mnemonic.is_none() + && passphrase.is_none() + && store_seed_phrase == StoreSeedPhrase::DoNotStore, + RpcError::HardwareWalletWithMnemonic + ); + WalletTypeArgs::Trezor + } + #[cfg(not(feature = "trezor"))] + Some(_) => { + return Err(RpcError::::InvalidHardwareWallet)?; + } + }; + + rpc::handle_result( + self.create_wallet(path.into(), args, false) + .await + .map(Into::::into), ) } diff --git a/wallet/wallet-rpc-lib/src/rpc/types.rs b/wallet/wallet-rpc-lib/src/rpc/types.rs index e0a079c546..650d0273d2 100644 --- a/wallet/wallet-rpc-lib/src/rpc/types.rs +++ b/wallet/wallet-rpc-lib/src/rpc/types.rs @@ -92,6 +92,12 @@ pub enum RpcError { #[error("Invalid mnemonic: {0}")] InvalidMnemonic(wallet_controller::mnemonic::Error), + #[error("Cannot specify a mnemonic or passphrase when using a hardware wallet")] + HardwareWalletWithMnemonic, + + #[error("Invalid hardware wallet selection")] + InvalidHardwareWallet, + #[error("Invalid ip address")] InvalidIpAddress, @@ -647,16 +653,19 @@ pub struct CreatedWallet { pub mnemonic: MnemonicInfo, } -impl From for CreatedWallet { - fn from(value: crate::CreatedWallet) -> Self { +impl From for CreatedWallet { + fn from(value: wallet_controller::types::CreatedWallet) -> Self { let mnemonic = match value { - crate::CreatedWallet::UserProvidedMnemonic => MnemonicInfo::UserProvided, - crate::CreatedWallet::NewlyGeneratedMnemonic(mnemonic, passphrase) => { - MnemonicInfo::NewlyGenerated { - mnemonic: mnemonic.to_string(), - passphrase, - } + wallet_controller::types::CreatedWallet::UserProvidedMnemonic => { + MnemonicInfo::UserProvided } + wallet_controller::types::CreatedWallet::NewlyGeneratedMnemonic( + mnemonic, + passphrase, + ) => MnemonicInfo::NewlyGenerated { + mnemonic: mnemonic.to_string(), + passphrase, + }, }; Self { mnemonic } } @@ -786,6 +795,12 @@ pub enum RpcCurrency { Token { token_id: RpcAddress }, } +#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, HasValueHint)] +pub enum HardwareWalletType { + #[cfg(feature = "trezor")] + Trezor, +} + #[cfg(test)] mod test { use super::*; diff --git a/wallet/wallet-rpc-lib/src/service/mod.rs b/wallet/wallet-rpc-lib/src/service/mod.rs index 8580b0ace5..90a55c1a21 100644 --- a/wallet/wallet-rpc-lib/src/service/mod.rs +++ b/wallet/wallet-rpc-lib/src/service/mod.rs @@ -26,7 +26,7 @@ use utils::shallow_clone::ShallowClone; pub use events::{Event, TxState}; pub use handle::{EventStream, SubmitError, WalletHandle}; use wallet_controller::{ControllerConfig, NodeInterface}; -pub use worker::{CreatedWallet, WalletController, WalletControllerError}; +pub use worker::{WalletController, WalletControllerError}; use events::WalletServiceEvents; diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index ba09c7eae5..e0e6fc47ad 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -21,9 +21,8 @@ use tokio::{sync::mpsc, task::JoinHandle}; use logging::log; use utils_networking::broadcaster::Broadcaster; -use wallet::wallet::Mnemonic; +use wallet_controller::types::{CreatedWallet, WalletTypeArgs}; use wallet_controller::{ControllerError, NodeInterface}; -use wallet_types::seed_phrase::StoreSeedPhrase; use crate::types::RpcError; @@ -52,11 +51,6 @@ pub enum WalletCommand { Stop, } -pub enum CreatedWallet { - UserProvidedMnemonic, - NewlyGeneratedMnemonic(Mnemonic, Option), -} - /// Represents the wallet worker task. It handles external commands and keeps the wallet in sync. pub struct WalletWorker { controller: Option>, @@ -186,33 +180,23 @@ where pub async fn create_wallet( &mut self, wallet_path: PathBuf, - whether_to_store_seed_phrase: StoreSeedPhrase, - mnemonic: Option, - passphrase: Option, + args: WalletTypeArgs, skip_syncing: bool, ) -> Result> { utils::ensure!( self.controller.is_none(), ControllerError::WalletFileAlreadyOpen ); - // TODO: Support other languages - let language = wallet::wallet::Language::English; - let newly_generated_mnemonic = mnemonic.is_none(); - let mnemonic = match &mnemonic { - Some(mnemonic) => wallet_controller::mnemonic::parse_mnemonic(language, mnemonic) - .map_err(RpcError::InvalidMnemonic)?, - None => wallet_controller::mnemonic::generate_new_mnemonic(language), - }; - let passphrase_ref = passphrase.as_ref().map(|x| x.as_ref()); + let newly_generated_mnemonic = args.user_supplied_menmonic(); + let (computed_args, wallet_created) = + args.parse_mnemonic().map_err(RpcError::InvalidMnemonic)?; let wallet = if newly_generated_mnemonic || skip_syncing { let info = self.node_rpc.chainstate_info().await.map_err(RpcError::RpcError)?; WalletController::create_wallet( self.chain_config.clone(), wallet_path, - mnemonic.clone(), - passphrase_ref, - whether_to_store_seed_phrase, + computed_args, (info.best_block_height, info.best_block_id), self.node_rpc.is_cold_wallet_node(), ) @@ -220,9 +204,7 @@ where WalletController::recover_wallet( self.chain_config.clone(), wallet_path, - mnemonic.clone(), - passphrase_ref, - whether_to_store_seed_phrase, + computed_args, self.node_rpc.is_cold_wallet_node(), ) } @@ -239,11 +221,7 @@ where self.controller.replace(controller); - let result = match newly_generated_mnemonic { - true => CreatedWallet::NewlyGeneratedMnemonic(mnemonic, passphrase), - false => CreatedWallet::UserProvidedMnemonic, - }; - Ok(result) + Ok(wallet_created) } pub fn subscribe(&mut self) -> EventStream { From 6ca2bbf7b095810e62b42fd4ff6ab87bddb14fe4 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 16 Jul 2024 00:36:22 +0200 Subject: [PATCH 09/48] add support for all inputs and outputs to trezor signer --- Cargo.lock | 1 + Cargo.toml | 5 + wallet/Cargo.toml | 1 + wallet/src/signer/trezor_signer/mod.rs | 568 +- wallet/src/signer/trezor_signer/tests.rs | 95 +- wallet/src/wallet/tests.rs | 2 +- wallet/trezor-client/src/client/common.rs | 38 +- wallet/trezor-client/src/client/ethereum.rs | 9 +- wallet/trezor-client/src/client/mintlayer.rs | 12 +- wallet/trezor-client/src/client/mod.rs | 10 +- wallet/trezor-client/src/client/solana.rs | 7 +- wallet/trezor-client/src/flows/sign_tx.rs | 28 +- wallet/trezor-client/src/lib.rs | 43 +- .../protos/generated/messages_mintlayer.rs | 6594 ++++++++++++++++- wallet/trezor-client/src/protos/mod.rs | 1 - .../trezor-client/src/transport/protocol.rs | 28 +- wallet/trezor-client/src/transport/udp.rs | 14 +- wallet/trezor-client/src/transport/webusb.rs | 8 +- wallet/trezor-client/src/utils.rs | 2 +- wallet/wallet-cli-commands/Cargo.toml | 5 + .../src/command_handler/mod.rs | 12 +- .../wallet-cli-commands/src/helper_types.rs | 1 + wallet/wallet-cli-commands/src/lib.rs | 2 +- wallet/wallet-cli-lib/Cargo.toml | 3 + wallet/wallet-controller/Cargo.toml | 5 + wallet/wallet-controller/src/lib.rs | 4 +- wallet/wallet-rpc-client/Cargo.toml | 6 + .../src/handles_client/mod.rs | 2 + wallet/wallet-rpc-lib/Cargo.toml | 5 + wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 2 +- 30 files changed, 6984 insertions(+), 529 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09eb889db8..70bf2d9ccc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9000,6 +9000,7 @@ dependencies = [ "thiserror", "tokio", "tower", + "utils", "utils-networking", "wallet", "wallet-controller", diff --git a/Cargo.toml b/Cargo.toml index 0ac231f3fb..638b269c49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -274,3 +274,8 @@ overflow-checks = true [profile.test.package.script] opt-level = 2 + +[features] +trezor = [] + +default = ["trezor"] diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index f7553b46af..f123ff7995 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -27,6 +27,7 @@ utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } trezor-client = { path = "./trezor-client", features = ["bitcoin", "mintlayer"], optional = true } +# trezor-client = { path = "../../trezor-firmware/rust/trezor-client", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } hex.workspace = true diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 0cbb139fd5..176a45a010 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -32,9 +32,12 @@ use common::{ }, sighash::{sighashtype::SigHashType, signature_hash}, }, - ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, - TxOutput, + timelock::OutputTimeLock, + tokens::{NftIssuance, TokenIssuance, TokenTotalSupply}, + AccountCommand, AccountSpending, ChainConfig, Destination, OutPointSourceId, + SignedTransactionIntent, Transaction, TxInput, TxOutput, }, + primitives::Amount, }; use crypto::key::{ extended::{ExtendedPrivateKey, ExtendedPublicKey}, @@ -45,7 +48,20 @@ use crypto::key::{ use itertools::Itertools; use randomness::make_true_rng; use serialization::Encode; -use trezor_client::find_devices; +use trezor_client::{ + find_devices, + protos::{ + MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerBurnTxOutput, + MintlayerChangeTokenAuhtority, MintlayerCreateDelegationIdTxOutput, + MintlayerCreateStakePoolTxOutput, MintlayerDataDepositTxOutput, + MintlayerDelegateStakingTxOutput, MintlayerFreezeToken, + MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, + MintlayerLockThenTransferTxOutput, MintlayerLockTokenSupply, MintlayerMintTokens, + MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, MintlayerTokenTotalSupply, + MintlayerTokenTotalSupplyType, MintlayerTxInput, MintlayerTxOutput, MintlayerUnfreezeToken, + MintlayerUnmintTokens, MintlayerUtxoType, + }, +}; #[allow(clippy::all)] use trezor_client::{ protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, @@ -136,12 +152,18 @@ impl TrezorSigner { )), Destination::PublicKeyHash(_) => { if let Some(signature) = signature { + if signature.is_empty() { + eprintln!("empty signature"); + return Ok((None, SignatureStatus::NotSigned)); + } + eprintln!("some signature pkh"); let pk = key_chain.find_public_key(destination).expect("found").into_public_key(); eprintln!("pk {:?}", pk.encode()); let mut signature = signature.clone(); signature.insert(0, 0); + eprintln!("sig len {}", signature.len()); let sig = Signature::from_data(signature)?; let sig = AuthorizedPublicKeyHashSpend::new(pk, sig); let sig = InputWitness::Standard(StandardInputSignature::new( @@ -149,6 +171,7 @@ impl TrezorSigner { sig.encode(), )); + eprintln!("sig ok"); Ok((Some(sig), SignatureStatus::FullySigned)) } else { eprintln!("empty signature"); @@ -184,30 +207,12 @@ impl TrezorSigner { } } - fn to_trezor_output_msgs( - &self, - ptx: &PartiallySignedTransaction, - ) -> Vec { + fn to_trezor_output_msgs(&self, ptx: &PartiallySignedTransaction) -> Vec { let outputs = ptx .tx() .outputs() .iter() - .map(|out| match out { - TxOutput::Transfer(value, dest) => match value { - OutputValue::Coin(amount) => { - let mut out_req = MintlayerTransferTxOutput::new(); - out_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - out_req.set_address( - Address::new(&self.chain_config, dest.clone()) - .expect("addressable") - .into_string(), - ); - out_req - } - _ => unimplemented!("support transfer of tokens in trezor"), - }, - _ => unimplemented!("support other output types in trezor"), - }) + .map(|out| to_trezor_output_msg(&self.chain_config, out)) .collect(); outputs } @@ -224,9 +229,9 @@ impl Signer for TrezorSigner { Vec, Vec, )> { - let inputs = to_trezor_input_msgs(&ptx); + let inputs = to_trezor_input_msgs(&ptx, key_chain, &self.chain_config); let outputs = self.to_trezor_output_msgs(&ptx); - let utxos = to_trezor_utxo_msgs(&ptx, key_chain); + let utxos = to_trezor_utxo_msgs(&ptx, &self.chain_config); let new_signatures = self .client @@ -234,6 +239,7 @@ impl Signer for TrezorSigner { .expect("") .mintlayer_sign_tx(inputs, outputs, utxos) .expect(""); + eprintln!("new signatures: {new_signatures:?}"); let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); @@ -258,6 +264,7 @@ impl Signer for TrezorSigner { .verify_signature(&self.chain_config, destination, &sighash) .is_ok() { + eprintln!("valid signature {sighash:?}!!\n\n"); Ok(( Some(w.clone()), SignatureStatus::FullySigned, @@ -335,33 +342,190 @@ impl Signer for TrezorSigner { } } -fn to_trezor_input_msgs(ptx: &PartiallySignedTransaction) -> Vec { +fn tx_output_value(out: &TxOutput) -> OutputValue { + match out { + TxOutput::Transfer(value, _) + | TxOutput::LockThenTransfer(value, _, _) + | TxOutput::Burn(value) => value.clone(), + TxOutput::DelegateStaking(amount, _) => OutputValue::Coin(*amount), + TxOutput::IssueNft(token_id, _, _) => { + OutputValue::TokenV1(*token_id, Amount::from_atoms(1)) + } + TxOutput::CreateStakePool(_, _) + | TxOutput::CreateDelegationId(_, _) + | TxOutput::ProduceBlockFromStake(_, _) + | TxOutput::IssueFungibleToken(_) + | TxOutput::DataDeposit(_) => OutputValue::Coin(Amount::ZERO), + } +} + +fn to_trezor_input_msgs( + ptx: &PartiallySignedTransaction, + key_chain: &impl AccountKeyChains, + chain_config: &ChainConfig, +) -> Vec { let inputs = ptx .tx() .inputs() .iter() .zip(ptx.input_utxos()) - .map(|(inp, utxo)| match (inp, utxo) { - (TxInput::Utxo(outpoint), Some(TxOutput::Transfer(value, _))) => { + .zip(ptx.destinations()) + .map(|((inp, utxo), dest)| match (inp, utxo, dest) { + (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => { let mut inp_req = MintlayerUtxoTxInput::new(); let id = match outpoint.source_id() { - OutPointSourceId::Transaction(id) => id.to_hash().0, - OutPointSourceId::BlockReward(id) => id.to_hash().0, + OutPointSourceId::Transaction(id) => { + inp_req.set_type(MintlayerUtxoType::TRANSACTION); + id.to_hash().0 + } + OutPointSourceId::BlockReward(id) => { + inp_req.set_type(MintlayerUtxoType::BLOCK); + id.to_hash().0 + } }; inp_req.set_prev_hash(id.to_vec()); inp_req.set_prev_index(outpoint.output_index()); - match value { + match tx_output_value(utxo) { OutputValue::Coin(amount) => { - inp_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + inp_req.value = Some(value).into(); + } + OutputValue::TokenV1(token_id, amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + inp_req.value = Some(value).into(); + } + OutputValue::TokenV0(_) => { + panic!("token v0 unsuported"); + } + } + + inp_req.set_address( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + match key_chain.find_public_key(dest) { + Some(FoundPubKey::Hierarchy(xpub)) => { + inp_req.address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + } + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") } - OutputValue::TokenV1(_, _) | OutputValue::TokenV0(_) => { - unimplemented!("support for tokens") + None => {} + }; + + let mut inp = MintlayerTxInput::new(); + inp.utxo = Some(inp_req).into(); + inp + } + (TxInput::Account(outpoint), _, Some(dest)) => { + let mut inp_req = MintlayerAccountTxInput::new(); + inp_req.set_address( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + match key_chain.find_public_key(dest) { + Some(FoundPubKey::Hierarchy(xpub)) => { + inp_req.address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + } + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") + } + None => {} + }; + inp_req.set_nonce(outpoint.nonce().value()); + match outpoint.account() { + AccountSpending::DelegationBalance(delegation_id, amount) => { + inp_req.set_delegation_id(delegation_id.to_hash().as_bytes().to_vec()); + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + inp_req.value = Some(value).into(); } } + let mut inp = MintlayerTxInput::new(); + inp.account = Some(inp_req).into(); + inp + } + (TxInput::AccountCommand(nonce, command), _, Some(dest)) => { + let mut inp_req = MintlayerAccountCommandTxInput::new(); + inp_req.set_address( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + match key_chain.find_public_key(dest) { + Some(FoundPubKey::Hierarchy(xpub)) => { + inp_req.address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + } + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") + } + None => {} + }; + inp_req.set_nonce(nonce.value()); + match command { + AccountCommand::MintTokens(token_id, amount) => { + let mut req = MintlayerMintTokens::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + + inp_req.mint = Some(req).into(); + } + AccountCommand::UnmintTokens(token_id) => { + let mut req = MintlayerUnmintTokens::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - inp_req + inp_req.unmint = Some(req).into(); + } + AccountCommand::FreezeToken(token_id, unfreezable) => { + let mut req = MintlayerFreezeToken::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_is_token_unfreezabe(unfreezable.as_bool()); + + inp_req.freeze_token = Some(req).into(); + } + AccountCommand::UnfreezeToken(token_id) => { + let mut req = MintlayerUnfreezeToken::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + + inp_req.unfreeze_token = Some(req).into(); + } + AccountCommand::LockTokenSupply(token_id) => { + let mut req = MintlayerLockTokenSupply::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + + inp_req.lock_token_supply = Some(req).into(); + } + AccountCommand::ChangeTokenAuthority(token_id, dest) => { + let mut req = MintlayerChangeTokenAuhtority::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_destination( + Address::new(chain_config, dest.clone()) + .expect("addressable") + .into_string(), + ); + + inp_req.change_token_authority = Some(req).into(); + } + } + let mut inp = MintlayerTxInput::new(); + inp.account_command = Some(inp_req).into(); + inp } - (TxInput::Utxo(_) | TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => { + (TxInput::Utxo(_) | TxInput::Account(_) | TxInput::AccountCommand(_, _), _, _) => { unimplemented!("accounting not supported yet with trezor") } }) @@ -371,59 +535,51 @@ fn to_trezor_input_msgs(ptx: &PartiallySignedTransaction) -> Vec BTreeMap<[u8; 32], BTreeMap> { - let utxos = ptx - .input_utxos() - .iter() - .zip(ptx.tx().inputs()) - .filter_map(|(utxo, inp)| utxo.as_ref().map(|utxo| (utxo, inp))) - .fold( - BTreeMap::new(), - |mut map: BTreeMap<[u8; 32], BTreeMap>, (utxo, inp)| { - match (inp, utxo) { - (TxInput::Utxo(outpoint), TxOutput::Transfer(value, dest)) => { - let mut out_req = MintlayerTransferTxOutput::new(); - match value { - OutputValue::Coin(amount) => { - out_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - } - OutputValue::TokenV0(_) | OutputValue::TokenV1(_, _) => { - unimplemented!("support tokens in trezor") - } - }; - - out_req.address_n = match key_chain.find_public_key(dest) { - Some(FoundPubKey::Hierarchy(xpub)) => xpub - .get_derivation_path() - .as_slice() - .iter() - .map(|c| c.into_encoded_index()) - .collect(), - Some(FoundPubKey::Standalone(_)) => { - unimplemented!("standalone keys with trezor") - } - None => unimplemented!("external keys with trezor"), - }; - - let id = match outpoint.source_id() { - OutPointSourceId::Transaction(id) => id.to_hash().0, - OutPointSourceId::BlockReward(id) => id.to_hash().0, - }; - - map.entry(id).or_default().insert(outpoint.output_index(), out_req); - } - (TxInput::Utxo(_), _) => unimplemented!("support other utxo types"), - (TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => { - panic!("can't have accounts as UTXOs") - } + chain_config: &ChainConfig, +) -> BTreeMap<[u8; 32], BTreeMap> { + let utxos = ptx.input_utxos().iter().zip(ptx.tx().inputs()).fold( + BTreeMap::new(), + |mut map: BTreeMap<[u8; 32], BTreeMap>, (utxo, inp)| { + match (inp, utxo) { + (TxInput::Utxo(outpoint), Some(utxo)) => { + let id = match outpoint.source_id() { + OutPointSourceId::Transaction(id) => id.to_hash().0, + OutPointSourceId::BlockReward(id) => id.to_hash().0, + }; + let out = to_trezor_output_msg(chain_config, utxo); + map.entry(id).or_default().insert(outpoint.output_index(), out); } - map - }, - ); + (TxInput::Utxo(_), None) => unimplemented!("missing utxo"), + (TxInput::Account(_) | TxInput::AccountCommand(_, _), Some(_)) => { + panic!("can't have accounts as UTXOs") + } + (TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => {} + } + map + }, + ); utxos } +fn set_value(value: &OutputValue, out_req: &mut MintlayerTransferTxOutput) { + match value { + OutputValue::Coin(amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + out_req.value = Some(value).into(); + } + OutputValue::TokenV1(token_id, amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + out_req.value = Some(value).into(); + } + OutputValue::TokenV0(_) => { + panic!("token v0 unsuported"); + } + }; +} + /// Get the private key that corresponds to the provided public key fn get_private_key( parent_key: &ExtendedPrivateKey, @@ -438,6 +594,242 @@ fn get_private_key( } } +fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> MintlayerTxOutput { + match out { + TxOutput::Transfer(value, dest) => { + let mut out_req = MintlayerTransferTxOutput::new(); + set_value(value, &mut out_req); + out_req.set_address( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + + let mut out = MintlayerTxOutput::new(); + out.transfer = Some(out_req).into(); + out + } + TxOutput::LockThenTransfer(value, dest, lock) => { + let mut out_req = MintlayerLockThenTransferTxOutput::new(); + match value { + OutputValue::Coin(amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + out_req.value = Some(value).into(); + } + OutputValue::TokenV1(token_id, amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + out_req.value = Some(value).into(); + } + OutputValue::TokenV0(_) => { + panic!("token v0 unsuported"); + } + }; + out_req.set_address( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + + let mut lock_req = trezor_client::protos::MintlayerOutputTimeLock::new(); + match lock { + OutputTimeLock::UntilTime(time) => { + lock_req.set_until_time(time.as_int_seconds()); + } + OutputTimeLock::UntilHeight(height) => { + lock_req.set_until_height(height.into_int()); + } + OutputTimeLock::ForSeconds(sec) => { + lock_req.set_for_seconds(*sec); + } + OutputTimeLock::ForBlockCount(count) => { + lock_req.set_for_block_count(*count); + } + } + out_req.lock = Some(lock_req).into(); + + let mut out = MintlayerTxOutput::new(); + out.lock_then_transfer = Some(out_req).into(); + out + } + TxOutput::Burn(value) => { + let mut out_req = MintlayerBurnTxOutput::new(); + match value { + OutputValue::Coin(amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + out_req.value = Some(value).into(); + } + OutputValue::TokenV1(token_id, amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + out_req.value = Some(value).into(); + } + OutputValue::TokenV0(_) => { + panic!("token v0 unsuported"); + } + }; + + let mut out = MintlayerTxOutput::new(); + out.burn = Some(out_req).into(); + out + } + TxOutput::CreateDelegationId(dest, pool_id) => { + let mut out_req = MintlayerCreateDelegationIdTxOutput::new(); + out_req.set_pool_id(pool_id.to_hash().as_bytes().to_vec()); + out_req.set_destination( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + let mut out = MintlayerTxOutput::new(); + out.create_delegation_id = Some(out_req).into(); + out + } + TxOutput::DelegateStaking(amount, delegation_id) => { + let mut out_req = MintlayerDelegateStakingTxOutput::new(); + out_req.set_delegation_id(delegation_id.to_hash().as_bytes().to_vec()); + out_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + let mut out = MintlayerTxOutput::new(); + out.delegate_staking = Some(out_req).into(); + out + } + TxOutput::CreateStakePool(pool_id, pool_data) => { + let mut out_req = MintlayerCreateStakePoolTxOutput::new(); + out_req.set_pool_id(pool_id.to_hash().as_bytes().to_vec()); + + out_req.set_pledge(pool_data.pledge().into_atoms().to_be_bytes().to_vec()); + out_req.set_staker( + Address::new(chain_config, pool_data.staker().clone()) + .expect("addressable") + .into_string(), + ); + out_req.set_decommission_key( + Address::new(chain_config, pool_data.decommission_key().clone()) + .expect("addressable") + .into_string(), + ); + out_req.set_vrf_public_key( + Address::new(chain_config, pool_data.vrf_public_key().clone()) + .expect("addressable") + .into_string(), + ); + out_req + .set_cost_per_block(pool_data.cost_per_block().into_atoms().to_be_bytes().to_vec()); + out_req.set_margin_ratio_per_thousand( + pool_data.margin_ratio_per_thousand().as_per_thousand_int() as u32, + ); + + let mut out = MintlayerTxOutput::new(); + out.create_stake_pool = Some(out_req).into(); + out + } + TxOutput::ProduceBlockFromStake(dest, pool_id) => { + let mut out_req = MintlayerProduceBlockFromStakeTxOutput::new(); + out_req.set_pool_id(pool_id.to_hash().as_bytes().to_vec()); + out_req.set_destination( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + let mut out = MintlayerTxOutput::new(); + out.produce_block_from_stake = Some(out_req).into(); + out + } + TxOutput::IssueFungibleToken(token_data) => { + let mut out_req = MintlayerIssueFungibleTokenTxOutput::new(); + + match token_data.as_ref() { + TokenIssuance::V1(data) => { + out_req.set_authority( + Address::new(chain_config, data.authority.clone()) + .expect("addressable") + .into_string(), + ); + out_req.set_token_ticker(data.token_ticker.clone()); + out_req.set_metadata_uri(data.metadata_uri.clone()); + out_req.set_number_of_decimals(data.number_of_decimals as u32); + out_req.set_is_freezable(data.is_freezable.as_bool()); + let mut total_supply = MintlayerTokenTotalSupply::new(); + match data.total_supply { + TokenTotalSupply::Lockable => { + total_supply.set_type(MintlayerTokenTotalSupplyType::LOCKABLE) + } + TokenTotalSupply::Unlimited => { + total_supply.set_type(MintlayerTokenTotalSupplyType::UNLIMITED) + } + TokenTotalSupply::Fixed(amount) => { + total_supply.set_type(MintlayerTokenTotalSupplyType::FIXED); + total_supply + .set_fixed_amount(amount.into_atoms().to_be_bytes().to_vec()); + } + } + out_req.total_supply = Some(total_supply).into(); + } + }; + + let mut out = MintlayerTxOutput::new(); + out.issue_fungible_token = Some(out_req).into(); + out + } + TxOutput::IssueNft(token_id, nft_data, dest) => { + let mut out_req = MintlayerIssueNftTxOutput::new(); + out_req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + out_req.set_destination( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + match nft_data.as_ref() { + NftIssuance::V0(data) => { + // + out_req.set_name(data.metadata.name.clone()); + out_req.set_ticker(data.metadata.ticker().clone()); + out_req.set_icon_uri( + data.metadata + .icon_uri() + .as_ref() + .as_ref() + .map(|x| x.clone()) + .unwrap_or_default(), + ); + out_req.set_media_uri( + data.metadata + .media_uri() + .as_ref() + .as_ref() + .map(|x| x.clone()) + .unwrap_or_default(), + ); + out_req.set_media_hash(data.metadata.media_hash().clone()); + out_req.set_additional_metadata_uri( + data.metadata + .additional_metadata_uri() + .as_ref() + .as_ref() + .map(|x| x.clone()) + .unwrap_or_default(), + ); + out_req.set_description(data.metadata.description.clone()); + if let Some(creator) = data.metadata.creator() { + out_req.set_creator( + Address::new( + chain_config, + Destination::PublicKey(creator.public_key.clone()), + ) + .expect("addressable") + .into_string(), + ); + } + } + }; + let mut out = MintlayerTxOutput::new(); + out.issue_nft = Some(out_req).into(); + out + } + TxOutput::DataDeposit(data) => { + let mut out_req = MintlayerDataDepositTxOutput::new(); + out_req.set_data(data.clone()); + let mut out = MintlayerTxOutput::new(); + out.data_deposit = Some(out_req).into(); + out + } + } +} + #[derive(Clone)] pub struct TrezorSignerProvider { client: Arc>, @@ -477,10 +869,16 @@ impl SignerProvider for TrezorSignerProvider { name: Option, db_tx: &mut impl WalletStorageWriteUnlocked, ) -> WalletResult> { + eprintln!( + "coin type in new acc trezor: {:?}", + chain_config.bip44_coin_type().get_index() + ); let derivation_path = make_account_path(&chain_config, account_index); let account_path = derivation_path.as_slice().iter().map(|c| c.into_encoded_index()).collect(); + eprintln!("account path {account_path:?}"); + let xpub = self .client .lock() diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 096d6d3630..1c7763d497 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -21,8 +21,14 @@ use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::output_value::OutputValue; -use common::chain::{Transaction, TxInput}; +use common::chain::signature::verify_signature; +use common::chain::timelock::OutputTimeLock; +use common::chain::tokens::TokenId; +use common::chain::{ + AccountNonce, AccountOutPoint, DelegationId, GenBlock, PoolId, Transaction, TxInput, +}; use common::primitives::{Amount, Id, H256}; +use crypto::key::KeyKind; use randomness::{Rng, RngCore}; use rstest::rstest; use test_utils::random::{make_seedable_rng, Seed}; @@ -59,7 +65,7 @@ fn sign_transaction(#[case] seed: Seed) { .unwrap(); let mut account = Account::new(chain_config.clone(), &mut db_tx, key_chain, None).unwrap(); - let amounts: Vec = (0..1) //(0..(2 + rng.next_u32() % 5)) + let amounts: Vec = (0..3) //(0..(2 + rng.next_u32() % 5)) // .map(|_| Amount::from_atoms(rng.next_u32() as UnsignedIntType)) .map(|_| Amount::from_atoms(1)) .collect(); @@ -82,18 +88,44 @@ fn sign_transaction(#[case] seed: Seed) { }) .collect(); - let inputs: Vec = utxos - .iter() - .map(|_txo| { - // let source_id = if rng.gen_bool(0.5) { - let source_id = Id::::new(H256::random_using(&mut rng)).into(); - // } else { - // Id::::new(H256::random_using(&mut rng)).into() - // }; + let inputs: Vec = (0..utxos.len()) + .into_iter() + .map(|_| { + let source_id = if rng.gen_bool(0.5) { + Id::::new(H256::random_using(&mut rng)).into() + } else { + Id::::new(H256::random_using(&mut rng)).into() + }; TxInput::from_utxo(source_id, rng.next_u32()) }) .collect(); + let acc_inputs = vec![ + TxInput::Account(AccountOutPoint::new( + AccountNonce::new(1), + AccountSpending::DelegationBalance( + DelegationId::new(H256::random_using(&mut rng)).into(), + Amount::from_atoms(rng.next_u32() as u128), + ), + )), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::UnmintTokens(TokenId::new(H256::random_using(&mut rng)).into()), + ), + ]; + let acc_dests: Vec = acc_inputs + .iter() + .map(|_| { + let purpose = if rng.gen_bool(0.5) { + ReceiveFunds + } else { + Change + }; + + account.get_new_address(&mut db_tx, purpose).unwrap().1.into_object() + }) + .collect(); + let dest_amount = total_amount.div(10).unwrap().mul(5).unwrap(); let lock_amount = total_amount.div(10).unwrap().mul(1).unwrap(); let burn_amount = total_amount.div(10).unwrap().mul(1).unwrap(); @@ -103,28 +135,38 @@ fn sign_transaction(#[case] seed: Seed) { .fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); let _fee_amount = total_amount.sub(outputs_amounts_sum).unwrap(); - // let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); + let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); let outputs = vec![ - // TxOutput::Transfer( - // OutputValue::Coin(dest_amount), - // Destination::PublicKey(dest_pub), - // ), - // TxOutput::LockThenTransfer( - // OutputValue::Coin(lock_amount), - // Destination::AnyoneCanSpend, - // OutputTimeLock::ForSeconds(rng.next_u64()), - // ), - // TxOutput::Burn(OutputValue::Coin(burn_amount)), + TxOutput::Transfer( + OutputValue::Coin(dest_amount), + Destination::PublicKey(dest_pub), + ), + TxOutput::LockThenTransfer( + OutputValue::Coin(lock_amount), + Destination::AnyoneCanSpend, + OutputTimeLock::ForSeconds(rng.next_u64()), + ), + TxOutput::Burn(OutputValue::Coin(burn_amount)), TxOutput::Transfer( OutputValue::Coin(Amount::from_atoms(100_000_000_000)), account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), ), + TxOutput::CreateDelegationId( + Destination::AnyoneCanSpend, + PoolId::new(H256::random_using(&mut rng)).into(), + ), + TxOutput::DelegateStaking( + Amount::from_atoms(200), + DelegationId::new(H256::random_using(&mut rng)).into(), + ), ]; - let tx = Transaction::new(0, inputs.clone(), outputs).unwrap(); - - let req = SendRequest::from_transaction(tx, utxos.clone(), &|_| None).unwrap(); + let req = SendRequest::new() + .with_inputs(inputs.clone().into_iter().zip(utxos.clone()), &|_| None) + .unwrap() + .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) + .with_outputs(outputs); let ptx = req.into_partially_signed_tx().unwrap(); let mut devices = find_devices(false); @@ -138,12 +180,13 @@ fn sign_transaction(#[case] seed: Seed) { ); let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); - eprintln!("num inputs in tx: {}", inputs.len()); + eprintln!("num inputs in tx: {} {:?}", inputs.len(), ptx.witnesses()); assert!(ptx.all_signatures_available()); let sig_tx = ptx.into_signed_tx().unwrap(); - let utxos_ref = utxos.iter().map(Some).collect::>(); + let utxos_ref = + utxos.iter().map(Some).chain(acc_dests.iter().map(|_| None)).collect::>(); for i in 0..sig_tx.inputs().len() { let destination = get_tx_output_destination( diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 50cf719768..07b15e553d 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -1088,7 +1088,7 @@ fn wallet_recover_new_account(#[case] seed: Seed) { let mut total_amounts = BTreeMap::new(); let mut last_account_index = DEFAULT_ACCOUNT_INDEX; - let blocks = (0..rng.gen_range(1..1000)) + let blocks = (0..rng.gen_range(1..100)) .map(|idx| { let tx_amount1 = Amount::from_atoms(rng.gen_range(1..10)); total_amounts diff --git a/wallet/trezor-client/src/client/common.rs b/wallet/trezor-client/src/client/common.rs index 9da4eb4025..b8bef6c9fd 100644 --- a/wallet/trezor-client/src/client/common.rs +++ b/wallet/trezor-client/src/client/common.rs @@ -160,12 +160,12 @@ impl<'a, T, R: TrezorMessage> TrezorResponse<'a, T, R> { TrezorResponse::ButtonRequest(_) => { Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) } - TrezorResponse::PinMatrixRequest(_) => Err(Error::UnexpectedInteractionRequest( - InteractionType::PinMatrix, - )), - TrezorResponse::PassphraseRequest(_) => Err(Error::UnexpectedInteractionRequest( - InteractionType::Passphrase, - )), + TrezorResponse::PinMatrixRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::PinMatrix)) + } + TrezorResponse::PassphraseRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::Passphrase)) + } } } @@ -175,12 +175,12 @@ impl<'a, T, R: TrezorMessage> TrezorResponse<'a, T, R> { TrezorResponse::ButtonRequest(r) => Ok(r), TrezorResponse::Ok(_) => Err(Error::UnexpectedMessageType(R::MESSAGE_TYPE)), TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), - TrezorResponse::PinMatrixRequest(_) => Err(Error::UnexpectedInteractionRequest( - InteractionType::PinMatrix, - )), - TrezorResponse::PassphraseRequest(_) => Err(Error::UnexpectedInteractionRequest( - InteractionType::Passphrase, - )), + TrezorResponse::PinMatrixRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::PinMatrix)) + } + TrezorResponse::PassphraseRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::Passphrase)) + } } } @@ -193,9 +193,9 @@ impl<'a, T, R: TrezorMessage> TrezorResponse<'a, T, R> { TrezorResponse::ButtonRequest(_) => { Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) } - TrezorResponse::PassphraseRequest(_) => Err(Error::UnexpectedInteractionRequest( - InteractionType::Passphrase, - )), + TrezorResponse::PassphraseRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::Passphrase)) + } } } @@ -208,9 +208,9 @@ impl<'a, T, R: TrezorMessage> TrezorResponse<'a, T, R> { TrezorResponse::ButtonRequest(_) => { Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) } - TrezorResponse::PinMatrixRequest(_) => Err(Error::UnexpectedInteractionRequest( - InteractionType::PinMatrix, - )), + TrezorResponse::PinMatrixRequest(_) => { + Err(Error::UnexpectedInteractionRequest(InteractionType::PinMatrix)) + } } } } @@ -237,7 +237,7 @@ impl<'a> EntropyRequest<'a> { /// Provide exactly 32 bytes or entropy. pub fn ack_entropy(self, entropy: Vec) -> Result> { if entropy.len() != 32 { - return Err(Error::InvalidEntropy); + return Err(Error::InvalidEntropy) } let mut req = protos::EntropyAck::new(); diff --git a/wallet/trezor-client/src/client/ethereum.rs b/wallet/trezor-client/src/client/ethereum.rs index 548a0ae505..c6b78f5329 100644 --- a/wallet/trezor-client/src/client/ethereum.rs +++ b/wallet/trezor-client/src/client/ethereum.rs @@ -30,10 +30,9 @@ impl Trezor { pub fn ethereum_get_address(&mut self, path: Vec) -> Result { let mut req = protos::EthereumGetAddress::new(); req.address_n = path; - let address = handle_interaction(self.call( - req, - Box::new(|_, m: protos::EthereumAddress| Ok(m.address().into())), - )?)?; + let address = handle_interaction( + self.call(req, Box::new(|_, m: protos::EthereumAddress| Ok(m.address().into())))?, + )?; Ok(address) } @@ -46,7 +45,7 @@ impl Trezor { Box::new(|_, m: protos::EthereumMessageSignature| { let signature = m.signature(); if signature.len() != 65 { - return Err(Error::MalformedSignature); + return Err(Error::MalformedSignature) } let r = signature[0..32].try_into().unwrap(); let s = signature[32..64].try_into().unwrap(); diff --git a/wallet/trezor-client/src/client/mintlayer.rs b/wallet/trezor-client/src/client/mintlayer.rs index 9250434a7b..a2154e7a4a 100644 --- a/wallet/trezor-client/src/client/mintlayer.rs +++ b/wallet/trezor-client/src/client/mintlayer.rs @@ -9,8 +9,8 @@ use crate::{ protos::{ self, mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper, mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper, - mintlayer_tx_request::MintlayerRequestType, MintlayerTransferTxOutput, - MintlayerTxAckOutput, MintlayerTxAckUtxoInput, MintlayerUtxoTxInput, + mintlayer_tx_request::MintlayerRequestType, MintlayerTxAckOutput, MintlayerTxAckUtxoInput, + MintlayerTxInput, MintlayerTxOutput, }, Error, TrezorResponse, }; @@ -51,9 +51,9 @@ impl Trezor { pub fn mintlayer_sign_tx( &mut self, - inputs: Vec, - outputs: Vec, - utxos: BTreeMap<[u8; 32], BTreeMap>, + inputs: Vec, + outputs: Vec, + utxos: BTreeMap<[u8; 32], BTreeMap>, ) -> Result>>> { let mut req = protos::MintlayerSignTx::new(); req.set_version(1); @@ -102,7 +102,7 @@ impl Trezor { req.output = MessageField::from_option( outputs.get(response.details.request_index() as usize).cloned(), ); - eprintln!("sending tx output"); + eprintln!("sending tx output {req:?}"); should_ack_button += 2; if response.details.request_index() as usize == outputs.len() - 1 { eprintln!("last output will wait for one more ack"); diff --git a/wallet/trezor-client/src/client/mod.rs b/wallet/trezor-client/src/client/mod.rs index d36fa372ca..35aa784407 100644 --- a/wallet/trezor-client/src/client/mod.rs +++ b/wallet/trezor-client/src/client/mod.rs @@ -10,8 +10,8 @@ pub use ethereum::*; #[cfg(feature = "solana")] mod solana; -// #[cfg(feature = "solana")] -// pub use solana::*; +#[cfg(feature = "solana")] +pub use solana::*; pub mod common; pub use common::*; @@ -40,11 +40,7 @@ pub struct Trezor { /// Create a new Trezor instance with the given transport. pub fn trezor_with_transport(model: Model, transport: Box) -> Trezor { - Trezor { - model, - transport, - features: None, - } + Trezor { model, transport, features: None } } impl Trezor { diff --git a/wallet/trezor-client/src/client/solana.rs b/wallet/trezor-client/src/client/solana.rs index 483ae259d8..15e3358e84 100644 --- a/wallet/trezor-client/src/client/solana.rs +++ b/wallet/trezor-client/src/client/solana.rs @@ -7,10 +7,9 @@ impl Trezor { let mut req = protos::SolanaGetAddress::new(); req.address_n = path; req.show_display = Some(true); - let address = handle_interaction(self.call( - req, - Box::new(|_, m: protos::SolanaAddress| Ok(m.address().into())), - )?)?; + let address = handle_interaction( + self.call(req, Box::new(|_, m: protos::SolanaAddress| Ok(m.address().into())))?, + )?; Ok(address) } } diff --git a/wallet/trezor-client/src/flows/sign_tx.rs b/wallet/trezor-client/src/flows/sign_tx.rs index e02972a9fb..3faaeaaa29 100644 --- a/wallet/trezor-client/src/flows/sign_tx.rs +++ b/wallet/trezor-client/src/flows/sign_tx.rs @@ -1,7 +1,5 @@ //! Logic to handle the sign_tx command flow. -#![allow(clippy::all)] - use crate::{ client::*, error::{Error, Result}, @@ -24,7 +22,7 @@ use tracing::trace; /// Fulfill a TxRequest for TXINPUT. fn ack_input_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { if req.details.is_none() || !req.details.has_request_index() { - return Err(Error::MalformedTxRequest(req.clone())); + return Err(Error::MalformedTxRequest(req.clone())) } // Choose either the tx we are signing or a dependent tx. @@ -65,10 +63,7 @@ fn ack_input_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result Result { if req.details.is_none() || !req.details.has_request_index() { - return Err(Error::MalformedTxRequest(req.clone())); + return Err(Error::MalformedTxRequest(req.clone())) } // For outputs, the Trezor only needs bin_outputs to be set for dependent txs and full outputs @@ -132,9 +127,7 @@ fn ack_output_request( } else if let Some(ref utxo) = inp.witness_utxo { utxo } else { - return Err(Error::InvalidPsbt( - "not all inputs have utxo data".to_owned(), - )); + return Err(Error::InvalidPsbt("not all inputs have utxo data".to_owned())) }; let mut bin_output = TxOutputBinType::new(); @@ -194,7 +187,7 @@ fn ack_output_request( /// Fulfill a TxRequest for TXMETA. fn ack_meta_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { if req.details.is_none() { - return Err(Error::MalformedTxRequest(req.clone())); + return Err(Error::MalformedTxRequest(req.clone())) } // Choose either the tx we are signing or a dependent tx. @@ -263,10 +256,7 @@ impl<'a> SignTxProgress<'a> { pub fn get_signature(&self) -> Option<(usize, &[u8])> { if self.has_signature() { let serialized = &self.req.serialized; - Some(( - serialized.signature_index() as usize, - serialized.signature(), - )) + Some((serialized.signature_index() as usize, serialized.signature())) } else { None } @@ -322,9 +312,9 @@ impl<'a> SignTxProgress<'a> { TxRequestType::TXOUTPUT => ack_output_request(&self.req, psbt, network), TxRequestType::TXMETA => ack_meta_request(&self.req, psbt), TxRequestType::TXEXTRADATA => unimplemented!(), //TODO(stevenroose) implement - TxRequestType::TXORIGINPUT - | TxRequestType::TXORIGOUTPUT - | TxRequestType::TXPAYMENTREQ => unimplemented!(), + TxRequestType::TXORIGINPUT | + TxRequestType::TXORIGOUTPUT | + TxRequestType::TXPAYMENTREQ => unimplemented!(), TxRequestType::TXFINISHED => unreachable!(), }?; self.ack_msg(ack) diff --git a/wallet/trezor-client/src/lib.rs b/wallet/trezor-client/src/lib.rs index d69445e641..7d0ccfdcc8 100644 --- a/wallet/trezor-client/src/lib.rs +++ b/wallet/trezor-client/src/lib.rs @@ -11,13 +11,11 @@ //! We use the log package interface, so any logger that supports log can be attached. //! Please be aware that `trace` logging can contain sensitive data. -#![allow(clippy::all)] #![warn(unreachable_pub, rustdoc::all)] #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![deny(unused_must_use, rust_2018_idioms)] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#[allow(clippy::all)] mod messages; pub mod client; @@ -27,7 +25,6 @@ pub mod transport; #[cfg(feature = "bitcoin")] pub mod utils; -#[allow(clippy::all)] mod flows { #[cfg(feature = "bitcoin")] pub(crate) mod sign_tx; @@ -86,11 +83,7 @@ pub struct AvailableDevice { impl fmt::Display for AvailableDevice { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!( - f, - "{} (transport: {}) (debug: {})", - self.model, &self.transport, self.debug - ) + write!(f, "{} (transport: {}) (debug: {})", self.model, &self.transport, self.debug) } } @@ -166,7 +159,7 @@ mod tests { #[serial] fn test_emulator_find() { let trezors = find_devices(false); - assert!(!trezors.is_empty()); + assert!(trezors.len() > 0); assert!(trezors.iter().any(|t| t.model == Model::TrezorEmulator)); } @@ -176,11 +169,11 @@ mod tests { let emulator = init_emulator(); let features = emulator.features().expect("Failed to get features"); assert_eq!(features.vendor(), "trezor.io"); - assert!(features.initialized()); - assert!(!features.firmware_present()); - assert!(features.initialized()); - assert!(!features.pin_protection()); - assert!(!features.passphrase_protection()); + assert_eq!(features.initialized(), true); + assert_eq!(features.firmware_present(), false); + assert_eq!(features.initialized(), true); + assert_eq!(features.pin_protection(), false); + assert_eq!(features.passphrase_protection(), false); assert!(["T", "Safe 3"].contains(&features.model())); } @@ -188,23 +181,12 @@ mod tests { #[serial] fn test_bitcoin_address() { let mut emulator = init_emulator(); - assert_eq!( - emulator.features().expect("Failed to get features").label(), - "SLIP-0014" - ); + assert_eq!(emulator.features().expect("Failed to get features").label(), "SLIP-0014"); let path = DerivationPath::from_str("m/44'/1'/0'/0/0").expect("Failed to parse path"); let address = emulator - .get_address( - &path, - InputScriptType::SPENDADDRESS, - bitcoin::Network::Testnet, - false, - ) + .get_address(&path, InputScriptType::SPENDADDRESS, bitcoin::Network::Testnet, false) .expect("Failed to get address"); - assert_eq!( - address.ok().unwrap().to_string(), - "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q" - ); + assert_eq!(address.ok().unwrap().to_string(), "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q"); } #[ignore] @@ -214,10 +196,7 @@ mod tests { tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); let mut emulator = init_emulator(); - assert_eq!( - emulator.features().expect("Failed to get features").label(), - "SLIP-0014" - ); + assert_eq!(emulator.features().expect("Failed to get features").label(), "SLIP-0014"); let mut ident = IdentityType::new(); ident.set_proto("gpg".to_owned()); diff --git a/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs b/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs index 3ea293f348..956afae943 100644 --- a/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs +++ b/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs @@ -2000,20 +2000,200 @@ pub mod mintlayer_tx_request { } } +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTxInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxInput.utxo) + pub utxo: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxInput.account) + pub account: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxInput.account_command) + pub account_command: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTxInput { + fn default() -> &'a MintlayerTxInput { + ::default_instance() + } +} + +impl MintlayerTxInput { + pub fn new() -> MintlayerTxInput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerUtxoTxInput>( + "utxo", + |m: &MintlayerTxInput| { &m.utxo }, + |m: &mut MintlayerTxInput| { &mut m.utxo }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerAccountTxInput>( + "account", + |m: &MintlayerTxInput| { &m.account }, + |m: &mut MintlayerTxInput| { &mut m.account }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerAccountCommandTxInput>( + "account_command", + |m: &MintlayerTxInput| { &m.account_command }, + |m: &mut MintlayerTxInput| { &mut m.account_command }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTxInput { + const NAME: &'static str = "MintlayerTxInput"; + + fn is_initialized(&self) -> bool { + for v in &self.utxo { + if !v.is_initialized() { + return false; + } + }; + for v in &self.account { + if !v.is_initialized() { + return false; + } + }; + for v in &self.account_command { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.utxo)?; + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.account)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.account_command)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.utxo.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.account.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.account_command.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.utxo.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.account.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.account_command.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxInput { + MintlayerTxInput::new() + } + + fn clear(&mut self) { + self.utxo.clear(); + self.account.clear(); + self.account_command.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxInput { + static instance: MintlayerTxInput = MintlayerTxInput { + utxo: ::protobuf::MessageField::none(), + account: ::protobuf::MessageField::none(), + account_command: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTxInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTxInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTxInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput) #[derive(PartialEq,Clone,Default,Debug)] pub struct MintlayerUtxoTxInput { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.address_n) pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.address) + pub address: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.prev_hash) pub prev_hash: ::std::option::Option<::std::vec::Vec>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.prev_index) pub prev_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.sequence) pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.amount) - pub amount: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.value) + pub value: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -2030,7 +2210,43 @@ impl MintlayerUtxoTxInput { ::std::default::Default::default() } - // required bytes prev_hash = 2; + // required string address = 2; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes prev_hash = 3; pub fn prev_hash(&self) -> &[u8] { match self.prev_hash.as_ref() { @@ -2066,7 +2282,7 @@ impl MintlayerUtxoTxInput { self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - // required uint32 prev_index = 3; + // required uint32 prev_index = 4; pub fn prev_index(&self) -> u32 { self.prev_index.unwrap_or(0) @@ -2085,69 +2301,60 @@ impl MintlayerUtxoTxInput { self.prev_index = ::std::option::Option::Some(v); } - // optional uint32 sequence = 4; + // required .hw.trezor.messages.mintlayer.MintlayerUtxoType type = 5; - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(4294967295u32) + pub fn type_(&self) -> MintlayerUtxoType { + match self.type_ { + Some(e) => e.enum_value_or(MintlayerUtxoType::TRANSACTION), + None => MintlayerUtxoType::TRANSACTION, + } } - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; } - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() + pub fn has_type(&self) -> bool { + self.type_.is_some() } // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); + pub fn set_type(&mut self, v: MintlayerUtxoType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } - // required bytes amount = 5; + // optional uint32 sequence = 6; - pub fn amount(&self) -> &[u8] { - match self.amount.as_ref() { - Some(v) => v, - None => &[], - } + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(4294967295u32) } - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; } - pub fn has_amount(&self) -> bool { - self.amount.is_some() + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() } // Param is passed by value, moved - pub fn set_amount(&mut self, v: ::std::vec::Vec) { - self.amount = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { - if self.amount.is_none() { - self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.amount.as_mut().unwrap() - } - - // Take field - pub fn take_amount(&mut self) -> ::std::vec::Vec { - self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); + let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "address_n", |m: &MintlayerUtxoTxInput| { &m.address_n }, |m: &mut MintlayerUtxoTxInput| { &mut m.address_n }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MintlayerUtxoTxInput| { &m.address }, + |m: &mut MintlayerUtxoTxInput| { &mut m.address }, + )); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "prev_hash", |m: &MintlayerUtxoTxInput| { &m.prev_hash }, @@ -2158,15 +2365,20 @@ impl MintlayerUtxoTxInput { |m: &MintlayerUtxoTxInput| { &m.prev_index }, |m: &mut MintlayerUtxoTxInput| { &mut m.prev_index }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &MintlayerUtxoTxInput| { &m.type_ }, + |m: &mut MintlayerUtxoTxInput| { &mut m.type_ }, + )); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "sequence", |m: &MintlayerUtxoTxInput| { &m.sequence }, |m: &mut MintlayerUtxoTxInput| { &mut m.sequence }, )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MintlayerUtxoTxInput| { &m.amount }, - |m: &mut MintlayerUtxoTxInput| { &mut m.amount }, + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( + "value", + |m: &MintlayerUtxoTxInput| { &m.value }, + |m: &mut MintlayerUtxoTxInput| { &mut m.value }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MintlayerUtxoTxInput", @@ -2180,15 +2392,26 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { const NAME: &'static str = "MintlayerUtxoTxInput"; fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } if self.prev_hash.is_none() { return false; } if self.prev_index.is_none() { return false; } - if self.amount.is_none() { + if self.type_.is_none() { + return false; + } + if self.value.is_none() { return false; } + for v in &self.value { + if !v.is_initialized() { + return false; + } + }; true } @@ -2202,16 +2425,22 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { self.address_n.push(is.read_uint32()?); }, 18 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); }, - 24 => { + 32 => { self.prev_index = ::std::option::Option::Some(is.read_uint32()?); }, - 32 => { + 40 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 48 => { self.sequence = ::std::option::Option::Some(is.read_uint32()?); }, - 42 => { - self.amount = ::std::option::Option::Some(is.read_bytes()?); + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -2228,17 +2457,24 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { for value in &self.address_n { my_size += ::protobuf::rt::uint32_size(1, *value); }; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); + my_size += ::protobuf::rt::bytes_size(3, &v); } if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(3, v); + my_size += ::protobuf::rt::uint32_size(4, v); + } + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(5, v.value()); } if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(4, v); + my_size += ::protobuf::rt::uint32_size(6, v); } - if let Some(v) = self.amount.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); + if let Some(v) = self.value.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -2249,18 +2485,5650 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { for v in &self.address_n { os.write_uint32(1, *v)?; }; + if let Some(v) = self.address.as_ref() { + os.write_string(2, v)?; + } if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(2, v)?; + os.write_bytes(3, v)?; + } + if let Some(v) = self.prev_index { + os.write_uint32(4, v)?; + } + if let Some(v) = self.type_ { + os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.sequence { + os.write_uint32(6, v)?; + } + if let Some(v) = self.value.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerUtxoTxInput { + MintlayerUtxoTxInput::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.address = ::std::option::Option::None; + self.prev_hash = ::std::option::Option::None; + self.prev_index = ::std::option::Option::None; + self.type_ = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.value.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerUtxoTxInput { + static instance: MintlayerUtxoTxInput = MintlayerUtxoTxInput { + address_n: ::std::vec::Vec::new(), + address: ::std::option::Option::None, + prev_hash: ::std::option::Option::None, + prev_index: ::std::option::Option::None, + type_: ::std::option::Option::None, + sequence: ::std::option::Option::None, + value: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerUtxoTxInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUtxoTxInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerUtxoTxInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerUtxoTxInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAccountTxInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerAccountTxInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.value) + pub value: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.nonce) + pub nonce: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.delegation_id) + pub delegation_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerAccountTxInput { + fn default() -> &'a MintlayerAccountTxInput { + ::default_instance() + } +} + +impl MintlayerAccountTxInput { + pub fn new() -> MintlayerAccountTxInput { + ::std::default::Default::default() + } + + // required string address = 2; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 sequence = 3; + + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(4294967295u32) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); + } + + // required uint64 nonce = 5; + + pub fn nonce(&self) -> u64 { + self.nonce.unwrap_or(0) + } + + pub fn clear_nonce(&mut self) { + self.nonce = ::std::option::Option::None; + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: u64) { + self.nonce = ::std::option::Option::Some(v); + } + + // required bytes delegation_id = 6; + + pub fn delegation_id(&self) -> &[u8] { + match self.delegation_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_delegation_id(&mut self) { + self.delegation_id = ::std::option::Option::None; + } + + pub fn has_delegation_id(&self) -> bool { + self.delegation_id.is_some() + } + + // Param is passed by value, moved + pub fn set_delegation_id(&mut self, v: ::std::vec::Vec) { + self.delegation_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delegation_id(&mut self) -> &mut ::std::vec::Vec { + if self.delegation_id.is_none() { + self.delegation_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.delegation_id.as_mut().unwrap() + } + + // Take field + pub fn take_delegation_id(&mut self) -> ::std::vec::Vec { + self.delegation_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerAccountTxInput| { &m.address_n }, + |m: &mut MintlayerAccountTxInput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MintlayerAccountTxInput| { &m.address }, + |m: &mut MintlayerAccountTxInput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &MintlayerAccountTxInput| { &m.sequence }, + |m: &mut MintlayerAccountTxInput| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( + "value", + |m: &MintlayerAccountTxInput| { &m.value }, + |m: &mut MintlayerAccountTxInput| { &mut m.value }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce", + |m: &MintlayerAccountTxInput| { &m.nonce }, + |m: &mut MintlayerAccountTxInput| { &mut m.nonce }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "delegation_id", + |m: &MintlayerAccountTxInput| { &m.delegation_id }, + |m: &mut MintlayerAccountTxInput| { &mut m.delegation_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerAccountTxInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerAccountTxInput { + const NAME: &'static str = "MintlayerAccountTxInput"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + if self.value.is_none() { + return false; + } + if self.nonce.is_none() { + return false; + } + if self.delegation_id.is_none() { + return false; + } + for v in &self.value { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; + }, + 40 => { + self.nonce = ::std::option::Option::Some(is.read_uint64()?); + }, + 50 => { + self.delegation_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.value.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.nonce { + my_size += ::protobuf::rt::uint64_size(5, v); + } + if let Some(v) = self.delegation_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.address.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.sequence { + os.write_uint32(3, v)?; + } + if let Some(v) = self.value.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.nonce { + os.write_uint64(5, v)?; + } + if let Some(v) = self.delegation_id.as_ref() { + os.write_bytes(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerAccountTxInput { + MintlayerAccountTxInput::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.address = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.value.clear(); + self.nonce = ::std::option::Option::None; + self.delegation_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerAccountTxInput { + static instance: MintlayerAccountTxInput = MintlayerAccountTxInput { + address_n: ::std::vec::Vec::new(), + address: ::std::option::Option::None, + sequence: ::std::option::Option::None, + value: ::protobuf::MessageField::none(), + nonce: ::std::option::Option::None, + delegation_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerAccountTxInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAccountTxInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerAccountTxInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerAccountTxInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerAccountCommandTxInput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.sequence) + pub sequence: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.nonce) + pub nonce: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.mint) + pub mint: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.unmint) + pub unmint: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.lock_token_supply) + pub lock_token_supply: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.freeze_token) + pub freeze_token: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.unfreeze_token) + pub unfreeze_token: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.change_token_authority) + pub change_token_authority: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerAccountCommandTxInput { + fn default() -> &'a MintlayerAccountCommandTxInput { + ::default_instance() + } +} + +impl MintlayerAccountCommandTxInput { + pub fn new() -> MintlayerAccountCommandTxInput { + ::std::default::Default::default() + } + + // required string address = 2; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint32 sequence = 3; + + pub fn sequence(&self) -> u32 { + self.sequence.unwrap_or(4294967295u32) + } + + pub fn clear_sequence(&mut self) { + self.sequence = ::std::option::Option::None; + } + + pub fn has_sequence(&self) -> bool { + self.sequence.is_some() + } + + // Param is passed by value, moved + pub fn set_sequence(&mut self, v: u32) { + self.sequence = ::std::option::Option::Some(v); + } + + // required uint64 nonce = 4; + + pub fn nonce(&self) -> u64 { + self.nonce.unwrap_or(0) + } + + pub fn clear_nonce(&mut self) { + self.nonce = ::std::option::Option::None; + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: u64) { + self.nonce = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(10); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerAccountCommandTxInput| { &m.address_n }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MintlayerAccountCommandTxInput| { &m.address }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "sequence", + |m: &MintlayerAccountCommandTxInput| { &m.sequence }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.sequence }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce", + |m: &MintlayerAccountCommandTxInput| { &m.nonce }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.nonce }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerMintTokens>( + "mint", + |m: &MintlayerAccountCommandTxInput| { &m.mint }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.mint }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerUnmintTokens>( + "unmint", + |m: &MintlayerAccountCommandTxInput| { &m.unmint }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.unmint }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerLockTokenSupply>( + "lock_token_supply", + |m: &MintlayerAccountCommandTxInput| { &m.lock_token_supply }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.lock_token_supply }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerFreezeToken>( + "freeze_token", + |m: &MintlayerAccountCommandTxInput| { &m.freeze_token }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.freeze_token }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerUnfreezeToken>( + "unfreeze_token", + |m: &MintlayerAccountCommandTxInput| { &m.unfreeze_token }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.unfreeze_token }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerChangeTokenAuhtority>( + "change_token_authority", + |m: &MintlayerAccountCommandTxInput| { &m.change_token_authority }, + |m: &mut MintlayerAccountCommandTxInput| { &mut m.change_token_authority }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerAccountCommandTxInput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerAccountCommandTxInput { + const NAME: &'static str = "MintlayerAccountCommandTxInput"; + + fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } + if self.nonce.is_none() { + return false; + } + for v in &self.mint { + if !v.is_initialized() { + return false; + } + }; + for v in &self.unmint { + if !v.is_initialized() { + return false; + } + }; + for v in &self.lock_token_supply { + if !v.is_initialized() { + return false; + } + }; + for v in &self.freeze_token { + if !v.is_initialized() { + return false; + } + }; + for v in &self.unfreeze_token { + if !v.is_initialized() { + return false; + } + }; + for v in &self.change_token_authority { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 18 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 24 => { + self.sequence = ::std::option::Option::Some(is.read_uint32()?); + }, + 32 => { + self.nonce = ::std::option::Option::Some(is.read_uint64()?); + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.mint)?; + }, + 50 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.unmint)?; + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.lock_token_supply)?; + }, + 66 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.freeze_token)?; + }, + 74 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.unfreeze_token)?; + }, + 82 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.change_token_authority)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.sequence { + my_size += ::protobuf::rt::uint32_size(3, v); + } + if let Some(v) = self.nonce { + my_size += ::protobuf::rt::uint64_size(4, v); + } + if let Some(v) = self.mint.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.unmint.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.lock_token_supply.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.freeze_token.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.unfreeze_token.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.change_token_authority.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.address.as_ref() { + os.write_string(2, v)?; + } + if let Some(v) = self.sequence { + os.write_uint32(3, v)?; + } + if let Some(v) = self.nonce { + os.write_uint64(4, v)?; + } + if let Some(v) = self.mint.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.unmint.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; + } + if let Some(v) = self.lock_token_supply.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.freeze_token.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; + } + if let Some(v) = self.unfreeze_token.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; + } + if let Some(v) = self.change_token_authority.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerAccountCommandTxInput { + MintlayerAccountCommandTxInput::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.address = ::std::option::Option::None; + self.sequence = ::std::option::Option::None; + self.nonce = ::std::option::Option::None; + self.mint.clear(); + self.unmint.clear(); + self.lock_token_supply.clear(); + self.freeze_token.clear(); + self.unfreeze_token.clear(); + self.change_token_authority.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerAccountCommandTxInput { + static instance: MintlayerAccountCommandTxInput = MintlayerAccountCommandTxInput { + address_n: ::std::vec::Vec::new(), + address: ::std::option::Option::None, + sequence: ::std::option::Option::None, + nonce: ::std::option::Option::None, + mint: ::protobuf::MessageField::none(), + unmint: ::protobuf::MessageField::none(), + lock_token_supply: ::protobuf::MessageField::none(), + freeze_token: ::protobuf::MessageField::none(), + unfreeze_token: ::protobuf::MessageField::none(), + change_token_authority: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerAccountCommandTxInput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAccountCommandTxInput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerAccountCommandTxInput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerAccountCommandTxInput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerMintTokens) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerMintTokens { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerMintTokens.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerMintTokens.amount) + pub amount: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerMintTokens.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerMintTokens { + fn default() -> &'a MintlayerMintTokens { + ::default_instance() + } +} + +impl MintlayerMintTokens { + pub fn new() -> MintlayerMintTokens { + ::std::default::Default::default() + } + + // required bytes token_id = 1; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes amount = 2; + + pub fn amount(&self) -> &[u8] { + match self.amount.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: ::std::vec::Vec) { + self.amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { + if self.amount.is_none() { + self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.amount.as_mut().unwrap() + } + + // Take field + pub fn take_amount(&mut self) -> ::std::vec::Vec { + self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerMintTokens| { &m.token_id }, + |m: &mut MintlayerMintTokens| { &mut m.token_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MintlayerMintTokens| { &m.amount }, + |m: &mut MintlayerMintTokens| { &mut m.amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerMintTokens", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerMintTokens { + const NAME: &'static str = "MintlayerMintTokens"; + + fn is_initialized(&self) -> bool { + if self.token_id.is_none() { + return false; + } + if self.amount.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.amount = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.amount.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.amount.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerMintTokens { + MintlayerMintTokens::new() + } + + fn clear(&mut self) { + self.token_id = ::std::option::Option::None; + self.amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerMintTokens { + static instance: MintlayerMintTokens = MintlayerMintTokens { + token_id: ::std::option::Option::None, + amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerMintTokens { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerMintTokens").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerMintTokens { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerMintTokens { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUnmintTokens) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerUnmintTokens { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUnmintTokens.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUnmintTokens.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerUnmintTokens { + fn default() -> &'a MintlayerUnmintTokens { + ::default_instance() + } +} + +impl MintlayerUnmintTokens { + pub fn new() -> MintlayerUnmintTokens { + ::std::default::Default::default() + } + + // required bytes token_id = 1; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerUnmintTokens| { &m.token_id }, + |m: &mut MintlayerUnmintTokens| { &mut m.token_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerUnmintTokens", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerUnmintTokens { + const NAME: &'static str = "MintlayerUnmintTokens"; + + fn is_initialized(&self) -> bool { + if self.token_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerUnmintTokens { + MintlayerUnmintTokens::new() + } + + fn clear(&mut self) { + self.token_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerUnmintTokens { + static instance: MintlayerUnmintTokens = MintlayerUnmintTokens { + token_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerUnmintTokens { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUnmintTokens").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerUnmintTokens { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerUnmintTokens { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerLockTokenSupply) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerLockTokenSupply { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockTokenSupply.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerLockTokenSupply.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerLockTokenSupply { + fn default() -> &'a MintlayerLockTokenSupply { + ::default_instance() + } +} + +impl MintlayerLockTokenSupply { + pub fn new() -> MintlayerLockTokenSupply { + ::std::default::Default::default() + } + + // required bytes token_id = 1; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerLockTokenSupply| { &m.token_id }, + |m: &mut MintlayerLockTokenSupply| { &mut m.token_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerLockTokenSupply", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerLockTokenSupply { + const NAME: &'static str = "MintlayerLockTokenSupply"; + + fn is_initialized(&self) -> bool { + if self.token_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerLockTokenSupply { + MintlayerLockTokenSupply::new() + } + + fn clear(&mut self) { + self.token_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerLockTokenSupply { + static instance: MintlayerLockTokenSupply = MintlayerLockTokenSupply { + token_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerLockTokenSupply { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerLockTokenSupply").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerLockTokenSupply { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerLockTokenSupply { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerFreezeToken) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerFreezeToken { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFreezeToken.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFreezeToken.is_token_unfreezabe) + pub is_token_unfreezabe: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerFreezeToken.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerFreezeToken { + fn default() -> &'a MintlayerFreezeToken { + ::default_instance() + } +} + +impl MintlayerFreezeToken { + pub fn new() -> MintlayerFreezeToken { + ::std::default::Default::default() + } + + // required bytes token_id = 1; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bool is_token_unfreezabe = 2; + + pub fn is_token_unfreezabe(&self) -> bool { + self.is_token_unfreezabe.unwrap_or(false) + } + + pub fn clear_is_token_unfreezabe(&mut self) { + self.is_token_unfreezabe = ::std::option::Option::None; + } + + pub fn has_is_token_unfreezabe(&self) -> bool { + self.is_token_unfreezabe.is_some() + } + + // Param is passed by value, moved + pub fn set_is_token_unfreezabe(&mut self, v: bool) { + self.is_token_unfreezabe = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerFreezeToken| { &m.token_id }, + |m: &mut MintlayerFreezeToken| { &mut m.token_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "is_token_unfreezabe", + |m: &MintlayerFreezeToken| { &m.is_token_unfreezabe }, + |m: &mut MintlayerFreezeToken| { &mut m.is_token_unfreezabe }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerFreezeToken", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerFreezeToken { + const NAME: &'static str = "MintlayerFreezeToken"; + + fn is_initialized(&self) -> bool { + if self.token_id.is_none() { + return false; + } + if self.is_token_unfreezabe.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.is_token_unfreezabe = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.is_token_unfreezabe { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.is_token_unfreezabe { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerFreezeToken { + MintlayerFreezeToken::new() + } + + fn clear(&mut self) { + self.token_id = ::std::option::Option::None; + self.is_token_unfreezabe = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerFreezeToken { + static instance: MintlayerFreezeToken = MintlayerFreezeToken { + token_id: ::std::option::Option::None, + is_token_unfreezabe: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerFreezeToken { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerFreezeToken").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerFreezeToken { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerFreezeToken { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUnfreezeToken) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerUnfreezeToken { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUnfreezeToken.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUnfreezeToken.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerUnfreezeToken { + fn default() -> &'a MintlayerUnfreezeToken { + ::default_instance() + } +} + +impl MintlayerUnfreezeToken { + pub fn new() -> MintlayerUnfreezeToken { + ::std::default::Default::default() + } + + // required bytes token_id = 1; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerUnfreezeToken| { &m.token_id }, + |m: &mut MintlayerUnfreezeToken| { &mut m.token_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerUnfreezeToken", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerUnfreezeToken { + const NAME: &'static str = "MintlayerUnfreezeToken"; + + fn is_initialized(&self) -> bool { + if self.token_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerUnfreezeToken { + MintlayerUnfreezeToken::new() + } + + fn clear(&mut self) { + self.token_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerUnfreezeToken { + static instance: MintlayerUnfreezeToken = MintlayerUnfreezeToken { + token_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerUnfreezeToken { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUnfreezeToken").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerUnfreezeToken { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerUnfreezeToken { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerChangeTokenAuhtority { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority.destination) + pub destination: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerChangeTokenAuhtority { + fn default() -> &'a MintlayerChangeTokenAuhtority { + ::default_instance() + } +} + +impl MintlayerChangeTokenAuhtority { + pub fn new() -> MintlayerChangeTokenAuhtority { + ::std::default::Default::default() + } + + // required bytes token_id = 1; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string destination = 2; + + pub fn destination(&self) -> &str { + match self.destination.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination(&mut self) { + self.destination = ::std::option::Option::None; + } + + pub fn has_destination(&self) -> bool { + self.destination.is_some() + } + + // Param is passed by value, moved + pub fn set_destination(&mut self, v: ::std::string::String) { + self.destination = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination(&mut self) -> &mut ::std::string::String { + if self.destination.is_none() { + self.destination = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination.as_mut().unwrap() + } + + // Take field + pub fn take_destination(&mut self) -> ::std::string::String { + self.destination.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerChangeTokenAuhtority| { &m.token_id }, + |m: &mut MintlayerChangeTokenAuhtority| { &mut m.token_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination", + |m: &MintlayerChangeTokenAuhtority| { &m.destination }, + |m: &mut MintlayerChangeTokenAuhtority| { &mut m.destination }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerChangeTokenAuhtority", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerChangeTokenAuhtority { + const NAME: &'static str = "MintlayerChangeTokenAuhtority"; + + fn is_initialized(&self) -> bool { + if self.token_id.is_none() { + return false; + } + if self.destination.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.destination = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.destination.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.destination.as_ref() { + os.write_string(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerChangeTokenAuhtority { + MintlayerChangeTokenAuhtority::new() + } + + fn clear(&mut self) { + self.token_id = ::std::option::Option::None; + self.destination = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerChangeTokenAuhtority { + static instance: MintlayerChangeTokenAuhtority = MintlayerChangeTokenAuhtority { + token_id: ::std::option::Option::None, + destination: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerChangeTokenAuhtority { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerChangeTokenAuhtority").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerChangeTokenAuhtority { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerChangeTokenAuhtority { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.transfer) + pub transfer: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.lock_then_transfer) + pub lock_then_transfer: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.burn) + pub burn: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.create_stake_pool) + pub create_stake_pool: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.produce_block_from_stake) + pub produce_block_from_stake: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.create_delegation_id) + pub create_delegation_id: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.delegate_staking) + pub delegate_staking: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.issue_fungible_token) + pub issue_fungible_token: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.issue_nft) + pub issue_nft: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.data_deposit) + pub data_deposit: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTxOutput { + fn default() -> &'a MintlayerTxOutput { + ::default_instance() + } +} + +impl MintlayerTxOutput { + pub fn new() -> MintlayerTxOutput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(10); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerTransferTxOutput>( + "transfer", + |m: &MintlayerTxOutput| { &m.transfer }, + |m: &mut MintlayerTxOutput| { &mut m.transfer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerLockThenTransferTxOutput>( + "lock_then_transfer", + |m: &MintlayerTxOutput| { &m.lock_then_transfer }, + |m: &mut MintlayerTxOutput| { &mut m.lock_then_transfer }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerBurnTxOutput>( + "burn", + |m: &MintlayerTxOutput| { &m.burn }, + |m: &mut MintlayerTxOutput| { &mut m.burn }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerCreateStakePoolTxOutput>( + "create_stake_pool", + |m: &MintlayerTxOutput| { &m.create_stake_pool }, + |m: &mut MintlayerTxOutput| { &mut m.create_stake_pool }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerProduceBlockFromStakeTxOutput>( + "produce_block_from_stake", + |m: &MintlayerTxOutput| { &m.produce_block_from_stake }, + |m: &mut MintlayerTxOutput| { &mut m.produce_block_from_stake }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerCreateDelegationIdTxOutput>( + "create_delegation_id", + |m: &MintlayerTxOutput| { &m.create_delegation_id }, + |m: &mut MintlayerTxOutput| { &mut m.create_delegation_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerDelegateStakingTxOutput>( + "delegate_staking", + |m: &MintlayerTxOutput| { &m.delegate_staking }, + |m: &mut MintlayerTxOutput| { &mut m.delegate_staking }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerIssueFungibleTokenTxOutput>( + "issue_fungible_token", + |m: &MintlayerTxOutput| { &m.issue_fungible_token }, + |m: &mut MintlayerTxOutput| { &mut m.issue_fungible_token }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerIssueNftTxOutput>( + "issue_nft", + |m: &MintlayerTxOutput| { &m.issue_nft }, + |m: &mut MintlayerTxOutput| { &mut m.issue_nft }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerDataDepositTxOutput>( + "data_deposit", + |m: &MintlayerTxOutput| { &m.data_deposit }, + |m: &mut MintlayerTxOutput| { &mut m.data_deposit }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTxOutput { + const NAME: &'static str = "MintlayerTxOutput"; + + fn is_initialized(&self) -> bool { + for v in &self.transfer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.lock_then_transfer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.burn { + if !v.is_initialized() { + return false; + } + }; + for v in &self.create_stake_pool { + if !v.is_initialized() { + return false; + } + }; + for v in &self.produce_block_from_stake { + if !v.is_initialized() { + return false; + } + }; + for v in &self.create_delegation_id { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delegate_staking { + if !v.is_initialized() { + return false; + } + }; + for v in &self.issue_fungible_token { + if !v.is_initialized() { + return false; + } + }; + for v in &self.issue_nft { + if !v.is_initialized() { + return false; + } + }; + for v in &self.data_deposit { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; + }, + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.lock_then_transfer)?; + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.burn)?; + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.create_stake_pool)?; + }, + 42 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.produce_block_from_stake)?; + }, + 50 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.create_delegation_id)?; + }, + 58 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.delegate_staking)?; + }, + 66 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.issue_fungible_token)?; + }, + 74 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.issue_nft)?; + }, + 82 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.data_deposit)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.transfer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.lock_then_transfer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.burn.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.create_stake_pool.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.produce_block_from_stake.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.create_delegation_id.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.delegate_staking.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.issue_fungible_token.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.issue_nft.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.data_deposit.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.transfer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.lock_then_transfer.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + } + if let Some(v) = self.burn.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.create_stake_pool.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.produce_block_from_stake.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + } + if let Some(v) = self.create_delegation_id.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; + } + if let Some(v) = self.delegate_staking.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.issue_fungible_token.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; + } + if let Some(v) = self.issue_nft.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; + } + if let Some(v) = self.data_deposit.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTxOutput { + MintlayerTxOutput::new() + } + + fn clear(&mut self) { + self.transfer.clear(); + self.lock_then_transfer.clear(); + self.burn.clear(); + self.create_stake_pool.clear(); + self.produce_block_from_stake.clear(); + self.create_delegation_id.clear(); + self.delegate_staking.clear(); + self.issue_fungible_token.clear(); + self.issue_nft.clear(); + self.data_deposit.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTxOutput { + static instance: MintlayerTxOutput = MintlayerTxOutput { + transfer: ::protobuf::MessageField::none(), + lock_then_transfer: ::protobuf::MessageField::none(), + burn: ::protobuf::MessageField::none(), + create_stake_pool: ::protobuf::MessageField::none(), + produce_block_from_stake: ::protobuf::MessageField::none(), + create_delegation_id: ::protobuf::MessageField::none(), + delegate_staking: ::protobuf::MessageField::none(), + issue_fungible_token: ::protobuf::MessageField::none(), + issue_nft: ::protobuf::MessageField::none(), + data_deposit: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerOutputValue) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerOutputValue { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputValue.amount) + pub amount: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputValue.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerOutputValue.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerOutputValue { + fn default() -> &'a MintlayerOutputValue { + ::default_instance() + } +} + +impl MintlayerOutputValue { + pub fn new() -> MintlayerOutputValue { + ::std::default::Default::default() + } + + // required bytes amount = 1; + + pub fn amount(&self) -> &[u8] { + match self.amount.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: ::std::vec::Vec) { + self.amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { + if self.amount.is_none() { + self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.amount.as_mut().unwrap() + } + + // Take field + pub fn take_amount(&mut self) -> ::std::vec::Vec { + self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes token_id = 2; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MintlayerOutputValue| { &m.amount }, + |m: &mut MintlayerOutputValue| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerOutputValue| { &m.token_id }, + |m: &mut MintlayerOutputValue| { &mut m.token_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerOutputValue", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerOutputValue { + const NAME: &'static str = "MintlayerOutputValue"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.amount = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerOutputValue { + MintlayerOutputValue::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.token_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerOutputValue { + static instance: MintlayerOutputValue = MintlayerOutputValue { + amount: ::std::option::Option::None, + token_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerOutputValue { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerOutputValue").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerOutputValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerOutputValue { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTransferTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.value) + pub value: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTransferTxOutput { + fn default() -> &'a MintlayerTransferTxOutput { + ::default_instance() + } +} + +impl MintlayerTransferTxOutput { + pub fn new() -> MintlayerTransferTxOutput { + ::std::default::Default::default() + } + + // optional string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MintlayerTransferTxOutput| { &m.address }, + |m: &mut MintlayerTransferTxOutput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerTransferTxOutput| { &m.address_n }, + |m: &mut MintlayerTransferTxOutput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( + "value", + |m: &MintlayerTransferTxOutput| { &m.value }, + |m: &mut MintlayerTransferTxOutput| { &mut m.value }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTransferTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTransferTxOutput { + const NAME: &'static str = "MintlayerTransferTxOutput"; + + fn is_initialized(&self) -> bool { + if self.value.is_none() { + return false; + } + for v in &self.value { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.value.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.value.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTransferTxOutput { + MintlayerTransferTxOutput::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.address_n.clear(); + self.value.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTransferTxOutput { + static instance: MintlayerTransferTxOutput = MintlayerTransferTxOutput { + address: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + value: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTransferTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTransferTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTransferTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTransferTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerOutputTimeLock { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.until_height) + pub until_height: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.until_time) + pub until_time: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.for_block_count) + pub for_block_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.for_seconds) + pub for_seconds: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerOutputTimeLock { + fn default() -> &'a MintlayerOutputTimeLock { + ::default_instance() + } +} + +impl MintlayerOutputTimeLock { + pub fn new() -> MintlayerOutputTimeLock { + ::std::default::Default::default() + } + + // optional uint64 until_height = 1; + + pub fn until_height(&self) -> u64 { + self.until_height.unwrap_or(0) + } + + pub fn clear_until_height(&mut self) { + self.until_height = ::std::option::Option::None; + } + + pub fn has_until_height(&self) -> bool { + self.until_height.is_some() + } + + // Param is passed by value, moved + pub fn set_until_height(&mut self, v: u64) { + self.until_height = ::std::option::Option::Some(v); + } + + // optional uint64 until_time = 2; + + pub fn until_time(&self) -> u64 { + self.until_time.unwrap_or(0) + } + + pub fn clear_until_time(&mut self) { + self.until_time = ::std::option::Option::None; + } + + pub fn has_until_time(&self) -> bool { + self.until_time.is_some() + } + + // Param is passed by value, moved + pub fn set_until_time(&mut self, v: u64) { + self.until_time = ::std::option::Option::Some(v); + } + + // optional uint64 for_block_count = 3; + + pub fn for_block_count(&self) -> u64 { + self.for_block_count.unwrap_or(0) + } + + pub fn clear_for_block_count(&mut self) { + self.for_block_count = ::std::option::Option::None; + } + + pub fn has_for_block_count(&self) -> bool { + self.for_block_count.is_some() + } + + // Param is passed by value, moved + pub fn set_for_block_count(&mut self, v: u64) { + self.for_block_count = ::std::option::Option::Some(v); + } + + // optional uint64 for_seconds = 4; + + pub fn for_seconds(&self) -> u64 { + self.for_seconds.unwrap_or(0) + } + + pub fn clear_for_seconds(&mut self) { + self.for_seconds = ::std::option::Option::None; + } + + pub fn has_for_seconds(&self) -> bool { + self.for_seconds.is_some() + } + + // Param is passed by value, moved + pub fn set_for_seconds(&mut self, v: u64) { + self.for_seconds = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "until_height", + |m: &MintlayerOutputTimeLock| { &m.until_height }, + |m: &mut MintlayerOutputTimeLock| { &mut m.until_height }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "until_time", + |m: &MintlayerOutputTimeLock| { &m.until_time }, + |m: &mut MintlayerOutputTimeLock| { &mut m.until_time }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "for_block_count", + |m: &MintlayerOutputTimeLock| { &m.for_block_count }, + |m: &mut MintlayerOutputTimeLock| { &mut m.for_block_count }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "for_seconds", + |m: &MintlayerOutputTimeLock| { &m.for_seconds }, + |m: &mut MintlayerOutputTimeLock| { &mut m.for_seconds }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerOutputTimeLock", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerOutputTimeLock { + const NAME: &'static str = "MintlayerOutputTimeLock"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.until_height = ::std::option::Option::Some(is.read_uint64()?); + }, + 16 => { + self.until_time = ::std::option::Option::Some(is.read_uint64()?); + }, + 24 => { + self.for_block_count = ::std::option::Option::Some(is.read_uint64()?); + }, + 32 => { + self.for_seconds = ::std::option::Option::Some(is.read_uint64()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.until_height { + my_size += ::protobuf::rt::uint64_size(1, v); + } + if let Some(v) = self.until_time { + my_size += ::protobuf::rt::uint64_size(2, v); + } + if let Some(v) = self.for_block_count { + my_size += ::protobuf::rt::uint64_size(3, v); + } + if let Some(v) = self.for_seconds { + my_size += ::protobuf::rt::uint64_size(4, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.until_height { + os.write_uint64(1, v)?; + } + if let Some(v) = self.until_time { + os.write_uint64(2, v)?; + } + if let Some(v) = self.for_block_count { + os.write_uint64(3, v)?; + } + if let Some(v) = self.for_seconds { + os.write_uint64(4, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerOutputTimeLock { + MintlayerOutputTimeLock::new() + } + + fn clear(&mut self) { + self.until_height = ::std::option::Option::None; + self.until_time = ::std::option::Option::None; + self.for_block_count = ::std::option::Option::None; + self.for_seconds = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerOutputTimeLock { + static instance: MintlayerOutputTimeLock = MintlayerOutputTimeLock { + until_height: ::std::option::Option::None, + until_time: ::std::option::Option::None, + for_block_count: ::std::option::Option::None, + for_seconds: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerOutputTimeLock { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerOutputTimeLock").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerOutputTimeLock { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerOutputTimeLock { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerLockThenTransferTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.value) + pub value: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.lock) + pub lock: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerLockThenTransferTxOutput { + fn default() -> &'a MintlayerLockThenTransferTxOutput { + ::default_instance() + } +} + +impl MintlayerLockThenTransferTxOutput { + pub fn new() -> MintlayerLockThenTransferTxOutput { + ::std::default::Default::default() + } + + // optional string address = 1; + + pub fn address(&self) -> &str { + match self.address.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address", + |m: &MintlayerLockThenTransferTxOutput| { &m.address }, + |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.address }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerLockThenTransferTxOutput| { &m.address_n }, + |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( + "value", + |m: &MintlayerLockThenTransferTxOutput| { &m.value }, + |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.value }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputTimeLock>( + "lock", + |m: &MintlayerLockThenTransferTxOutput| { &m.lock }, + |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.lock }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerLockThenTransferTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { + const NAME: &'static str = "MintlayerLockThenTransferTxOutput"; + + fn is_initialized(&self) -> bool { + if self.value.is_none() { + return false; + } + if self.lock.is_none() { + return false; + } + for v in &self.value { + if !v.is_initialized() { + return false; + } + }; + for v in &self.lock { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.address = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 16 => { + self.address_n.push(is.read_uint32()?); + }, + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.lock)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(2, *value); + }; + if let Some(v) = self.value.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.lock.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.address.as_ref() { + os.write_string(1, v)?; + } + for v in &self.address_n { + os.write_uint32(2, *v)?; + }; + if let Some(v) = self.value.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.lock.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerLockThenTransferTxOutput { + MintlayerLockThenTransferTxOutput::new() + } + + fn clear(&mut self) { + self.address = ::std::option::Option::None; + self.address_n.clear(); + self.value.clear(); + self.lock.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerLockThenTransferTxOutput { + static instance: MintlayerLockThenTransferTxOutput = MintlayerLockThenTransferTxOutput { + address: ::std::option::Option::None, + address_n: ::std::vec::Vec::new(), + value: ::protobuf::MessageField::none(), + lock: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerLockThenTransferTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerLockThenTransferTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerLockThenTransferTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerLockThenTransferTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerBurnTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerBurnTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerBurnTxOutput.value) + pub value: ::protobuf::MessageField, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerBurnTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerBurnTxOutput { + fn default() -> &'a MintlayerBurnTxOutput { + ::default_instance() + } +} + +impl MintlayerBurnTxOutput { + pub fn new() -> MintlayerBurnTxOutput { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( + "value", + |m: &MintlayerBurnTxOutput| { &m.value }, + |m: &mut MintlayerBurnTxOutput| { &mut m.value }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerBurnTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerBurnTxOutput { + const NAME: &'static str = "MintlayerBurnTxOutput"; + + fn is_initialized(&self) -> bool { + if self.value.is_none() { + return false; + } + for v in &self.value { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.value.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.value.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerBurnTxOutput { + MintlayerBurnTxOutput::new() + } + + fn clear(&mut self) { + self.value.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerBurnTxOutput { + static instance: MintlayerBurnTxOutput = MintlayerBurnTxOutput { + value: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerBurnTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerBurnTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerBurnTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerBurnTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerCreateStakePoolTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.pool_id) + pub pool_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.pledge) + pub pledge: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.staker) + pub staker: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.vrf_public_key) + pub vrf_public_key: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.decommission_key) + pub decommission_key: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.margin_ratio_per_thousand) + pub margin_ratio_per_thousand: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.cost_per_block) + pub cost_per_block: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerCreateStakePoolTxOutput { + fn default() -> &'a MintlayerCreateStakePoolTxOutput { + ::default_instance() + } +} + +impl MintlayerCreateStakePoolTxOutput { + pub fn new() -> MintlayerCreateStakePoolTxOutput { + ::std::default::Default::default() + } + + // required bytes pool_id = 1; + + pub fn pool_id(&self) -> &[u8] { + match self.pool_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pool_id(&mut self) { + self.pool_id = ::std::option::Option::None; + } + + pub fn has_pool_id(&self) -> bool { + self.pool_id.is_some() + } + + // Param is passed by value, moved + pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { + self.pool_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { + if self.pool_id.is_none() { + self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pool_id.as_mut().unwrap() + } + + // Take field + pub fn take_pool_id(&mut self) -> ::std::vec::Vec { + self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes pledge = 2; + + pub fn pledge(&self) -> &[u8] { + match self.pledge.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pledge(&mut self) { + self.pledge = ::std::option::Option::None; + } + + pub fn has_pledge(&self) -> bool { + self.pledge.is_some() + } + + // Param is passed by value, moved + pub fn set_pledge(&mut self, v: ::std::vec::Vec) { + self.pledge = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pledge(&mut self) -> &mut ::std::vec::Vec { + if self.pledge.is_none() { + self.pledge = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pledge.as_mut().unwrap() + } + + // Take field + pub fn take_pledge(&mut self) -> ::std::vec::Vec { + self.pledge.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string staker = 3; + + pub fn staker(&self) -> &str { + match self.staker.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_staker(&mut self) { + self.staker = ::std::option::Option::None; + } + + pub fn has_staker(&self) -> bool { + self.staker.is_some() + } + + // Param is passed by value, moved + pub fn set_staker(&mut self, v: ::std::string::String) { + self.staker = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_staker(&mut self) -> &mut ::std::string::String { + if self.staker.is_none() { + self.staker = ::std::option::Option::Some(::std::string::String::new()); + } + self.staker.as_mut().unwrap() + } + + // Take field + pub fn take_staker(&mut self) -> ::std::string::String { + self.staker.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string vrf_public_key = 4; + + pub fn vrf_public_key(&self) -> &str { + match self.vrf_public_key.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_vrf_public_key(&mut self) { + self.vrf_public_key = ::std::option::Option::None; + } + + pub fn has_vrf_public_key(&self) -> bool { + self.vrf_public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_vrf_public_key(&mut self, v: ::std::string::String) { + self.vrf_public_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vrf_public_key(&mut self) -> &mut ::std::string::String { + if self.vrf_public_key.is_none() { + self.vrf_public_key = ::std::option::Option::Some(::std::string::String::new()); + } + self.vrf_public_key.as_mut().unwrap() + } + + // Take field + pub fn take_vrf_public_key(&mut self) -> ::std::string::String { + self.vrf_public_key.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string decommission_key = 5; + + pub fn decommission_key(&self) -> &str { + match self.decommission_key.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_decommission_key(&mut self) { + self.decommission_key = ::std::option::Option::None; + } + + pub fn has_decommission_key(&self) -> bool { + self.decommission_key.is_some() + } + + // Param is passed by value, moved + pub fn set_decommission_key(&mut self, v: ::std::string::String) { + self.decommission_key = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_decommission_key(&mut self) -> &mut ::std::string::String { + if self.decommission_key.is_none() { + self.decommission_key = ::std::option::Option::Some(::std::string::String::new()); + } + self.decommission_key.as_mut().unwrap() + } + + // Take field + pub fn take_decommission_key(&mut self) -> ::std::string::String { + self.decommission_key.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint32 margin_ratio_per_thousand = 6; + + pub fn margin_ratio_per_thousand(&self) -> u32 { + self.margin_ratio_per_thousand.unwrap_or(0) + } + + pub fn clear_margin_ratio_per_thousand(&mut self) { + self.margin_ratio_per_thousand = ::std::option::Option::None; + } + + pub fn has_margin_ratio_per_thousand(&self) -> bool { + self.margin_ratio_per_thousand.is_some() + } + + // Param is passed by value, moved + pub fn set_margin_ratio_per_thousand(&mut self, v: u32) { + self.margin_ratio_per_thousand = ::std::option::Option::Some(v); + } + + // required bytes cost_per_block = 7; + + pub fn cost_per_block(&self) -> &[u8] { + match self.cost_per_block.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_cost_per_block(&mut self) { + self.cost_per_block = ::std::option::Option::None; + } + + pub fn has_cost_per_block(&self) -> bool { + self.cost_per_block.is_some() + } + + // Param is passed by value, moved + pub fn set_cost_per_block(&mut self, v: ::std::vec::Vec) { + self.cost_per_block = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cost_per_block(&mut self) -> &mut ::std::vec::Vec { + if self.cost_per_block.is_none() { + self.cost_per_block = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.cost_per_block.as_mut().unwrap() + } + + // Take field + pub fn take_cost_per_block(&mut self) -> ::std::vec::Vec { + self.cost_per_block.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(7); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pool_id", + |m: &MintlayerCreateStakePoolTxOutput| { &m.pool_id }, + |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.pool_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pledge", + |m: &MintlayerCreateStakePoolTxOutput| { &m.pledge }, + |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.pledge }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "staker", + |m: &MintlayerCreateStakePoolTxOutput| { &m.staker }, + |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.staker }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "vrf_public_key", + |m: &MintlayerCreateStakePoolTxOutput| { &m.vrf_public_key }, + |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.vrf_public_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "decommission_key", + |m: &MintlayerCreateStakePoolTxOutput| { &m.decommission_key }, + |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.decommission_key }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "margin_ratio_per_thousand", + |m: &MintlayerCreateStakePoolTxOutput| { &m.margin_ratio_per_thousand }, + |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.margin_ratio_per_thousand }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "cost_per_block", + |m: &MintlayerCreateStakePoolTxOutput| { &m.cost_per_block }, + |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.cost_per_block }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerCreateStakePoolTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerCreateStakePoolTxOutput { + const NAME: &'static str = "MintlayerCreateStakePoolTxOutput"; + + fn is_initialized(&self) -> bool { + if self.pool_id.is_none() { + return false; + } + if self.pledge.is_none() { + return false; + } + if self.staker.is_none() { + return false; + } + if self.vrf_public_key.is_none() { + return false; + } + if self.decommission_key.is_none() { + return false; + } + if self.margin_ratio_per_thousand.is_none() { + return false; + } + if self.cost_per_block.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.pool_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.pledge = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.staker = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.vrf_public_key = ::std::option::Option::Some(is.read_string()?); + }, + 42 => { + self.decommission_key = ::std::option::Option::Some(is.read_string()?); + }, + 48 => { + self.margin_ratio_per_thousand = ::std::option::Option::Some(is.read_uint32()?); + }, + 58 => { + self.cost_per_block = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.pool_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.pledge.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.staker.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.vrf_public_key.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.decommission_key.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.margin_ratio_per_thousand { + my_size += ::protobuf::rt::uint32_size(6, v); + } + if let Some(v) = self.cost_per_block.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.pool_id.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.pledge.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.staker.as_ref() { + os.write_string(3, v)?; + } + if let Some(v) = self.vrf_public_key.as_ref() { + os.write_string(4, v)?; + } + if let Some(v) = self.decommission_key.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.margin_ratio_per_thousand { + os.write_uint32(6, v)?; + } + if let Some(v) = self.cost_per_block.as_ref() { + os.write_bytes(7, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerCreateStakePoolTxOutput { + MintlayerCreateStakePoolTxOutput::new() + } + + fn clear(&mut self) { + self.pool_id = ::std::option::Option::None; + self.pledge = ::std::option::Option::None; + self.staker = ::std::option::Option::None; + self.vrf_public_key = ::std::option::Option::None; + self.decommission_key = ::std::option::Option::None; + self.margin_ratio_per_thousand = ::std::option::Option::None; + self.cost_per_block = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerCreateStakePoolTxOutput { + static instance: MintlayerCreateStakePoolTxOutput = MintlayerCreateStakePoolTxOutput { + pool_id: ::std::option::Option::None, + pledge: ::std::option::Option::None, + staker: ::std::option::Option::None, + vrf_public_key: ::std::option::Option::None, + decommission_key: ::std::option::Option::None, + margin_ratio_per_thousand: ::std::option::Option::None, + cost_per_block: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerCreateStakePoolTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerCreateStakePoolTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerCreateStakePoolTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerCreateStakePoolTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerProduceBlockFromStakeTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput.destination) + pub destination: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput.pool_id) + pub pool_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerProduceBlockFromStakeTxOutput { + fn default() -> &'a MintlayerProduceBlockFromStakeTxOutput { + ::default_instance() + } +} + +impl MintlayerProduceBlockFromStakeTxOutput { + pub fn new() -> MintlayerProduceBlockFromStakeTxOutput { + ::std::default::Default::default() + } + + // required string destination = 1; + + pub fn destination(&self) -> &str { + match self.destination.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination(&mut self) { + self.destination = ::std::option::Option::None; + } + + pub fn has_destination(&self) -> bool { + self.destination.is_some() + } + + // Param is passed by value, moved + pub fn set_destination(&mut self, v: ::std::string::String) { + self.destination = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination(&mut self) -> &mut ::std::string::String { + if self.destination.is_none() { + self.destination = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination.as_mut().unwrap() + } + + // Take field + pub fn take_destination(&mut self) -> ::std::string::String { + self.destination.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes pool_id = 2; + + pub fn pool_id(&self) -> &[u8] { + match self.pool_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pool_id(&mut self) { + self.pool_id = ::std::option::Option::None; + } + + pub fn has_pool_id(&self) -> bool { + self.pool_id.is_some() + } + + // Param is passed by value, moved + pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { + self.pool_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { + if self.pool_id.is_none() { + self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pool_id.as_mut().unwrap() + } + + // Take field + pub fn take_pool_id(&mut self) -> ::std::vec::Vec { + self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination", + |m: &MintlayerProduceBlockFromStakeTxOutput| { &m.destination }, + |m: &mut MintlayerProduceBlockFromStakeTxOutput| { &mut m.destination }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pool_id", + |m: &MintlayerProduceBlockFromStakeTxOutput| { &m.pool_id }, + |m: &mut MintlayerProduceBlockFromStakeTxOutput| { &mut m.pool_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerProduceBlockFromStakeTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerProduceBlockFromStakeTxOutput { + const NAME: &'static str = "MintlayerProduceBlockFromStakeTxOutput"; + + fn is_initialized(&self) -> bool { + if self.destination.is_none() { + return false; + } + if self.pool_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.destination = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.pool_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.destination.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.pool_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.destination.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.pool_id.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerProduceBlockFromStakeTxOutput { + MintlayerProduceBlockFromStakeTxOutput::new() + } + + fn clear(&mut self) { + self.destination = ::std::option::Option::None; + self.pool_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerProduceBlockFromStakeTxOutput { + static instance: MintlayerProduceBlockFromStakeTxOutput = MintlayerProduceBlockFromStakeTxOutput { + destination: ::std::option::Option::None, + pool_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerProduceBlockFromStakeTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerProduceBlockFromStakeTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerProduceBlockFromStakeTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerProduceBlockFromStakeTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerCreateDelegationIdTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput.destination) + pub destination: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput.pool_id) + pub pool_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerCreateDelegationIdTxOutput { + fn default() -> &'a MintlayerCreateDelegationIdTxOutput { + ::default_instance() + } +} + +impl MintlayerCreateDelegationIdTxOutput { + pub fn new() -> MintlayerCreateDelegationIdTxOutput { + ::std::default::Default::default() + } + + // required string destination = 1; + + pub fn destination(&self) -> &str { + match self.destination.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination(&mut self) { + self.destination = ::std::option::Option::None; + } + + pub fn has_destination(&self) -> bool { + self.destination.is_some() + } + + // Param is passed by value, moved + pub fn set_destination(&mut self, v: ::std::string::String) { + self.destination = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination(&mut self) -> &mut ::std::string::String { + if self.destination.is_none() { + self.destination = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination.as_mut().unwrap() + } + + // Take field + pub fn take_destination(&mut self) -> ::std::string::String { + self.destination.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes pool_id = 2; + + pub fn pool_id(&self) -> &[u8] { + match self.pool_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pool_id(&mut self) { + self.pool_id = ::std::option::Option::None; + } + + pub fn has_pool_id(&self) -> bool { + self.pool_id.is_some() + } + + // Param is passed by value, moved + pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { + self.pool_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { + if self.pool_id.is_none() { + self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pool_id.as_mut().unwrap() + } + + // Take field + pub fn take_pool_id(&mut self) -> ::std::vec::Vec { + self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination", + |m: &MintlayerCreateDelegationIdTxOutput| { &m.destination }, + |m: &mut MintlayerCreateDelegationIdTxOutput| { &mut m.destination }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pool_id", + |m: &MintlayerCreateDelegationIdTxOutput| { &m.pool_id }, + |m: &mut MintlayerCreateDelegationIdTxOutput| { &mut m.pool_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerCreateDelegationIdTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerCreateDelegationIdTxOutput { + const NAME: &'static str = "MintlayerCreateDelegationIdTxOutput"; + + fn is_initialized(&self) -> bool { + if self.destination.is_none() { + return false; + } + if self.pool_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.destination = ::std::option::Option::Some(is.read_string()?); + }, + 18 => { + self.pool_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.destination.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.pool_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.destination.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.pool_id.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerCreateDelegationIdTxOutput { + MintlayerCreateDelegationIdTxOutput::new() + } + + fn clear(&mut self) { + self.destination = ::std::option::Option::None; + self.pool_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerCreateDelegationIdTxOutput { + static instance: MintlayerCreateDelegationIdTxOutput = MintlayerCreateDelegationIdTxOutput { + destination: ::std::option::Option::None, + pool_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerCreateDelegationIdTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerCreateDelegationIdTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerCreateDelegationIdTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerCreateDelegationIdTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerDelegateStakingTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput.amount) + pub amount: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput.delegation_id) + pub delegation_id: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerDelegateStakingTxOutput { + fn default() -> &'a MintlayerDelegateStakingTxOutput { + ::default_instance() + } +} + +impl MintlayerDelegateStakingTxOutput { + pub fn new() -> MintlayerDelegateStakingTxOutput { + ::std::default::Default::default() + } + + // required bytes amount = 1; + + pub fn amount(&self) -> &[u8] { + match self.amount.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_amount(&mut self) { + self.amount = ::std::option::Option::None; + } + + pub fn has_amount(&self) -> bool { + self.amount.is_some() + } + + // Param is passed by value, moved + pub fn set_amount(&mut self, v: ::std::vec::Vec) { + self.amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { + if self.amount.is_none() { + self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.amount.as_mut().unwrap() + } + + // Take field + pub fn take_amount(&mut self) -> ::std::vec::Vec { + self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes delegation_id = 2; + + pub fn delegation_id(&self) -> &[u8] { + match self.delegation_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_delegation_id(&mut self) { + self.delegation_id = ::std::option::Option::None; + } + + pub fn has_delegation_id(&self) -> bool { + self.delegation_id.is_some() + } + + // Param is passed by value, moved + pub fn set_delegation_id(&mut self, v: ::std::vec::Vec) { + self.delegation_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delegation_id(&mut self) -> &mut ::std::vec::Vec { + if self.delegation_id.is_none() { + self.delegation_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.delegation_id.as_mut().unwrap() + } + + // Take field + pub fn take_delegation_id(&mut self) -> ::std::vec::Vec { + self.delegation_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "amount", + |m: &MintlayerDelegateStakingTxOutput| { &m.amount }, + |m: &mut MintlayerDelegateStakingTxOutput| { &mut m.amount }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "delegation_id", + |m: &MintlayerDelegateStakingTxOutput| { &m.delegation_id }, + |m: &mut MintlayerDelegateStakingTxOutput| { &mut m.delegation_id }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerDelegateStakingTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerDelegateStakingTxOutput { + const NAME: &'static str = "MintlayerDelegateStakingTxOutput"; + + fn is_initialized(&self) -> bool { + if self.amount.is_none() { + return false; + } + if self.delegation_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.amount = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.delegation_id = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.amount.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.delegation_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.amount.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.delegation_id.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerDelegateStakingTxOutput { + MintlayerDelegateStakingTxOutput::new() + } + + fn clear(&mut self) { + self.amount = ::std::option::Option::None; + self.delegation_id = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerDelegateStakingTxOutput { + static instance: MintlayerDelegateStakingTxOutput = MintlayerDelegateStakingTxOutput { + amount: ::std::option::Option::None, + delegation_id: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerDelegateStakingTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerDelegateStakingTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerDelegateStakingTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerDelegateStakingTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerTokenTotalSupply { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply.type) + pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply.fixed_amount) + pub fixed_amount: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerTokenTotalSupply { + fn default() -> &'a MintlayerTokenTotalSupply { + ::default_instance() + } +} + +impl MintlayerTokenTotalSupply { + pub fn new() -> MintlayerTokenTotalSupply { + ::std::default::Default::default() + } + + // required .hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType type = 1; + + pub fn type_(&self) -> MintlayerTokenTotalSupplyType { + match self.type_ { + Some(e) => e.enum_value_or(MintlayerTokenTotalSupplyType::FIXED), + None => MintlayerTokenTotalSupplyType::FIXED, + } + } + + pub fn clear_type_(&mut self) { + self.type_ = ::std::option::Option::None; + } + + pub fn has_type(&self) -> bool { + self.type_.is_some() + } + + // Param is passed by value, moved + pub fn set_type(&mut self, v: MintlayerTokenTotalSupplyType) { + self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); + } + + // optional bytes fixed_amount = 2; + + pub fn fixed_amount(&self) -> &[u8] { + match self.fixed_amount.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_fixed_amount(&mut self) { + self.fixed_amount = ::std::option::Option::None; + } + + pub fn has_fixed_amount(&self) -> bool { + self.fixed_amount.is_some() + } + + // Param is passed by value, moved + pub fn set_fixed_amount(&mut self, v: ::std::vec::Vec) { + self.fixed_amount = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_fixed_amount(&mut self) -> &mut ::std::vec::Vec { + if self.fixed_amount.is_none() { + self.fixed_amount = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.fixed_amount.as_mut().unwrap() + } + + // Take field + pub fn take_fixed_amount(&mut self) -> ::std::vec::Vec { + self.fixed_amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "type", + |m: &MintlayerTokenTotalSupply| { &m.type_ }, + |m: &mut MintlayerTokenTotalSupply| { &mut m.type_ }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "fixed_amount", + |m: &MintlayerTokenTotalSupply| { &m.fixed_amount }, + |m: &mut MintlayerTokenTotalSupply| { &mut m.fixed_amount }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTokenTotalSupply", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerTokenTotalSupply { + const NAME: &'static str = "MintlayerTokenTotalSupply"; + + fn is_initialized(&self) -> bool { + if self.type_.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); + }, + 18 => { + self.fixed_amount = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(1, v.value()); + } + if let Some(v) = self.fixed_amount.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.type_ { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.fixed_amount.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerTokenTotalSupply { + MintlayerTokenTotalSupply::new() + } + + fn clear(&mut self) { + self.type_ = ::std::option::Option::None; + self.fixed_amount = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerTokenTotalSupply { + static instance: MintlayerTokenTotalSupply = MintlayerTokenTotalSupply { + type_: ::std::option::Option::None, + fixed_amount: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerTokenTotalSupply { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTokenTotalSupply").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerTokenTotalSupply { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerTokenTotalSupply { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerIssueFungibleTokenTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.token_ticker) + pub token_ticker: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.number_of_decimals) + pub number_of_decimals: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.metadata_uri) + pub metadata_uri: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.total_supply) + pub total_supply: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.authority) + pub authority: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.is_freezable) + pub is_freezable: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerIssueFungibleTokenTxOutput { + fn default() -> &'a MintlayerIssueFungibleTokenTxOutput { + ::default_instance() + } +} + +impl MintlayerIssueFungibleTokenTxOutput { + pub fn new() -> MintlayerIssueFungibleTokenTxOutput { + ::std::default::Default::default() + } + + // required bytes token_ticker = 1; + + pub fn token_ticker(&self) -> &[u8] { + match self.token_ticker.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_ticker(&mut self) { + self.token_ticker = ::std::option::Option::None; + } + + pub fn has_token_ticker(&self) -> bool { + self.token_ticker.is_some() + } + + // Param is passed by value, moved + pub fn set_token_ticker(&mut self, v: ::std::vec::Vec) { + self.token_ticker = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_ticker(&mut self) -> &mut ::std::vec::Vec { + if self.token_ticker.is_none() { + self.token_ticker = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_ticker.as_mut().unwrap() + } + + // Take field + pub fn take_token_ticker(&mut self) -> ::std::vec::Vec { + self.token_ticker.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint32 number_of_decimals = 2; + + pub fn number_of_decimals(&self) -> u32 { + self.number_of_decimals.unwrap_or(0) + } + + pub fn clear_number_of_decimals(&mut self) { + self.number_of_decimals = ::std::option::Option::None; + } + + pub fn has_number_of_decimals(&self) -> bool { + self.number_of_decimals.is_some() + } + + // Param is passed by value, moved + pub fn set_number_of_decimals(&mut self, v: u32) { + self.number_of_decimals = ::std::option::Option::Some(v); + } + + // required bytes metadata_uri = 3; + + pub fn metadata_uri(&self) -> &[u8] { + match self.metadata_uri.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_metadata_uri(&mut self) { + self.metadata_uri = ::std::option::Option::None; + } + + pub fn has_metadata_uri(&self) -> bool { + self.metadata_uri.is_some() + } + + // Param is passed by value, moved + pub fn set_metadata_uri(&mut self, v: ::std::vec::Vec) { + self.metadata_uri = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_metadata_uri(&mut self) -> &mut ::std::vec::Vec { + if self.metadata_uri.is_none() { + self.metadata_uri = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.metadata_uri.as_mut().unwrap() + } + + // Take field + pub fn take_metadata_uri(&mut self) -> ::std::vec::Vec { + self.metadata_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string authority = 5; + + pub fn authority(&self) -> &str { + match self.authority.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_authority(&mut self) { + self.authority = ::std::option::Option::None; + } + + pub fn has_authority(&self) -> bool { + self.authority.is_some() + } + + // Param is passed by value, moved + pub fn set_authority(&mut self, v: ::std::string::String) { + self.authority = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_authority(&mut self) -> &mut ::std::string::String { + if self.authority.is_none() { + self.authority = ::std::option::Option::Some(::std::string::String::new()); + } + self.authority.as_mut().unwrap() + } + + // Take field + pub fn take_authority(&mut self) -> ::std::string::String { + self.authority.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bool is_freezable = 6; + + pub fn is_freezable(&self) -> bool { + self.is_freezable.unwrap_or(false) + } + + pub fn clear_is_freezable(&mut self) { + self.is_freezable = ::std::option::Option::None; + } + + pub fn has_is_freezable(&self) -> bool { + self.is_freezable.is_some() + } + + // Param is passed by value, moved + pub fn set_is_freezable(&mut self, v: bool) { + self.is_freezable = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_ticker", + |m: &MintlayerIssueFungibleTokenTxOutput| { &m.token_ticker }, + |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.token_ticker }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "number_of_decimals", + |m: &MintlayerIssueFungibleTokenTxOutput| { &m.number_of_decimals }, + |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.number_of_decimals }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "metadata_uri", + |m: &MintlayerIssueFungibleTokenTxOutput| { &m.metadata_uri }, + |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.metadata_uri }, + )); + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerTokenTotalSupply>( + "total_supply", + |m: &MintlayerIssueFungibleTokenTxOutput| { &m.total_supply }, + |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.total_supply }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "authority", + |m: &MintlayerIssueFungibleTokenTxOutput| { &m.authority }, + |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.authority }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "is_freezable", + |m: &MintlayerIssueFungibleTokenTxOutput| { &m.is_freezable }, + |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.is_freezable }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerIssueFungibleTokenTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerIssueFungibleTokenTxOutput { + const NAME: &'static str = "MintlayerIssueFungibleTokenTxOutput"; + + fn is_initialized(&self) -> bool { + if self.token_ticker.is_none() { + return false; + } + if self.number_of_decimals.is_none() { + return false; + } + if self.metadata_uri.is_none() { + return false; + } + if self.total_supply.is_none() { + return false; + } + if self.authority.is_none() { + return false; + } + if self.is_freezable.is_none() { + return false; + } + for v in &self.total_supply { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_ticker = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.number_of_decimals = ::std::option::Option::Some(is.read_uint32()?); + }, + 26 => { + self.metadata_uri = ::std::option::Option::Some(is.read_bytes()?); + }, + 34 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.total_supply)?; + }, + 42 => { + self.authority = ::std::option::Option::Some(is.read_string()?); + }, + 48 => { + self.is_freezable = ::std::option::Option::Some(is.read_bool()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_ticker.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.number_of_decimals { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.metadata_uri.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.total_supply.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.authority.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + if let Some(v) = self.is_freezable { + my_size += 1 + 1; + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_ticker.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.number_of_decimals { + os.write_uint32(2, v)?; + } + if let Some(v) = self.metadata_uri.as_ref() { + os.write_bytes(3, v)?; + } + if let Some(v) = self.total_supply.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + } + if let Some(v) = self.authority.as_ref() { + os.write_string(5, v)?; + } + if let Some(v) = self.is_freezable { + os.write_bool(6, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerIssueFungibleTokenTxOutput { + MintlayerIssueFungibleTokenTxOutput::new() + } + + fn clear(&mut self) { + self.token_ticker = ::std::option::Option::None; + self.number_of_decimals = ::std::option::Option::None; + self.metadata_uri = ::std::option::Option::None; + self.total_supply.clear(); + self.authority = ::std::option::Option::None; + self.is_freezable = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerIssueFungibleTokenTxOutput { + static instance: MintlayerIssueFungibleTokenTxOutput = MintlayerIssueFungibleTokenTxOutput { + token_ticker: ::std::option::Option::None, + number_of_decimals: ::std::option::Option::None, + metadata_uri: ::std::option::Option::None, + total_supply: ::protobuf::MessageField::none(), + authority: ::std::option::Option::None, + is_freezable: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerIssueFungibleTokenTxOutput { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerIssueFungibleTokenTxOutput").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerIssueFungibleTokenTxOutput { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerIssueFungibleTokenTxOutput { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerIssueNftTxOutput { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.token_id) + pub token_id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.destination) + pub destination: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.creator) + pub creator: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.name) + pub name: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.description) + pub description: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.ticker) + pub ticker: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.icon_uri) + pub icon_uri: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.additional_metadata_uri) + pub additional_metadata_uri: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.media_uri) + pub media_uri: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.media_hash) + pub media_hash: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerIssueNftTxOutput { + fn default() -> &'a MintlayerIssueNftTxOutput { + ::default_instance() + } +} + +impl MintlayerIssueNftTxOutput { + pub fn new() -> MintlayerIssueNftTxOutput { + ::std::default::Default::default() + } + + // required bytes token_id = 1; + + pub fn token_id(&self) -> &[u8] { + match self.token_id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_token_id(&mut self) { + self.token_id = ::std::option::Option::None; + } + + pub fn has_token_id(&self) -> bool { + self.token_id.is_some() + } + + // Param is passed by value, moved + pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + self.token_id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { + if self.token_id.is_none() { + self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.token_id.as_mut().unwrap() + } + + // Take field + pub fn take_token_id(&mut self) -> ::std::vec::Vec { + self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required string destination = 2; + + pub fn destination(&self) -> &str { + match self.destination.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_destination(&mut self) { + self.destination = ::std::option::Option::None; + } + + pub fn has_destination(&self) -> bool { + self.destination.is_some() + } + + // Param is passed by value, moved + pub fn set_destination(&mut self, v: ::std::string::String) { + self.destination = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination(&mut self) -> &mut ::std::string::String { + if self.destination.is_none() { + self.destination = ::std::option::Option::Some(::std::string::String::new()); + } + self.destination.as_mut().unwrap() + } + + // Take field + pub fn take_destination(&mut self) -> ::std::string::String { + self.destination.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string creator = 3; + + pub fn creator(&self) -> &str { + match self.creator.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_creator(&mut self) { + self.creator = ::std::option::Option::None; + } + + pub fn has_creator(&self) -> bool { + self.creator.is_some() + } + + // Param is passed by value, moved + pub fn set_creator(&mut self, v: ::std::string::String) { + self.creator = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_creator(&mut self) -> &mut ::std::string::String { + if self.creator.is_none() { + self.creator = ::std::option::Option::Some(::std::string::String::new()); + } + self.creator.as_mut().unwrap() + } + + // Take field + pub fn take_creator(&mut self) -> ::std::string::String { + self.creator.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bytes name = 4; + + pub fn name(&self) -> &[u8] { + match self.name.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::vec::Vec) { + self.name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::vec::Vec { + if self.name.is_none() { + self.name = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::vec::Vec { + self.name.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes description = 5; + + pub fn description(&self) -> &[u8] { + match self.description.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_description(&mut self) { + self.description = ::std::option::Option::None; + } + + pub fn has_description(&self) -> bool { + self.description.is_some() + } + + // Param is passed by value, moved + pub fn set_description(&mut self, v: ::std::vec::Vec) { + self.description = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_description(&mut self) -> &mut ::std::vec::Vec { + if self.description.is_none() { + self.description = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.description.as_mut().unwrap() + } + + // Take field + pub fn take_description(&mut self) -> ::std::vec::Vec { + self.description.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes ticker = 6; + + pub fn ticker(&self) -> &[u8] { + match self.ticker.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_ticker(&mut self) { + self.ticker = ::std::option::Option::None; + } + + pub fn has_ticker(&self) -> bool { + self.ticker.is_some() + } + + // Param is passed by value, moved + pub fn set_ticker(&mut self, v: ::std::vec::Vec) { + self.ticker = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ticker(&mut self) -> &mut ::std::vec::Vec { + if self.ticker.is_none() { + self.ticker = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.ticker.as_mut().unwrap() + } + + // Take field + pub fn take_ticker(&mut self) -> ::std::vec::Vec { + self.ticker.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes icon_uri = 7; + + pub fn icon_uri(&self) -> &[u8] { + match self.icon_uri.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_icon_uri(&mut self) { + self.icon_uri = ::std::option::Option::None; + } + + pub fn has_icon_uri(&self) -> bool { + self.icon_uri.is_some() + } + + // Param is passed by value, moved + pub fn set_icon_uri(&mut self, v: ::std::vec::Vec) { + self.icon_uri = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_icon_uri(&mut self) -> &mut ::std::vec::Vec { + if self.icon_uri.is_none() { + self.icon_uri = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.icon_uri.as_mut().unwrap() + } + + // Take field + pub fn take_icon_uri(&mut self) -> ::std::vec::Vec { + self.icon_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes additional_metadata_uri = 8; + + pub fn additional_metadata_uri(&self) -> &[u8] { + match self.additional_metadata_uri.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_additional_metadata_uri(&mut self) { + self.additional_metadata_uri = ::std::option::Option::None; + } + + pub fn has_additional_metadata_uri(&self) -> bool { + self.additional_metadata_uri.is_some() + } + + // Param is passed by value, moved + pub fn set_additional_metadata_uri(&mut self, v: ::std::vec::Vec) { + self.additional_metadata_uri = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_additional_metadata_uri(&mut self) -> &mut ::std::vec::Vec { + if self.additional_metadata_uri.is_none() { + self.additional_metadata_uri = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.additional_metadata_uri.as_mut().unwrap() + } + + // Take field + pub fn take_additional_metadata_uri(&mut self) -> ::std::vec::Vec { + self.additional_metadata_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes media_uri = 9; + + pub fn media_uri(&self) -> &[u8] { + match self.media_uri.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_media_uri(&mut self) { + self.media_uri = ::std::option::Option::None; + } + + pub fn has_media_uri(&self) -> bool { + self.media_uri.is_some() + } + + // Param is passed by value, moved + pub fn set_media_uri(&mut self, v: ::std::vec::Vec) { + self.media_uri = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_media_uri(&mut self) -> &mut ::std::vec::Vec { + if self.media_uri.is_none() { + self.media_uri = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.media_uri.as_mut().unwrap() + } + + // Take field + pub fn take_media_uri(&mut self) -> ::std::vec::Vec { + self.media_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes media_hash = 10; + + pub fn media_hash(&self) -> &[u8] { + match self.media_hash.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_media_hash(&mut self) { + self.media_hash = ::std::option::Option::None; + } + + pub fn has_media_hash(&self) -> bool { + self.media_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_media_hash(&mut self, v: ::std::vec::Vec) { + self.media_hash = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_media_hash(&mut self) -> &mut ::std::vec::Vec { + if self.media_hash.is_none() { + self.media_hash = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.media_hash.as_mut().unwrap() + } + + // Take field + pub fn take_media_hash(&mut self) -> ::std::vec::Vec { + self.media_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(10); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "token_id", + |m: &MintlayerIssueNftTxOutput| { &m.token_id }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.token_id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "destination", + |m: &MintlayerIssueNftTxOutput| { &m.destination }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.destination }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "creator", + |m: &MintlayerIssueNftTxOutput| { &m.creator }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.creator }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &MintlayerIssueNftTxOutput| { &m.name }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.name }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "description", + |m: &MintlayerIssueNftTxOutput| { &m.description }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.description }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "ticker", + |m: &MintlayerIssueNftTxOutput| { &m.ticker }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.ticker }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "icon_uri", + |m: &MintlayerIssueNftTxOutput| { &m.icon_uri }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.icon_uri }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "additional_metadata_uri", + |m: &MintlayerIssueNftTxOutput| { &m.additional_metadata_uri }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.additional_metadata_uri }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "media_uri", + |m: &MintlayerIssueNftTxOutput| { &m.media_uri }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.media_uri }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "media_hash", + |m: &MintlayerIssueNftTxOutput| { &m.media_hash }, + |m: &mut MintlayerIssueNftTxOutput| { &mut m.media_hash }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerIssueNftTxOutput", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerIssueNftTxOutput { + const NAME: &'static str = "MintlayerIssueNftTxOutput"; + + fn is_initialized(&self) -> bool { + if self.token_id.is_none() { + return false; + } + if self.destination.is_none() { + return false; + } + if self.name.is_none() { + return false; + } + if self.description.is_none() { + return false; + } + if self.ticker.is_none() { + return false; + } + if self.media_hash.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.token_id = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.destination = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.creator = ::std::option::Option::Some(is.read_string()?); + }, + 34 => { + self.name = ::std::option::Option::Some(is.read_bytes()?); + }, + 42 => { + self.description = ::std::option::Option::Some(is.read_bytes()?); + }, + 50 => { + self.ticker = ::std::option::Option::Some(is.read_bytes()?); + }, + 58 => { + self.icon_uri = ::std::option::Option::Some(is.read_bytes()?); + }, + 66 => { + self.additional_metadata_uri = ::std::option::Option::Some(is.read_bytes()?); + }, + 74 => { + self.media_uri = ::std::option::Option::Some(is.read_bytes()?); + }, + 82 => { + self.media_hash = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.token_id.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.destination.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.creator.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(v) = self.name.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(v) = self.description.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } + if let Some(v) = self.ticker.as_ref() { + my_size += ::protobuf::rt::bytes_size(6, &v); + } + if let Some(v) = self.icon_uri.as_ref() { + my_size += ::protobuf::rt::bytes_size(7, &v); + } + if let Some(v) = self.additional_metadata_uri.as_ref() { + my_size += ::protobuf::rt::bytes_size(8, &v); + } + if let Some(v) = self.media_uri.as_ref() { + my_size += ::protobuf::rt::bytes_size(9, &v); + } + if let Some(v) = self.media_hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(10, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.token_id.as_ref() { + os.write_bytes(1, v)?; } - if let Some(v) = self.prev_index { - os.write_uint32(3, v)?; + if let Some(v) = self.destination.as_ref() { + os.write_string(2, v)?; } - if let Some(v) = self.sequence { - os.write_uint32(4, v)?; + if let Some(v) = self.creator.as_ref() { + os.write_string(3, v)?; } - if let Some(v) = self.amount.as_ref() { + if let Some(v) = self.name.as_ref() { + os.write_bytes(4, v)?; + } + if let Some(v) = self.description.as_ref() { os.write_bytes(5, v)?; } + if let Some(v) = self.ticker.as_ref() { + os.write_bytes(6, v)?; + } + if let Some(v) = self.icon_uri.as_ref() { + os.write_bytes(7, v)?; + } + if let Some(v) = self.additional_metadata_uri.as_ref() { + os.write_bytes(8, v)?; + } + if let Some(v) = self.media_uri.as_ref() { + os.write_bytes(9, v)?; + } + if let Some(v) = self.media_hash.as_ref() { + os.write_bytes(10, v)?; + } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } @@ -2273,178 +8141,138 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { &mut self.special_fields } - fn new() -> MintlayerUtxoTxInput { - MintlayerUtxoTxInput::new() + fn new() -> MintlayerIssueNftTxOutput { + MintlayerIssueNftTxOutput::new() } fn clear(&mut self) { - self.address_n.clear(); - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.amount = ::std::option::Option::None; + self.token_id = ::std::option::Option::None; + self.destination = ::std::option::Option::None; + self.creator = ::std::option::Option::None; + self.name = ::std::option::Option::None; + self.description = ::std::option::Option::None; + self.ticker = ::std::option::Option::None; + self.icon_uri = ::std::option::Option::None; + self.additional_metadata_uri = ::std::option::Option::None; + self.media_uri = ::std::option::Option::None; + self.media_hash = ::std::option::Option::None; self.special_fields.clear(); } - fn default_instance() -> &'static MintlayerUtxoTxInput { - static instance: MintlayerUtxoTxInput = MintlayerUtxoTxInput { - address_n: ::std::vec::Vec::new(), - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - sequence: ::std::option::Option::None, - amount: ::std::option::Option::None, + fn default_instance() -> &'static MintlayerIssueNftTxOutput { + static instance: MintlayerIssueNftTxOutput = MintlayerIssueNftTxOutput { + token_id: ::std::option::Option::None, + destination: ::std::option::Option::None, + creator: ::std::option::Option::None, + name: ::std::option::Option::None, + description: ::std::option::Option::None, + ticker: ::std::option::Option::None, + icon_uri: ::std::option::Option::None, + additional_metadata_uri: ::std::option::Option::None, + media_uri: ::std::option::Option::None, + media_hash: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } -impl ::protobuf::MessageFull for MintlayerUtxoTxInput { +impl ::protobuf::MessageFull for MintlayerIssueNftTxOutput { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUtxoTxInput").unwrap()).clone() + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerIssueNftTxOutput").unwrap()).clone() } } -impl ::std::fmt::Display for MintlayerUtxoTxInput { +impl ::std::fmt::Display for MintlayerIssueNftTxOutput { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } -impl ::protobuf::reflect::ProtobufValue for MintlayerUtxoTxInput { +impl ::protobuf::reflect::ProtobufValue for MintlayerIssueNftTxOutput { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput) +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerDataDepositTxOutput) #[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTransferTxOutput { +pub struct MintlayerDataDepositTxOutput { // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.amount) - pub amount: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerDataDepositTxOutput.data) + pub data: ::std::option::Option<::std::vec::Vec>, // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.special_fields) + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerDataDepositTxOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, } -impl<'a> ::std::default::Default for &'a MintlayerTransferTxOutput { - fn default() -> &'a MintlayerTransferTxOutput { - ::default_instance() +impl<'a> ::std::default::Default for &'a MintlayerDataDepositTxOutput { + fn default() -> &'a MintlayerDataDepositTxOutput { + ::default_instance() } } -impl MintlayerTransferTxOutput { - pub fn new() -> MintlayerTransferTxOutput { +impl MintlayerDataDepositTxOutput { + pub fn new() -> MintlayerDataDepositTxOutput { ::std::default::Default::default() } - // optional string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes amount = 3; + // required bytes data = 1; - pub fn amount(&self) -> &[u8] { - match self.amount.as_ref() { + pub fn data(&self) -> &[u8] { + match self.data.as_ref() { Some(v) => v, None => &[], } } - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; + pub fn clear_data(&mut self) { + self.data = ::std::option::Option::None; } - pub fn has_amount(&self) -> bool { - self.amount.is_some() + pub fn has_data(&self) -> bool { + self.data.is_some() } // Param is passed by value, moved - pub fn set_amount(&mut self, v: ::std::vec::Vec) { - self.amount = ::std::option::Option::Some(v); + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { - if self.amount.is_none() { - self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data = ::std::option::Option::Some(::std::vec::Vec::new()); } - self.amount.as_mut().unwrap() + self.data.as_mut().unwrap() } // Take field - pub fn take_amount(&mut self) -> ::std::vec::Vec { - self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); + let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerTransferTxOutput| { &m.address }, - |m: &mut MintlayerTransferTxOutput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerTransferTxOutput| { &m.address_n }, - |m: &mut MintlayerTransferTxOutput| { &mut m.address_n }, + "data", + |m: &MintlayerDataDepositTxOutput| { &m.data }, + |m: &mut MintlayerDataDepositTxOutput| { &mut m.data }, )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MintlayerTransferTxOutput| { &m.amount }, - |m: &mut MintlayerTransferTxOutput| { &mut m.amount }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTransferTxOutput", + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerDataDepositTxOutput", fields, oneofs, ) } } -impl ::protobuf::Message for MintlayerTransferTxOutput { - const NAME: &'static str = "MintlayerTransferTxOutput"; +impl ::protobuf::Message for MintlayerDataDepositTxOutput { + const NAME: &'static str = "MintlayerDataDepositTxOutput"; fn is_initialized(&self) -> bool { - if self.amount.is_none() { + if self.data.is_none() { return false; } true @@ -2454,16 +8282,7 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 26 => { - self.amount = ::std::option::Option::Some(is.read_bytes()?); + self.data = ::std::option::Option::Some(is.read_bytes()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -2477,14 +8296,8 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - if let Some(v) = self.amount.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); + if let Some(v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -2492,14 +8305,8 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; - if let Some(v) = self.amount.as_ref() { - os.write_bytes(3, v)?; + if let Some(v) = self.data.as_ref() { + os.write_bytes(1, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -2513,42 +8320,38 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { &mut self.special_fields } - fn new() -> MintlayerTransferTxOutput { - MintlayerTransferTxOutput::new() + fn new() -> MintlayerDataDepositTxOutput { + MintlayerDataDepositTxOutput::new() } fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.address_n.clear(); - self.amount = ::std::option::Option::None; + self.data = ::std::option::Option::None; self.special_fields.clear(); } - fn default_instance() -> &'static MintlayerTransferTxOutput { - static instance: MintlayerTransferTxOutput = MintlayerTransferTxOutput { - address: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - amount: ::std::option::Option::None, + fn default_instance() -> &'static MintlayerDataDepositTxOutput { + static instance: MintlayerDataDepositTxOutput = MintlayerDataDepositTxOutput { + data: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } -impl ::protobuf::MessageFull for MintlayerTransferTxOutput { +impl ::protobuf::MessageFull for MintlayerDataDepositTxOutput { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTransferTxOutput").unwrap()).clone() + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerDataDepositTxOutput").unwrap()).clone() } } -impl ::std::fmt::Display for MintlayerTransferTxOutput { +impl ::std::fmt::Display for MintlayerDataDepositTxOutput { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } -impl ::protobuf::reflect::ProtobufValue for MintlayerTransferTxOutput { +impl ::protobuf::reflect::ProtobufValue for MintlayerDataDepositTxOutput { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } @@ -2981,8 +8784,8 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerPrevInput { #[derive(PartialEq,Clone,Default,Debug)] pub struct MintlayerPrevTransferOutput { // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.amount) - pub amount: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.value) + pub value: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -2999,49 +8802,13 @@ impl MintlayerPrevTransferOutput { ::std::default::Default::default() } - // required bytes amount = 1; - - pub fn amount(&self) -> &[u8] { - match self.amount.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: ::std::vec::Vec) { - self.amount = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { - if self.amount.is_none() { - self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.amount.as_mut().unwrap() - } - - // Take field - pub fn take_amount(&mut self) -> ::std::vec::Vec { - self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MintlayerPrevTransferOutput| { &m.amount }, - |m: &mut MintlayerPrevTransferOutput| { &mut m.amount }, + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( + "value", + |m: &MintlayerPrevTransferOutput| { &m.value }, + |m: &mut MintlayerPrevTransferOutput| { &mut m.value }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MintlayerPrevTransferOutput", @@ -3055,9 +8822,14 @@ impl ::protobuf::Message for MintlayerPrevTransferOutput { const NAME: &'static str = "MintlayerPrevTransferOutput"; fn is_initialized(&self) -> bool { - if self.amount.is_none() { + if self.value.is_none() { return false; } + for v in &self.value { + if !v.is_initialized() { + return false; + } + }; true } @@ -3065,7 +8837,7 @@ impl ::protobuf::Message for MintlayerPrevTransferOutput { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.amount = ::std::option::Option::Some(is.read_bytes()?); + ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -3079,8 +8851,9 @@ impl ::protobuf::Message for MintlayerPrevTransferOutput { #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; - if let Some(v) = self.amount.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); + if let Some(v) = self.value.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -3088,8 +8861,8 @@ impl ::protobuf::Message for MintlayerPrevTransferOutput { } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount.as_ref() { - os.write_bytes(1, v)?; + if let Some(v) = self.value.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -3108,13 +8881,13 @@ impl ::protobuf::Message for MintlayerPrevTransferOutput { } fn clear(&mut self) { - self.amount = ::std::option::Option::None; + self.value.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MintlayerPrevTransferOutput { static instance: MintlayerPrevTransferOutput = MintlayerPrevTransferOutput { - amount: ::std::option::Option::None, + value: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -3276,7 +9049,7 @@ pub mod mintlayer_tx_ack_utxo_input { pub struct MintlayerTxAckInputWrapper { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper.input) - pub input: ::protobuf::MessageField, + pub input: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -3296,7 +9069,7 @@ pub mod mintlayer_tx_ack_utxo_input { pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerUtxoTxInput>( + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerTxInput>( "input", |m: &MintlayerTxAckInputWrapper| { &m.input }, |m: &mut MintlayerTxAckInputWrapper| { &mut m.input }, @@ -3541,7 +9314,7 @@ pub mod mintlayer_tx_ack_output { pub struct MintlayerTxAckOutputWrapper { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper.output) - pub output: ::protobuf::MessageField, + pub output: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -3561,7 +9334,7 @@ pub mod mintlayer_tx_ack_output { pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerTransferTxOutput>( + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerTxOutput>( "output", |m: &MintlayerTxAckOutputWrapper| { &m.output }, |m: &mut MintlayerTxAckOutputWrapper| { &mut m.output }, @@ -3668,6 +9441,135 @@ pub mod mintlayer_tx_ack_output { } } +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.mintlayer.MintlayerUtxoType) +pub enum MintlayerUtxoType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerUtxoType.TRANSACTION) + TRANSACTION = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerUtxoType.BLOCK) + BLOCK = 1, +} + +impl ::protobuf::Enum for MintlayerUtxoType { + const NAME: &'static str = "MintlayerUtxoType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(MintlayerUtxoType::TRANSACTION), + 1 => ::std::option::Option::Some(MintlayerUtxoType::BLOCK), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "TRANSACTION" => ::std::option::Option::Some(MintlayerUtxoType::TRANSACTION), + "BLOCK" => ::std::option::Option::Some(MintlayerUtxoType::BLOCK), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [MintlayerUtxoType] = &[ + MintlayerUtxoType::TRANSACTION, + MintlayerUtxoType::BLOCK, + ]; +} + +impl ::protobuf::EnumFull for MintlayerUtxoType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("MintlayerUtxoType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for MintlayerUtxoType { + fn default() -> Self { + MintlayerUtxoType::TRANSACTION + } +} + +impl MintlayerUtxoType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MintlayerUtxoType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType) +pub enum MintlayerTokenTotalSupplyType { + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType.FIXED) + FIXED = 0, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType.LOCKABLE) + LOCKABLE = 1, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType.UNLIMITED) + UNLIMITED = 2, +} + +impl ::protobuf::Enum for MintlayerTokenTotalSupplyType { + const NAME: &'static str = "MintlayerTokenTotalSupplyType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::FIXED), + 1 => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::LOCKABLE), + 2 => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::UNLIMITED), + _ => ::std::option::Option::None + } + } + + fn from_str(str: &str) -> ::std::option::Option { + match str { + "FIXED" => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::FIXED), + "LOCKABLE" => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::LOCKABLE), + "UNLIMITED" => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::UNLIMITED), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [MintlayerTokenTotalSupplyType] = &[ + MintlayerTokenTotalSupplyType::FIXED, + MintlayerTokenTotalSupplyType::LOCKABLE, + MintlayerTokenTotalSupplyType::UNLIMITED, + ]; +} + +impl ::protobuf::EnumFull for MintlayerTokenTotalSupplyType { + fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("MintlayerTokenTotalSupplyType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for MintlayerTokenTotalSupplyType { + fn default() -> Self { + MintlayerTokenTotalSupplyType::FIXED + } +} + +impl MintlayerTokenTotalSupplyType { + fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { + ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MintlayerTokenTotalSupplyType") + } +} + static file_descriptor_proto_data: &'static [u8] = b"\ \n\x18messages-mintlayer.proto\x12\x1chw.trezor.messages.mintlayer\"q\n\ \x13MintlayerGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addr\ @@ -3698,30 +9600,134 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x20\x01(\x0cR\tsignature\x12#\n\rserialized_tx\x18\x03\x20\x01(\x0cR\ \x0cserializedTx\"M\n\x14MintlayerRequestType\x12\x0b\n\x07TXINPUT\x10\0\ \x12\x0c\n\x08TXOUTPUT\x10\x01\x12\n\n\x06TXMETA\x10\x02\x12\x0e\n\nTXFI\ - NISHED\x10\x03\"\xaf\x01\n\x14MintlayerUtxoTxInput\x12\x1b\n\taddress_n\ - \x18\x01\x20\x03(\rR\x08addressN\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\ - \x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndex\ - \x12&\n\x08sequence\x18\x04\x20\x01(\r:\n4294967295R\x08sequence\x12\x16\ - \n\x06amount\x18\x05\x20\x02(\x0cR\x06amount\"j\n\x19MintlayerTransferTx\ - Output\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12\x1b\n\tad\ - dress_n\x18\x02\x20\x03(\rR\x08addressN\x12\x16\n\x06amount\x18\x03\x20\ - \x02(\x0cR\x06amount\"s\n\x0fMintlayerPrevTx\x12\x18\n\x07version\x18\ - \x01\x20\x02(\rR\x07version\x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\ - \x0binputsCount\x12#\n\routputs_count\x18\x07\x20\x02(\rR\x0coutputsCoun\ - t\"b\n\x12MintlayerPrevInput\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\x0cR\ - \x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndexJ\x04\ - \x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06\"5\n\x1bMintl\ - ayerPrevTransferOutput\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\x06amou\ - nt\"\xe3\x01\n\x17MintlayerTxAckUtxoInput\x12`\n\x02tx\x18\x01\x20\x02(\ - \x0b2P.hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxA\ - ckInputWrapperR\x02tx\x1af\n\x1aMintlayerTxAckInputWrapper\x12H\n\x05inp\ - ut\x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerUtxoTxIn\ - putR\x05input\"\xe6\x01\n\x14MintlayerTxAckOutput\x12^\n\x02tx\x18\x01\ - \x20\x02(\x0b2N.hw.trezor.messages.mintlayer.MintlayerTxAckOutput.Mintla\ - yerTxAckOutputWrapperR\x02tx\x1an\n\x1bMintlayerTxAckOutputWrapper\x12O\ - \n\x06output\x18\x05\x20\x02(\x0b27.hw.trezor.messages.mintlayer.Mintlay\ - erTransferTxOutputR\x06outputB=\n#com.satoshilabs.trezor.lib.protobufB\ - \x16TrezorMessageMintlayer\ + NISHED\x10\x03\"\x92\x02\n\x10MintlayerTxInput\x12F\n\x04utxo\x18\x01\ + \x20\x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerUtxoTxInputR\x04ut\ + xo\x12O\n\x07account\x18\x02\x20\x01(\x0b25.hw.trezor.messages.mintlayer\ + .MintlayerAccountTxInputR\x07account\x12e\n\x0faccount_command\x18\x03\ + \x20\x01(\x0b2<.hw.trezor.messages.mintlayer.MintlayerAccountCommandTxIn\ + putR\x0eaccountCommand\"\xc0\x02\n\x14MintlayerUtxoTxInput\x12\x1b\n\tad\ + dress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07address\x18\x02\x20\ + \x02(\tR\x07address\x12\x1b\n\tprev_hash\x18\x03\x20\x02(\x0cR\x08prevHa\ + sh\x12\x1d\n\nprev_index\x18\x04\x20\x02(\rR\tprevIndex\x12C\n\x04type\ + \x18\x05\x20\x02(\x0e2/.hw.trezor.messages.mintlayer.MintlayerUtxoTypeR\ + \x04type\x12&\n\x08sequence\x18\x06\x20\x01(\r:\n4294967295R\x08sequence\ + \x12H\n\x05value\x18\x07\x20\x02(\x0b22.hw.trezor.messages.mintlayer.Min\ + tlayerOutputValueR\x05value\"\xfd\x01\n\x17MintlayerAccountTxInput\x12\ + \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07address\ + \x18\x02\x20\x02(\tR\x07address\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n\ + 4294967295R\x08sequence\x12H\n\x05value\x18\x04\x20\x02(\x0b22.hw.trezor\ + .messages.mintlayer.MintlayerOutputValueR\x05value\x12\x14\n\x05nonce\ + \x18\x05\x20\x02(\x04R\x05nonce\x12#\n\rdelegation_id\x18\x06\x20\x02(\ + \x0cR\x0cdelegationId\"\xb4\x05\n\x1eMintlayerAccountCommandTxInput\x12\ + \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07address\ + \x18\x02\x20\x02(\tR\x07address\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n\ + 4294967295R\x08sequence\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonc\ + e\x12E\n\x04mint\x18\x05\x20\x01(\x0b21.hw.trezor.messages.mintlayer.Min\ + tlayerMintTokensR\x04mint\x12K\n\x06unmint\x18\x06\x20\x01(\x0b23.hw.tre\ + zor.messages.mintlayer.MintlayerUnmintTokensR\x06unmint\x12b\n\x11lock_t\ + oken_supply\x18\x07\x20\x01(\x0b26.hw.trezor.messages.mintlayer.Mintlaye\ + rLockTokenSupplyR\x0flockTokenSupply\x12U\n\x0cfreeze_token\x18\x08\x20\ + \x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerFreezeTokenR\x0bfreeze\ + Token\x12[\n\x0eunfreeze_token\x18\t\x20\x01(\x0b24.hw.trezor.messages.m\ + intlayer.MintlayerUnfreezeTokenR\runfreezeToken\x12q\n\x16change_token_a\ + uthority\x18\n\x20\x01(\x0b2;.hw.trezor.messages.mintlayer.MintlayerChan\ + geTokenAuhtorityR\x14changeTokenAuthority\"H\n\x13MintlayerMintTokens\ + \x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x16\n\x06amo\ + unt\x18\x02\x20\x02(\x0cR\x06amount\"2\n\x15MintlayerUnmintTokens\x12\ + \x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\"5\n\x18MintlayerLoc\ + kTokenSupply\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\"a\n\ + \x14MintlayerFreezeToken\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07\ + tokenId\x12.\n\x13is_token_unfreezabe\x18\x02\x20\x02(\x08R\x11isTokenUn\ + freezabe\"3\n\x16MintlayerUnfreezeToken\x12\x19\n\x08token_id\x18\x01\ + \x20\x02(\x0cR\x07tokenId\"\\\n\x1dMintlayerChangeTokenAuhtority\x12\x19\ + \n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x20\n\x0bdestination\ + \x18\x02\x20\x02(\tR\x0bdestination\"\x95\x08\n\x11MintlayerTxOutput\x12\ + S\n\x08transfer\x18\x01\x20\x01(\x0b27.hw.trezor.messages.mintlayer.Mint\ + layerTransferTxOutputR\x08transfer\x12m\n\x12lock_then_transfer\x18\x02\ + \x20\x01(\x0b2?.hw.trezor.messages.mintlayer.MintlayerLockThenTransferTx\ + OutputR\x10lockThenTransfer\x12G\n\x04burn\x18\x03\x20\x01(\x0b23.hw.tre\ + zor.messages.mintlayer.MintlayerBurnTxOutputR\x04burn\x12j\n\x11create_s\ + take_pool\x18\x04\x20\x01(\x0b2>.hw.trezor.messages.mintlayer.MintlayerC\ + reateStakePoolTxOutputR\x0fcreateStakePool\x12}\n\x18produce_block_from_\ + stake\x18\x05\x20\x01(\x0b2D.hw.trezor.messages.mintlayer.MintlayerProdu\ + ceBlockFromStakeTxOutputR\x15produceBlockFromStake\x12s\n\x14create_dele\ + gation_id\x18\x06\x20\x01(\x0b2A.hw.trezor.messages.mintlayer.MintlayerC\ + reateDelegationIdTxOutputR\x12createDelegationId\x12i\n\x10delegate_stak\ + ing\x18\x07\x20\x01(\x0b2>.hw.trezor.messages.mintlayer.MintlayerDelegat\ + eStakingTxOutputR\x0fdelegateStaking\x12s\n\x14issue_fungible_token\x18\ + \x08\x20\x01(\x0b2A.hw.trezor.messages.mintlayer.MintlayerIssueFungibleT\ + okenTxOutputR\x12issueFungibleToken\x12T\n\tissue_nft\x18\t\x20\x01(\x0b\ + 27.hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutputR\x08issueNft\ + \x12]\n\x0cdata_deposit\x18\n\x20\x01(\x0b2:.hw.trezor.messages.mintlaye\ + r.MintlayerDataDepositTxOutputR\x0bdataDeposit\"I\n\x14MintlayerOutputVa\ + lue\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\x06amount\x12\x19\n\x08tok\ + en_id\x18\x02\x20\x01(\x0cR\x07tokenId\"\x9c\x01\n\x19MintlayerTransferT\ + xOutput\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12\x1b\n\ta\ + ddress_n\x18\x02\x20\x03(\rR\x08addressN\x12H\n\x05value\x18\x03\x20\x02\ + (\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05value\"\ + \xa4\x01\n\x17MintlayerOutputTimeLock\x12!\n\x0cuntil_height\x18\x01\x20\ + \x01(\x04R\x0buntilHeight\x12\x1d\n\nuntil_time\x18\x02\x20\x01(\x04R\tu\ + ntilTime\x12&\n\x0ffor_block_count\x18\x03\x20\x01(\x04R\rforBlockCount\ + \x12\x1f\n\x0bfor_seconds\x18\x04\x20\x01(\x04R\nforSeconds\"\xef\x01\n!\ + MintlayerLockThenTransferTxOutput\x12\x18\n\x07address\x18\x01\x20\x01(\ + \tR\x07address\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12H\ + \n\x05value\x18\x03\x20\x02(\x0b22.hw.trezor.messages.mintlayer.Mintlaye\ + rOutputValueR\x05value\x12I\n\x04lock\x18\x04\x20\x02(\x0b25.hw.trezor.m\ + essages.mintlayer.MintlayerOutputTimeLockR\x04lock\"a\n\x15MintlayerBurn\ + TxOutput\x12H\n\x05value\x18\x01\x20\x02(\x0b22.hw.trezor.messages.mintl\ + ayer.MintlayerOutputValueR\x05value\"\x9d\x02\n\x20MintlayerCreateStakeP\ + oolTxOutput\x12\x17\n\x07pool_id\x18\x01\x20\x02(\x0cR\x06poolId\x12\x16\ + \n\x06pledge\x18\x02\x20\x02(\x0cR\x06pledge\x12\x16\n\x06staker\x18\x03\ + \x20\x02(\tR\x06staker\x12$\n\x0evrf_public_key\x18\x04\x20\x02(\tR\x0cv\ + rfPublicKey\x12)\n\x10decommission_key\x18\x05\x20\x02(\tR\x0fdecommissi\ + onKey\x129\n\x19margin_ratio_per_thousand\x18\x06\x20\x02(\rR\x16marginR\ + atioPerThousand\x12$\n\x0ecost_per_block\x18\x07\x20\x02(\x0cR\x0ccostPe\ + rBlock\"c\n&MintlayerProduceBlockFromStakeTxOutput\x12\x20\n\x0bdestinat\ + ion\x18\x01\x20\x02(\tR\x0bdestination\x12\x17\n\x07pool_id\x18\x02\x20\ + \x02(\x0cR\x06poolId\"`\n#MintlayerCreateDelegationIdTxOutput\x12\x20\n\ + \x0bdestination\x18\x01\x20\x02(\tR\x0bdestination\x12\x17\n\x07pool_id\ + \x18\x02\x20\x02(\x0cR\x06poolId\"_\n\x20MintlayerDelegateStakingTxOutpu\ + t\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\x06amount\x12#\n\rdelegation\ + _id\x18\x02\x20\x02(\x0cR\x0cdelegationId\"\x8f\x01\n\x19MintlayerTokenT\ + otalSupply\x12O\n\x04type\x18\x01\x20\x02(\x0e2;.hw.trezor.messages.mint\ + layer.MintlayerTokenTotalSupplyTypeR\x04type\x12!\n\x0cfixed_amount\x18\ + \x02\x20\x01(\x0cR\x0bfixedAmount\"\xb6\x02\n#MintlayerIssueFungibleToke\ + nTxOutput\x12!\n\x0ctoken_ticker\x18\x01\x20\x02(\x0cR\x0btokenTicker\ + \x12,\n\x12number_of_decimals\x18\x02\x20\x02(\rR\x10numberOfDecimals\ + \x12!\n\x0cmetadata_uri\x18\x03\x20\x02(\x0cR\x0bmetadataUri\x12Z\n\x0ct\ + otal_supply\x18\x04\x20\x02(\x0b27.hw.trezor.messages.mintlayer.Mintlaye\ + rTokenTotalSupplyR\x0btotalSupply\x12\x1c\n\tauthority\x18\x05\x20\x02(\ + \tR\tauthority\x12!\n\x0cis_freezable\x18\x06\x20\x02(\x08R\x0bisFreezab\ + le\"\xcf\x02\n\x19MintlayerIssueNftTxOutput\x12\x19\n\x08token_id\x18\ + \x01\x20\x02(\x0cR\x07tokenId\x12\x20\n\x0bdestination\x18\x02\x20\x02(\ + \tR\x0bdestination\x12\x18\n\x07creator\x18\x03\x20\x01(\tR\x07creator\ + \x12\x12\n\x04name\x18\x04\x20\x02(\x0cR\x04name\x12\x20\n\x0bdescriptio\ + n\x18\x05\x20\x02(\x0cR\x0bdescription\x12\x16\n\x06ticker\x18\x06\x20\ + \x02(\x0cR\x06ticker\x12\x19\n\x08icon_uri\x18\x07\x20\x01(\x0cR\x07icon\ + Uri\x126\n\x17additional_metadata_uri\x18\x08\x20\x01(\x0cR\x15additiona\ + lMetadataUri\x12\x1b\n\tmedia_uri\x18\t\x20\x01(\x0cR\x08mediaUri\x12\ + \x1d\n\nmedia_hash\x18\n\x20\x02(\x0cR\tmediaHash\"2\n\x1cMintlayerDataD\ + epositTxOutput\x12\x12\n\x04data\x18\x01\x20\x02(\x0cR\x04data\"s\n\x0fM\ + intlayerPrevTx\x12\x18\n\x07version\x18\x01\x20\x02(\rR\x07version\x12!\ + \n\x0cinputs_count\x18\x06\x20\x02(\rR\x0binputsCount\x12#\n\routputs_co\ + unt\x18\x07\x20\x02(\rR\x0coutputsCount\"b\n\x12MintlayerPrevInput\x12\ + \x1b\n\tprev_hash\x18\x02\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_inde\ + x\x18\x03\x20\x02(\rR\tprevIndexJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\ + \x05J\x04\x08\x05\x10\x06\"g\n\x1bMintlayerPrevTransferOutput\x12H\n\x05\ + value\x18\x01\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutpu\ + tValueR\x05value\"\xdf\x01\n\x17MintlayerTxAckUtxoInput\x12`\n\x02tx\x18\ + \x01\x20\x02(\x0b2P.hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput\ + .MintlayerTxAckInputWrapperR\x02tx\x1ab\n\x1aMintlayerTxAckInputWrapper\ + \x12D\n\x05input\x18\x02\x20\x02(\x0b2..hw.trezor.messages.mintlayer.Min\ + tlayerTxInputR\x05input\"\xde\x01\n\x14MintlayerTxAckOutput\x12^\n\x02tx\ + \x18\x01\x20\x02(\x0b2N.hw.trezor.messages.mintlayer.MintlayerTxAckOutpu\ + t.MintlayerTxAckOutputWrapperR\x02tx\x1af\n\x1bMintlayerTxAckOutputWrapp\ + er\x12G\n\x06output\x18\x05\x20\x02(\x0b2/.hw.trezor.messages.mintlayer.\ + MintlayerTxOutputR\x06output*/\n\x11MintlayerUtxoType\x12\x0f\n\x0bTRANS\ + ACTION\x10\0\x12\t\n\x05BLOCK\x10\x01*G\n\x1dMintlayerTokenTotalSupplyTy\ + pe\x12\t\n\x05FIXED\x10\0\x12\x0c\n\x08LOCKABLE\x10\x01\x12\r\n\tUNLIMIT\ + ED\x10\x02B=\n#com.satoshilabs.trezor.lib.protobufB\x16TrezorMessageMint\ + layer\ "; /// `FileDescriptorProto` object which was a source for this generated file @@ -3739,7 +9745,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(18); + let mut messages = ::std::vec::Vec::with_capacity(40); messages.push(MintlayerGetAddress::generated_message_descriptor_data()); messages.push(MintlayerAddress::generated_message_descriptor_data()); messages.push(MintlayerGetPublicKey::generated_message_descriptor_data()); @@ -3747,8 +9753,30 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { messages.push(MintlayerVerifySig::generated_message_descriptor_data()); messages.push(MintlayerSignTx::generated_message_descriptor_data()); messages.push(MintlayerTxRequest::generated_message_descriptor_data()); + messages.push(MintlayerTxInput::generated_message_descriptor_data()); messages.push(MintlayerUtxoTxInput::generated_message_descriptor_data()); + messages.push(MintlayerAccountTxInput::generated_message_descriptor_data()); + messages.push(MintlayerAccountCommandTxInput::generated_message_descriptor_data()); + messages.push(MintlayerMintTokens::generated_message_descriptor_data()); + messages.push(MintlayerUnmintTokens::generated_message_descriptor_data()); + messages.push(MintlayerLockTokenSupply::generated_message_descriptor_data()); + messages.push(MintlayerFreezeToken::generated_message_descriptor_data()); + messages.push(MintlayerUnfreezeToken::generated_message_descriptor_data()); + messages.push(MintlayerChangeTokenAuhtority::generated_message_descriptor_data()); + messages.push(MintlayerTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerOutputValue::generated_message_descriptor_data()); messages.push(MintlayerTransferTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerOutputTimeLock::generated_message_descriptor_data()); + messages.push(MintlayerLockThenTransferTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerBurnTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerCreateStakePoolTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerProduceBlockFromStakeTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerCreateDelegationIdTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerDelegateStakingTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerTokenTotalSupply::generated_message_descriptor_data()); + messages.push(MintlayerIssueFungibleTokenTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerIssueNftTxOutput::generated_message_descriptor_data()); + messages.push(MintlayerDataDepositTxOutput::generated_message_descriptor_data()); messages.push(MintlayerPrevTx::generated_message_descriptor_data()); messages.push(MintlayerPrevInput::generated_message_descriptor_data()); messages.push(MintlayerPrevTransferOutput::generated_message_descriptor_data()); @@ -3758,7 +9786,9 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { messages.push(mintlayer_tx_request::MintlayerTxRequestSerializedType::generated_message_descriptor_data()); messages.push(mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper::generated_message_descriptor_data()); messages.push(mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(1); + let mut enums = ::std::vec::Vec::with_capacity(3); + enums.push(MintlayerUtxoType::generated_enum_descriptor_data()); + enums.push(MintlayerTokenTotalSupplyType::generated_enum_descriptor_data()); enums.push(mintlayer_tx_request::MintlayerRequestType::generated_enum_descriptor_data()); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), diff --git a/wallet/trezor-client/src/protos/mod.rs b/wallet/trezor-client/src/protos/mod.rs index 0f0a68126b..316fe5b927 100644 --- a/wallet/trezor-client/src/protos/mod.rs +++ b/wallet/trezor-client/src/protos/mod.rs @@ -4,7 +4,6 @@ // This significantly improves compile times. // See https://github.com/joshieDo/rust-trezor-api/pull/9 for more details. #[allow(ambiguous_glob_reexports, unreachable_pub)] -#[allow(clippy::all)] mod generated { macro_rules! modules { ($($($feature:literal =>)? $module:ident)+) => {$( diff --git a/wallet/trezor-client/src/transport/protocol.rs b/wallet/trezor-client/src/transport/protocol.rs index fd9376f266..e058b5a9ba 100644 --- a/wallet/trezor-client/src/transport/protocol.rs +++ b/wallet/trezor-client/src/transport/protocol.rs @@ -39,11 +39,8 @@ impl Protocol for ProtocolV2 { self.link.write_chunk(chunk)?; let resp = self.link.read_chunk()?; if resp[0] != 0x03 { - println!( - "bad magic in v2 session_begin: {:x} instead of 0x03", - resp[0] - ); - return Err(Error::DeviceBadMagic); + println!("bad magic in v2 session_begin: {:x} instead of 0x03", resp[0]); + return Err(Error::DeviceBadMagic) } self.session_id = BigEndian::read_u32(&resp[1..5]); Ok(()) @@ -58,7 +55,7 @@ impl Protocol for ProtocolV2 { let resp = self.link.read_chunk()?; if resp[0] != 0x04 { println!("bad magic in v2 session_end: {:x} instead of 0x04", resp[0]); - return Err(Error::DeviceBadMagic); + return Err(Error::DeviceBadMagic) } self.session_id = 0; Ok(()) @@ -110,10 +107,10 @@ impl Protocol for ProtocolV2 { let chunk = self.link.read_chunk()?; if chunk[0] != 0x01 { println!("bad magic in v2 read: {:x} instead of 0x01", chunk[0]); - return Err(Error::DeviceBadMagic); + return Err(Error::DeviceBadMagic) } if BigEndian::read_u32(&chunk[1..5]) != self.session_id { - return Err(Error::DeviceBadSessionId); + return Err(Error::DeviceBadSessionId) } let message_type_id = BigEndian::read_u32(&chunk[5..9]); let message_type = MessageType::from_i32(message_type_id as i32) @@ -125,17 +122,14 @@ impl Protocol for ProtocolV2 { while data.len() < data_length { let chunk = self.link.read_chunk()?; if chunk[0] != 0x02 { - println!( - "bad magic in v2 session_begin: {:x} instead of 0x02", - chunk[0] - ); - return Err(Error::DeviceBadMagic); + println!("bad magic in v2 session_begin: {:x} instead of 0x02", chunk[0]); + return Err(Error::DeviceBadMagic) } if BigEndian::read_u32(&chunk[1..5]) != self.session_id { - return Err(Error::DeviceBadSessionId); + return Err(Error::DeviceBadSessionId) } if BigEndian::read_u32(&chunk[5..9]) != seq as u32 { - return Err(Error::DeviceUnexpectedSequenceNumber); + return Err(Error::DeviceUnexpectedSequenceNumber) } seq += 1; @@ -191,7 +185,7 @@ impl Protocol for ProtocolV1 { "bad magic in v1 read: {:x}{:x}{:x} instead of 0x3f2323", chunk[0], chunk[1], chunk[2] ); - return Err(Error::DeviceBadMagic); + return Err(Error::DeviceBadMagic) } let message_type_id = BigEndian::read_u16(&chunk[3..5]) as u32; let message_type = MessageType::from_i32(message_type_id as i32) @@ -203,7 +197,7 @@ impl Protocol for ProtocolV1 { let chunk = self.link.read_chunk()?; if chunk[0] != 0x3f { println!("bad magic in v1 read: {:x} instead of 0x3f", chunk[0]); - return Err(Error::DeviceBadMagic); + return Err(Error::DeviceBadMagic) } data.extend(&chunk[1..]); diff --git a/wallet/trezor-client/src/transport/udp.rs b/wallet/trezor-client/src/transport/udp.rs index b70ef5bf66..54c4ba3797 100644 --- a/wallet/trezor-client/src/transport/udp.rs +++ b/wallet/trezor-client/src/transport/udp.rs @@ -48,7 +48,7 @@ impl Link for UdpLink { let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); self.socket.set_write_timeout(Some(timeout))?; if let Err(e) = self.socket.send(&chunk) { - return Err(e.into()); + return Err(e.into()) } Ok(()) } @@ -100,15 +100,11 @@ impl UdpTransport { let mut devices = Vec::new(); let mut dest = String::new(); match path { - Some(p) => p.clone_into(&mut dest), + Some(p) => dest = p.to_owned(), None => { dest.push_str(DEFAULT_HOST); dest.push(':'); - dest.push_str(if debug { - DEFAULT_DEBUG_PORT - } else { - DEFAULT_PORT - }); + dest.push_str(if debug { DEFAULT_DEBUG_PORT } else { DEFAULT_PORT }); } }; let link = UdpLink::open(&dest)?; @@ -136,9 +132,7 @@ impl UdpTransport { path.push(':'); path.push_str(&transport.port); let link = UdpLink::open(&path)?; - Ok(Box::new(UdpTransport { - protocol: ProtocolV1 { link }, - })) + Ok(Box::new(UdpTransport { protocol: ProtocolV1 { link } })) } } diff --git a/wallet/trezor-client/src/transport/webusb.rs b/wallet/trezor-client/src/transport/webusb.rs index 635f048ecb..9e65af0901 100644 --- a/wallet/trezor-client/src/transport/webusb.rs +++ b/wallet/trezor-client/src/transport/webusb.rs @@ -53,7 +53,7 @@ impl Link for WebUsbLink { debug_assert_eq!(CHUNK_SIZE, chunk.len()); let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); if let Err(e) = self.handle.write_interrupt(self.endpoint, &chunk, timeout) { - return Err(e.into()); + return Err(e.into()) } Ok(()) } @@ -101,7 +101,7 @@ impl WebUsbTransport { .ok_or(rusb::Error::Other)? .class_code(); if class_code != constants::LIBUSB_CLASS_VENDOR_SPEC { - continue; + continue } devices.push(AvailableDevice { @@ -137,9 +137,9 @@ impl WebUsbTransport { let dev_desc = dev.device_descriptor()?; let dev_id = (dev_desc.vendor_id(), dev_desc.product_id()); if derive_model(dev_id).as_ref() != Some(&device.model) { - return Err(Error::DeviceDisconnected); + return Err(Error::DeviceDisconnected) } - let handle = dev.open()?; + let mut handle = dev.open()?; handle.claim_interface(interface)?; Ok(Box::new(WebUsbTransport { diff --git a/wallet/trezor-client/src/utils.rs b/wallet/trezor-client/src/utils.rs index c248599700..1d4647eb60 100644 --- a/wallet/trezor-client/src/utils.rs +++ b/wallet/trezor-client/src/utils.rs @@ -45,7 +45,7 @@ pub fn parse_recoverable_signature( sig: &[u8], ) -> Result { if sig.len() != 65 { - return Err(bitcoin::secp256k1::Error::InvalidSignature); + return Err(bitcoin::secp256k1::Error::InvalidSignature) } // Bitcoin Core sets the first byte to `27 + rec + (fCompressed ? 4 : 0)`. diff --git a/wallet/wallet-cli-commands/Cargo.toml b/wallet/wallet-cli-commands/Cargo.toml index ee84204b80..db781c74b8 100644 --- a/wallet/wallet-cli-commands/Cargo.toml +++ b/wallet/wallet-cli-commands/Cargo.toml @@ -56,3 +56,8 @@ test-utils = { path = "../../test-utils" } wallet-test-node = { path = "../wallet-test-node" } rstest.workspace = true + +[features] +trezor = [] + +default = ["trezor"] diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index 2a7ff3575d..1dea94f8b9 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -43,13 +43,12 @@ use wallet_rpc_lib::types::{ }; #[cfg(feature = "trezor")] -use crate::helper_types::CLIHardwareWalletType; +use wallet_rpc_lib::types::HardwareWalletType; + use crate::{ errors::WalletCliCommandError, helper_types::parse_generic_token_transfer, - ManageableWalletCommand, WalletManagementCommand, + helper_types::CLIHardwareWalletType, ManageableWalletCommand, WalletManagementCommand, }; -#[cfg(feature = "trezor")] -use wallet_rpc_lib::types::HardwareWalletType; use self::local_state::WalletWithState; @@ -151,9 +150,10 @@ where passphrase, hardware_wallet, } => { - let hardware_wallet = hardware_wallet.map(|t| match t { + let hardware_wallet = hardware_wallet.and_then(|t| match t { #[cfg(feature = "trezor")] - CLIHardwareWalletType::Trezor => HardwareWalletType::Trezor, + CLIHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), + CLIHardwareWalletType::None => None, }); let newly_generated_mnemonic = self diff --git a/wallet/wallet-cli-commands/src/helper_types.rs b/wallet/wallet-cli-commands/src/helper_types.rs index 00562c1073..c3d7abe044 100644 --- a/wallet/wallet-cli-commands/src/helper_types.rs +++ b/wallet/wallet-cli-commands/src/helper_types.rs @@ -436,6 +436,7 @@ impl YesNo { #[derive(Debug, Clone, Copy, ValueEnum)] pub enum CLIHardwareWalletType { + None, #[cfg(feature = "trezor")] Trezor, } diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index 1dce2f46d0..2e09c4f4fb 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -65,7 +65,7 @@ pub enum WalletManagementCommand { /// Create a wallet using a connected hardware wallet. Only the public keys will be kept in /// the software wallet - #[arg(long, conflicts_with_all(["mnemonic", "passphrase", "whether_to_store_seed_phrase"]))] + #[arg(long, conflicts_with_all(["mnemonic", "passphrase"]))] hardware_wallet: Option, }, diff --git a/wallet/wallet-cli-lib/Cargo.toml b/wallet/wallet-cli-lib/Cargo.toml index 84bec932f6..28eafe69c0 100644 --- a/wallet/wallet-cli-lib/Cargo.toml +++ b/wallet/wallet-cli-lib/Cargo.toml @@ -56,3 +56,6 @@ test-utils = { path = "../../test-utils" } wallet-test-node = { path = "../wallet-test-node" } rstest.workspace = true + +[features] +trezor = [] diff --git a/wallet/wallet-controller/Cargo.toml b/wallet/wallet-controller/Cargo.toml index fee41f4b2d..38839d43ef 100644 --- a/wallet/wallet-controller/Cargo.toml +++ b/wallet/wallet-controller/Cargo.toml @@ -44,3 +44,8 @@ test-utils = { path = "../../test-utils" } anyhow.workspace = true rstest.workspace = true + +[features] +trezor = [] + +default = ["trezor"] diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index c304b1962c..278d3c91c4 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -285,7 +285,7 @@ where db, best_block, wallet_type, - |db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), + |_db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), ) .map_err(ControllerError::WalletError)?; Ok(WalletType2::Trezor(wallet)) @@ -341,7 +341,7 @@ where Arc::clone(&chain_config), db, wallet_type, - |db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), + |_db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), ) .map_err(ControllerError::WalletError)?; Ok(WalletType2::Trezor(wallet)) diff --git a/wallet/wallet-rpc-client/Cargo.toml b/wallet/wallet-rpc-client/Cargo.toml index c62e8133fd..50fe6c9513 100644 --- a/wallet/wallet-rpc-client/Cargo.toml +++ b/wallet/wallet-rpc-client/Cargo.toml @@ -18,6 +18,7 @@ p2p-types = { path = "../../p2p/types" } rpc = { path = "../../rpc" } serialization = { path = "../../serialization" } subsystem = { path = "../../subsystem" } +utils = { path = "../../utils" } utils-networking = { path = "../../utils/networking" } wallet = { path = ".." } wallet-controller = { path = "../wallet-controller" } @@ -35,3 +36,8 @@ tower.workspace = true chainstate-storage = { path = "../../chainstate/storage" } tokio = { workspace = true, default-features = false, features = ["io-util", "macros", "net", "rt", "sync"] } + +[features] +trezor = [] + +default = ["trezor"] diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 8fd0a7052e..3e85533a00 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -30,6 +30,8 @@ use node_comm::node_traits::NodeInterface; use p2p_types::{bannable_address::BannableAddress, socket_address::SocketAddress, PeerId}; use rpc::types::RpcHexString; use serialization::{hex::HexEncode, hex_encoded::HexEncoded, json_encoded::JsonEncoded}; +#[cfg(feature = "trezor")] +use utils::ensure; use utils_networking::IpOrSocketAddress; use wallet::{account::TxInfo, version::get_version}; use wallet_controller::{ diff --git a/wallet/wallet-rpc-lib/Cargo.toml b/wallet/wallet-rpc-lib/Cargo.toml index 7d3b48c11e..cf974e860c 100644 --- a/wallet/wallet-rpc-lib/Cargo.toml +++ b/wallet/wallet-rpc-lib/Cargo.toml @@ -49,3 +49,8 @@ wallet-test-node = { path = "../wallet-test-node" } wallet-types = { path = "../types" } rstest.workspace = true + +[features] +trezor = [] + +default = ["trezor"] diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index 5f27a2a00f..4086639491 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -115,7 +115,7 @@ where mnemonic.is_none() && passphrase.is_none() && store_seed_phrase == StoreSeedPhrase::DoNotStore, - RpcError::HardwareWalletWithMnemonic + RpcError::::HardwareWalletWithMnemonic ); WalletTypeArgs::Trezor } From 77b68b8d9bca1dcd4b5de8557a8e75096076e171 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 29 Jul 2024 08:31:38 +0200 Subject: [PATCH 10/48] add support for signing challenges with trezor --- wallet/src/signer/mod.rs | 11 +- wallet/src/signer/software_signer/tests.rs | 42 + wallet/src/signer/trezor_signer/mod.rs | 706 ++++++++------ wallet/src/signer/trezor_signer/tests.rs | 62 +- wallet/trezor-client/src/client/common.rs | 2 +- wallet/trezor-client/src/client/ethereum.rs | 2 +- wallet/trezor-client/src/client/mintlayer.rs | 63 +- wallet/trezor-client/src/client/mod.rs | 4 +- wallet/trezor-client/src/error.rs | 8 + wallet/trezor-client/src/flows/sign_tx.rs | 16 +- wallet/trezor-client/src/lib.rs | 12 +- .../trezor-client/src/messages/generated.rs | 2 +- .../src/protos/generated/messages.rs | 24 +- .../src/protos/generated/messages_bitcoin.rs | 11 +- .../protos/generated/messages_mintlayer.rs | 864 ++++++++++++------ .../trezor-client/src/transport/protocol.rs | 18 +- wallet/trezor-client/src/transport/udp.rs | 2 +- wallet/trezor-client/src/transport/webusb.rs | 8 +- wallet/trezor-client/src/utils.rs | 2 +- 19 files changed, 1216 insertions(+), 643 deletions(-) diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 800c194a17..1db0d20764 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -18,7 +18,10 @@ use std::sync::Arc; use common::chain::{ partially_signed_transaction::PartiallySignedTransaction, signature::{ - inputsig::arbitrary_message::{ArbitraryMessageSignature, SignArbitraryMessageError}, + inputsig::{ + arbitrary_message::{ArbitraryMessageSignature, SignArbitraryMessageError}, + classical_multisig::multisig_partial_signature::PartiallySignedMultisigStructureError, + }, DestinationSigError, }, ChainConfig, Destination, SignedTransactionIntent, SignedTransactionIntentError, Transaction, @@ -60,9 +63,15 @@ pub enum SignerError { #[error("Signed transaction intent error: {0}")] SignedTransactionIntentError(#[from] SignedTransactionIntentError), #[error("{0}")] + MultisigError(#[from] PartiallySignedMultisigStructureError), + #[error("{0}")] SerializationError(#[from] serialization::Error), #[error("Trezor error: {0}")] TrezorError(#[from] TrezorError), + #[error("Partially signed tx is missing input's destination")] + MissingDestinationInTransaction, + #[error("Partially signed tx is missing UTXO type input's UTXO")] + MissingUtxo, } type SignerResult = Result; diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index 820a0b8688..222fbbe168 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -21,6 +21,8 @@ use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::output_value::OutputValue; +use common::chain::signature::inputsig::arbitrary_message::produce_message_challenge; +use common::chain::signature::verify_signature; use common::chain::timelock::OutputTimeLock; use common::chain::{GenBlock, TxInput}; use common::primitives::amount::UnsignedIntType; @@ -37,6 +39,46 @@ use wallet_types::KeyPurpose::{Change, ReceiveFunds}; const MNEMONIC: &str = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"; +#[rstest] +#[trace] +#[case(Seed::from_entropy())] +fn sign_message(#[case] seed: Seed) { + let mut rng = make_seedable_rng(seed); + + let config = Arc::new(create_regtest()); + let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); + let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); + + let master_key_chain = MasterKeyChain::new_from_mnemonic( + config.clone(), + &mut db_tx, + MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + ) + .unwrap(); + + let key_chain = master_key_chain + .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) + .unwrap(); + let mut account = Account::new(config.clone(), &mut db_tx, key_chain, None).unwrap(); + + let destination = account.get_new_address(&mut db_tx, ReceiveFunds).unwrap().1.into_object(); + let mut signer = SoftwareSigner::new(config.clone(), DEFAULT_ACCOUNT_INDEX); + let message = vec![rng.gen::(), rng.gen::(), rng.gen::()]; + let res = signer + .sign_challenge( + message.clone(), + destination.clone(), + account.key_chain(), + &db_tx, + ) + .unwrap(); + + let message_challenge = produce_message_challenge(&message); + res.verify_signature(&config, &destination, &message_challenge).unwrap(); +} + #[rstest] #[trace] #[case(Seed::from_entropy())] diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 176a45a010..a306422b08 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -28,31 +28,37 @@ use common::{ arbitrary_message::ArbitraryMessageSignature, authorize_pubkey_spend::AuthorizedPublicKeySpend, authorize_pubkeyhash_spend::AuthorizedPublicKeyHashSpend, - standard_signature::StandardInputSignature, InputWitness, + classical_multisig::{ + authorize_classical_multisig::AuthorizedClassicalMultisigSpend, + multisig_partial_signature::{self, PartiallySignedMultisigChallenge}, + }, + standard_signature::StandardInputSignature, + InputWitness, }, sighash::{sighashtype::SigHashType, signature_hash}, + DestinationSigError, }, timelock::OutputTimeLock, tokens::{NftIssuance, TokenIssuance, TokenTotalSupply}, AccountCommand, AccountSpending, ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, TxOutput, }, - primitives::Amount, + primitives::{Amount, H256}, }; use crypto::key::{ - extended::{ExtendedPrivateKey, ExtendedPublicKey}, + extended::ExtendedPublicKey, hdkd::{chain_code::ChainCode, derivable::Derivable, u31::U31}, secp256k1::{extended_keys::Secp256k1ExtendedPublicKey, Secp256k1PublicKey}, - PrivateKey, Signature, + Signature, }; use itertools::Itertools; -use randomness::make_true_rng; use serialization::Encode; use trezor_client::{ + client::mintlayer::MintlayerSignature, find_devices, protos::{ - MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerBurnTxOutput, - MintlayerChangeTokenAuhtority, MintlayerCreateDelegationIdTxOutput, + MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerAddressPath, + MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerCreateDelegationIdTxOutput, MintlayerCreateStakePoolTxOutput, MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFreezeToken, MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, @@ -74,10 +80,7 @@ use wallet_storage::{ use wallet_types::{signature_status::SignatureStatus, AccountId}; use crate::{ - key_chain::{ - make_account_path, AccountKeyChainImplHardware, AccountKeyChains, FoundPubKey, - MasterKeyChain, - }, + key_chain::{make_account_path, AccountKeyChainImplHardware, AccountKeyChains, FoundPubKey}, Account, WalletResult, }; @@ -88,61 +91,29 @@ use super::{Signer, SignerError, SignerProvider, SignerResult}; pub enum TrezorError { #[error("No connected Trezor device found")] NoDeviceFound, + #[error("Trezor device error: {0}")] + DeviceError(#[from] trezor_client::Error), } pub struct TrezorSigner { chain_config: Arc, - account_index: U31, client: Arc>, } impl TrezorSigner { - pub fn new( - chain_config: Arc, - account_index: U31, - client: Arc>, - ) -> Self { + pub fn new(chain_config: Arc, client: Arc>) -> Self { Self { chain_config, - account_index, client, } } - fn derive_account_private_key( - &self, - db_tx: &impl WalletStorageReadUnlocked, - ) -> SignerResult { - let account_path = make_account_path(&self.chain_config, self.account_index); - - let root_key = MasterKeyChain::load_root_key(db_tx)?.derive_absolute_path(&account_path)?; - Ok(root_key) - } - - fn get_private_key_for_destination( - &self, - destination: &Destination, - key_chain: &impl AccountKeyChains, - db_tx: &impl WalletStorageReadUnlocked, - ) -> SignerResult> { - let xpriv = self.derive_account_private_key(db_tx)?; - match key_chain.find_public_key(destination) { - Some(FoundPubKey::Hierarchy(xpub)) => { - get_private_key(&xpriv, &xpub).map(|pk| Some(pk.private_key())) - } - Some(FoundPubKey::Standalone(acc_public_key)) => { - let standalone_pk = db_tx.get_account_standalone_private_key(&acc_public_key)?; - Ok(standalone_pk) - } - None => Ok(None), - } - } - fn make_signature( &self, - signature: &Option>, + signature: &Vec, destination: &Destination, sighash_type: SigHashType, + sighash: H256, key_chain: &impl AccountKeyChains, ) -> SignerResult<(Option, SignatureStatus)> { match destination { @@ -151,19 +122,11 @@ impl TrezorSigner { SignatureStatus::FullySigned, )), Destination::PublicKeyHash(_) => { - if let Some(signature) = signature { - if signature.is_empty() { - eprintln!("empty signature"); - return Ok((None, SignatureStatus::NotSigned)); - } - - eprintln!("some signature pkh"); + if let Some(signature) = signature.first() { let pk = key_chain.find_public_key(destination).expect("found").into_public_key(); - eprintln!("pk {:?}", pk.encode()); - let mut signature = signature.clone(); + let mut signature = signature.signature.clone(); signature.insert(0, 0); - eprintln!("sig len {}", signature.len()); let sig = Signature::from_data(signature)?; let sig = AuthorizedPublicKeyHashSpend::new(pk, sig); let sig = InputWitness::Standard(StandardInputSignature::new( @@ -171,17 +134,14 @@ impl TrezorSigner { sig.encode(), )); - eprintln!("sig ok"); Ok((Some(sig), SignatureStatus::FullySigned)) } else { - eprintln!("empty signature"); Ok((None, SignatureStatus::NotSigned)) } } Destination::PublicKey(_) => { - if let Some(signature) = signature { - eprintln!("some signature pk"); - let mut signature = signature.clone(); + if let Some(signature) = signature.first() { + let mut signature = signature.signature.clone(); signature.insert(0, 0); let sig = Signature::from_data(signature)?; let sig = AuthorizedPublicKeySpend::new(sig); @@ -192,13 +152,53 @@ impl TrezorSigner { Ok((Some(sig), SignatureStatus::FullySigned)) } else { - eprintln!("empty signature"); Ok((None, SignatureStatus::NotSigned)) } } Destination::ClassicMultisig(_) => { - if let Some(_challenge) = key_chain.find_multisig_challenge(destination) { - unimplemented!("add support for multisig in Trezor") + if let Some(challenge) = key_chain.find_multisig_challenge(destination) { + let mut current_signatures = + AuthorizedClassicalMultisigSpend::new_empty(challenge.clone()); + + for sig in signature { + if let Some(idx) = sig.multisig_idx { + let mut signature = sig.signature.clone(); + signature.insert(0, 0); + let sig = Signature::from_data(signature)?; + current_signatures.add_signature(idx as u8, sig); + } + } + + let msg = sighash.encode(); + // Check the signatures status again after adding that last signature + let verifier = PartiallySignedMultisigChallenge::from_partial( + &self.chain_config, + &msg, + ¤t_signatures, + )?; + + let status = match verifier.verify_signatures(&self.chain_config)? { + multisig_partial_signature::SigsVerifyResult::CompleteAndValid => { + SignatureStatus::FullySigned + } + multisig_partial_signature::SigsVerifyResult::Incomplete => { + SignatureStatus::PartialMultisig { + required_signatures: challenge.min_required_signatures(), + num_signatures: current_signatures.signatures().len() as u8, + } + } + multisig_partial_signature::SigsVerifyResult::Invalid => { + unreachable!( + "We checked the signatures then added a signature, so this should be unreachable" + ) + } + }; + + let sig = InputWitness::Standard(StandardInputSignature::new( + sighash_type, + current_signatures.encode(), + )); + return Ok((Some(sig), status)); } Ok((None, SignatureStatus::NotSigned)) @@ -229,17 +229,16 @@ impl Signer for TrezorSigner { Vec, Vec, )> { - let inputs = to_trezor_input_msgs(&ptx, key_chain, &self.chain_config); + let inputs = to_trezor_input_msgs(&ptx, key_chain, &self.chain_config)?; let outputs = self.to_trezor_output_msgs(&ptx); let utxos = to_trezor_utxo_msgs(&ptx, &self.chain_config); let new_signatures = self .client .lock() - .expect("") + .expect("poisoned lock") .mintlayer_sign_tx(inputs, outputs, utxos) - .expect(""); - eprintln!("new signatures: {new_signatures:?}"); + .map_err(TrezorError::DeviceError)?; let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); @@ -264,14 +263,77 @@ impl Signer for TrezorSigner { .verify_signature(&self.chain_config, destination, &sighash) .is_ok() { - eprintln!("valid signature {sighash:?}!!\n\n"); Ok(( Some(w.clone()), SignatureStatus::FullySigned, SignatureStatus::FullySigned, )) } else if let Destination::ClassicMultisig(_) = destination { - unimplemented!("add support for multisig to Trezor"); + let mut current_signatures = AuthorizedClassicalMultisigSpend::from_data( + sig.raw_signature(), + )?; + + let previous_status = SignatureStatus::PartialMultisig { + required_signatures: current_signatures.challenge().min_required_signatures(), + num_signatures: current_signatures.signatures().len() as u8, + }; + + if let Some(signature) = new_signatures.get(i) { + for sig in signature { + if let Some(idx) = sig.multisig_idx { + let mut signature = sig.signature.clone(); + signature.insert(0, 0); + let sig = Signature::from_data(signature)?; + current_signatures.add_signature(idx as u8, sig); + } + } + + let msg = sighash.encode(); + // Check the signatures status again after adding that last signature + let verifier = PartiallySignedMultisigChallenge::from_partial( + &self.chain_config, + &msg, + ¤t_signatures, + )?; + + let status = match verifier.verify_signatures(&self.chain_config)? { + multisig_partial_signature::SigsVerifyResult::CompleteAndValid => { + SignatureStatus::FullySigned + } + multisig_partial_signature::SigsVerifyResult::Incomplete => { + let challenge = current_signatures.challenge(); + SignatureStatus::PartialMultisig { + required_signatures: challenge.min_required_signatures(), + num_signatures: current_signatures.signatures().len() as u8, + } + } + multisig_partial_signature::SigsVerifyResult::Invalid => { + unreachable!( + "We checked the signatures then added a signature, so this should be unreachable" + ) + } + }; + + let sighash_type = + SigHashType::try_from(SigHashType::ALL).expect("Should not fail"); + let sig = InputWitness::Standard(StandardInputSignature::new( + sighash_type, + current_signatures.encode(), + )); + return Ok((Some(sig), + previous_status, + status)); + } + else { + Ok(( + None, + SignatureStatus::InvalidSignature, + SignatureStatus::NotSigned, + )) + + } + + } else { Ok(( None, @@ -291,13 +353,17 @@ impl Signer for TrezorSigner { (Some(destination), Some(sig)) => { let sighash_type = SigHashType::try_from(SigHashType::ALL).expect("Should not fail"); - eprintln!("making sig for {i}"); - let (sig, status) = - self.make_signature(sig, destination, sighash_type, key_chain)?; + let sighash = signature_hash(sighash_type, ptx.tx(), &inputs_utxo_refs, i)?; + let (sig, status) = self.make_signature( + sig, + destination, + sighash_type, + sighash, + key_chain, + )?; Ok((sig, SignatureStatus::NotSigned, status)) } (Some(_) | None, None) | (None, Some(_)) => { - eprintln!("no signature!"); Ok((None, SignatureStatus::NotSigned, SignatureStatus::NotSigned)) } }, @@ -314,19 +380,61 @@ impl Signer for TrezorSigner { message: Vec, destination: Destination, key_chain: &impl AccountKeyChains, - db_tx: &impl WalletStorageReadUnlocked, + _db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult { - let private_key = self - .get_private_key_for_destination(&destination, key_chain, db_tx)? - .ok_or(SignerError::DestinationNotFromThisWallet)?; - - let sig = ArbitraryMessageSignature::produce_uniparty_signature( - &private_key, - &destination, - &message, - make_true_rng(), - )?; + let data = match key_chain.find_public_key(&destination) { + Some(FoundPubKey::Hierarchy(xpub)) => { + let address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + + let addr = Address::new(&self.chain_config, destination.clone()) + .expect("addressable") + .into_string(); + + let sig = self + .client + .lock() + .expect("poisoned lock") + .mintlayer_sign_message(address_n, addr, message) + .map_err(TrezorError::DeviceError)?; + let mut signature = sig; + signature.insert(0, 0); + let signature = Signature::from_data(signature)?; + + match &destination { + Destination::PublicKey(_) => AuthorizedPublicKeySpend::new(signature).encode(), + Destination::PublicKeyHash(_) => { + AuthorizedPublicKeyHashSpend::new(xpub.into_public_key(), signature) + .encode() + } + Destination::AnyoneCanSpend => { + return Err(SignerError::SigningError( + DestinationSigError::AttemptedToProduceSignatureForAnyoneCanSpend, + )) + } + Destination::ClassicMultisig(_) => { + return Err(SignerError::SigningError( + DestinationSigError::AttemptedToProduceClassicalMultisigSignatureInUnipartySignatureCode, + )) + } + Destination::ScriptHash(_) => { + return Err(SignerError::SigningError( + DestinationSigError::Unsupported, + )) + } + } + } + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") + } + None => return Err(SignerError::DestinationNotFromThisWallet), + }; + let sig = ArbitraryMessageSignature::from_data(data); Ok(sig) } @@ -363,174 +471,241 @@ fn to_trezor_input_msgs( ptx: &PartiallySignedTransaction, key_chain: &impl AccountKeyChains, chain_config: &ChainConfig, -) -> Vec { - let inputs = ptx - .tx() +) -> SignerResult> { + ptx.tx() .inputs() .iter() .zip(ptx.input_utxos()) .zip(ptx.destinations()) .map(|((inp, utxo), dest)| match (inp, utxo, dest) { - (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => { - let mut inp_req = MintlayerUtxoTxInput::new(); - let id = match outpoint.source_id() { - OutPointSourceId::Transaction(id) => { - inp_req.set_type(MintlayerUtxoType::TRANSACTION); - id.to_hash().0 - } - OutPointSourceId::BlockReward(id) => { - inp_req.set_type(MintlayerUtxoType::BLOCK); - id.to_hash().0 - } - }; - inp_req.set_prev_hash(id.to_vec()); - inp_req.set_prev_index(outpoint.output_index()); - match tx_output_value(utxo) { - OutputValue::Coin(amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - inp_req.value = Some(value).into(); - } - OutputValue::TokenV1(token_id, amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - value.set_token_id(token_id.to_hash().as_bytes().to_vec()); - inp_req.value = Some(value).into(); - } - OutputValue::TokenV0(_) => { - panic!("token v0 unsuported"); - } - } + (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => Ok(to_trezor_utxo_input( + outpoint, + utxo, + chain_config, + dest, + key_chain, + )), + (TxInput::Account(outpoint), _, Some(dest)) => Ok(to_trezor_account_input( + chain_config, + dest, + key_chain, + outpoint, + )), + (TxInput::AccountCommand(nonce, command), _, Some(dest)) => Ok( + to_trezor_account_command_input(chain_config, dest, key_chain, nonce, command), + ), + (_, _, None) => Err(SignerError::MissingDestinationInTransaction), + (TxInput::Utxo(_), _, _) => Err(SignerError::MissingUtxo), + }) + .collect() +} - inp_req.set_address( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); - match key_chain.find_public_key(dest) { - Some(FoundPubKey::Hierarchy(xpub)) => { - inp_req.address_n = xpub - .get_derivation_path() - .as_slice() - .iter() - .map(|c| c.into_encoded_index()) - .collect(); - } - Some(FoundPubKey::Standalone(_)) => { - unimplemented!("standalone keys with trezor") - } - None => {} - }; +fn to_trezor_account_command_input( + chain_config: &ChainConfig, + dest: &Destination, + key_chain: &impl AccountKeyChains, + nonce: &common::chain::AccountNonce, + command: &AccountCommand, +) -> MintlayerTxInput { + let mut inp_req = MintlayerAccountCommandTxInput::new(); + inp_req + .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); + match key_chain.find_public_key(dest) { + Some(FoundPubKey::Hierarchy(xpub)) => { + let address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + inp_req.address_n = vec![MintlayerAddressPath { + address_n, + ..Default::default() + }]; + } + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") + } + None => {} + }; + inp_req.set_nonce(nonce.value()); + match command { + AccountCommand::MintTokens(token_id, amount) => { + let mut req = MintlayerMintTokens::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + + inp_req.mint = Some(req).into(); + } + AccountCommand::UnmintTokens(token_id) => { + let mut req = MintlayerUnmintTokens::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - let mut inp = MintlayerTxInput::new(); - inp.utxo = Some(inp_req).into(); - inp - } - (TxInput::Account(outpoint), _, Some(dest)) => { - let mut inp_req = MintlayerAccountTxInput::new(); - inp_req.set_address( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); - match key_chain.find_public_key(dest) { - Some(FoundPubKey::Hierarchy(xpub)) => { - inp_req.address_n = xpub - .get_derivation_path() - .as_slice() - .iter() - .map(|c| c.into_encoded_index()) - .collect(); - } - Some(FoundPubKey::Standalone(_)) => { - unimplemented!("standalone keys with trezor") - } - None => {} - }; - inp_req.set_nonce(outpoint.nonce().value()); - match outpoint.account() { - AccountSpending::DelegationBalance(delegation_id, amount) => { - inp_req.set_delegation_id(delegation_id.to_hash().as_bytes().to_vec()); - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - inp_req.value = Some(value).into(); - } - } - let mut inp = MintlayerTxInput::new(); - inp.account = Some(inp_req).into(); - inp - } - (TxInput::AccountCommand(nonce, command), _, Some(dest)) => { - let mut inp_req = MintlayerAccountCommandTxInput::new(); - inp_req.set_address( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); - match key_chain.find_public_key(dest) { - Some(FoundPubKey::Hierarchy(xpub)) => { - inp_req.address_n = xpub - .get_derivation_path() - .as_slice() - .iter() - .map(|c| c.into_encoded_index()) - .collect(); - } - Some(FoundPubKey::Standalone(_)) => { - unimplemented!("standalone keys with trezor") - } - None => {} - }; - inp_req.set_nonce(nonce.value()); - match command { - AccountCommand::MintTokens(token_id, amount) => { - let mut req = MintlayerMintTokens::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - - inp_req.mint = Some(req).into(); - } - AccountCommand::UnmintTokens(token_id) => { - let mut req = MintlayerUnmintTokens::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + inp_req.unmint = Some(req).into(); + } + AccountCommand::FreezeToken(token_id, unfreezable) => { + let mut req = MintlayerFreezeToken::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_is_token_unfreezabe(unfreezable.as_bool()); - inp_req.unmint = Some(req).into(); - } - AccountCommand::FreezeToken(token_id, unfreezable) => { - let mut req = MintlayerFreezeToken::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - req.set_is_token_unfreezabe(unfreezable.as_bool()); + inp_req.freeze_token = Some(req).into(); + } + AccountCommand::UnfreezeToken(token_id) => { + let mut req = MintlayerUnfreezeToken::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - inp_req.freeze_token = Some(req).into(); - } - AccountCommand::UnfreezeToken(token_id) => { - let mut req = MintlayerUnfreezeToken::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + inp_req.unfreeze_token = Some(req).into(); + } + AccountCommand::LockTokenSupply(token_id) => { + let mut req = MintlayerLockTokenSupply::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - inp_req.unfreeze_token = Some(req).into(); - } - AccountCommand::LockTokenSupply(token_id) => { - let mut req = MintlayerLockTokenSupply::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + inp_req.lock_token_supply = Some(req).into(); + } + AccountCommand::ChangeTokenAuthority(token_id, dest) => { + let mut req = MintlayerChangeTokenAuhtority::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_destination( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); - inp_req.lock_token_supply = Some(req).into(); - } - AccountCommand::ChangeTokenAuthority(token_id, dest) => { - let mut req = MintlayerChangeTokenAuhtority::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - req.set_destination( - Address::new(chain_config, dest.clone()) - .expect("addressable") - .into_string(), - ); + inp_req.change_token_authority = Some(req).into(); + } + } + let mut inp = MintlayerTxInput::new(); + inp.account_command = Some(inp_req).into(); + inp +} - inp_req.change_token_authority = Some(req).into(); - } - } - let mut inp = MintlayerTxInput::new(); - inp.account_command = Some(inp_req).into(); - inp - } - (TxInput::Utxo(_) | TxInput::Account(_) | TxInput::AccountCommand(_, _), _, _) => { - unimplemented!("accounting not supported yet with trezor") +fn to_trezor_account_input( + chain_config: &ChainConfig, + dest: &Destination, + key_chain: &impl AccountKeyChains, + outpoint: &common::chain::AccountOutPoint, +) -> MintlayerTxInput { + let mut inp_req = MintlayerAccountTxInput::new(); + inp_req + .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); + match key_chain.find_public_key(dest) { + Some(FoundPubKey::Hierarchy(xpub)) => { + let address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + inp_req.address_n = vec![MintlayerAddressPath { + address_n, + ..Default::default() + }]; + } + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") + } + None => {} + }; + inp_req.set_nonce(outpoint.nonce().value()); + match outpoint.account() { + AccountSpending::DelegationBalance(delegation_id, amount) => { + inp_req.set_delegation_id(delegation_id.to_hash().as_bytes().to_vec()); + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + inp_req.value = Some(value).into(); + } + } + let mut inp = MintlayerTxInput::new(); + inp.account = Some(inp_req).into(); + inp +} + +fn to_trezor_utxo_input( + outpoint: &common::chain::UtxoOutPoint, + utxo: &TxOutput, + chain_config: &ChainConfig, + dest: &Destination, + key_chain: &impl AccountKeyChains, +) -> MintlayerTxInput { + let mut inp_req = MintlayerUtxoTxInput::new(); + let id = match outpoint.source_id() { + OutPointSourceId::Transaction(id) => { + inp_req.set_type(MintlayerUtxoType::TRANSACTION); + id.to_hash().0 + } + OutPointSourceId::BlockReward(id) => { + inp_req.set_type(MintlayerUtxoType::BLOCK); + id.to_hash().0 + } + }; + inp_req.set_prev_hash(id.to_vec()); + inp_req.set_prev_index(outpoint.output_index()); + match tx_output_value(utxo) { + OutputValue::Coin(amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + inp_req.value = Some(value).into(); + } + OutputValue::TokenV1(token_id, amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + inp_req.value = Some(value).into(); + } + OutputValue::TokenV0(_) => { + panic!("token v0 unsuported"); + } + } + + inp_req + .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); + match key_chain.find_public_key(dest) { + Some(FoundPubKey::Hierarchy(xpub)) => { + let address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + inp_req.address_n = vec![MintlayerAddressPath { + address_n, + ..Default::default() + }]; + } + Some(FoundPubKey::Standalone(_)) => { + unimplemented!("standalone keys with trezor") + } + None => { + if let Some(challenge) = key_chain.find_multisig_challenge(dest) { + inp_req.address_n = challenge + .public_keys() + .iter() + .enumerate() + .filter_map(|(idx, pk)| { + match key_chain.find_public_key(&Destination::PublicKey(pk.clone())) { + Some(FoundPubKey::Hierarchy(xpub)) => { + let address_n = xpub + .get_derivation_path() + .as_slice() + .iter() + .map(|c| c.into_encoded_index()) + .collect(); + Some(MintlayerAddressPath { + address_n, + multisig_idx: Some(idx as u32), + special_fields: Default::default(), + }) + } + Some(FoundPubKey::Standalone(_)) => unimplemented!("standalone keys"), + None => None, + } + }) + .collect(); } - }) - .collect(); - inputs + } + }; + + let mut inp = MintlayerTxInput::new(); + inp.utxo = Some(inp_req).into(); + inp } fn to_trezor_utxo_msgs( @@ -580,20 +755,6 @@ fn set_value(value: &OutputValue, out_req: &mut MintlayerTransferTxOutput) { }; } -/// Get the private key that corresponds to the provided public key -fn get_private_key( - parent_key: &ExtendedPrivateKey, - requested_key: &ExtendedPublicKey, -) -> SignerResult { - let derived_key = - parent_key.clone().derive_absolute_path(requested_key.get_derivation_path())?; - if &derived_key.to_public_key() == requested_key { - Ok(derived_key) - } else { - Err(SignerError::KeysNotInSameHierarchy) - } -} - fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> MintlayerTxOutput { match out { TxOutput::Transfer(value, dest) => { @@ -779,28 +940,17 @@ fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> Mintlayer out_req.set_name(data.metadata.name.clone()); out_req.set_ticker(data.metadata.ticker().clone()); out_req.set_icon_uri( - data.metadata - .icon_uri() - .as_ref() - .as_ref() - .map(|x| x.clone()) - .unwrap_or_default(), + data.metadata.icon_uri().as_ref().clone().unwrap_or_default(), ); out_req.set_media_uri( - data.metadata - .media_uri() - .as_ref() - .as_ref() - .map(|x| x.clone()) - .unwrap_or_default(), + data.metadata.media_uri().as_ref().clone().unwrap_or_default(), ); out_req.set_media_hash(data.metadata.media_hash().clone()); out_req.set_additional_metadata_uri( data.metadata .additional_metadata_uri() .as_ref() - .as_ref() - .map(|x| x.clone()) + .clone() .unwrap_or_default(), ); out_req.set_description(data.metadata.description.clone()); @@ -858,8 +1008,8 @@ impl SignerProvider for TrezorSignerProvider { type S = TrezorSigner; type K = AccountKeyChainImplHardware; - fn provide(&mut self, chain_config: Arc, account_index: U31) -> Self::S { - TrezorSigner::new(chain_config, account_index, self.client.clone()) + fn provide(&mut self, chain_config: Arc, _account_index: U31) -> Self::S { + TrezorSigner::new(chain_config, self.client.clone()) } fn make_new_account( @@ -869,24 +1019,16 @@ impl SignerProvider for TrezorSignerProvider { name: Option, db_tx: &mut impl WalletStorageWriteUnlocked, ) -> WalletResult> { - eprintln!( - "coin type in new acc trezor: {:?}", - chain_config.bip44_coin_type().get_index() - ); let derivation_path = make_account_path(&chain_config, account_index); let account_path = derivation_path.as_slice().iter().map(|c| c.into_encoded_index()).collect(); - eprintln!("account path {account_path:?}"); - let xpub = self .client .lock() - .expect("") + .expect("poisoned lock") .mintlayer_get_public_key(account_path) - .expect("") - .ok() - .expect(""); + .map_err(|e| SignerError::TrezorError(TrezorError::DeviceError(e)))?; let chain_code = ChainCode::from(xpub.chain_code.0); let account_pubkey = Secp256k1ExtendedPublicKey::from_hardware_wallet( diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 1c7763d497..8cbc321bea 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -21,6 +21,7 @@ use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::output_value::OutputValue; +use common::chain::signature::inputsig::arbitrary_message::produce_message_challenge; use common::chain::signature::verify_signature; use common::chain::timelock::OutputTimeLock; use common::chain::tokens::TokenId; @@ -28,7 +29,7 @@ use common::chain::{ AccountNonce, AccountOutPoint, DelegationId, GenBlock, PoolId, Transaction, TxInput, }; use common::primitives::{Amount, Id, H256}; -use crypto::key::KeyKind; +use crypto::key::{KeyKind, PrivateKey}; use randomness::{Rng, RngCore}; use rstest::rstest; use test_utils::random::{make_seedable_rng, Seed}; @@ -41,6 +42,50 @@ use wallet_types::KeyPurpose::{Change, ReceiveFunds}; const MNEMONIC: &str = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"; +#[rstest] +#[trace] +#[case(Seed::from_entropy())] +fn sign_message(#[case] seed: Seed) { + let mut rng = make_seedable_rng(seed); + + let chain_config = Arc::new(create_regtest()); + let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); + let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); + + let master_key_chain = MasterKeyChain::new_from_mnemonic( + chain_config.clone(), + &mut db_tx, + MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + ) + .unwrap(); + + let key_chain = master_key_chain + .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) + .unwrap(); + let mut account = Account::new(chain_config.clone(), &mut db_tx, key_chain, None).unwrap(); + + let destination = account.get_new_address(&mut db_tx, ReceiveFunds).unwrap().1.into_object(); + let mut devices = find_devices(false); + assert!(!devices.is_empty()); + let client = devices.pop().unwrap().connect().unwrap(); + + let mut signer = TrezorSigner::new(chain_config.clone(), Arc::new(Mutex::new(client))); + let message = vec![rng.gen::(), rng.gen::(), rng.gen::()]; + let res = signer + .sign_challenge( + message.clone(), + destination.clone(), + account.key_chain(), + &db_tx, + ) + .unwrap(); + + let message_challenge = produce_message_challenge(&message); + res.verify_signature(&chain_config, &destination, &message_challenge).unwrap(); +} + #[rstest] #[trace] #[case(Seed::from_entropy())] @@ -89,7 +134,6 @@ fn sign_transaction(#[case] seed: Seed) { .collect(); let inputs: Vec = (0..utxos.len()) - .into_iter() .map(|_| { let source_id = if rng.gen_bool(0.5) { Id::::new(H256::random_using(&mut rng)).into() @@ -104,13 +148,13 @@ fn sign_transaction(#[case] seed: Seed) { TxInput::Account(AccountOutPoint::new( AccountNonce::new(1), AccountSpending::DelegationBalance( - DelegationId::new(H256::random_using(&mut rng)).into(), + DelegationId::new(H256::random_using(&mut rng)), Amount::from_atoms(rng.next_u32() as u128), ), )), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::UnmintTokens(TokenId::new(H256::random_using(&mut rng)).into()), + AccountCommand::UnmintTokens(TokenId::new(H256::random_using(&mut rng))), ), ]; let acc_dests: Vec = acc_inputs @@ -154,11 +198,11 @@ fn sign_transaction(#[case] seed: Seed) { ), TxOutput::CreateDelegationId( Destination::AnyoneCanSpend, - PoolId::new(H256::random_using(&mut rng)).into(), + PoolId::new(H256::random_using(&mut rng)), ), TxOutput::DelegateStaking( Amount::from_atoms(200), - DelegationId::new(H256::random_using(&mut rng)).into(), + DelegationId::new(H256::random_using(&mut rng)), ), ]; @@ -173,11 +217,7 @@ fn sign_transaction(#[case] seed: Seed) { assert!(!devices.is_empty()); let client = devices.pop().unwrap().connect().unwrap(); - let mut signer = TrezorSigner::new( - chain_config.clone(), - DEFAULT_ACCOUNT_INDEX, - Arc::new(Mutex::new(client)), - ); + let mut signer = TrezorSigner::new(chain_config.clone(), Arc::new(Mutex::new(client))); let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); eprintln!("num inputs in tx: {} {:?}", inputs.len(), ptx.witnesses()); diff --git a/wallet/trezor-client/src/client/common.rs b/wallet/trezor-client/src/client/common.rs index b8bef6c9fd..897f849704 100644 --- a/wallet/trezor-client/src/client/common.rs +++ b/wallet/trezor-client/src/client/common.rs @@ -237,7 +237,7 @@ impl<'a> EntropyRequest<'a> { /// Provide exactly 32 bytes or entropy. pub fn ack_entropy(self, entropy: Vec) -> Result> { if entropy.len() != 32 { - return Err(Error::InvalidEntropy) + return Err(Error::InvalidEntropy); } let mut req = protos::EntropyAck::new(); diff --git a/wallet/trezor-client/src/client/ethereum.rs b/wallet/trezor-client/src/client/ethereum.rs index c6b78f5329..365c124401 100644 --- a/wallet/trezor-client/src/client/ethereum.rs +++ b/wallet/trezor-client/src/client/ethereum.rs @@ -45,7 +45,7 @@ impl Trezor { Box::new(|_, m: protos::EthereumMessageSignature| { let signature = m.signature(); if signature.len() != 65 { - return Err(Error::MalformedSignature) + return Err(Error::MalformedSignature); } let r = signature[0..32].try_into().unwrap(); let s = signature[32..64].try_into().unwrap(); diff --git a/wallet/trezor-client/src/client/mintlayer.rs b/wallet/trezor-client/src/client/mintlayer.rs index a2154e7a4a..0cdd93b34c 100644 --- a/wallet/trezor-client/src/client/mintlayer.rs +++ b/wallet/trezor-client/src/client/mintlayer.rs @@ -12,31 +12,36 @@ use crate::{ mintlayer_tx_request::MintlayerRequestType, MintlayerTxAckOutput, MintlayerTxAckUtxoInput, MintlayerTxInput, MintlayerTxOutput, }, - Error, TrezorResponse, + Error, }; /// A chain code #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ChainCode(pub [u8; 32]); -// impl_array_newtype!(ChainCode, u8, 32); -// impl_bytes_newtype!(ChainCode, 32); pub struct XPub { - /// Public key pub public_key: secp256k1::PublicKey, - /// Chain code pub chain_code: ChainCode, } +#[derive(Debug)] +pub struct MintlayerSignature { + pub signature: Vec, + pub multisig_idx: Option, +} + +impl MintlayerSignature { + fn new(signature: Vec, multisig_idx: Option) -> Self { + Self { signature, multisig_idx } + } +} + impl Trezor { // Mintlayer - pub fn mintlayer_get_public_key( - &mut self, - path: Vec, - ) -> Result> { + pub fn mintlayer_get_public_key(&mut self, path: Vec) -> Result { let mut req = protos::MintlayerGetPublicKey::new(); req.address_n = path; - self.call( + self.call::<_, _, protos::MintlayerPublicKey>( req, Box::new(|_, m| { Ok(XPub { @@ -46,7 +51,25 @@ impl Trezor { ), }) }), - ) + )? + .ok() + } + + pub fn mintlayer_sign_message( + &mut self, + path: Vec, + address: String, + message: Vec, + ) -> Result> { + let mut req = protos::MintlayerSignMessage::new(); + req.address_n = path; + req.set_message(message); + req.set_address(address); + let msg = self.call::<_, _, protos::MessageSignature>( + req, + Box::new(|_, m| Ok(m.signature().to_vec())), + )?; + msg.button_request()?.ack()?.button_request()?.ack()?.ok() } pub fn mintlayer_sign_tx( @@ -54,24 +77,21 @@ impl Trezor { inputs: Vec, outputs: Vec, utxos: BTreeMap<[u8; 32], BTreeMap>, - ) -> Result>>> { + ) -> Result>> { let mut req = protos::MintlayerSignTx::new(); req.set_version(1); req.set_inputs_count(inputs.len() as u32); req.set_outputs_count(outputs.len() as u32); - eprintln!("sending tx request"); let mut msg = self.call::<_, _, protos::MintlayerTxRequest>(req, Box::new(|_, m| Ok(m)))?; let mut should_ack_button = 0; loop { if should_ack_button > 0 { - eprintln!("waiting for button to sending button ack"); msg = msg.button_request()?.ack()?; should_ack_button -= 1; continue; } - eprintln!("waiting for ok msg"); let response = msg.ok()?; match response.request_type() { MintlayerRequestType::TXINPUT => { @@ -81,7 +101,6 @@ impl Trezor { ); let mut req2 = MintlayerTxAckUtxoInput::new(); req2.tx = MessageField::some(req); - eprintln!("sending tx input ack {req2:?}"); msg = self .call::<_, _, protos::MintlayerTxRequest>(req2, Box::new(|_, m| Ok(m)))?; } @@ -97,15 +116,12 @@ impl Trezor { .get(&tx_id) .and_then(|tx| tx.get(&response.details.request_index())); req.output = MessageField::from_option(out.cloned()); - eprintln!("sending tx input output utxo"); } else { req.output = MessageField::from_option( outputs.get(response.details.request_index() as usize).cloned(), ); - eprintln!("sending tx output {req:?}"); should_ack_button += 2; if response.details.request_index() as usize == outputs.len() - 1 { - eprintln!("last output will wait for one more ack"); should_ack_button += 1; } } @@ -121,7 +137,14 @@ impl Trezor { return Ok(response .serialized .iter() - .map(|s| Some(s.signature().to_vec())) + .map(|s| { + s.signatures + .iter() + .map(|s| { + MintlayerSignature::new(s.signature().to_vec(), s.multisig_idx) + }) + .collect() + }) .collect()) } } diff --git a/wallet/trezor-client/src/client/mod.rs b/wallet/trezor-client/src/client/mod.rs index 35aa784407..4ef5e135e1 100644 --- a/wallet/trezor-client/src/client/mod.rs +++ b/wallet/trezor-client/src/client/mod.rs @@ -10,8 +10,8 @@ pub use ethereum::*; #[cfg(feature = "solana")] mod solana; -#[cfg(feature = "solana")] -pub use solana::*; +// #[cfg(feature = "solana")] +// pub use solana::*; pub mod common; pub use common::*; diff --git a/wallet/trezor-client/src/error.rs b/wallet/trezor-client/src/error.rs index 777e9bfc6e..eee7258784 100644 --- a/wallet/trezor-client/src/error.rs +++ b/wallet/trezor-client/src/error.rs @@ -103,3 +103,11 @@ pub enum Error { #[error("malformed MintlayerTxRequest: {0:?}")] MalformedMintlayerTxRequest(protos::MintlayerTxRequest), } + +impl PartialEq for Error { + fn eq(&self, _other: &Self) -> bool { + false + } +} + +impl Eq for Error {} diff --git a/wallet/trezor-client/src/flows/sign_tx.rs b/wallet/trezor-client/src/flows/sign_tx.rs index 3faaeaaa29..40c72bdc73 100644 --- a/wallet/trezor-client/src/flows/sign_tx.rs +++ b/wallet/trezor-client/src/flows/sign_tx.rs @@ -22,7 +22,7 @@ use tracing::trace; /// Fulfill a TxRequest for TXINPUT. fn ack_input_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { if req.details.is_none() || !req.details.has_request_index() { - return Err(Error::MalformedTxRequest(req.clone())) + return Err(Error::MalformedTxRequest(req.clone())); } // Choose either the tx we are signing or a dependent tx. @@ -63,7 +63,7 @@ fn ack_input_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result Result { if req.details.is_none() || !req.details.has_request_index() { - return Err(Error::MalformedTxRequest(req.clone())) + return Err(Error::MalformedTxRequest(req.clone())); } // For outputs, the Trezor only needs bin_outputs to be set for dependent txs and full outputs @@ -127,7 +127,7 @@ fn ack_output_request( } else if let Some(ref utxo) = inp.witness_utxo { utxo } else { - return Err(Error::InvalidPsbt("not all inputs have utxo data".to_owned())) + return Err(Error::InvalidPsbt("not all inputs have utxo data".to_owned())); }; let mut bin_output = TxOutputBinType::new(); @@ -187,7 +187,7 @@ fn ack_output_request( /// Fulfill a TxRequest for TXMETA. fn ack_meta_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { if req.details.is_none() { - return Err(Error::MalformedTxRequest(req.clone())) + return Err(Error::MalformedTxRequest(req.clone())); } // Choose either the tx we are signing or a dependent tx. @@ -312,9 +312,9 @@ impl<'a> SignTxProgress<'a> { TxRequestType::TXOUTPUT => ack_output_request(&self.req, psbt, network), TxRequestType::TXMETA => ack_meta_request(&self.req, psbt), TxRequestType::TXEXTRADATA => unimplemented!(), //TODO(stevenroose) implement - TxRequestType::TXORIGINPUT | - TxRequestType::TXORIGOUTPUT | - TxRequestType::TXPAYMENTREQ => unimplemented!(), + TxRequestType::TXORIGINPUT + | TxRequestType::TXORIGOUTPUT + | TxRequestType::TXPAYMENTREQ => unimplemented!(), TxRequestType::TXFINISHED => unreachable!(), }?; self.ack_msg(ack) diff --git a/wallet/trezor-client/src/lib.rs b/wallet/trezor-client/src/lib.rs index 7d0ccfdcc8..72cdda2942 100644 --- a/wallet/trezor-client/src/lib.rs +++ b/wallet/trezor-client/src/lib.rs @@ -159,7 +159,7 @@ mod tests { #[serial] fn test_emulator_find() { let trezors = find_devices(false); - assert!(trezors.len() > 0); + assert!(!trezors.is_empty()); assert!(trezors.iter().any(|t| t.model == Model::TrezorEmulator)); } @@ -169,11 +169,11 @@ mod tests { let emulator = init_emulator(); let features = emulator.features().expect("Failed to get features"); assert_eq!(features.vendor(), "trezor.io"); - assert_eq!(features.initialized(), true); - assert_eq!(features.firmware_present(), false); - assert_eq!(features.initialized(), true); - assert_eq!(features.pin_protection(), false); - assert_eq!(features.passphrase_protection(), false); + assert!(features.initialized()); + assert!(!features.firmware_present()); + assert!(features.initialized()); + assert!(!features.pin_protection()); + assert!(!features.passphrase_protection()); assert!(["T", "Safe 3"].contains(&features.model())); } diff --git a/wallet/trezor-client/src/messages/generated.rs b/wallet/trezor-client/src/messages/generated.rs index 83b12bf65f..6bc61176fa 100644 --- a/wallet/trezor-client/src/messages/generated.rs +++ b/wallet/trezor-client/src/messages/generated.rs @@ -189,7 +189,7 @@ trezor_message_impl! { MintlayerAddress => MessageType_MintlayerAddress, MintlayerGetPublicKey => MessageType_MintlayerGetPublicKey, MintlayerPublicKey => MessageType_MintlayerPublicKey, - MintlayerVerifySig => MessageType_MintlayerVerifySig, + MintlayerSignMessage => MessageType_MintlayerSignMessage, MintlayerSignTx => MessageType_MintlayerSignTx, MintlayerTxRequest => MessageType_MintlayerTxRequest, MintlayerTxAckUtxoInput => MessageType_MintlayerTxAckUtxoInput, diff --git a/wallet/trezor-client/src/protos/generated/messages.rs b/wallet/trezor-client/src/protos/generated/messages.rs index 4ce75c2df3..f28b357c0a 100644 --- a/wallet/trezor-client/src/protos/generated/messages.rs +++ b/wallet/trezor-client/src/protos/generated/messages.rs @@ -522,8 +522,8 @@ pub enum MessageType { MessageType_MintlayerGetPublicKey = 1002, // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerPublicKey) MessageType_MintlayerPublicKey = 1003, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerVerifySig) - MessageType_MintlayerVerifySig = 1004, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerSignMessage) + MessageType_MintlayerSignMessage = 1004, // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerSignTx) MessageType_MintlayerSignTx = 1005, // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerTxRequest) @@ -790,7 +790,7 @@ impl ::protobuf::Enum for MessageType { 1001 => ::std::option::Option::Some(MessageType::MessageType_MintlayerAddress), 1002 => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetPublicKey), 1003 => ::std::option::Option::Some(MessageType::MessageType_MintlayerPublicKey), - 1004 => ::std::option::Option::Some(MessageType::MessageType_MintlayerVerifySig), + 1004 => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignMessage), 1005 => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignTx), 1006 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxRequest), 1007 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckUtxoInput), @@ -1048,7 +1048,7 @@ impl ::protobuf::Enum for MessageType { "MessageType_MintlayerAddress" => ::std::option::Option::Some(MessageType::MessageType_MintlayerAddress), "MessageType_MintlayerGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetPublicKey), "MessageType_MintlayerPublicKey" => ::std::option::Option::Some(MessageType::MessageType_MintlayerPublicKey), - "MessageType_MintlayerVerifySig" => ::std::option::Option::Some(MessageType::MessageType_MintlayerVerifySig), + "MessageType_MintlayerSignMessage" => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignMessage), "MessageType_MintlayerSignTx" => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignTx), "MessageType_MintlayerTxRequest" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxRequest), "MessageType_MintlayerTxAckUtxoInput" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckUtxoInput), @@ -1305,7 +1305,7 @@ impl ::protobuf::Enum for MessageType { MessageType::MessageType_MintlayerAddress, MessageType::MessageType_MintlayerGetPublicKey, MessageType::MessageType_MintlayerPublicKey, - MessageType::MessageType_MintlayerVerifySig, + MessageType::MessageType_MintlayerSignMessage, MessageType::MessageType_MintlayerSignTx, MessageType::MessageType_MintlayerTxRequest, MessageType::MessageType_MintlayerTxAckUtxoInput, @@ -1568,7 +1568,7 @@ impl ::protobuf::EnumFull for MessageType { MessageType::MessageType_MintlayerAddress => 244, MessageType::MessageType_MintlayerGetPublicKey => 245, MessageType::MessageType_MintlayerPublicKey => 246, - MessageType::MessageType_MintlayerVerifySig => 247, + MessageType::MessageType_MintlayerSignMessage => 247, MessageType::MessageType_MintlayerSignTx => 248, MessageType::MessageType_MintlayerTxRequest => 249, MessageType::MessageType_MintlayerTxAckUtxoInput => 250, @@ -1622,7 +1622,7 @@ pub mod exts { static file_descriptor_proto_data: &'static [u8] = b"\ \n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\x20google/protobuf/de\ - scriptor.proto*\xa3W\n\x0bMessageType\x12(\n\x16MessageType_Initialize\ + scriptor.proto*\xa5W\n\x0bMessageType\x12(\n\x16MessageType_Initialize\ \x10\0\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12\x1e\n\ \x10MessageType_Ping\x10\x01\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\ %\n\x13MessageType_Success\x10\x02\x1a\x0c\x80\xa6\x1d\x01\xa8\xb5\x18\ @@ -1901,11 +1901,11 @@ static file_descriptor_proto_data: &'static [u8] = b"\ ss\x10\xe8\x07\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_MintlayerAd\ dress\x10\xe9\x07\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_MintlayerGe\ tPublicKey\x10\xea\x07\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_Min\ - tlayerPublicKey\x10\xeb\x07\x1a\x04\x98\xb5\x18\x01\x12)\n\x1eMessageTyp\ - e_MintlayerVerifySig\x10\xec\x07\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMessa\ - geType_MintlayerSignTx\x10\xed\x07\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMes\ - sageType_MintlayerTxRequest\x10\xee\x07\x1a\x04\x98\xb5\x18\x01\x12.\n#M\ - essageType_MintlayerTxAckUtxoInput\x10\xef\x07\x1a\x04\x90\xb5\x18\x01\ + tlayerPublicKey\x10\xeb\x07\x1a\x04\x98\xb5\x18\x01\x12+\n\x20MessageTyp\ + e_MintlayerSignMessage\x10\xec\x07\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMes\ + sageType_MintlayerSignTx\x10\xed\x07\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eM\ + essageType_MintlayerTxRequest\x10\xee\x07\x1a\x04\x98\xb5\x18\x01\x12.\n\ + #MessageType_MintlayerTxAckUtxoInput\x10\xef\x07\x1a\x04\x90\xb5\x18\x01\ \x12+\n\x20MessageType_MintlayerTxAckOutput\x10\xf0\x07\x1a\x04\x90\xb5\ \x18\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\\\"\x04\x08r\x10z\"\x06\ \x08\xdb\x01\x10\xdb\x01\"\x06\x08\xe0\x01\x10\xe0\x01\"\x06\x08\xac\x02\ diff --git a/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs b/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs index 59422c58bb..5d99647cc1 100644 --- a/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs +++ b/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs @@ -13289,8 +13289,6 @@ pub enum AmountUnit { MICROBITCOIN = 2, // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.SATOSHI) SATOSHI = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.ML) - ML = 4, } impl ::protobuf::Enum for AmountUnit { @@ -13306,7 +13304,6 @@ impl ::protobuf::Enum for AmountUnit { 1 => ::std::option::Option::Some(AmountUnit::MILLIBITCOIN), 2 => ::std::option::Option::Some(AmountUnit::MICROBITCOIN), 3 => ::std::option::Option::Some(AmountUnit::SATOSHI), - 4 => ::std::option::Option::Some(AmountUnit::ML), _ => ::std::option::Option::None } } @@ -13317,7 +13314,6 @@ impl ::protobuf::Enum for AmountUnit { "MILLIBITCOIN" => ::std::option::Option::Some(AmountUnit::MILLIBITCOIN), "MICROBITCOIN" => ::std::option::Option::Some(AmountUnit::MICROBITCOIN), "SATOSHI" => ::std::option::Option::Some(AmountUnit::SATOSHI), - "ML" => ::std::option::Option::Some(AmountUnit::ML), _ => ::std::option::Option::None } } @@ -13327,7 +13323,6 @@ impl ::protobuf::Enum for AmountUnit { AmountUnit::MILLIBITCOIN, AmountUnit::MICROBITCOIN, AmountUnit::SATOSHI, - AmountUnit::ML, ]; } @@ -13595,10 +13590,10 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x01\x12\x11\n\rPAYTOMULTISIG\x10\x02\x12\x11\n\rPAYTOOPRETURN\x10\x03\ \x12\x10\n\x0cPAYTOWITNESS\x10\x04\x12\x14\n\x10PAYTOP2SHWITNESS\x10\x05\ \x12\x10\n\x0cPAYTOTAPROOT\x10\x06*.\n\x16DecredStakingSpendType\x12\t\n\ - \x05SSGen\x10\0\x12\t\n\x05SSRTX\x10\x01*R\n\nAmountUnit\x12\x0b\n\x07BI\ + \x05SSGen\x10\0\x12\t\n\x05SSRTX\x10\x01*J\n\nAmountUnit\x12\x0b\n\x07BI\ TCOIN\x10\0\x12\x10\n\x0cMILLIBITCOIN\x10\x01\x12\x10\n\x0cMICROBITCOIN\ - \x10\x02\x12\x0b\n\x07SATOSHI\x10\x03\x12\x06\n\x02ML\x10\x04B?\n#com.sa\ - toshilabs.trezor.lib.protobufB\x14TrezorMessageBitcoin\x80\xa6\x1d\x01\ + \x10\x02\x12\x0b\n\x07SATOSHI\x10\x03B?\n#com.satoshilabs.trezor.lib.pro\ + tobufB\x14TrezorMessageBitcoin\x80\xa6\x1d\x01\ "; /// `FileDescriptorProto` object which was a source for this generated file diff --git a/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs b/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs index 956afae943..a69dd08fdb 100644 --- a/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs +++ b/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs @@ -765,66 +765,66 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerPublicKey { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerVerifySig) +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerSignMessage) #[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerVerifySig { +pub struct MintlayerSignMessage { // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerVerifySig.address_n) + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignMessage.address_n) pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerVerifySig.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerVerifySig.message) + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignMessage.address) + pub address: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignMessage.message) pub message: ::std::option::Option<::std::vec::Vec>, // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerVerifySig.special_fields) + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerSignMessage.special_fields) pub special_fields: ::protobuf::SpecialFields, } -impl<'a> ::std::default::Default for &'a MintlayerVerifySig { - fn default() -> &'a MintlayerVerifySig { - ::default_instance() +impl<'a> ::std::default::Default for &'a MintlayerSignMessage { + fn default() -> &'a MintlayerSignMessage { + ::default_instance() } } -impl MintlayerVerifySig { - pub fn new() -> MintlayerVerifySig { +impl MintlayerSignMessage { + pub fn new() -> MintlayerSignMessage { ::std::default::Default::default() } - // required bytes signature = 2; + // required string address = 2; - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { + pub fn address(&self) -> &str { + match self.address.as_ref() { Some(v) => v, - None => &[], + None => "", } } - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; + pub fn clear_address(&mut self) { + self.address = ::std::option::Option::None; } - pub fn has_signature(&self) -> bool { - self.signature.is_some() + pub fn has_address(&self) -> bool { + self.address.is_some() } // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address = ::std::option::Option::Some(::std::string::String::new()); } - self.signature.as_mut().unwrap() + self.address.as_mut().unwrap() } // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) } // required bytes message = 3; @@ -868,32 +868,32 @@ impl MintlayerVerifySig { let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "address_n", - |m: &MintlayerVerifySig| { &m.address_n }, - |m: &mut MintlayerVerifySig| { &mut m.address_n }, + |m: &MintlayerSignMessage| { &m.address_n }, + |m: &mut MintlayerSignMessage| { &mut m.address_n }, )); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &MintlayerVerifySig| { &m.signature }, - |m: &mut MintlayerVerifySig| { &mut m.signature }, + "address", + |m: &MintlayerSignMessage| { &m.address }, + |m: &mut MintlayerSignMessage| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "message", - |m: &MintlayerVerifySig| { &m.message }, - |m: &mut MintlayerVerifySig| { &mut m.message }, + |m: &MintlayerSignMessage| { &m.message }, + |m: &mut MintlayerSignMessage| { &mut m.message }, )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerVerifySig", + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerSignMessage", fields, oneofs, ) } } -impl ::protobuf::Message for MintlayerVerifySig { - const NAME: &'static str = "MintlayerVerifySig"; +impl ::protobuf::Message for MintlayerSignMessage { + const NAME: &'static str = "MintlayerSignMessage"; fn is_initialized(&self) -> bool { - if self.signature.is_none() { + if self.address.is_none() { return false; } if self.message.is_none() { @@ -912,7 +912,7 @@ impl ::protobuf::Message for MintlayerVerifySig { self.address_n.push(is.read_uint32()?); }, 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); + self.address = ::std::option::Option::Some(is.read_string()?); }, 26 => { self.message = ::std::option::Option::Some(is.read_bytes()?); @@ -932,8 +932,8 @@ impl ::protobuf::Message for MintlayerVerifySig { for value in &self.address_n { my_size += ::protobuf::rt::uint32_size(1, *value); }; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); + if let Some(v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); } if let Some(v) = self.message.as_ref() { my_size += ::protobuf::rt::bytes_size(3, &v); @@ -947,8 +947,8 @@ impl ::protobuf::Message for MintlayerVerifySig { for v in &self.address_n { os.write_uint32(1, *v)?; }; - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; + if let Some(v) = self.address.as_ref() { + os.write_string(2, v)?; } if let Some(v) = self.message.as_ref() { os.write_bytes(3, v)?; @@ -965,21 +965,21 @@ impl ::protobuf::Message for MintlayerVerifySig { &mut self.special_fields } - fn new() -> MintlayerVerifySig { - MintlayerVerifySig::new() + fn new() -> MintlayerSignMessage { + MintlayerSignMessage::new() } fn clear(&mut self) { self.address_n.clear(); - self.signature = ::std::option::Option::None; + self.address = ::std::option::Option::None; self.message = ::std::option::Option::None; self.special_fields.clear(); } - fn default_instance() -> &'static MintlayerVerifySig { - static instance: MintlayerVerifySig = MintlayerVerifySig { + fn default_instance() -> &'static MintlayerSignMessage { + static instance: MintlayerSignMessage = MintlayerSignMessage { address_n: ::std::vec::Vec::new(), - signature: ::std::option::Option::None, + address: ::std::option::Option::None, message: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; @@ -987,20 +987,20 @@ impl ::protobuf::Message for MintlayerVerifySig { } } -impl ::protobuf::MessageFull for MintlayerVerifySig { +impl ::protobuf::MessageFull for MintlayerSignMessage { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerVerifySig").unwrap()).clone() + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerSignMessage").unwrap()).clone() } } -impl ::std::fmt::Display for MintlayerVerifySig { +impl ::std::fmt::Display for MintlayerSignMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } -impl ::protobuf::reflect::ProtobufValue for MintlayerVerifySig { +impl ::protobuf::reflect::ProtobufValue for MintlayerSignMessage { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } @@ -1377,6 +1377,16 @@ impl ::protobuf::Message for MintlayerTxRequest { const NAME: &'static str = "MintlayerTxRequest"; fn is_initialized(&self) -> bool { + for v in &self.details { + if !v.is_initialized() { + return false; + } + }; + for v in &self.serialized { + if !v.is_initialized() { + return false; + } + }; true } @@ -1678,52 +1688,31 @@ pub mod mintlayer_tx_request { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } - // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType) + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature) #[derive(PartialEq,Clone,Default,Debug)] - pub struct MintlayerTxRequestSerializedType { + pub struct MintlayerSignature { // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signature_index) - pub signature_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signature) + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature.signature) pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.serialized_tx) - pub serialized_tx: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature.multisig_idx) + pub multisig_idx: ::std::option::Option, // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.special_fields) + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature.special_fields) pub special_fields: ::protobuf::SpecialFields, } - impl<'a> ::std::default::Default for &'a MintlayerTxRequestSerializedType { - fn default() -> &'a MintlayerTxRequestSerializedType { - ::default_instance() + impl<'a> ::std::default::Default for &'a MintlayerSignature { + fn default() -> &'a MintlayerSignature { + ::default_instance() } } - impl MintlayerTxRequestSerializedType { - pub fn new() -> MintlayerTxRequestSerializedType { + impl MintlayerSignature { + pub fn new() -> MintlayerSignature { ::std::default::Default::default() } - // optional uint32 signature_index = 1; - - pub fn signature_index(&self) -> u32 { - self.signature_index.unwrap_or(0) - } - - pub fn clear_signature_index(&mut self) { - self.signature_index = ::std::option::Option::None; - } - - pub fn has_signature_index(&self) -> bool { - self.signature_index.is_some() - } - - // Param is passed by value, moved - pub fn set_signature_index(&mut self, v: u32) { - self.signature_index = ::std::option::Option::Some(v); - } - - // optional bytes signature = 2; + // required bytes signature = 1; pub fn signature(&self) -> &[u8] { match self.signature.as_ref() { @@ -1759,6 +1748,189 @@ pub mod mintlayer_tx_request { self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) } + // optional uint32 multisig_idx = 2; + + pub fn multisig_idx(&self) -> u32 { + self.multisig_idx.unwrap_or(0) + } + + pub fn clear_multisig_idx(&mut self) { + self.multisig_idx = ::std::option::Option::None; + } + + pub fn has_multisig_idx(&self) -> bool { + self.multisig_idx.is_some() + } + + // Param is passed by value, moved + pub fn set_multisig_idx(&mut self, v: u32) { + self.multisig_idx = ::std::option::Option::Some(v); + } + + pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &MintlayerSignature| { &m.signature }, + |m: &mut MintlayerSignature| { &mut m.signature }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "multisig_idx", + |m: &MintlayerSignature| { &m.multisig_idx }, + |m: &mut MintlayerSignature| { &mut m.multisig_idx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxRequest.MintlayerSignature", + fields, + oneofs, + ) + } + } + + impl ::protobuf::Message for MintlayerSignature { + const NAME: &'static str = "MintlayerSignature"; + + fn is_initialized(&self) -> bool { + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + 16 => { + self.multisig_idx = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.multisig_idx { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.multisig_idx { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerSignature { + MintlayerSignature::new() + } + + fn clear(&mut self) { + self.signature = ::std::option::Option::None; + self.multisig_idx = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerSignature { + static instance: MintlayerSignature = MintlayerSignature { + signature: ::std::option::Option::None, + multisig_idx: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } + } + + impl ::protobuf::MessageFull for MintlayerSignature { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxRequest.MintlayerSignature").unwrap()).clone() + } + } + + impl ::std::fmt::Display for MintlayerSignature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } + } + + impl ::protobuf::reflect::ProtobufValue for MintlayerSignature { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; + } + + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType) + #[derive(PartialEq,Clone,Default,Debug)] + pub struct MintlayerTxRequestSerializedType { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signature_index) + pub signature_index: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signatures) + pub signatures: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.serialized_tx) + pub serialized_tx: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a MintlayerTxRequestSerializedType { + fn default() -> &'a MintlayerTxRequestSerializedType { + ::default_instance() + } + } + + impl MintlayerTxRequestSerializedType { + pub fn new() -> MintlayerTxRequestSerializedType { + ::std::default::Default::default() + } + + // optional uint32 signature_index = 1; + + pub fn signature_index(&self) -> u32 { + self.signature_index.unwrap_or(0) + } + + pub fn clear_signature_index(&mut self) { + self.signature_index = ::std::option::Option::None; + } + + pub fn has_signature_index(&self) -> bool { + self.signature_index.is_some() + } + + // Param is passed by value, moved + pub fn set_signature_index(&mut self, v: u32) { + self.signature_index = ::std::option::Option::Some(v); + } + // optional bytes serialized_tx = 3; pub fn serialized_tx(&self) -> &[u8] { @@ -1803,10 +1975,10 @@ pub mod mintlayer_tx_request { |m: &MintlayerTxRequestSerializedType| { &m.signature_index }, |m: &mut MintlayerTxRequestSerializedType| { &mut m.signature_index }, )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &MintlayerTxRequestSerializedType| { &m.signature }, - |m: &mut MintlayerTxRequestSerializedType| { &mut m.signature }, + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "signatures", + |m: &MintlayerTxRequestSerializedType| { &m.signatures }, + |m: &mut MintlayerTxRequestSerializedType| { &mut m.signatures }, )); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "serialized_tx", @@ -1825,6 +1997,11 @@ pub mod mintlayer_tx_request { const NAME: &'static str = "MintlayerTxRequestSerializedType"; fn is_initialized(&self) -> bool { + for v in &self.signatures { + if !v.is_initialized() { + return false; + } + }; true } @@ -1835,7 +2012,7 @@ pub mod mintlayer_tx_request { self.signature_index = ::std::option::Option::Some(is.read_uint32()?); }, 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); + self.signatures.push(is.read_message()?); }, 26 => { self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); @@ -1855,9 +2032,10 @@ pub mod mintlayer_tx_request { if let Some(v) = self.signature_index { my_size += ::protobuf::rt::uint32_size(1, v); } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } + for value in &self.signatures { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; + }; if let Some(v) = self.serialized_tx.as_ref() { my_size += ::protobuf::rt::bytes_size(3, &v); } @@ -1870,9 +2048,9 @@ pub mod mintlayer_tx_request { if let Some(v) = self.signature_index { os.write_uint32(1, v)?; } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } + for v in &self.signatures { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + }; if let Some(v) = self.serialized_tx.as_ref() { os.write_bytes(3, v)?; } @@ -1894,7 +2072,7 @@ pub mod mintlayer_tx_request { fn clear(&mut self) { self.signature_index = ::std::option::Option::None; - self.signature = ::std::option::Option::None; + self.signatures.clear(); self.serialized_tx = ::std::option::Option::None; self.special_fields.clear(); } @@ -1902,7 +2080,7 @@ pub mod mintlayer_tx_request { fn default_instance() -> &'static MintlayerTxRequestSerializedType { static instance: MintlayerTxRequestSerializedType = MintlayerTxRequestSerializedType { signature_index: ::std::option::Option::None, - signature: ::std::option::Option::None, + signatures: ::std::vec::Vec::new(), serialized_tx: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; @@ -2176,12 +2354,174 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerTxInput { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAddressPath) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct MintlayerAddressPath { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAddressPath.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAddressPath.multisig_idx) + pub multisig_idx: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAddressPath.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a MintlayerAddressPath { + fn default() -> &'a MintlayerAddressPath { + ::default_instance() + } +} + +impl MintlayerAddressPath { + pub fn new() -> MintlayerAddressPath { + ::std::default::Default::default() + } + + // optional uint32 multisig_idx = 2; + + pub fn multisig_idx(&self) -> u32 { + self.multisig_idx.unwrap_or(0) + } + + pub fn clear_multisig_idx(&mut self) { + self.multisig_idx = ::std::option::Option::None; + } + + pub fn has_multisig_idx(&self) -> bool { + self.multisig_idx.is_some() + } + + // Param is passed by value, moved + pub fn set_multisig_idx(&mut self, v: u32) { + self.multisig_idx = ::std::option::Option::Some(v); + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &MintlayerAddressPath| { &m.address_n }, + |m: &mut MintlayerAddressPath| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "multisig_idx", + |m: &MintlayerAddressPath| { &m.multisig_idx }, + |m: &mut MintlayerAddressPath| { &mut m.multisig_idx }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerAddressPath", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for MintlayerAddressPath { + const NAME: &'static str = "MintlayerAddressPath"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.multisig_idx = ::std::option::Option::Some(is.read_uint32()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.multisig_idx { + my_size += ::protobuf::rt::uint32_size(2, v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.multisig_idx { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> MintlayerAddressPath { + MintlayerAddressPath::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.multisig_idx = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static MintlayerAddressPath { + static instance: MintlayerAddressPath = MintlayerAddressPath { + address_n: ::std::vec::Vec::new(), + multisig_idx: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for MintlayerAddressPath { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAddressPath").unwrap()).clone() + } +} + +impl ::std::fmt::Display for MintlayerAddressPath { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MintlayerAddressPath { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput) #[derive(PartialEq,Clone,Default,Debug)] pub struct MintlayerUtxoTxInput { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.address_n) - pub address_n: ::std::vec::Vec, + pub address_n: ::std::vec::Vec, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.address) pub address: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.prev_hash) @@ -2407,6 +2747,11 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { if self.value.is_none() { return false; } + for v in &self.address_n { + if !v.is_initialized() { + return false; + } + }; for v in &self.value { if !v.is_initialized() { return false; @@ -2419,10 +2764,7 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); + self.address_n.push(is.read_message()?); }, 18 => { self.address = ::std::option::Option::Some(is.read_string()?); @@ -2455,7 +2797,8 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if let Some(v) = self.address.as_ref() { my_size += ::protobuf::rt::string_size(2, &v); @@ -2483,7 +2826,7 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.address_n { - os.write_uint32(1, *v)?; + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; if let Some(v) = self.address.as_ref() { os.write_string(2, v)?; @@ -2567,7 +2910,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerUtxoTxInput { pub struct MintlayerAccountTxInput { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.address_n) - pub address_n: ::std::vec::Vec, + pub address_n: ::std::vec::Vec, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.address) pub address: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.sequence) @@ -2761,6 +3104,11 @@ impl ::protobuf::Message for MintlayerAccountTxInput { if self.delegation_id.is_none() { return false; } + for v in &self.address_n { + if !v.is_initialized() { + return false; + } + }; for v in &self.value { if !v.is_initialized() { return false; @@ -2773,10 +3121,7 @@ impl ::protobuf::Message for MintlayerAccountTxInput { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); + self.address_n.push(is.read_message()?); }, 18 => { self.address = ::std::option::Option::Some(is.read_string()?); @@ -2806,7 +3151,8 @@ impl ::protobuf::Message for MintlayerAccountTxInput { fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if let Some(v) = self.address.as_ref() { my_size += ::protobuf::rt::string_size(2, &v); @@ -2831,7 +3177,7 @@ impl ::protobuf::Message for MintlayerAccountTxInput { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.address_n { - os.write_uint32(1, *v)?; + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; if let Some(v) = self.address.as_ref() { os.write_string(2, v)?; @@ -2910,7 +3256,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerAccountTxInput { pub struct MintlayerAccountCommandTxInput { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.address_n) - pub address_n: ::std::vec::Vec, + pub address_n: ::std::vec::Vec, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.address) pub address: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.sequence) @@ -3090,6 +3436,11 @@ impl ::protobuf::Message for MintlayerAccountCommandTxInput { if self.nonce.is_none() { return false; } + for v in &self.address_n { + if !v.is_initialized() { + return false; + } + }; for v in &self.mint { if !v.is_initialized() { return false; @@ -3127,10 +3478,7 @@ impl ::protobuf::Message for MintlayerAccountCommandTxInput { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); + self.address_n.push(is.read_message()?); }, 18 => { self.address = ::std::option::Option::Some(is.read_string()?); @@ -3172,7 +3520,8 @@ impl ::protobuf::Message for MintlayerAccountCommandTxInput { fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if let Some(v) = self.address.as_ref() { my_size += ::protobuf::rt::string_size(2, &v); @@ -3214,7 +3563,7 @@ impl ::protobuf::Message for MintlayerAccountCommandTxInput { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.address_n { - os.write_uint32(1, *v)?; + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; if let Some(v) = self.address.as_ref() { os.write_string(2, v)?; @@ -4993,8 +5342,6 @@ pub struct MintlayerTransferTxOutput { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address) pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address_n) - pub address_n: ::std::vec::Vec, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.value) pub value: ::protobuf::MessageField, // special fields @@ -5050,18 +5397,13 @@ impl MintlayerTransferTxOutput { } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); + let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "address", |m: &MintlayerTransferTxOutput| { &m.address }, |m: &mut MintlayerTransferTxOutput| { &mut m.address }, )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerTransferTxOutput| { &m.address_n }, - |m: &mut MintlayerTransferTxOutput| { &mut m.address_n }, - )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( "value", |m: &MintlayerTransferTxOutput| { &m.value }, @@ -5097,12 +5439,6 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { self.address = ::std::option::Option::Some(is.read_string()?); }, 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; }, tag => { @@ -5120,9 +5456,6 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { if let Some(v) = self.address.as_ref() { my_size += ::protobuf::rt::string_size(1, &v); } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; if let Some(v) = self.value.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; @@ -5136,11 +5469,8 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { if let Some(v) = self.address.as_ref() { os.write_string(1, v)?; } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -5160,7 +5490,6 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { fn clear(&mut self) { self.address = ::std::option::Option::None; - self.address_n.clear(); self.value.clear(); self.special_fields.clear(); } @@ -5168,7 +5497,6 @@ impl ::protobuf::Message for MintlayerTransferTxOutput { fn default_instance() -> &'static MintlayerTransferTxOutput { static instance: MintlayerTransferTxOutput = MintlayerTransferTxOutput { address: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), value: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; @@ -5451,8 +5779,6 @@ pub struct MintlayerLockThenTransferTxOutput { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.address) pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.address_n) - pub address_n: ::std::vec::Vec, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.value) pub value: ::protobuf::MessageField, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.lock) @@ -5510,18 +5836,13 @@ impl MintlayerLockThenTransferTxOutput { } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); + let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "address", |m: &MintlayerLockThenTransferTxOutput| { &m.address }, |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.address }, )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerLockThenTransferTxOutput| { &m.address_n }, - |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.address_n }, - )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( "value", |m: &MintlayerLockThenTransferTxOutput| { &m.value }, @@ -5570,15 +5891,9 @@ impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { self.address = ::std::option::Option::Some(is.read_string()?); }, 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; }, - 34 => { + 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.lock)?; }, tag => { @@ -5596,9 +5911,6 @@ impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { if let Some(v) = self.address.as_ref() { my_size += ::protobuf::rt::string_size(1, &v); } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; if let Some(v) = self.value.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; @@ -5616,14 +5928,11 @@ impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { if let Some(v) = self.address.as_ref() { os.write_string(1, v)?; } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if let Some(v) = self.lock.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -5643,7 +5952,6 @@ impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { fn clear(&mut self) { self.address = ::std::option::Option::None; - self.address_n.clear(); self.value.clear(); self.lock.clear(); self.special_fields.clear(); @@ -5652,7 +5960,6 @@ impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { fn default_instance() -> &'static MintlayerLockThenTransferTxOutput { static instance: MintlayerLockThenTransferTxOutput = MintlayerLockThenTransferTxOutput { address: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), value: ::protobuf::MessageField::none(), lock: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), @@ -9579,14 +9886,14 @@ static file_descriptor_proto_data: &'static [u8] = b"\ etPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ \x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"R\n\x12MintlayerP\ ublicKey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\x12\x1d\ - \n\nchain_code\x18\x02\x20\x02(\x0cR\tchainCode\"i\n\x12MintlayerVerifyS\ - ig\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1c\n\tsigna\ - ture\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\x18\x03\x20\ + \n\nchain_code\x18\x02\x20\x02(\x0cR\tchainCode\"g\n\x14MintlayerSignMes\ + sage\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07a\ + ddress\x18\x02\x20\x02(\tR\x07address\x12\x18\n\x07message\x18\x03\x20\ \x02(\x0cR\x07message\"\xb6\x01\n\x0fMintlayerSignTx\x12#\n\routputs_cou\ nt\x18\x01\x20\x02(\rR\x0coutputsCount\x12!\n\x0cinputs_count\x18\x02\ \x20\x02(\rR\x0binputsCount\x12\x1b\n\x07version\x18\x03\x20\x01(\r:\x01\ 1R\x07version\x12\"\n\tserialize\x18\x04\x20\x01(\x08:\x04trueR\tseriali\ - ze\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\x9a\x05\n\ + ze\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\xb8\x06\n\ \x12MintlayerTxRequest\x12h\n\x0crequest_type\x18\x01\x20\x01(\x0e2E.hw.\ trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestTypeR\x0bre\ questType\x12h\n\x07details\x18\x02\x20\x01(\x0b2N.hw.trezor.messages.mi\ @@ -9595,38 +9902,45 @@ static file_descriptor_proto_data: &'static [u8] = b"\ layerTxRequest.MintlayerTxRequestSerializedTypeR\nserialized\x1a]\n\x1dM\ intlayerTxRequestDetailsType\x12#\n\rrequest_index\x18\x01\x20\x01(\rR\ \x0crequestIndex\x12\x17\n\x07tx_hash\x18\x02\x20\x01(\x0cR\x06txHash\ - \x1a\x8e\x01\n\x20MintlayerTxRequestSerializedType\x12'\n\x0fsignature_i\ - ndex\x18\x01\x20\x01(\rR\x0esignatureIndex\x12\x1c\n\tsignature\x18\x02\ - \x20\x01(\x0cR\tsignature\x12#\n\rserialized_tx\x18\x03\x20\x01(\x0cR\ - \x0cserializedTx\"M\n\x14MintlayerRequestType\x12\x0b\n\x07TXINPUT\x10\0\ - \x12\x0c\n\x08TXOUTPUT\x10\x01\x12\n\n\x06TXMETA\x10\x02\x12\x0e\n\nTXFI\ - NISHED\x10\x03\"\x92\x02\n\x10MintlayerTxInput\x12F\n\x04utxo\x18\x01\ - \x20\x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerUtxoTxInputR\x04ut\ - xo\x12O\n\x07account\x18\x02\x20\x01(\x0b25.hw.trezor.messages.mintlayer\ - .MintlayerAccountTxInputR\x07account\x12e\n\x0faccount_command\x18\x03\ - \x20\x01(\x0b2<.hw.trezor.messages.mintlayer.MintlayerAccountCommandTxIn\ - putR\x0eaccountCommand\"\xc0\x02\n\x14MintlayerUtxoTxInput\x12\x1b\n\tad\ - dress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07address\x18\x02\x20\ - \x02(\tR\x07address\x12\x1b\n\tprev_hash\x18\x03\x20\x02(\x0cR\x08prevHa\ - sh\x12\x1d\n\nprev_index\x18\x04\x20\x02(\rR\tprevIndex\x12C\n\x04type\ - \x18\x05\x20\x02(\x0e2/.hw.trezor.messages.mintlayer.MintlayerUtxoTypeR\ - \x04type\x12&\n\x08sequence\x18\x06\x20\x01(\r:\n4294967295R\x08sequence\ - \x12H\n\x05value\x18\x07\x20\x02(\x0b22.hw.trezor.messages.mintlayer.Min\ - tlayerOutputValueR\x05value\"\xfd\x01\n\x17MintlayerAccountTxInput\x12\ - \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07address\ - \x18\x02\x20\x02(\tR\x07address\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n\ - 4294967295R\x08sequence\x12H\n\x05value\x18\x04\x20\x02(\x0b22.hw.trezor\ - .messages.mintlayer.MintlayerOutputValueR\x05value\x12\x14\n\x05nonce\ - \x18\x05\x20\x02(\x04R\x05nonce\x12#\n\rdelegation_id\x18\x06\x20\x02(\ - \x0cR\x0cdelegationId\"\xb4\x05\n\x1eMintlayerAccountCommandTxInput\x12\ - \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07address\ - \x18\x02\x20\x02(\tR\x07address\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n\ - 4294967295R\x08sequence\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonc\ - e\x12E\n\x04mint\x18\x05\x20\x01(\x0b21.hw.trezor.messages.mintlayer.Min\ - tlayerMintTokensR\x04mint\x12K\n\x06unmint\x18\x06\x20\x01(\x0b23.hw.tre\ - zor.messages.mintlayer.MintlayerUnmintTokensR\x06unmint\x12b\n\x11lock_t\ - oken_supply\x18\x07\x20\x01(\x0b26.hw.trezor.messages.mintlayer.Mintlaye\ - rLockTokenSupplyR\x0flockTokenSupply\x12U\n\x0cfreeze_token\x18\x08\x20\ + \x1aU\n\x12MintlayerSignature\x12\x1c\n\tsignature\x18\x01\x20\x02(\x0cR\ + \tsignature\x12!\n\x0cmultisig_idx\x18\x02\x20\x01(\rR\x0bmultisigIdx\ + \x1a\xd5\x01\n\x20MintlayerTxRequestSerializedType\x12'\n\x0fsignature_i\ + ndex\x18\x01\x20\x01(\rR\x0esignatureIndex\x12c\n\nsignatures\x18\x02\ + \x20\x03(\x0b2C.hw.trezor.messages.mintlayer.MintlayerTxRequest.Mintlaye\ + rSignatureR\nsignatures\x12#\n\rserialized_tx\x18\x03\x20\x01(\x0cR\x0cs\ + erializedTx\"M\n\x14MintlayerRequestType\x12\x0b\n\x07TXINPUT\x10\0\x12\ + \x0c\n\x08TXOUTPUT\x10\x01\x12\n\n\x06TXMETA\x10\x02\x12\x0e\n\nTXFINISH\ + ED\x10\x03\"\x92\x02\n\x10MintlayerTxInput\x12F\n\x04utxo\x18\x01\x20\ + \x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerUtxoTxInputR\x04utxo\ + \x12O\n\x07account\x18\x02\x20\x01(\x0b25.hw.trezor.messages.mintlayer.M\ + intlayerAccountTxInputR\x07account\x12e\n\x0faccount_command\x18\x03\x20\ + \x01(\x0b2<.hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInputR\ + \x0eaccountCommand\"V\n\x14MintlayerAddressPath\x12\x1b\n\taddress_n\x18\ + \x01\x20\x03(\rR\x08addressN\x12!\n\x0cmultisig_idx\x18\x02\x20\x01(\rR\ + \x0bmultisigIdx\"\xf4\x02\n\x14MintlayerUtxoTxInput\x12O\n\taddress_n\ + \x18\x01\x20\x03(\x0b22.hw.trezor.messages.mintlayer.MintlayerAddressPat\ + hR\x08addressN\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07address\x12\ + \x1b\n\tprev_hash\x18\x03\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_inde\ + x\x18\x04\x20\x02(\rR\tprevIndex\x12C\n\x04type\x18\x05\x20\x02(\x0e2/.h\ + w.trezor.messages.mintlayer.MintlayerUtxoTypeR\x04type\x12&\n\x08sequenc\ + e\x18\x06\x20\x01(\r:\n4294967295R\x08sequence\x12H\n\x05value\x18\x07\ + \x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05va\ + lue\"\xb1\x02\n\x17MintlayerAccountTxInput\x12O\n\taddress_n\x18\x01\x20\ + \x03(\x0b22.hw.trezor.messages.mintlayer.MintlayerAddressPathR\x08addres\ + sN\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07address\x12&\n\x08sequenc\ + e\x18\x03\x20\x01(\r:\n4294967295R\x08sequence\x12H\n\x05value\x18\x04\ + \x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05va\ + lue\x12\x14\n\x05nonce\x18\x05\x20\x02(\x04R\x05nonce\x12#\n\rdelegation\ + _id\x18\x06\x20\x02(\x0cR\x0cdelegationId\"\xe8\x05\n\x1eMintlayerAccoun\ + tCommandTxInput\x12O\n\taddress_n\x18\x01\x20\x03(\x0b22.hw.trezor.messa\ + ges.mintlayer.MintlayerAddressPathR\x08addressN\x12\x18\n\x07address\x18\ + \x02\x20\x02(\tR\x07address\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n4294\ + 967295R\x08sequence\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\ + \x12E\n\x04mint\x18\x05\x20\x01(\x0b21.hw.trezor.messages.mintlayer.Mint\ + layerMintTokensR\x04mint\x12K\n\x06unmint\x18\x06\x20\x01(\x0b23.hw.trez\ + or.messages.mintlayer.MintlayerUnmintTokensR\x06unmint\x12b\n\x11lock_to\ + ken_supply\x18\x07\x20\x01(\x0b26.hw.trezor.messages.mintlayer.Mintlayer\ + LockTokenSupplyR\x0flockTokenSupply\x12U\n\x0cfreeze_token\x18\x08\x20\ \x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerFreezeTokenR\x0bfreeze\ Token\x12[\n\x0eunfreeze_token\x18\t\x20\x01(\x0b24.hw.trezor.messages.m\ intlayer.MintlayerUnfreezeTokenR\runfreezeToken\x12q\n\x16change_token_a\ @@ -9661,73 +9975,71 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x12]\n\x0cdata_deposit\x18\n\x20\x01(\x0b2:.hw.trezor.messages.mintlaye\ r.MintlayerDataDepositTxOutputR\x0bdataDeposit\"I\n\x14MintlayerOutputVa\ lue\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\x06amount\x12\x19\n\x08tok\ - en_id\x18\x02\x20\x01(\x0cR\x07tokenId\"\x9c\x01\n\x19MintlayerTransferT\ - xOutput\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12\x1b\n\ta\ - ddress_n\x18\x02\x20\x03(\rR\x08addressN\x12H\n\x05value\x18\x03\x20\x02\ - (\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05value\"\ - \xa4\x01\n\x17MintlayerOutputTimeLock\x12!\n\x0cuntil_height\x18\x01\x20\ - \x01(\x04R\x0buntilHeight\x12\x1d\n\nuntil_time\x18\x02\x20\x01(\x04R\tu\ - ntilTime\x12&\n\x0ffor_block_count\x18\x03\x20\x01(\x04R\rforBlockCount\ - \x12\x1f\n\x0bfor_seconds\x18\x04\x20\x01(\x04R\nforSeconds\"\xef\x01\n!\ - MintlayerLockThenTransferTxOutput\x12\x18\n\x07address\x18\x01\x20\x01(\ - \tR\x07address\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12H\ - \n\x05value\x18\x03\x20\x02(\x0b22.hw.trezor.messages.mintlayer.Mintlaye\ - rOutputValueR\x05value\x12I\n\x04lock\x18\x04\x20\x02(\x0b25.hw.trezor.m\ - essages.mintlayer.MintlayerOutputTimeLockR\x04lock\"a\n\x15MintlayerBurn\ - TxOutput\x12H\n\x05value\x18\x01\x20\x02(\x0b22.hw.trezor.messages.mintl\ - ayer.MintlayerOutputValueR\x05value\"\x9d\x02\n\x20MintlayerCreateStakeP\ - oolTxOutput\x12\x17\n\x07pool_id\x18\x01\x20\x02(\x0cR\x06poolId\x12\x16\ - \n\x06pledge\x18\x02\x20\x02(\x0cR\x06pledge\x12\x16\n\x06staker\x18\x03\ - \x20\x02(\tR\x06staker\x12$\n\x0evrf_public_key\x18\x04\x20\x02(\tR\x0cv\ - rfPublicKey\x12)\n\x10decommission_key\x18\x05\x20\x02(\tR\x0fdecommissi\ - onKey\x129\n\x19margin_ratio_per_thousand\x18\x06\x20\x02(\rR\x16marginR\ - atioPerThousand\x12$\n\x0ecost_per_block\x18\x07\x20\x02(\x0cR\x0ccostPe\ - rBlock\"c\n&MintlayerProduceBlockFromStakeTxOutput\x12\x20\n\x0bdestinat\ - ion\x18\x01\x20\x02(\tR\x0bdestination\x12\x17\n\x07pool_id\x18\x02\x20\ - \x02(\x0cR\x06poolId\"`\n#MintlayerCreateDelegationIdTxOutput\x12\x20\n\ - \x0bdestination\x18\x01\x20\x02(\tR\x0bdestination\x12\x17\n\x07pool_id\ - \x18\x02\x20\x02(\x0cR\x06poolId\"_\n\x20MintlayerDelegateStakingTxOutpu\ - t\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\x06amount\x12#\n\rdelegation\ - _id\x18\x02\x20\x02(\x0cR\x0cdelegationId\"\x8f\x01\n\x19MintlayerTokenT\ - otalSupply\x12O\n\x04type\x18\x01\x20\x02(\x0e2;.hw.trezor.messages.mint\ - layer.MintlayerTokenTotalSupplyTypeR\x04type\x12!\n\x0cfixed_amount\x18\ - \x02\x20\x01(\x0cR\x0bfixedAmount\"\xb6\x02\n#MintlayerIssueFungibleToke\ - nTxOutput\x12!\n\x0ctoken_ticker\x18\x01\x20\x02(\x0cR\x0btokenTicker\ - \x12,\n\x12number_of_decimals\x18\x02\x20\x02(\rR\x10numberOfDecimals\ - \x12!\n\x0cmetadata_uri\x18\x03\x20\x02(\x0cR\x0bmetadataUri\x12Z\n\x0ct\ - otal_supply\x18\x04\x20\x02(\x0b27.hw.trezor.messages.mintlayer.Mintlaye\ - rTokenTotalSupplyR\x0btotalSupply\x12\x1c\n\tauthority\x18\x05\x20\x02(\ - \tR\tauthority\x12!\n\x0cis_freezable\x18\x06\x20\x02(\x08R\x0bisFreezab\ - le\"\xcf\x02\n\x19MintlayerIssueNftTxOutput\x12\x19\n\x08token_id\x18\ - \x01\x20\x02(\x0cR\x07tokenId\x12\x20\n\x0bdestination\x18\x02\x20\x02(\ - \tR\x0bdestination\x12\x18\n\x07creator\x18\x03\x20\x01(\tR\x07creator\ - \x12\x12\n\x04name\x18\x04\x20\x02(\x0cR\x04name\x12\x20\n\x0bdescriptio\ - n\x18\x05\x20\x02(\x0cR\x0bdescription\x12\x16\n\x06ticker\x18\x06\x20\ - \x02(\x0cR\x06ticker\x12\x19\n\x08icon_uri\x18\x07\x20\x01(\x0cR\x07icon\ - Uri\x126\n\x17additional_metadata_uri\x18\x08\x20\x01(\x0cR\x15additiona\ - lMetadataUri\x12\x1b\n\tmedia_uri\x18\t\x20\x01(\x0cR\x08mediaUri\x12\ - \x1d\n\nmedia_hash\x18\n\x20\x02(\x0cR\tmediaHash\"2\n\x1cMintlayerDataD\ - epositTxOutput\x12\x12\n\x04data\x18\x01\x20\x02(\x0cR\x04data\"s\n\x0fM\ - intlayerPrevTx\x12\x18\n\x07version\x18\x01\x20\x02(\rR\x07version\x12!\ - \n\x0cinputs_count\x18\x06\x20\x02(\rR\x0binputsCount\x12#\n\routputs_co\ - unt\x18\x07\x20\x02(\rR\x0coutputsCount\"b\n\x12MintlayerPrevInput\x12\ - \x1b\n\tprev_hash\x18\x02\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_inde\ - x\x18\x03\x20\x02(\rR\tprevIndexJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\ - \x05J\x04\x08\x05\x10\x06\"g\n\x1bMintlayerPrevTransferOutput\x12H\n\x05\ - value\x18\x01\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutpu\ - tValueR\x05value\"\xdf\x01\n\x17MintlayerTxAckUtxoInput\x12`\n\x02tx\x18\ - \x01\x20\x02(\x0b2P.hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput\ - .MintlayerTxAckInputWrapperR\x02tx\x1ab\n\x1aMintlayerTxAckInputWrapper\ - \x12D\n\x05input\x18\x02\x20\x02(\x0b2..hw.trezor.messages.mintlayer.Min\ - tlayerTxInputR\x05input\"\xde\x01\n\x14MintlayerTxAckOutput\x12^\n\x02tx\ - \x18\x01\x20\x02(\x0b2N.hw.trezor.messages.mintlayer.MintlayerTxAckOutpu\ - t.MintlayerTxAckOutputWrapperR\x02tx\x1af\n\x1bMintlayerTxAckOutputWrapp\ - er\x12G\n\x06output\x18\x05\x20\x02(\x0b2/.hw.trezor.messages.mintlayer.\ - MintlayerTxOutputR\x06output*/\n\x11MintlayerUtxoType\x12\x0f\n\x0bTRANS\ - ACTION\x10\0\x12\t\n\x05BLOCK\x10\x01*G\n\x1dMintlayerTokenTotalSupplyTy\ - pe\x12\t\n\x05FIXED\x10\0\x12\x0c\n\x08LOCKABLE\x10\x01\x12\r\n\tUNLIMIT\ - ED\x10\x02B=\n#com.satoshilabs.trezor.lib.protobufB\x16TrezorMessageMint\ - layer\ + en_id\x18\x02\x20\x01(\x0cR\x07tokenId\"\x7f\n\x19MintlayerTransferTxOut\ + put\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12H\n\x05value\ + \x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValu\ + eR\x05value\"\xa4\x01\n\x17MintlayerOutputTimeLock\x12!\n\x0cuntil_heigh\ + t\x18\x01\x20\x01(\x04R\x0buntilHeight\x12\x1d\n\nuntil_time\x18\x02\x20\ + \x01(\x04R\tuntilTime\x12&\n\x0ffor_block_count\x18\x03\x20\x01(\x04R\rf\ + orBlockCount\x12\x1f\n\x0bfor_seconds\x18\x04\x20\x01(\x04R\nforSeconds\ + \"\xd2\x01\n!MintlayerLockThenTransferTxOutput\x12\x18\n\x07address\x18\ + \x01\x20\x01(\tR\x07address\x12H\n\x05value\x18\x02\x20\x02(\x0b22.hw.tr\ + ezor.messages.mintlayer.MintlayerOutputValueR\x05value\x12I\n\x04lock\ + \x18\x03\x20\x02(\x0b25.hw.trezor.messages.mintlayer.MintlayerOutputTime\ + LockR\x04lock\"a\n\x15MintlayerBurnTxOutput\x12H\n\x05value\x18\x01\x20\ + \x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05value\ + \"\x9d\x02\n\x20MintlayerCreateStakePoolTxOutput\x12\x17\n\x07pool_id\ + \x18\x01\x20\x02(\x0cR\x06poolId\x12\x16\n\x06pledge\x18\x02\x20\x02(\ + \x0cR\x06pledge\x12\x16\n\x06staker\x18\x03\x20\x02(\tR\x06staker\x12$\n\ + \x0evrf_public_key\x18\x04\x20\x02(\tR\x0cvrfPublicKey\x12)\n\x10decommi\ + ssion_key\x18\x05\x20\x02(\tR\x0fdecommissionKey\x129\n\x19margin_ratio_\ + per_thousand\x18\x06\x20\x02(\rR\x16marginRatioPerThousand\x12$\n\x0ecos\ + t_per_block\x18\x07\x20\x02(\x0cR\x0ccostPerBlock\"c\n&MintlayerProduceB\ + lockFromStakeTxOutput\x12\x20\n\x0bdestination\x18\x01\x20\x02(\tR\x0bde\ + stination\x12\x17\n\x07pool_id\x18\x02\x20\x02(\x0cR\x06poolId\"`\n#Mint\ + layerCreateDelegationIdTxOutput\x12\x20\n\x0bdestination\x18\x01\x20\x02\ + (\tR\x0bdestination\x12\x17\n\x07pool_id\x18\x02\x20\x02(\x0cR\x06poolId\ + \"_\n\x20MintlayerDelegateStakingTxOutput\x12\x16\n\x06amount\x18\x01\ + \x20\x02(\x0cR\x06amount\x12#\n\rdelegation_id\x18\x02\x20\x02(\x0cR\x0c\ + delegationId\"\x8f\x01\n\x19MintlayerTokenTotalSupply\x12O\n\x04type\x18\ + \x01\x20\x02(\x0e2;.hw.trezor.messages.mintlayer.MintlayerTokenTotalSupp\ + lyTypeR\x04type\x12!\n\x0cfixed_amount\x18\x02\x20\x01(\x0cR\x0bfixedAmo\ + unt\"\xb6\x02\n#MintlayerIssueFungibleTokenTxOutput\x12!\n\x0ctoken_tick\ + er\x18\x01\x20\x02(\x0cR\x0btokenTicker\x12,\n\x12number_of_decimals\x18\ + \x02\x20\x02(\rR\x10numberOfDecimals\x12!\n\x0cmetadata_uri\x18\x03\x20\ + \x02(\x0cR\x0bmetadataUri\x12Z\n\x0ctotal_supply\x18\x04\x20\x02(\x0b27.\ + hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyR\x0btotalSupply\ + \x12\x1c\n\tauthority\x18\x05\x20\x02(\tR\tauthority\x12!\n\x0cis_freeza\ + ble\x18\x06\x20\x02(\x08R\x0bisFreezable\"\xcf\x02\n\x19MintlayerIssueNf\ + tTxOutput\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x20\ + \n\x0bdestination\x18\x02\x20\x02(\tR\x0bdestination\x12\x18\n\x07creato\ + r\x18\x03\x20\x01(\tR\x07creator\x12\x12\n\x04name\x18\x04\x20\x02(\x0cR\ + \x04name\x12\x20\n\x0bdescription\x18\x05\x20\x02(\x0cR\x0bdescription\ + \x12\x16\n\x06ticker\x18\x06\x20\x02(\x0cR\x06ticker\x12\x19\n\x08icon_u\ + ri\x18\x07\x20\x01(\x0cR\x07iconUri\x126\n\x17additional_metadata_uri\ + \x18\x08\x20\x01(\x0cR\x15additionalMetadataUri\x12\x1b\n\tmedia_uri\x18\ + \t\x20\x01(\x0cR\x08mediaUri\x12\x1d\n\nmedia_hash\x18\n\x20\x02(\x0cR\t\ + mediaHash\"2\n\x1cMintlayerDataDepositTxOutput\x12\x12\n\x04data\x18\x01\ + \x20\x02(\x0cR\x04data\"s\n\x0fMintlayerPrevTx\x12\x18\n\x07version\x18\ + \x01\x20\x02(\rR\x07version\x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\ + \x0binputsCount\x12#\n\routputs_count\x18\x07\x20\x02(\rR\x0coutputsCoun\ + t\"b\n\x12MintlayerPrevInput\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\x0cR\ + \x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndexJ\x04\ + \x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06\"g\n\x1bMintl\ + ayerPrevTransferOutput\x12H\n\x05value\x18\x01\x20\x02(\x0b22.hw.trezor.\ + messages.mintlayer.MintlayerOutputValueR\x05value\"\xdf\x01\n\x17Mintlay\ + erTxAckUtxoInput\x12`\n\x02tx\x18\x01\x20\x02(\x0b2P.hw.trezor.messages.\ + mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapperR\x02tx\x1ab\ + \n\x1aMintlayerTxAckInputWrapper\x12D\n\x05input\x18\x02\x20\x02(\x0b2..\ + hw.trezor.messages.mintlayer.MintlayerTxInputR\x05input\"\xde\x01\n\x14M\ + intlayerTxAckOutput\x12^\n\x02tx\x18\x01\x20\x02(\x0b2N.hw.trezor.messag\ + es.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapperR\x02tx\x1a\ + f\n\x1bMintlayerTxAckOutputWrapper\x12G\n\x06output\x18\x05\x20\x02(\x0b\ + 2/.hw.trezor.messages.mintlayer.MintlayerTxOutputR\x06output*/\n\x11Mint\ + layerUtxoType\x12\x0f\n\x0bTRANSACTION\x10\0\x12\t\n\x05BLOCK\x10\x01*G\ + \n\x1dMintlayerTokenTotalSupplyType\x12\t\n\x05FIXED\x10\0\x12\x0c\n\x08\ + LOCKABLE\x10\x01\x12\r\n\tUNLIMITED\x10\x02B=\n#com.satoshilabs.trezor.l\ + ib.protobufB\x16TrezorMessageMintlayer\ "; /// `FileDescriptorProto` object which was a source for this generated file @@ -9745,15 +10057,16 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(40); + let mut messages = ::std::vec::Vec::with_capacity(42); messages.push(MintlayerGetAddress::generated_message_descriptor_data()); messages.push(MintlayerAddress::generated_message_descriptor_data()); messages.push(MintlayerGetPublicKey::generated_message_descriptor_data()); messages.push(MintlayerPublicKey::generated_message_descriptor_data()); - messages.push(MintlayerVerifySig::generated_message_descriptor_data()); + messages.push(MintlayerSignMessage::generated_message_descriptor_data()); messages.push(MintlayerSignTx::generated_message_descriptor_data()); messages.push(MintlayerTxRequest::generated_message_descriptor_data()); messages.push(MintlayerTxInput::generated_message_descriptor_data()); + messages.push(MintlayerAddressPath::generated_message_descriptor_data()); messages.push(MintlayerUtxoTxInput::generated_message_descriptor_data()); messages.push(MintlayerAccountTxInput::generated_message_descriptor_data()); messages.push(MintlayerAccountCommandTxInput::generated_message_descriptor_data()); @@ -9783,6 +10096,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { messages.push(MintlayerTxAckUtxoInput::generated_message_descriptor_data()); messages.push(MintlayerTxAckOutput::generated_message_descriptor_data()); messages.push(mintlayer_tx_request::MintlayerTxRequestDetailsType::generated_message_descriptor_data()); + messages.push(mintlayer_tx_request::MintlayerSignature::generated_message_descriptor_data()); messages.push(mintlayer_tx_request::MintlayerTxRequestSerializedType::generated_message_descriptor_data()); messages.push(mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper::generated_message_descriptor_data()); messages.push(mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper::generated_message_descriptor_data()); diff --git a/wallet/trezor-client/src/transport/protocol.rs b/wallet/trezor-client/src/transport/protocol.rs index e058b5a9ba..ab2c6d886a 100644 --- a/wallet/trezor-client/src/transport/protocol.rs +++ b/wallet/trezor-client/src/transport/protocol.rs @@ -40,7 +40,7 @@ impl Protocol for ProtocolV2 { let resp = self.link.read_chunk()?; if resp[0] != 0x03 { println!("bad magic in v2 session_begin: {:x} instead of 0x03", resp[0]); - return Err(Error::DeviceBadMagic) + return Err(Error::DeviceBadMagic); } self.session_id = BigEndian::read_u32(&resp[1..5]); Ok(()) @@ -55,7 +55,7 @@ impl Protocol for ProtocolV2 { let resp = self.link.read_chunk()?; if resp[0] != 0x04 { println!("bad magic in v2 session_end: {:x} instead of 0x04", resp[0]); - return Err(Error::DeviceBadMagic) + return Err(Error::DeviceBadMagic); } self.session_id = 0; Ok(()) @@ -107,10 +107,10 @@ impl Protocol for ProtocolV2 { let chunk = self.link.read_chunk()?; if chunk[0] != 0x01 { println!("bad magic in v2 read: {:x} instead of 0x01", chunk[0]); - return Err(Error::DeviceBadMagic) + return Err(Error::DeviceBadMagic); } if BigEndian::read_u32(&chunk[1..5]) != self.session_id { - return Err(Error::DeviceBadSessionId) + return Err(Error::DeviceBadSessionId); } let message_type_id = BigEndian::read_u32(&chunk[5..9]); let message_type = MessageType::from_i32(message_type_id as i32) @@ -123,13 +123,13 @@ impl Protocol for ProtocolV2 { let chunk = self.link.read_chunk()?; if chunk[0] != 0x02 { println!("bad magic in v2 session_begin: {:x} instead of 0x02", chunk[0]); - return Err(Error::DeviceBadMagic) + return Err(Error::DeviceBadMagic); } if BigEndian::read_u32(&chunk[1..5]) != self.session_id { - return Err(Error::DeviceBadSessionId) + return Err(Error::DeviceBadSessionId); } if BigEndian::read_u32(&chunk[5..9]) != seq as u32 { - return Err(Error::DeviceUnexpectedSequenceNumber) + return Err(Error::DeviceUnexpectedSequenceNumber); } seq += 1; @@ -185,7 +185,7 @@ impl Protocol for ProtocolV1 { "bad magic in v1 read: {:x}{:x}{:x} instead of 0x3f2323", chunk[0], chunk[1], chunk[2] ); - return Err(Error::DeviceBadMagic) + return Err(Error::DeviceBadMagic); } let message_type_id = BigEndian::read_u16(&chunk[3..5]) as u32; let message_type = MessageType::from_i32(message_type_id as i32) @@ -197,7 +197,7 @@ impl Protocol for ProtocolV1 { let chunk = self.link.read_chunk()?; if chunk[0] != 0x3f { println!("bad magic in v1 read: {:x} instead of 0x3f", chunk[0]); - return Err(Error::DeviceBadMagic) + return Err(Error::DeviceBadMagic); } data.extend(&chunk[1..]); diff --git a/wallet/trezor-client/src/transport/udp.rs b/wallet/trezor-client/src/transport/udp.rs index 54c4ba3797..921a2c931d 100644 --- a/wallet/trezor-client/src/transport/udp.rs +++ b/wallet/trezor-client/src/transport/udp.rs @@ -48,7 +48,7 @@ impl Link for UdpLink { let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); self.socket.set_write_timeout(Some(timeout))?; if let Err(e) = self.socket.send(&chunk) { - return Err(e.into()) + return Err(e.into()); } Ok(()) } diff --git a/wallet/trezor-client/src/transport/webusb.rs b/wallet/trezor-client/src/transport/webusb.rs index 9e65af0901..635f048ecb 100644 --- a/wallet/trezor-client/src/transport/webusb.rs +++ b/wallet/trezor-client/src/transport/webusb.rs @@ -53,7 +53,7 @@ impl Link for WebUsbLink { debug_assert_eq!(CHUNK_SIZE, chunk.len()); let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); if let Err(e) = self.handle.write_interrupt(self.endpoint, &chunk, timeout) { - return Err(e.into()) + return Err(e.into()); } Ok(()) } @@ -101,7 +101,7 @@ impl WebUsbTransport { .ok_or(rusb::Error::Other)? .class_code(); if class_code != constants::LIBUSB_CLASS_VENDOR_SPEC { - continue + continue; } devices.push(AvailableDevice { @@ -137,9 +137,9 @@ impl WebUsbTransport { let dev_desc = dev.device_descriptor()?; let dev_id = (dev_desc.vendor_id(), dev_desc.product_id()); if derive_model(dev_id).as_ref() != Some(&device.model) { - return Err(Error::DeviceDisconnected) + return Err(Error::DeviceDisconnected); } - let mut handle = dev.open()?; + let handle = dev.open()?; handle.claim_interface(interface)?; Ok(Box::new(WebUsbTransport { diff --git a/wallet/trezor-client/src/utils.rs b/wallet/trezor-client/src/utils.rs index 1d4647eb60..c248599700 100644 --- a/wallet/trezor-client/src/utils.rs +++ b/wallet/trezor-client/src/utils.rs @@ -45,7 +45,7 @@ pub fn parse_recoverable_signature( sig: &[u8], ) -> Result { if sig.len() != 65 { - return Err(bitcoin::secp256k1::Error::InvalidSignature) + return Err(bitcoin::secp256k1::Error::InvalidSignature); } // Bitcoin Core sets the first byte to `27 + rec + (fCompressed ? 4 : 0)`. From 2df804e30635889dcf8f4b51104c7eff51970480 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 30 Jul 2024 09:47:37 +0200 Subject: [PATCH 11/48] Add support for trezor wallet in node gui --- node-gui/backend/src/backend_impl.rs | 90 +++++++++++--- node-gui/backend/src/lib.rs | 3 +- node-gui/backend/src/messages.rs | 4 +- node-gui/src/main.rs | 13 ++ node-gui/src/main_window/main_menu.rs | 19 +++ .../src/main_window/main_widget/tabs/mod.rs | 5 + .../main_widget/tabs/wallet/left_panel.rs | 3 +- .../main_widget/tabs/wallet/mod.rs | 2 + node-gui/src/main_window/mod.rs | 115 +++++++++++------- node-gui/src/widgets/create_hw_wallet.rs | 79 ++++++++++++ node-gui/src/widgets/mod.rs | 1 + wallet/src/signer/software_signer/mod.rs | 2 +- wallet/src/signer/trezor_signer/mod.rs | 94 ++++++++++---- wallet/src/wallet/mod.rs | 9 ++ wallet/src/wallet/tests.rs | 35 +----- wallet/trezor-client/rustfmt.toml | 11 ++ wallet/types/src/wallet_type.rs | 3 + .../src/command_handler/mod.rs | 7 ++ wallet/wallet-cli-commands/src/lib.rs | 4 + wallet/wallet-cli-lib/src/lib.rs | 2 + wallet/wallet-controller/src/lib.rs | 48 +++++--- wallet/wallet-controller/src/types/mod.rs | 1 + .../src/handles_client/mod.rs | 8 +- .../src/rpc_client/client_impl.rs | 2 + .../src/wallet_rpc_traits.rs | 1 + wallet/wallet-rpc-lib/src/lib.rs | 3 +- wallet/wallet-rpc-lib/src/rpc/interface.rs | 1 + wallet/wallet-rpc-lib/src/rpc/mod.rs | 16 ++- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 2 + wallet/wallet-rpc-lib/src/service/mod.rs | 6 +- wallet/wallet-rpc-lib/src/service/worker.rs | 3 + 31 files changed, 449 insertions(+), 143 deletions(-) create mode 100644 node-gui/src/widgets/create_hw_wallet.rs create mode 100644 wallet/trezor-client/rustfmt.toml diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index 06366f8a7f..fb951dc54f 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -41,10 +41,8 @@ use wallet_controller::{ ControllerConfig, NodeInterface, UtxoState, WalletHandlesClient, }; use wallet_rpc_client::handles_client::WalletRpcHandlesClient; -use wallet_rpc_lib::{EventStream, WalletRpc, WalletService}; -use wallet_types::{ - seed_phrase::StoreSeedPhrase, wallet_type::WalletType, with_locked::WithLocked, -}; +use wallet_rpc_lib::{types::HardwareWalletType, EventStream, WalletRpc, WalletService}; +use wallet_types::{wallet_type::WalletType, with_locked::WithLocked}; use super::{ account_id::AccountId, @@ -262,7 +260,7 @@ impl Backend { async fn add_create_wallet( &mut self, file_path: PathBuf, - mnemonic: wallet_controller::mnemonic::Mnemonic, + wallet_args: WalletTypeArgs, wallet_type: WalletType, import: ImportOrCreate, ) -> Result { @@ -284,7 +282,7 @@ impl Backend { .create_wallet( handles_client, file_path.clone(), - &mnemonic, + wallet_args, import, wallet_events, ) @@ -303,7 +301,35 @@ impl Backend { let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); let (wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self - .create_wallet(client, file_path.clone(), &mnemonic, import, wallet_events) + .create_wallet( + client, + file_path.clone(), + wallet_args, + import, + wallet_events, + ) + .await?; + + let wallet_data = WalletData { + controller: GuiHotColdController::Cold(wallet_rpc, command_handler), + accounts: accounts_data, + best_block, + updated: false, + }; + + (wallet_data, accounts_info, best_block) + } + (WalletType::Trezor, _) => { + let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); + + let (wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self + .create_wallet( + client, + file_path.clone(), + wallet_args, + import, + wallet_events, + ) .await?; let wallet_data = WalletData { @@ -340,7 +366,7 @@ impl Backend { &mut self, handles_client: N, file_path: PathBuf, - mnemonic: &wallet::wallet::Mnemonic, + wallet_args: WalletTypeArgs, import: ImportOrCreate, wallet_events: GuiWalletEvents, ) -> Result< @@ -369,14 +395,9 @@ impl Backend { let node_rpc = wallet_service.node_rpc().clone(); let chain_config = wallet_service.chain_config().clone(); let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); - let args = WalletTypeArgs::Software { - mnemonic: Some(mnemonic.to_string()), - passphrase: None, - store_seed_phrase: StoreSeedPhrase::Store, - }; wallet_rpc - .create_wallet(file_path, args, import.skip_syncing()) + .create_wallet(file_path, wallet_args, import.skip_syncing()) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; tokio::spawn(forward_events( @@ -453,7 +474,9 @@ impl Backend { best_block, accounts_info, accounts_data, - ) = self.open_wallet(handles_client, file_path.clone(), wallet_events).await?; + ) = self + .open_wallet(handles_client, file_path.clone(), wallet_events, None) + .await?; let wallet_data = WalletData { controller: GuiHotColdController::Hot(wallet_rpc, command_handler), @@ -474,7 +497,35 @@ impl Backend { best_block, accounts_info, accounts_data, - ) = self.open_wallet(client, file_path.clone(), wallet_events).await?; + ) = self.open_wallet(client, file_path.clone(), wallet_events, None).await?; + + let wallet_data = WalletData { + controller: GuiHotColdController::Cold(wallet_rpc, command_handler), + accounts: accounts_data, + best_block, + updated: false, + }; + + (wallet_data, accounts_info, best_block, encryption_state) + } + (WalletType::Trezor, _) => { + let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); + + let ( + wallet_rpc, + command_handler, + encryption_state, + best_block, + accounts_info, + accounts_data, + ) = self + .open_wallet( + client, + file_path.clone(), + wallet_events, + Some(HardwareWalletType::Trezor), + ) + .await?; let wallet_data = WalletData { controller: GuiHotColdController::Cold(wallet_rpc, command_handler), @@ -509,6 +560,7 @@ impl Backend { handles_client: N, file_path: PathBuf, wallet_events: GuiWalletEvents, + hardware_wallet: Option, ) -> Result< ( WalletRpc, @@ -537,7 +589,7 @@ impl Backend { let chain_config = wallet_service.chain_config().clone(); let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); wallet_rpc - .open_wallet(file_path, None, false) + .open_wallet(file_path, None, false, hardware_wallet) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; tokio::spawn(forward_events( @@ -966,13 +1018,13 @@ impl Backend { Self::send_event(&self.event_tx, BackendEvent::OpenWallet(open_res)); } BackendRequest::RecoverWallet { - mnemonic, + wallet_args, file_path, import, wallet_type, } => { let import_res = - self.add_create_wallet(file_path, mnemonic, wallet_type, import).await; + self.add_create_wallet(file_path, wallet_args, wallet_type, import).await; Self::send_event(&self.event_tx, BackendEvent::ImportWallet(import_res)); } BackendRequest::CloseWallet(wallet_id) => { diff --git a/node-gui/backend/src/lib.rs b/node-gui/backend/src/lib.rs index 8994369b7c..e653a453b6 100644 --- a/node-gui/backend/src/lib.rs +++ b/node-gui/backend/src/lib.rs @@ -65,6 +65,7 @@ impl ImportOrCreate { pub enum WalletMode { Cold, Hot, + Trezor, } #[derive(Debug)] @@ -182,7 +183,7 @@ pub async fn node_initialize( }); (chain_config, chain_info) } - WalletMode::Cold => { + WalletMode::Trezor | WalletMode::Cold => { let chain_config = Arc::new(match network { InitNetwork::Mainnet => common::chain::config::create_mainnet(), InitNetwork::Testnet => common::chain::config::create_testnet(), diff --git a/node-gui/backend/src/messages.rs b/node-gui/backend/src/messages.rs index de0a2a2a54..06c56e3859 100644 --- a/node-gui/backend/src/messages.rs +++ b/node-gui/backend/src/messages.rs @@ -32,7 +32,7 @@ use p2p::P2pEvent; use serialization::hex_encoded::hex_encoded_serialization; use wallet::account::transaction_list::TransactionList; use wallet_cli_commands::ConsoleCommand; -use wallet_controller::types::Balances; +use wallet_controller::types::{Balances, WalletTypeArgs}; use wallet_rpc_lib::types::PoolInfo; use wallet_types::wallet_type::WalletType; @@ -180,7 +180,7 @@ pub enum BackendRequest { // This will remove the old file if it already exists. // The frontend should check if this is what the user really wants. RecoverWallet { - mnemonic: wallet_controller::mnemonic::Mnemonic, + wallet_args: WalletTypeArgs, file_path: PathBuf, import: ImportOrCreate, wallet_type: WalletType, diff --git a/node-gui/src/main.rs b/node-gui/src/main.rs index a112506a20..1c8b400931 100644 --- a/node-gui/src/main.rs +++ b/node-gui/src/main.rs @@ -37,6 +37,8 @@ use tokio::sync::mpsc::UnboundedReceiver; const COLD_WALLET_TOOLTIP_TEXT: &str = "Start the wallet in Cold mode without connecting to the network or any nodes. The Cold mode is made to run the wallet on an air-gapped machine without internet connection for storage of keys of high-value. For example, pool decommission keys."; const HOT_WALLET_TOOLTIP_TEXT: &str = "Start the wallet in Hot mode and connect to the network."; +const TREZOR_WALLET_TOOLTIP_TEXT: &str = + "Start the wallet in Trezor mode and connect to a Trezor hardware wallet."; const MAIN_NETWORK_TOOLTIP: &str = "The 'Mainnet' is the main network that has coins with value."; const TEST_NETWORK_TOOLTIP: &str = "The 'Testnet' is the network with coins that have no value, but is used for testing various applications before deploying them on Mainnet."; @@ -348,6 +350,17 @@ impl Application for MintlayerNodeGUI { .gap(10) .style(iced::theme::Container::Box) ], + row![ + iced::widget::button(text("Trezor")).on_press(WalletMode::Trezor), + tooltip( + Text::new(iced_aw::Bootstrap::Question.to_string()) + .font(iced_aw::BOOTSTRAP_FONT), + TREZOR_WALLET_TOOLTIP_TEXT, + tooltip::Position::Bottom + ) + .gap(10) + .style(iced::theme::Container::Box) + ], ] .align_items(iced::Alignment::Center) .spacing(5); diff --git a/node-gui/src/main_window/main_menu.rs b/node-gui/src/main_window/main_menu.rs index e1810c8847..4457cd8865 100644 --- a/node-gui/src/main_window/main_menu.rs +++ b/node-gui/src/main_window/main_menu.rs @@ -157,6 +157,25 @@ fn make_menu_file<'a>(wallet_mode: WalletMode) -> Item<'a, MenuMessage, Theme, i menu_item("Exit", MenuMessage::Exit), ] } + WalletMode::Trezor => { + vec![ + menu_item( + "Create new Trezor wallet", + MenuMessage::CreateNewWallet { + wallet_type: WalletType::Trezor, + }, + ), + menu_item( + "Open Trezor wallet", + MenuMessage::OpenWallet { + wallet_type: WalletType::Trezor, + }, + ), + // TODO: enable setting when needed + // menu_item("Settings", MenuMessage::NoOp), + menu_item("Exit", MenuMessage::Exit), + ] + } }) .width(260), ); diff --git a/node-gui/src/main_window/main_widget/tabs/mod.rs b/node-gui/src/main_window/main_widget/tabs/mod.rs index a862e79622..f5c10cd8c0 100644 --- a/node-gui/src/main_window/main_widget/tabs/mod.rs +++ b/node-gui/src/main_window/main_widget/tabs/mod.rs @@ -115,6 +115,11 @@ impl TabsWidget { self.cold_wallet_tab.tab_label(), self.cold_wallet_tab.view(node_state), ), + WalletMode::Trezor => tabs.push( + TabIndex::Summary as usize, + self.cold_wallet_tab.tab_label(), + self.cold_wallet_tab.view(node_state), + ), }; // TODO: enable settings tab when needed //.push( diff --git a/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs b/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs index 5694bc9e98..85c33b098e 100644 --- a/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs +++ b/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs @@ -116,6 +116,7 @@ pub fn view_left_panel( // `next_height` is used to prevent flickering when a new block is found let show_scan_progress = match wallet_info.wallet_type { + WalletType::Trezor => false, WalletType::Cold => false, WalletType::Hot => { wallet_info.best_block.1.next_height() < node_state.chain_info.best_block_height @@ -174,7 +175,7 @@ pub fn view_left_panel( .spacing(10) .padding(10), match wallet_info.wallet_type { - WalletType::Cold => { + WalletType::Trezor | WalletType::Cold => { column![ panel_button( "Addresses", diff --git a/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs b/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs index a5d26f8053..d14ed46e59 100644 --- a/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs +++ b/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs @@ -178,6 +178,7 @@ impl WalletTab { let selected_panel = match wallet_type { WalletType::Hot => SelectedPanel::Transactions, WalletType::Cold => SelectedPanel::Addresses, + WalletType::Trezor => SelectedPanel::Addresses, }; WalletTab { @@ -482,6 +483,7 @@ impl Tab for WalletTab { let still_syncing = match wallet_info.wallet_type { WalletType::Cold => false, + WalletType::Trezor => false, WalletType::Hot => { wallet_info.best_block.1.next_height() < node_state.chain_info.best_block_height } diff --git a/node-gui/src/main_window/mod.rs b/node-gui/src/main_window/mod.rs index f929b26cdb..e3b6017e37 100644 --- a/node-gui/src/main_window/mod.rs +++ b/node-gui/src/main_window/mod.rs @@ -32,12 +32,14 @@ use node_gui_backend::{ use p2p::{net::types::services::Services, types::peer_id::PeerId, P2pEvent}; use rfd::AsyncFileDialog; use wallet_cli_commands::ConsoleCommand; -use wallet_types::wallet_type::WalletType; +use wallet_controller::types::WalletTypeArgs; +use wallet_types::{seed_phrase::StoreSeedPhrase, wallet_type::WalletType}; use crate::{ main_window::{main_menu::MenuMessage, main_widget::MainWidgetMessage}, widgets::{ confirm_broadcast::new_confirm_broadcast, + create_hw_wallet::hw_wallet_create_dialog, new_wallet_account::new_wallet_account, popup_dialog::{popup_dialog, Popup}, wallet_mnemonic::wallet_mnemonic_dialog, @@ -145,6 +147,12 @@ pub struct MainWindow { wallet_msg: Option, } +#[derive(Debug, Clone)] +pub enum WalletArgs { + Trezor, + Software { mnemonic: String }, +} + #[derive(Debug, Clone)] pub enum MainWindowMessage { MenuMessage(main_menu::MenuMessage), @@ -158,12 +166,12 @@ pub enum MainWindowMessage { OpenWalletFileCanceled, ImportWalletMnemonic { - mnemonic: String, + args: WalletArgs, import: ImportOrCreate, wallet_type: WalletType, }, ImportWalletFileSelected { - mnemonic: wallet_controller::mnemonic::Mnemonic, + wallet_args: WalletTypeArgs, file_path: PathBuf, import: ImportOrCreate, wallet_type: WalletType, @@ -643,48 +651,58 @@ impl MainWindow { } MainWindowMessage::ImportWalletMnemonic { - mnemonic, + args, import, wallet_type, } => { - let mnemonic_res = - wallet_controller::mnemonic::parse_mnemonic(self.language, &mnemonic); - match mnemonic_res { - Ok(mnemonic) => { - self.file_dialog_active = true; - Command::perform( - async move { - let file_opt = AsyncFileDialog::new().save_file().await; - if let Some(file) = file_opt { - log::info!("Save wallet file: {file:?}"); - MainWindowMessage::ImportWalletFileSelected { - mnemonic, - file_path: file.path().to_owned(), - import, - wallet_type, - } - } else { - MainWindowMessage::ImportWalletFileCanceled - } + let wallet_args = match args { + WalletArgs::Software { mnemonic } => { + let mnemonic_res = + wallet_controller::mnemonic::parse_mnemonic(self.language, &mnemonic); + match mnemonic_res { + Ok(mnemonic) => WalletTypeArgs::Software { + mnemonic: Some(mnemonic.to_string()), + passphrase: None, + store_seed_phrase: StoreSeedPhrase::Store, }, - identity, - ) - } - Err(err) => { - self.show_error(err.to_string()); - Command::none() + Err(err) => { + self.show_error(err.to_string()); + return Command::none(); + } + } } - } + WalletArgs::Trezor => WalletTypeArgs::Trezor, + }; + + self.file_dialog_active = true; + Command::perform( + async move { + let file_opt = AsyncFileDialog::new().save_file().await; + if let Some(file) = file_opt { + log::info!("Save wallet file: {file:?}"); + MainWindowMessage::ImportWalletFileSelected { + wallet_args, + file_path: file.path().to_owned(), + import, + wallet_type, + } + } else { + MainWindowMessage::ImportWalletFileCanceled + } + }, + identity, + ) } MainWindowMessage::ImportWalletFileSelected { - mnemonic, + wallet_args, file_path, import, wallet_type, } => { self.file_dialog_active = false; + backend_sender.send(BackendRequest::RecoverWallet { - mnemonic, + wallet_args, file_path, import, wallet_type, @@ -767,16 +785,27 @@ impl MainWindow { wallet_type, } => { let wallet_type = *wallet_type; - wallet_mnemonic_dialog( - Some(generated_mnemonic.clone()), - Box::new(move |mnemonic| MainWindowMessage::ImportWalletMnemonic { - mnemonic, - import: ImportOrCreate::Create, - wallet_type, - }), - Box::new(|| MainWindowMessage::CloseDialog), - ) - .into() + match wallet_type { + WalletType::Hot | WalletType::Cold => wallet_mnemonic_dialog( + Some(generated_mnemonic.clone()), + Box::new(move |mnemonic| MainWindowMessage::ImportWalletMnemonic { + args: WalletArgs::Software { mnemonic }, + import: ImportOrCreate::Create, + wallet_type, + }), + Box::new(|| MainWindowMessage::CloseDialog), + ) + .into(), + WalletType::Trezor => hw_wallet_create_dialog( + Box::new(move || MainWindowMessage::ImportWalletMnemonic { + args: WalletArgs::Trezor, + import: ImportOrCreate::Create, + wallet_type, + }), + Box::new(|| MainWindowMessage::CloseDialog), + ) + .into(), + } } ActiveDialog::WalletRecover { wallet_type } => { @@ -784,7 +813,7 @@ impl MainWindow { wallet_mnemonic_dialog( None, Box::new(move |mnemonic| MainWindowMessage::ImportWalletMnemonic { - mnemonic, + args: WalletArgs::Software { mnemonic }, import: ImportOrCreate::Import, wallet_type, }), diff --git a/node-gui/src/widgets/create_hw_wallet.rs b/node-gui/src/widgets/create_hw_wallet.rs new file mode 100644 index 0000000000..c7904ec4c0 --- /dev/null +++ b/node-gui/src/widgets/create_hw_wallet.rs @@ -0,0 +1,79 @@ +// Copyright (c) 2021-2024 RBB S.r.l +// opensource@mintlayer.org +// SPDX-License-Identifier: MIT +// Licensed under the MIT License; +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use iced::{ + alignment::Horizontal, + widget::{self, container, Button, Component, Text}, + Element, Length, Theme, +}; +use iced_aw::Card; + +pub struct CreateHwWalletDialog { + on_import: Box Message>, + on_close: Box Message>, +} + +pub fn hw_wallet_create_dialog( + on_import: Box Message>, + on_close: Box Message>, +) -> CreateHwWalletDialog { + CreateHwWalletDialog { + on_import, + on_close, + } +} + +#[derive(Clone)] +pub enum ImportEvent { + Ok, + Cancel, +} + +impl Component for CreateHwWalletDialog { + type State = (); + type Event = ImportEvent; + + fn update(&mut self, _state: &mut Self::State, event: Self::Event) -> Option { + match event { + ImportEvent::Ok => Some((self.on_import)()), + ImportEvent::Cancel => Some((self.on_close)()), + } + } + + fn view(&self, _state: &Self::State) -> Element { + let button = Button::new(Text::new("Select file").horizontal_alignment(Horizontal::Center)) + .width(100.0) + .on_press(ImportEvent::Ok); + + Card::new( + Text::new("Create new Wallet"), + Text::new("Create a new Trezor wallet using the connected Trezor device"), + ) + .foot(container(button).width(Length::Fill).center_x()) + .max_width(600.0) + .on_close(ImportEvent::Cancel) + .into() + } +} + +impl<'a, Message> From> + for Element<'a, Message, Theme, iced::Renderer> +where + Message: 'a, +{ + fn from(component: CreateHwWalletDialog) -> Self { + widget::component(component) + } +} diff --git a/node-gui/src/widgets/mod.rs b/node-gui/src/widgets/mod.rs index d5c81a2140..dae4b17e73 100644 --- a/node-gui/src/widgets/mod.rs +++ b/node-gui/src/widgets/mod.rs @@ -14,6 +14,7 @@ // limitations under the License. pub mod confirm_broadcast; +pub mod create_hw_wallet; pub mod new_wallet_account; pub mod popup_dialog; pub mod wallet_mnemonic; diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index 61362f2452..c8204cb177 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -439,7 +439,7 @@ impl SoftwareSignerProvider { pub fn load_from_database( chain_config: Arc, db_tx: &impl WalletStorageReadLocked, - ) -> SignerResult { + ) -> WalletResult { let master_key_chain = MasterKeyChain::new_from_existing_database(chain_config, db_tx)?; Ok(Self { master_key_chain }) } diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index a306422b08..3c0edd1369 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -77,11 +77,13 @@ use utils::ensure; use wallet_storage::{ WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, }; -use wallet_types::{signature_status::SignatureStatus, AccountId}; +use wallet_types::{ + account_info::DEFAULT_ACCOUNT_INDEX, signature_status::SignatureStatus, AccountId, +}; use crate::{ key_chain::{make_account_path, AccountKeyChainImplHardware, AccountKeyChains, FoundPubKey}, - Account, WalletResult, + Account, WalletError, WalletResult, }; use super::{Signer, SignerError, SignerProvider, SignerResult}; @@ -993,43 +995,42 @@ impl std::fmt::Debug for TrezorSignerProvider { impl TrezorSignerProvider { pub fn new() -> Result { - let mut devices = find_devices(false); - ensure!(!devices.is_empty(), TrezorError::NoDeviceFound); - - let client = devices.pop().unwrap().connect().unwrap(); + let client = find_trezor_device()?; Ok(Self { client: Arc::new(Mutex::new(client)), }) } -} -impl SignerProvider for TrezorSignerProvider { - type S = TrezorSigner; - type K = AccountKeyChainImplHardware; + pub fn load_from_database( + chain_config: Arc, + db_tx: &impl WalletStorageReadLocked, + ) -> WalletResult { + let client = find_trezor_device().map_err(SignerError::TrezorError)?; - fn provide(&mut self, chain_config: Arc, _account_index: U31) -> Self::S { - TrezorSigner::new(chain_config, self.client.clone()) + let provider = Self { + client: Arc::new(Mutex::new(client)), + }; + + check_public_keys(db_tx, &provider, chain_config)?; + + Ok(provider) } - fn make_new_account( - &mut self, - chain_config: Arc, + fn fetch_extended_pub_key( + &self, + chain_config: &Arc, account_index: U31, - name: Option, - db_tx: &mut impl WalletStorageWriteUnlocked, - ) -> WalletResult> { - let derivation_path = make_account_path(&chain_config, account_index); + ) -> Result { + let derivation_path = make_account_path(chain_config, account_index); let account_path = derivation_path.as_slice().iter().map(|c| c.into_encoded_index()).collect(); - let xpub = self .client .lock() .expect("poisoned lock") .mintlayer_get_public_key(account_path) .map_err(|e| SignerError::TrezorError(TrezorError::DeviceError(e)))?; - let chain_code = ChainCode::from(xpub.chain_code.0); let account_pubkey = Secp256k1ExtendedPublicKey::from_hardware_wallet( derivation_path, @@ -1037,6 +1038,57 @@ impl SignerProvider for TrezorSignerProvider { Secp256k1PublicKey::from_bytes(&xpub.public_key.serialize()).expect(""), ); let account_pubkey = ExtendedPublicKey::from_hardware_public_key(account_pubkey); + Ok(account_pubkey) + } +} + +/// Check that the public keys in the DB are the same as the ones with the connected hardware +/// wallet +fn check_public_keys( + db_tx: &impl WalletStorageReadLocked, + provider: &TrezorSignerProvider, + chain_config: Arc, +) -> Result<(), WalletError> { + let first_acc = db_tx + .get_accounts_info()? + .iter() + .find_map(|(acc_id, info)| { + (info.account_index() == DEFAULT_ACCOUNT_INDEX).then_some(acc_id) + }) + .cloned() + .ok_or(WalletError::WalletNotInitialized)?; + let expected_pk = provider.fetch_extended_pub_key(&chain_config, DEFAULT_ACCOUNT_INDEX)?; + let loaded_acc = provider.load_account_from_database(chain_config, db_tx, &first_acc)?; + ensure!( + loaded_acc.key_chain().account_public_key() == &expected_pk, + WalletError::HardwareWalletDifferentFile + ); + Ok(()) +} + +fn find_trezor_device() -> Result { + let mut devices = find_devices(false); + let device = devices.pop().ok_or(TrezorError::NoDeviceFound)?; + let client = device.connect()?; + Ok(client) +} + +impl SignerProvider for TrezorSignerProvider { + type S = TrezorSigner; + type K = AccountKeyChainImplHardware; + + fn provide(&mut self, chain_config: Arc, _account_index: U31) -> Self::S { + TrezorSigner::new(chain_config, self.client.clone()) + } + + fn make_new_account( + &mut self, + chain_config: Arc, + account_index: U31, + name: Option, + db_tx: &mut impl WalletStorageWriteUnlocked, + ) -> WalletResult> { + let account_pubkey = self.fetch_extended_pub_key(&chain_config, account_index)?; let lookahead_size = db_tx.get_lookahead_size()?; diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 24c621b4bf..9dffe5a27d 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -250,6 +250,10 @@ pub enum WalletError { OrderInfoMissing(OrderId), #[error("Calculating filled amount for order {0} failed")] CalculateOrderFilledAmountFailed(OrderId), + #[error("Cannot change a Trezor wallet type")] + CannotChangeTrezorWalletType, + #[error("The file being loaded does not correspond to the connected hardware wallet")] + HardwareWalletDifferentFile, } /// Result type used for the wallet @@ -620,8 +624,13 @@ where (WalletType::Hot, WalletType::Cold) => { Self::migrate_hot_to_cold_wallet(db, chain_config, signer_provider)? } + (WalletType::Cold | WalletType::Hot, WalletType::Trezor) + | (WalletType::Trezor, WalletType::Hot | WalletType::Cold) => { + return Err(WalletError::CannotChangeTrezorWalletType) + } (WalletType::Cold, WalletType::Cold) => {} (WalletType::Hot, WalletType::Hot) => {} + (WalletType::Trezor, WalletType::Trezor) => {} } Ok(()) } diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 07b15e553d..edb404ee8b 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -268,12 +268,7 @@ fn verify_wallet_balance( |_| Ok(()), WalletType::Hot, false, - |db_tx| { - Ok(SoftwareSignerProvider::load_from_database( - chain_config.clone(), - db_tx, - )?) - }, + |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) .unwrap(); @@ -370,12 +365,7 @@ fn wallet_creation_in_memory() { |_| Ok(()), WalletType::Hot, false, - |db_tx| { - Ok(SoftwareSignerProvider::load_from_database( - chain_config2, - db_tx, - )?) - }, + |db_tx| SoftwareSignerProvider::load_from_database(chain_config2, db_tx), ) { Ok(_) => panic!("Wallet loading should fail"), Err(err) => assert_eq!(err, WalletError::WalletNotInitialized), @@ -393,12 +383,7 @@ fn wallet_creation_in_memory() { |_| Ok(()), WalletType::Hot, false, - |db_tx| { - Ok(SoftwareSignerProvider::load_from_database( - chain_config.clone(), - db_tx, - )?) - }, + |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) .unwrap(); } @@ -489,12 +474,7 @@ fn wallet_migration_to_v2(#[case] seed: Seed) { |_| Ok(()), WalletType::Hot, false, - |db_tx| { - Ok(SoftwareSignerProvider::load_from_database( - chain_config.clone(), - db_tx, - )?) - }, + |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) .unwrap(); @@ -973,12 +953,7 @@ fn test_wallet_accounts( |_| Ok(()), WalletType::Hot, false, - |db_tx| { - Ok(SoftwareSignerProvider::load_from_database( - chain_config.clone(), - db_tx, - )?) - }, + |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) .unwrap(); let accounts = wallet.account_indexes().cloned().collect::>(); diff --git a/wallet/trezor-client/rustfmt.toml b/wallet/trezor-client/rustfmt.toml new file mode 100644 index 0000000000..422c4f323c --- /dev/null +++ b/wallet/trezor-client/rustfmt.toml @@ -0,0 +1,11 @@ +reorder_imports = true +imports_granularity = "Crate" +use_small_heuristics = "Max" +comment_width = 100 +wrap_comments = true +binop_separator = "Back" +trailing_comma = "Vertical" +trailing_semicolon = false +use_field_init_shorthand = true + +ignore = ["src/protos/messages_*"] diff --git a/wallet/types/src/wallet_type.rs b/wallet/types/src/wallet_type.rs index e8e00af62a..8953e98a03 100644 --- a/wallet/types/src/wallet_type.rs +++ b/wallet/types/src/wallet_type.rs @@ -22,6 +22,8 @@ pub enum WalletType { Cold, #[codec(index = 1)] Hot, + #[codec(index = 2)] + Trezor, } impl Display for WalletType { @@ -29,6 +31,7 @@ impl Display for WalletType { match self { Self::Hot => write!(f, "Hot"), Self::Cold => write!(f, "Cold"), + Self::Trezor => write!(f, "Trezor"), } } } diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index 1dea94f8b9..f953134ebd 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -203,13 +203,20 @@ where wallet_path, encryption_password, force_change_wallet_type, + hardware_wallet, } => { + let hardware_wallet = hardware_wallet.and_then(|t| match t { + #[cfg(feature = "trezor")] + CLIHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), + CLIHardwareWalletType::None => None, + }); self.wallet() .await? .open_wallet( wallet_path, encryption_password, Some(force_change_wallet_type), + hardware_wallet, ) .await?; self.wallet.update_wallet::().await; diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index 2e09c4f4fb..0a039eee27 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -78,6 +78,10 @@ pub enum WalletManagementCommand { /// Force change the wallet type from hot to cold or from cold to hot #[arg(long)] force_change_wallet_type: bool, + + /// Open a wallet file related to a connected hardware wallet. + #[arg(long)] + hardware_wallet: Option, }, #[clap(name = "wallet-close")] diff --git a/wallet/wallet-cli-lib/src/lib.rs b/wallet/wallet-cli-lib/src/lib.rs index abac293473..5fc3a8321b 100644 --- a/wallet/wallet-cli-lib/src/lib.rs +++ b/wallet/wallet-cli-lib/src/lib.rs @@ -284,6 +284,8 @@ fn setup_events_and_repl( wallet_path, encryption_password: args.wallet_password, force_change_wallet_type: args.force_change_wallet_type, + // TODO: add support for opening a hardware_wallet + hardware_wallet: None, }, ), res_tx, diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 278d3c91c4..c1195ab180 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -380,8 +380,9 @@ where chain_config: Arc, file_path: impl AsRef, password: Option, - wallet_type: WalletType, + current_wallet_type: WalletType, force_change_wallet_type: bool, + open_as_wallet_type: WalletType, ) -> Result, ControllerError> { utils::ensure!( file_path.as_ref().exists(), @@ -394,23 +395,34 @@ where let db = wallet::wallet::open_or_create_wallet_file(&file_path) .map_err(ControllerError::WalletError)?; - let wallet = wallet::Wallet::load_wallet( - Arc::clone(&chain_config), - db, - password, - |version| Self::make_backup_wallet_file(file_path.as_ref(), version), - wallet_type, - force_change_wallet_type, - |db_tx| { - Ok(SoftwareSignerProvider::load_from_database( - chain_config.clone(), - db_tx, - )?) - }, - ) - .map_err(ControllerError::WalletError)?; - - Ok(WalletType2::Software(wallet)) + match open_as_wallet_type { + WalletType::Cold | WalletType::Hot => { + let wallet = wallet::Wallet::load_wallet( + Arc::clone(&chain_config), + db, + password, + |version| Self::make_backup_wallet_file(file_path.as_ref(), version), + current_wallet_type, + force_change_wallet_type, + |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), + ) + .map_err(ControllerError::WalletError)?; + Ok(WalletType2::Software(wallet)) + } + WalletType::Trezor => { + let wallet = wallet::Wallet::load_wallet( + Arc::clone(&chain_config), + db, + password, + |version| Self::make_backup_wallet_file(file_path.as_ref(), version), + current_wallet_type, + force_change_wallet_type, + |db_tx| TrezorSignerProvider::load_from_database(chain_config.clone(), db_tx), + ) + .map_err(ControllerError::WalletError)?; + Ok(WalletType2::Trezor(wallet)) + } + } } pub fn seed_phrase(&self) -> Result, ControllerError> { diff --git a/wallet/wallet-controller/src/types/mod.rs b/wallet/wallet-controller/src/types/mod.rs index b5718e11a6..ce455bf232 100644 --- a/wallet/wallet-controller/src/types/mod.rs +++ b/wallet/wallet-controller/src/types/mod.rs @@ -150,6 +150,7 @@ pub enum CreatedWallet { NewlyGeneratedMnemonic(Mnemonic, Option), } +#[derive(Debug, Clone)] pub enum WalletTypeArgs { Software { mnemonic: Option, diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 3e85533a00..59babca8e3 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -170,9 +170,15 @@ where path: PathBuf, password: Option, force_migrate_wallet_type: Option, + hardware_wallet: Option, ) -> Result<(), Self::Error> { self.wallet_rpc - .open_wallet(path, password, force_migrate_wallet_type.unwrap_or(false)) + .open_wallet( + path, + password, + force_migrate_wallet_type.unwrap_or(false), + hardware_wallet, + ) .await .map_err(WalletRpcHandlesClientError::WalletRpcError) } diff --git a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs index bad3b4aba5..37e5a97564 100644 --- a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs @@ -104,12 +104,14 @@ impl WalletInterface for ClientWalletRpc { path: PathBuf, password: Option, force_migrate_wallet_type: Option, + hardware_wallet: Option, ) -> Result<(), Self::Error> { ColdWalletRpcClient::open_wallet( &self.http_client, path.to_string_lossy().to_string(), password, force_migrate_wallet_type, + hardware_wallet, ) .await .map_err(WalletRpcError::ResponseError) diff --git a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs index 5b108fb3da..1f661e6294 100644 --- a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs +++ b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs @@ -80,6 +80,7 @@ pub trait WalletInterface { path: PathBuf, password: Option, force_migrate_wallet_type: Option, + hardware_wallet: Option, ) -> Result<(), Self::Error>; async fn close_wallet(&self) -> Result<(), Self::Error>; diff --git a/wallet/wallet-rpc-lib/src/lib.rs b/wallet/wallet-rpc-lib/src/lib.rs index 4c982b1973..2c0dd3a7de 100644 --- a/wallet/wallet-rpc-lib/src/lib.rs +++ b/wallet/wallet-rpc-lib/src/lib.rs @@ -101,7 +101,8 @@ where // Start the wallet service let wallet_service = WalletService::start( wallet_config.chain_config, - wallet_config.wallet_file, + // TODO add support for trezor wallet + wallet_config.wallet_file.map(|file| (file, node_rpc.is_cold_wallet_node())), wallet_config.force_change_wallet_type, wallet_config.start_staking_for_account, node_rpc, diff --git a/wallet/wallet-rpc-lib/src/rpc/interface.rs b/wallet/wallet-rpc-lib/src/rpc/interface.rs index 085c2ebf41..a25fdf5743 100644 --- a/wallet/wallet-rpc-lib/src/rpc/interface.rs +++ b/wallet/wallet-rpc-lib/src/rpc/interface.rs @@ -84,6 +84,7 @@ trait ColdWalletRpc { path: String, password: Option, force_migrate_wallet_type: Option, + hardware_wallet: Option, ) -> rpc::RpcResult<()>; /// Close the currently open wallet file diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index a413d86b88..acfd791f6a 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -86,8 +86,8 @@ use crate::{ pub use self::types::RpcError; use self::types::{ - AddressInfo, AddressWithUsageInfo, DelegationInfo, LegacyVrfPublicKeyInfo, NewAccountInfo, - NewTransaction, PoolInfo, PublicKeyInfo, RpcAddress, RpcAmountIn, RpcHexString, + AddressInfo, AddressWithUsageInfo, DelegationInfo, HardwareWalletType, LegacyVrfPublicKeyInfo, + NewAccountInfo, NewTransaction, PoolInfo, PublicKeyInfo, RpcAddress, RpcAmountIn, RpcHexString, RpcStandaloneAddress, RpcStandaloneAddressDetails, RpcStandaloneAddresses, RpcStandalonePrivateKeyAddress, RpcTokenId, RpcUtxoOutpoint, StakingStatus, StandaloneAddressWithDetails, VrfPublicKeyInfo, @@ -146,13 +146,23 @@ where wallet_path: PathBuf, password: Option, force_migrate_wallet_type: bool, + open_as_hw_wallet: Option, ) -> WRpcResult<(), N> { + let open_as_wallet_type = + open_as_hw_wallet.map_or(self.node.is_cold_wallet_node(), |hw| match hw { + HardwareWalletType::Trezor => WalletType::Trezor, + }); Ok(self .wallet .manage_async(move |wallet_manager| { Box::pin(async move { wallet_manager - .open_wallet(wallet_path, password, force_migrate_wallet_type) + .open_wallet( + wallet_path, + password, + force_migrate_wallet_type, + open_as_wallet_type, + ) .await }) }) diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index 4086639491..f97f05b2f5 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -137,12 +137,14 @@ where path: String, password: Option, force_migrate_wallet_type: Option, + open_as_hw_wallet: Option, ) -> rpc::RpcResult<()> { rpc::handle_result( self.open_wallet( path.into(), password, force_migrate_wallet_type.unwrap_or(false), + open_as_hw_wallet, ) .await, ) diff --git a/wallet/wallet-rpc-lib/src/service/mod.rs b/wallet/wallet-rpc-lib/src/service/mod.rs index 90a55c1a21..e14b2b9774 100644 --- a/wallet/wallet-rpc-lib/src/service/mod.rs +++ b/wallet/wallet-rpc-lib/src/service/mod.rs @@ -26,6 +26,7 @@ use utils::shallow_clone::ShallowClone; pub use events::{Event, TxState}; pub use handle::{EventStream, SubmitError, WalletHandle}; use wallet_controller::{ControllerConfig, NodeInterface}; +use wallet_types::wallet_type::WalletType; pub use worker::{WalletController, WalletControllerError}; use events::WalletServiceEvents; @@ -56,7 +57,7 @@ where { pub async fn start( chain_config: Arc, - wallet_file: Option, + wallet_file: Option<(PathBuf, WalletType)>, force_change_wallet_type: bool, start_staking_for_account: Vec, node_rpc: N, @@ -64,7 +65,7 @@ where let (wallet_events, events_rx) = WalletServiceEvents::new(); let (command_tx, command_rx) = tokio::sync::mpsc::unbounded_channel(); - let controller = if let Some(wallet_file) = &wallet_file { + let controller = if let Some((wallet_file, open_as_wallet_type)) = &wallet_file { let wallet = { // TODO: Allow user to set password (config file only) let wallet_password = None; @@ -74,6 +75,7 @@ where wallet_password, node_rpc.is_cold_wallet_node(), force_change_wallet_type, + *open_as_wallet_type, )? }; diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index e0e6fc47ad..bdd66a2f0e 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -23,6 +23,7 @@ use logging::log; use utils_networking::broadcaster::Broadcaster; use wallet_controller::types::{CreatedWallet, WalletTypeArgs}; use wallet_controller::{ControllerError, NodeInterface}; +use wallet_types::wallet_type::WalletType; use crate::types::RpcError; @@ -151,6 +152,7 @@ where wallet_path: PathBuf, password: Option, force_migrate_wallet_type: bool, + open_as_wallet_type: WalletType, ) -> Result<(), ControllerError> { utils::ensure!( self.controller.is_none(), @@ -163,6 +165,7 @@ where password, self.node_rpc.is_cold_wallet_node(), force_migrate_wallet_type, + open_as_wallet_type, )?; let controller = WalletController::new( From 8dfd74c55610bd3d153ca1567867bffb27803070 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 30 Jul 2024 21:05:35 +0200 Subject: [PATCH 12/48] fix pipeline errors --- build-tools/codecheck/codecheck.py | 2 +- wallet/src/signer/software_signer/tests.rs | 1 - wallet/src/signer/trezor_signer/mod.rs | 7 +++++++ wallet/src/signer/trezor_signer/tests.rs | 1 - wallet/trezor-client/Cargo.toml | 8 ++++---- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build-tools/codecheck/codecheck.py b/build-tools/codecheck/codecheck.py index c17de5fc99..f23b420fa6 100755 --- a/build-tools/codecheck/codecheck.py +++ b/build-tools/codecheck/codecheck.py @@ -268,7 +268,7 @@ def check_local_licenses(): template = re.compile('(?:' + r')\n(?:'.join(LICENSE_TEMPLATE) + ')') ok = True - for path in rs_sources(): + for path in rs_sources(['wallet/trezor-client']): if any(fnmatch.fnmatch(os.path.abspath(path), os.path.abspath(exempted)) for exempted in exempted_files): continue diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index 222fbbe168..c2ee84b145 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -22,7 +22,6 @@ use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::output_value::OutputValue; use common::chain::signature::inputsig::arbitrary_message::produce_message_challenge; -use common::chain::signature::verify_signature; use common::chain::timelock::OutputTimeLock; use common::chain::{GenBlock, TxInput}; use common::primitives::amount::UnsignedIntType; diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 3c0edd1369..54b0eecd5f 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -455,6 +455,7 @@ impl Signer for TrezorSigner { fn tx_output_value(out: &TxOutput) -> OutputValue { match out { TxOutput::Transfer(value, _) + | TxOutput::Htlc(value, _) | TxOutput::LockThenTransfer(value, _, _) | TxOutput::Burn(value) => value.clone(), TxOutput::DelegateStaking(amount, _) => OutputValue::Coin(*amount), @@ -465,6 +466,7 @@ fn tx_output_value(out: &TxOutput) -> OutputValue { | TxOutput::CreateDelegationId(_, _) | TxOutput::ProduceBlockFromStake(_, _) | TxOutput::IssueFungibleToken(_) + | TxOutput::AnyoneCanTake(_) | TxOutput::DataDeposit(_) => OutputValue::Coin(Amount::ZERO), } } @@ -573,6 +575,9 @@ fn to_trezor_account_command_input( inp_req.change_token_authority = Some(req).into(); } + AccountCommand::ConcludeOrder(_) | AccountCommand::FillOrder(_, _, _) => { + unimplemented!("order commands") + } } let mut inp = MintlayerTxInput::new(); inp.account_command = Some(inp_req).into(); @@ -979,6 +984,8 @@ fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> Mintlayer out.data_deposit = Some(out_req).into(); out } + TxOutput::Htlc(_, _) => unimplemented!("HTLC"), + TxOutput::AnyoneCanTake(_) => unimplemented!("AnyoneCanTake"), } } diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 8cbc321bea..2862594e79 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -22,7 +22,6 @@ use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::output_value::OutputValue; use common::chain::signature::inputsig::arbitrary_message::produce_message_challenge; -use common::chain::signature::verify_signature; use common::chain::timelock::OutputTimeLock; use common::chain::tokens::TokenId; use common::chain::{ diff --git a/wallet/trezor-client/Cargo.toml b/wallet/trezor-client/Cargo.toml index cf93e75d6f..b7bfa619f0 100644 --- a/wallet/trezor-client/Cargo.toml +++ b/wallet/trezor-client/Cargo.toml @@ -14,7 +14,7 @@ authors = [ ] license = "CC0-1.0" homepage = "https://github.com/trezor/trezor-firmware/tree/master/rust/trezor-client" -repository = "https://github.com/trezor/trezor-firmware" +# repository = "https://github.com/trezor/trezor-firmware" description = "Client library for interfacing with Trezor hardware wallet devices" keywords = ["ethereum", "bitcoin", "trezor", "wallet"] categories = ["api-bindings", "cryptography::cryptocurrencies"] @@ -37,7 +37,7 @@ rust-version = "1.60" [dependencies] # important: keep in sync -protobuf = "=3.3.0" +protobuf = "=3.3" # protobuf-codegen = "=3.3.0" byteorder = "1.4" rusb = "0.9" @@ -48,11 +48,11 @@ tracing = "0.1" # bitcoin bitcoin = { version = "0.31", optional = true } -unicode-normalization = { version = "0.1.22", optional = true } +unicode-normalization = { version = "0.1", optional = true } [dev-dependencies] tracing-subscriber = "0.3" -serial_test = "2.0.0" +serial_test = "2.0" [features] default = ["bitcoin", "ethereum", "solana", "mintlayer"] From 2b5e363d47f6d709319e8120574782aebb3dde83 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 31 Jul 2024 11:56:55 +0200 Subject: [PATCH 13/48] fix trezor feature compilation --- Cargo.toml | 2 - node-gui/Cargo.toml | 3 + node-gui/backend/src/backend_impl.rs | 2 + node-gui/backend/src/lib.rs | 84 ++++++++++++------- node-gui/src/main.rs | 16 ++-- node-gui/src/main_window/main_menu.rs | 1 + .../src/main_window/main_widget/tabs/mod.rs | 1 + .../main_widget/tabs/wallet/left_panel.rs | 20 ++++- .../main_widget/tabs/wallet/mod.rs | 2 + node-gui/src/main_window/mod.rs | 10 ++- node-gui/src/widgets/mod.rs | 1 + wallet/Cargo.toml | 4 +- wallet/src/signer/mod.rs | 6 +- wallet/src/signer/trezor_signer/mod.rs | 1 + wallet/src/wallet/mod.rs | 2 + wallet/trezor-client/src/lib.rs | 1 + wallet/types/Cargo.toml | 3 + wallet/types/src/wallet_type.rs | 2 + wallet/wallet-cli-commands/Cargo.toml | 4 +- wallet/wallet-cli-lib/Cargo.toml | 2 +- wallet/wallet-cli/Cargo.toml | 3 + wallet/wallet-controller/Cargo.toml | 4 +- wallet/wallet-controller/src/lib.rs | 1 + wallet/wallet-node-client/Cargo.toml | 3 + wallet/wallet-rpc-client/Cargo.toml | 4 +- wallet/wallet-rpc-daemon/Cargo.toml | 3 + wallet/wallet-rpc-lib/Cargo.toml | 4 +- wallet/wallet-rpc-lib/src/rpc/mod.rs | 4 + wallet/wallet-rpc-lib/src/service/worker.rs | 2 +- 29 files changed, 137 insertions(+), 58 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 638b269c49..384c0aa7c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -277,5 +277,3 @@ opt-level = 2 [features] trezor = [] - -default = ["trezor"] diff --git a/node-gui/Cargo.toml b/node-gui/Cargo.toml index 6a4161476c..cb62a562b0 100644 --- a/node-gui/Cargo.toml +++ b/node-gui/Cargo.toml @@ -38,3 +38,6 @@ tokio.workspace = true [target.'cfg(windows)'.build-dependencies] winres = "0.1" + +[features] +trezor = ["wallet-controller/trezor", "wallet-types/trezor"] diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index fb951dc54f..919fc844d0 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -319,6 +319,7 @@ impl Backend { (wallet_data, accounts_info, best_block) } + #[cfg(feature = "trezor")] (WalletType::Trezor, _) => { let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); @@ -508,6 +509,7 @@ impl Backend { (wallet_data, accounts_info, best_block, encryption_state) } + #[cfg(feature = "trezor")] (WalletType::Trezor, _) => { let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); diff --git a/node-gui/backend/src/lib.rs b/node-gui/backend/src/lib.rs index e653a453b6..ac41c53030 100644 --- a/node-gui/backend/src/lib.rs +++ b/node-gui/backend/src/lib.rs @@ -65,6 +65,7 @@ impl ImportOrCreate { pub enum WalletMode { Cold, Hot, + #[cfg(feature = "trezor")] Trezor, } @@ -183,35 +184,23 @@ pub async fn node_initialize( }); (chain_config, chain_info) } - WalletMode::Trezor | WalletMode::Cold => { - let chain_config = Arc::new(match network { - InitNetwork::Mainnet => common::chain::config::create_mainnet(), - InitNetwork::Testnet => common::chain::config::create_testnet(), - }); - let chain_info = ChainInfo { - best_block_id: chain_config.genesis_block_id(), - best_block_height: BlockHeight::zero(), - median_time: chain_config.genesis_block().timestamp(), - best_block_timestamp: chain_config.genesis_block().timestamp(), - is_initial_block_download: false, - }; - - let manager_join_handle = tokio::spawn(async move {}); - - let backend = backend_impl::Backend::new_cold( - chain_config.clone(), - event_tx, - low_priority_event_tx, - wallet_updated_tx, - manager_join_handle, - ); - - tokio::spawn(async move { - backend_impl::run_cold(backend, request_rx, wallet_updated_rx).await; - }); - - (chain_config, chain_info) - } + #[cfg(feature = "trezor")] + WalletMode::Trezor => spawn_cold_backend( + network, + event_tx, + request_rx, + low_priority_event_tx, + wallet_updated_tx, + wallet_updated_rx, + ), + WalletMode::Cold => spawn_cold_backend( + network, + event_tx, + request_rx, + low_priority_event_tx, + wallet_updated_tx, + wallet_updated_rx, + ), }; let initialized_node = InitializedNode { @@ -228,3 +217,40 @@ pub async fn node_initialize( Ok(backend_controls) } + +fn spawn_cold_backend( + network: InitNetwork, + event_tx: UnboundedSender, + request_rx: UnboundedReceiver, + low_priority_event_tx: UnboundedSender, + wallet_updated_tx: UnboundedSender, + wallet_updated_rx: UnboundedReceiver, +) -> (Arc, ChainInfo) { + let chain_config = Arc::new(match network { + InitNetwork::Mainnet => common::chain::config::create_mainnet(), + InitNetwork::Testnet => common::chain::config::create_testnet(), + }); + let chain_info = ChainInfo { + best_block_id: chain_config.genesis_block_id(), + best_block_height: BlockHeight::zero(), + median_time: chain_config.genesis_block().timestamp(), + best_block_timestamp: chain_config.genesis_block().timestamp(), + is_initial_block_download: false, + }; + + let manager_join_handle = tokio::spawn(async move {}); + + let backend = backend_impl::Backend::new_cold( + chain_config.clone(), + event_tx, + low_priority_event_tx, + wallet_updated_tx, + manager_join_handle, + ); + + tokio::spawn(async move { + backend_impl::run_cold(backend, request_rx, wallet_updated_rx).await; + }); + + (chain_config, chain_info) +} diff --git a/node-gui/src/main.rs b/node-gui/src/main.rs index 1c8b400931..361db199e2 100644 --- a/node-gui/src/main.rs +++ b/node-gui/src/main.rs @@ -37,6 +37,7 @@ use tokio::sync::mpsc::UnboundedReceiver; const COLD_WALLET_TOOLTIP_TEXT: &str = "Start the wallet in Cold mode without connecting to the network or any nodes. The Cold mode is made to run the wallet on an air-gapped machine without internet connection for storage of keys of high-value. For example, pool decommission keys."; const HOT_WALLET_TOOLTIP_TEXT: &str = "Start the wallet in Hot mode and connect to the network."; +#[cfg(feature = "trezor")] const TREZOR_WALLET_TOOLTIP_TEXT: &str = "Start the wallet in Trezor mode and connect to a Trezor hardware wallet."; @@ -350,7 +351,13 @@ impl Application for MintlayerNodeGUI { .gap(10) .style(iced::theme::Container::Box) ], - row![ + ] + .align_items(iced::Alignment::Center) + .spacing(5); + + #[cfg(feature = "trezor")] + let error_box = { + let trezor_row = row![ iced::widget::button(text("Trezor")).on_press(WalletMode::Trezor), tooltip( Text::new(iced_aw::Bootstrap::Question.to_string()) @@ -360,10 +367,9 @@ impl Application for MintlayerNodeGUI { ) .gap(10) .style(iced::theme::Container::Box) - ], - ] - .align_items(iced::Alignment::Center) - .spacing(5); + ]; + error_box.push(trezor_row) + }; let res: Element = container(error_box) .width(Length::Fill) diff --git a/node-gui/src/main_window/main_menu.rs b/node-gui/src/main_window/main_menu.rs index 4457cd8865..39252621c0 100644 --- a/node-gui/src/main_window/main_menu.rs +++ b/node-gui/src/main_window/main_menu.rs @@ -157,6 +157,7 @@ fn make_menu_file<'a>(wallet_mode: WalletMode) -> Item<'a, MenuMessage, Theme, i menu_item("Exit", MenuMessage::Exit), ] } + #[cfg(feature = "trezor")] WalletMode::Trezor => { vec![ menu_item( diff --git a/node-gui/src/main_window/main_widget/tabs/mod.rs b/node-gui/src/main_window/main_widget/tabs/mod.rs index f5c10cd8c0..fcb9278f7c 100644 --- a/node-gui/src/main_window/main_widget/tabs/mod.rs +++ b/node-gui/src/main_window/main_widget/tabs/mod.rs @@ -115,6 +115,7 @@ impl TabsWidget { self.cold_wallet_tab.tab_label(), self.cold_wallet_tab.view(node_state), ), + #[cfg(feature = "trezor")] WalletMode::Trezor => tabs.push( TabIndex::Summary as usize, self.cold_wallet_tab.tab_label(), diff --git a/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs b/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs index 85c33b098e..f55a8b3102 100644 --- a/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs +++ b/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs @@ -116,6 +116,7 @@ pub fn view_left_panel( // `next_height` is used to prevent flickering when a new block is found let show_scan_progress = match wallet_info.wallet_type { + #[cfg(feature = "trezor")] WalletType::Trezor => false, WalletType::Cold => false, WalletType::Hot => { @@ -175,7 +176,24 @@ pub fn view_left_panel( .spacing(10) .padding(10), match wallet_info.wallet_type { - WalletType::Trezor | WalletType::Cold => { + #[cfg(feature = "trezor")] + WalletType::Trezor => { + column![ + panel_button( + "Addresses", + SelectedPanel::Addresses, + selected_panel, + ADDRESSES_TOOLTIP_TEXT + ), + panel_button( + "Console", + SelectedPanel::Console, + selected_panel, + CONSOLE_TOOLTIP_TEXT, + ) + ] + } + WalletType::Cold => { column![ panel_button( "Addresses", diff --git a/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs b/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs index d14ed46e59..71fcdb5847 100644 --- a/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs +++ b/node-gui/src/main_window/main_widget/tabs/wallet/mod.rs @@ -178,6 +178,7 @@ impl WalletTab { let selected_panel = match wallet_type { WalletType::Hot => SelectedPanel::Transactions, WalletType::Cold => SelectedPanel::Addresses, + #[cfg(feature = "trezor")] WalletType::Trezor => SelectedPanel::Addresses, }; @@ -483,6 +484,7 @@ impl Tab for WalletTab { let still_syncing = match wallet_info.wallet_type { WalletType::Cold => false, + #[cfg(feature = "trezor")] WalletType::Trezor => false, WalletType::Hot => { wallet_info.best_block.1.next_height() < node_state.chain_info.best_block_height diff --git a/node-gui/src/main_window/mod.rs b/node-gui/src/main_window/mod.rs index e3b6017e37..660a849198 100644 --- a/node-gui/src/main_window/mod.rs +++ b/node-gui/src/main_window/mod.rs @@ -35,11 +35,12 @@ use wallet_cli_commands::ConsoleCommand; use wallet_controller::types::WalletTypeArgs; use wallet_types::{seed_phrase::StoreSeedPhrase, wallet_type::WalletType}; +#[cfg(feature = "trezor")] +use crate::widgets::create_hw_wallet::hw_wallet_create_dialog; use crate::{ main_window::{main_menu::MenuMessage, main_widget::MainWidgetMessage}, widgets::{ confirm_broadcast::new_confirm_broadcast, - create_hw_wallet::hw_wallet_create_dialog, new_wallet_account::new_wallet_account, popup_dialog::{popup_dialog, Popup}, wallet_mnemonic::wallet_mnemonic_dialog, @@ -149,8 +150,11 @@ pub struct MainWindow { #[derive(Debug, Clone)] pub enum WalletArgs { + Software { + mnemonic: String, + }, + #[cfg(feature = "trezor")] Trezor, - Software { mnemonic: String }, } #[derive(Debug, Clone)] @@ -671,6 +675,7 @@ impl MainWindow { } } } + #[cfg(feature = "trezor")] WalletArgs::Trezor => WalletTypeArgs::Trezor, }; @@ -796,6 +801,7 @@ impl MainWindow { Box::new(|| MainWindowMessage::CloseDialog), ) .into(), + #[cfg(feature = "trezor")] WalletType::Trezor => hw_wallet_create_dialog( Box::new(move || MainWindowMessage::ImportWalletMnemonic { args: WalletArgs::Trezor, diff --git a/node-gui/src/widgets/mod.rs b/node-gui/src/widgets/mod.rs index dae4b17e73..b519b51821 100644 --- a/node-gui/src/widgets/mod.rs +++ b/node-gui/src/widgets/mod.rs @@ -14,6 +14,7 @@ // limitations under the License. pub mod confirm_broadcast; +#[cfg(feature = "trezor")] pub mod create_hw_wallet; pub mod new_wallet_account; pub mod popup_dialog; diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index f123ff7995..3a3e3aa96b 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -44,6 +44,4 @@ rstest.workspace = true tempfile.workspace = true [features] -trezor = ["trezor-client"] - -default = ["trezor"] +trezor = ["dep:trezor-client", "wallet-types/trezor"] diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 1db0d20764..52a38ec8fd 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -37,12 +37,13 @@ use crate::{ Account, WalletResult, }; -use self::trezor_signer::TrezorError; - pub mod software_signer; #[cfg(feature = "trezor")] pub mod trezor_signer; +#[cfg(feature = "trezor")] +use self::trezor_signer::TrezorError; + /// Signer errors #[derive(thiserror::Error, Debug, Eq, PartialEq)] pub enum SignerError { @@ -66,6 +67,7 @@ pub enum SignerError { MultisigError(#[from] PartiallySignedMultisigStructureError), #[error("{0}")] SerializationError(#[from] serialization::Error), + #[cfg(feature = "trezor")] #[error("Trezor error: {0}")] TrezorError(#[from] TrezorError), #[error("Partially signed tx is missing input's destination")] diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 54b0eecd5f..7b557f0f43 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -1120,5 +1120,6 @@ impl SignerProvider for TrezorSignerProvider { } } +#[cfg(feature = "trezor-emulator")] #[cfg(test)] mod tests; diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 9dffe5a27d..6b20f93674 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -624,12 +624,14 @@ where (WalletType::Hot, WalletType::Cold) => { Self::migrate_hot_to_cold_wallet(db, chain_config, signer_provider)? } + #[cfg(feature = "trezor")] (WalletType::Cold | WalletType::Hot, WalletType::Trezor) | (WalletType::Trezor, WalletType::Hot | WalletType::Cold) => { return Err(WalletError::CannotChangeTrezorWalletType) } (WalletType::Cold, WalletType::Cold) => {} (WalletType::Hot, WalletType::Hot) => {} + #[cfg(feature = "trezor")] (WalletType::Trezor, WalletType::Trezor) => {} } Ok(()) diff --git a/wallet/trezor-client/src/lib.rs b/wallet/trezor-client/src/lib.rs index 72cdda2942..8f204c29bc 100644 --- a/wallet/trezor-client/src/lib.rs +++ b/wallet/trezor-client/src/lib.rs @@ -134,6 +134,7 @@ pub fn unique(debug: bool) -> Result { } } +#[cfg(feature = "trezor-emulator")] #[cfg(test)] mod tests { use serial_test::serial; diff --git a/wallet/types/Cargo.toml b/wallet/types/Cargo.toml index ee16b1d4f1..a1141ddf60 100644 --- a/wallet/types/Cargo.toml +++ b/wallet/types/Cargo.toml @@ -28,3 +28,6 @@ zeroize.workspace = true test-utils = { path = "../../test-utils" } rstest.workspace = true + +[features] +trezor = [] diff --git a/wallet/types/src/wallet_type.rs b/wallet/types/src/wallet_type.rs index 8953e98a03..7be9b18823 100644 --- a/wallet/types/src/wallet_type.rs +++ b/wallet/types/src/wallet_type.rs @@ -22,6 +22,7 @@ pub enum WalletType { Cold, #[codec(index = 1)] Hot, + #[cfg(feature = "trezor")] #[codec(index = 2)] Trezor, } @@ -31,6 +32,7 @@ impl Display for WalletType { match self { Self::Hot => write!(f, "Hot"), Self::Cold => write!(f, "Cold"), + #[cfg(feature = "trezor")] Self::Trezor => write!(f, "Trezor"), } } diff --git a/wallet/wallet-cli-commands/Cargo.toml b/wallet/wallet-cli-commands/Cargo.toml index db781c74b8..0a0b4a1ff8 100644 --- a/wallet/wallet-cli-commands/Cargo.toml +++ b/wallet/wallet-cli-commands/Cargo.toml @@ -58,6 +58,4 @@ wallet-test-node = { path = "../wallet-test-node" } rstest.workspace = true [features] -trezor = [] - -default = ["trezor"] +trezor = ["wallet-types/trezor", "wallet-rpc-lib/trezor"] diff --git a/wallet/wallet-cli-lib/Cargo.toml b/wallet/wallet-cli-lib/Cargo.toml index 28eafe69c0..00043dc082 100644 --- a/wallet/wallet-cli-lib/Cargo.toml +++ b/wallet/wallet-cli-lib/Cargo.toml @@ -58,4 +58,4 @@ wallet-test-node = { path = "../wallet-test-node" } rstest.workspace = true [features] -trezor = [] +trezor = ["wallet/trezor", "wallet-cli-commands/trezor", "wallet-types/trezor", "wallet-rpc-lib/trezor", "wallet-rpc-client/trezor"] diff --git a/wallet/wallet-cli/Cargo.toml b/wallet/wallet-cli/Cargo.toml index 033027324e..bf68f34857 100644 --- a/wallet/wallet-cli/Cargo.toml +++ b/wallet/wallet-cli/Cargo.toml @@ -14,3 +14,6 @@ wallet-cli-lib = { path = "../wallet-cli-lib" } clap = { workspace = true, features = ["derive"] } tokio = { workspace = true, default-features = false, features = ["io-util", "macros", "net", "rt", "sync"] } + +[features] +trezor = ["wallet-cli-lib/trezor"] diff --git a/wallet/wallet-controller/Cargo.toml b/wallet/wallet-controller/Cargo.toml index 38839d43ef..04741d42d9 100644 --- a/wallet/wallet-controller/Cargo.toml +++ b/wallet/wallet-controller/Cargo.toml @@ -46,6 +46,4 @@ anyhow.workspace = true rstest.workspace = true [features] -trezor = [] - -default = ["trezor"] +trezor = ["wallet-types/trezor"] diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index c1195ab180..a3bbf47594 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -409,6 +409,7 @@ where .map_err(ControllerError::WalletError)?; Ok(WalletType2::Software(wallet)) } + #[cfg(feature = "trezor")] WalletType::Trezor => { let wallet = wallet::Wallet::load_wallet( Arc::clone(&chain_config), diff --git a/wallet/wallet-node-client/Cargo.toml b/wallet/wallet-node-client/Cargo.toml index a4155e04f7..8970753a39 100644 --- a/wallet/wallet-node-client/Cargo.toml +++ b/wallet/wallet-node-client/Cargo.toml @@ -33,3 +33,6 @@ tower.workspace = true chainstate-storage = { path = "../../chainstate/storage" } tokio = { workspace = true, default-features = false, features = ["io-util", "macros", "net", "rt", "sync"] } + +[features] +trezor = ["wallet-types/trezor"] diff --git a/wallet/wallet-rpc-client/Cargo.toml b/wallet/wallet-rpc-client/Cargo.toml index 50fe6c9513..8fa3b30a5c 100644 --- a/wallet/wallet-rpc-client/Cargo.toml +++ b/wallet/wallet-rpc-client/Cargo.toml @@ -38,6 +38,4 @@ chainstate-storage = { path = "../../chainstate/storage" } tokio = { workspace = true, default-features = false, features = ["io-util", "macros", "net", "rt", "sync"] } [features] -trezor = [] - -default = ["trezor"] +trezor = ["wallet/trezor", "wallet-types/trezor", "wallet-rpc-lib/trezor", "wallet-controller/trezor"] diff --git a/wallet/wallet-rpc-daemon/Cargo.toml b/wallet/wallet-rpc-daemon/Cargo.toml index 332fda36d2..6270884661 100644 --- a/wallet/wallet-rpc-daemon/Cargo.toml +++ b/wallet/wallet-rpc-daemon/Cargo.toml @@ -23,3 +23,6 @@ tokio.workspace = true rpc-description = { path = "../../rpc/description" } expect-test.workspace = true + +[features] +trezor = ["wallet-rpc-lib/trezor"] diff --git a/wallet/wallet-rpc-lib/Cargo.toml b/wallet/wallet-rpc-lib/Cargo.toml index cf974e860c..c97addeafd 100644 --- a/wallet/wallet-rpc-lib/Cargo.toml +++ b/wallet/wallet-rpc-lib/Cargo.toml @@ -51,6 +51,4 @@ wallet-types = { path = "../types" } rstest.workspace = true [features] -trezor = [] - -default = ["trezor"] +trezor = ["wallet-types/trezor"] diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index acfd791f6a..2b97c03a91 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -84,6 +84,9 @@ use crate::{ WalletHandle, WalletRpcConfig, }; +#[cfg(feature = "trezor")] +use wallet_types::wallet_type::WalletType; + pub use self::types::RpcError; use self::types::{ AddressInfo, AddressWithUsageInfo, DelegationInfo, HardwareWalletType, LegacyVrfPublicKeyInfo, @@ -150,6 +153,7 @@ where ) -> WRpcResult<(), N> { let open_as_wallet_type = open_as_hw_wallet.map_or(self.node.is_cold_wallet_node(), |hw| match hw { + #[cfg(feature = "trezor")] HardwareWalletType::Trezor => WalletType::Trezor, }); Ok(self diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index bdd66a2f0e..a236e53e9c 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -190,7 +190,7 @@ where self.controller.is_none(), ControllerError::WalletFileAlreadyOpen ); - let newly_generated_mnemonic = args.user_supplied_menmonic(); + let newly_generated_mnemonic = !args.user_supplied_menmonic(); let (computed_args, wallet_created) = args.parse_mnemonic().map_err(RpcError::InvalidMnemonic)?; From 2d79ff73a6831976be3f27656b32a22ed9b69fef Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Thu, 1 Aug 2024 11:46:44 +0200 Subject: [PATCH 14/48] update rpc docs --- wallet/wallet-rpc-daemon/docs/RPC.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wallet/wallet-rpc-daemon/docs/RPC.md b/wallet/wallet-rpc-daemon/docs/RPC.md index d7862a7dbb..1b80b67214 100644 --- a/wallet/wallet-rpc-daemon/docs/RPC.md +++ b/wallet/wallet-rpc-daemon/docs/RPC.md @@ -2707,6 +2707,7 @@ Parameters: "passphrase": EITHER OF 1) string 2) null, + "hardware_wallet": null, } ``` @@ -2740,6 +2741,7 @@ Parameters: "force_migrate_wallet_type": EITHER OF 1) bool 2) null, + "hardware_wallet": null, } ``` From 585cfadb6157bb94d5ef6f03cbee990fbd3edc05 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 6 Aug 2024 12:44:09 +0200 Subject: [PATCH 15/48] remove the trezor client code and reference the git repository --- Cargo.lock | 45 +- Cargo.toml | 1 - do_checks.sh | 1 + wallet/Cargo.toml | 3 +- wallet/trezor-client/.gitignore | 1 - wallet/trezor-client/Cargo.toml | 77 - wallet/trezor-client/LICENSE | 122 - wallet/trezor-client/README.md | 40 - wallet/trezor-client/build/Cargo.toml | 8 - wallet/trezor-client/build/README.md | 7 - wallet/trezor-client/build/src/main.rs | 34 - wallet/trezor-client/rustfmt.toml | 11 - wallet/trezor-client/scripts/build_messages | 110 - wallet/trezor-client/scripts/build_protos | 27 - wallet/trezor-client/src/client/bitcoin.rs | 95 - wallet/trezor-client/src/client/common.rs | 247 - wallet/trezor-client/src/client/ethereum.rs | 167 - wallet/trezor-client/src/client/mintlayer.rs | 153 - wallet/trezor-client/src/client/mod.rs | 262 - wallet/trezor-client/src/client/solana.rs | 15 - wallet/trezor-client/src/error.rs | 113 - wallet/trezor-client/src/flows/sign_tx.rs | 322 - wallet/trezor-client/src/lib.rs | 227 - .../trezor-client/src/messages/generated.rs | 306 - wallet/trezor-client/src/messages/mod.rs | 26 - .../src/protos/generated/messages.rs | 1963 --- .../src/protos/generated/messages_binance.rs | 3083 ---- .../src/protos/generated/messages_bitcoin.rs | 13677 ---------------- .../protos/generated/messages_bootloader.rs | 767 - .../src/protos/generated/messages_cardano.rs | 10240 ------------ .../src/protos/generated/messages_common.rs | 2521 --- .../src/protos/generated/messages_crypto.rs | 2956 ---- .../src/protos/generated/messages_debug.rs | 3555 ---- .../src/protos/generated/messages_eos.rs | 6536 -------- .../src/protos/generated/messages_ethereum.rs | 4199 ----- .../messages_ethereum_definitions.rs | 1001 -- .../generated/messages_ethereum_eip712.rs | 1465 -- .../protos/generated/messages_management.rs | 10842 ------------ .../protos/generated/messages_mintlayer.rs | 10116 ------------ .../src/protos/generated/messages_monero.rs | 12061 -------------- .../src/protos/generated/messages_nem.rs | 4998 ------ .../src/protos/generated/messages_ripple.rs | 1241 -- .../src/protos/generated/messages_solana.rs | 1594 -- .../src/protos/generated/messages_stellar.rs | 6413 -------- .../src/protos/generated/messages_tezos.rs | 4584 ------ .../src/protos/generated/messages_webauthn.rs | 1257 -- wallet/trezor-client/src/protos/mod.rs | 43 - wallet/trezor-client/src/transport/error.rs | 49 - wallet/trezor-client/src/transport/mod.rs | 85 - .../trezor-client/src/transport/protocol.rs | 208 - wallet/trezor-client/src/transport/udp.rs | 153 - wallet/trezor-client/src/transport/webusb.rs | 173 - wallet/trezor-client/src/utils.rs | 73 - 53 files changed, 6 insertions(+), 108267 deletions(-) delete mode 100644 wallet/trezor-client/.gitignore delete mode 100644 wallet/trezor-client/Cargo.toml delete mode 100644 wallet/trezor-client/LICENSE delete mode 100644 wallet/trezor-client/README.md delete mode 100644 wallet/trezor-client/build/Cargo.toml delete mode 100644 wallet/trezor-client/build/README.md delete mode 100644 wallet/trezor-client/build/src/main.rs delete mode 100644 wallet/trezor-client/rustfmt.toml delete mode 100755 wallet/trezor-client/scripts/build_messages delete mode 100755 wallet/trezor-client/scripts/build_protos delete mode 100644 wallet/trezor-client/src/client/bitcoin.rs delete mode 100644 wallet/trezor-client/src/client/common.rs delete mode 100644 wallet/trezor-client/src/client/ethereum.rs delete mode 100644 wallet/trezor-client/src/client/mintlayer.rs delete mode 100644 wallet/trezor-client/src/client/mod.rs delete mode 100644 wallet/trezor-client/src/client/solana.rs delete mode 100644 wallet/trezor-client/src/error.rs delete mode 100644 wallet/trezor-client/src/flows/sign_tx.rs delete mode 100644 wallet/trezor-client/src/lib.rs delete mode 100644 wallet/trezor-client/src/messages/generated.rs delete mode 100644 wallet/trezor-client/src/messages/mod.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_binance.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_bitcoin.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_bootloader.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_cardano.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_common.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_crypto.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_debug.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_eos.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_ethereum.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_management.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_mintlayer.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_monero.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_nem.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_ripple.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_solana.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_stellar.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_tezos.rs delete mode 100644 wallet/trezor-client/src/protos/generated/messages_webauthn.rs delete mode 100644 wallet/trezor-client/src/protos/mod.rs delete mode 100644 wallet/trezor-client/src/transport/error.rs delete mode 100644 wallet/trezor-client/src/transport/mod.rs delete mode 100644 wallet/trezor-client/src/transport/protocol.rs delete mode 100644 wallet/trezor-client/src/transport/udp.rs delete mode 100644 wallet/trezor-client/src/transport/webusb.rs delete mode 100644 wallet/trezor-client/src/utils.rs diff --git a/Cargo.lock b/Cargo.lock index 70bf2d9ccc..2c4942ae2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1606,7 +1606,7 @@ dependencies = [ "serde_json", "serde_test", "serde_with", - "serial_test 3.1.1", + "serial_test", "serialization", "static_assertions", "strum", @@ -2062,19 +2062,6 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core 0.9.10", -] - [[package]] name = "data-encoding" version = "2.6.0" @@ -7133,20 +7120,6 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "serial_test" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" -dependencies = [ - "dashmap", - "futures", - "lazy_static", - "log", - "parking_lot 0.12.3", - "serial_test_derive 2.0.0", -] - [[package]] name = "serial_test" version = "3.1.1" @@ -7158,18 +7131,7 @@ dependencies = [ "once_cell", "parking_lot 0.12.3", "scc", - "serial_test_derive 3.1.1", -] - -[[package]] -name = "serial_test_derive" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", + "serial_test_derive", ] [[package]] @@ -8414,16 +8376,15 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.3" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer#aaf3552da31a9446e868c4fafb9ee740afac0c48" dependencies = [ "bitcoin", "byteorder", "hex", "protobuf", "rusb", - "serial_test 2.0.0", "thiserror", "tracing", - "tracing-subscriber", "unicode-normalization", ] diff --git a/Cargo.toml b/Cargo.toml index 384c0aa7c1..744407c547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,7 +77,6 @@ members = [ "wallet/wallet-rpc-daemon", # Wallet RPC daemon binary. "wallet/wallet-rpc-lib", # Wallet RPC definitions library. "wallet/wallet-test-node", # Node for wallet testing as a library. - "wallet/trezor-client", # Auto generated trezor client library from trezor firmware repo "wasm-wrappers", # WASM wrappers for various components. "wasm-wrappers/wasm-doc-gen", # WASM wrappers documentation generator. ] diff --git a/do_checks.sh b/do_checks.sh index 5066fb964e..70fb41a84a 100755 --- a/do_checks.sh +++ b/do_checks.sh @@ -28,6 +28,7 @@ cargo clippy --all-features --workspace --all-targets -- \ cargo clippy --all-features --workspace --lib --bins --examples -- \ -A clippy::all \ -D clippy::float_arithmetic \ + -D clippy::unwrap_used \ -D clippy::dbg_macro \ -D clippy::items_after_statements \ -D clippy::fallible_impl_from \ diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 3a3e3aa96b..95064c36c2 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -26,7 +26,7 @@ utils-networking = { path = "../utils/networking" } utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } -trezor-client = { path = "./trezor-client", features = ["bitcoin", "mintlayer"], optional = true } +trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer", features = ["bitcoin", "mintlayer"], optional = true } # trezor-client = { path = "../../trezor-firmware/rust/trezor-client", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } @@ -45,3 +45,4 @@ tempfile.workspace = true [features] trezor = ["dep:trezor-client", "wallet-types/trezor"] +trezor-emulator = [] diff --git a/wallet/trezor-client/.gitignore b/wallet/trezor-client/.gitignore deleted file mode 100644 index 2f7896d1d1..0000000000 --- a/wallet/trezor-client/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/ diff --git a/wallet/trezor-client/Cargo.toml b/wallet/trezor-client/Cargo.toml deleted file mode 100644 index b7bfa619f0..0000000000 --- a/wallet/trezor-client/Cargo.toml +++ /dev/null @@ -1,77 +0,0 @@ -[package] -name = "trezor-client" -# license.workspace = true -# version.workspace = true -# edition.workspace = true -# rust-version.workspace = true -version = "0.1.3" -authors = [ - "Piyush Kumar ", - "joshieDo ", - "DaniPopes <57450786+DaniPopes@users.noreply.github.com>", - "Roman Zeyde ", - "Steven Roose ", -] -license = "CC0-1.0" -homepage = "https://github.com/trezor/trezor-firmware/tree/master/rust/trezor-client" -# repository = "https://github.com/trezor/trezor-firmware" -description = "Client library for interfacing with Trezor hardware wallet devices" -keywords = ["ethereum", "bitcoin", "trezor", "wallet"] -categories = ["api-bindings", "cryptography::cryptocurrencies"] -readme = "README.md" -exclude = [".github/", "examples/", "scripts/", ".clippy.toml", ".gitignore", "rustfmt.toml"] -edition = "2021" -rust-version = "1.60" - -# [package.metadata.docs.rs] -# all-features = true -# rustdoc-args = ["--cfg", "docsrs"] - -# [workspace] -# members = ["build", "."] - -# [workspace.dependencies] -# # important: keep in sync -# protobuf = "=3.3.0" -# protobuf-codegen = "=3.3.0" - -[dependencies] -# important: keep in sync -protobuf = "=3.3" -# protobuf-codegen = "=3.3.0" -byteorder = "1.4" -rusb = "0.9" - -hex = { version = "0.4", default-features = false, features = ["std"] } -thiserror = "1.0" -tracing = "0.1" - -# bitcoin -bitcoin = { version = "0.31", optional = true } -unicode-normalization = { version = "0.1", optional = true } - -[dev-dependencies] -tracing-subscriber = "0.3" -serial_test = "2.0" - -[features] -default = ["bitcoin", "ethereum", "solana", "mintlayer"] -no_clippy = [] - - -# Client implementations -bitcoin = ["dep:bitcoin", "unicode-normalization"] -ethereum = [] - -# Just bindings to the Trezor protobufs -binance = [] -cardano = [] -eos = [] -monero = [] -nem = [] -ripple = [] -solana = [] -stellar = [] -tezos = [] -webauthn = [] -mintlayer = [] diff --git a/wallet/trezor-client/LICENSE b/wallet/trezor-client/LICENSE deleted file mode 100644 index 6ca207ef00..0000000000 --- a/wallet/trezor-client/LICENSE +++ /dev/null @@ -1,122 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. - diff --git a/wallet/trezor-client/README.md b/wallet/trezor-client/README.md deleted file mode 100644 index 0dc9820ade..0000000000 --- a/wallet/trezor-client/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# trezor-client - -[![Downloads][downloads-badge]][crates-io] -[![License][license-badge]][license-url] -[![CI Status][actions-badge]][actions-url] - -A fork of a [fork](https://github.com/romanz/rust-trezor-api) of a [library](https://github.com/stevenroose/rust-trezor-api) that provides a way to communicate with a Trezor T device from a Rust project. - -Previous iterations provided implementations for Bitcoin only. **This crate also provides an Ethereum interface**, mainly for use in [ethers-rs](https://github.com/gakonst/ethers-rs/). - -## Requirements - -**MSRV: 1.60** - -See the [Trezor guide](https://trezor.io/learn/a/os-requirements-for-trezor) on how to install and use the Trezor Suite app. - -Last tested with firmware v2.4.2. - -## Examples / Tests - -`cargo run --example features` - -## Features - -- `bitcoin` and `ethereum`: client implementation and full support; -- `cardano`, `monero`, `nem`, `ripple`, `stellar` and `tezos`: only protobuf bindings. - -## Credits - -- [Trezor](https://github.com/trezor/trezor-firmware) -- [joshieDo](https://github.com/joshieDo) -- [Piyush Kumar](https://github.com/wszdexdrf) -- [stevenroose](https://github.com/stevenroose) -- [romanz](https://github.com/romanz) -- [DaniPopes](https://github.com/DaniPopes) - -[downloads-badge]: https://img.shields.io/crates/d/trezor-client?style=for-the-badge&logo=rust -[crates-io]: https://crates.io/crates/trezor-client -[license-badge]: https://img.shields.io/badge/license-CC0--1.0-blue.svg?style=for-the-badge -[license-url]: https://github.com/trezor/trezor-firmware/blob/master/rust/trezor-client/LICENSE diff --git a/wallet/trezor-client/build/Cargo.toml b/wallet/trezor-client/build/Cargo.toml deleted file mode 100644 index 384591b7bd..0000000000 --- a/wallet/trezor-client/build/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "trezor-client-build" -version = "0.0.0" -description = "Builds Trezor protobuf bindings for trezor-client" -publish = false - -[dependencies] -protobuf-codegen.workspace = true diff --git a/wallet/trezor-client/build/README.md b/wallet/trezor-client/build/README.md deleted file mode 100644 index d78f14296e..0000000000 --- a/wallet/trezor-client/build/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# trezor-client-build - -Simple build script for [`trezor-client`](../). -Builds the Rust bindings for the [Trezor protobufs](../../../common/protob/). - -This crate is separate from the main crate to avoid dependencies on the -protobuf compiler (`protoc`) and the `protobuf-codegen` crate in `trezor-client`. diff --git a/wallet/trezor-client/build/src/main.rs b/wallet/trezor-client/build/src/main.rs deleted file mode 100644 index 752edf14e6..0000000000 --- a/wallet/trezor-client/build/src/main.rs +++ /dev/null @@ -1,34 +0,0 @@ -use std::{ - fs, - path::{Path, PathBuf}, -}; - -fn main() { - let proto_path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../../common/protob"); - let proto_dir = Path::new(proto_path).canonicalize().unwrap(); - let protos: Vec = fs::read_dir(&proto_dir) - .unwrap() - .filter_map(|entry| { - let entry = entry.unwrap(); - let path = entry.path(); - if path.is_file() && path.extension().map_or(false, |ext| ext == "proto") { - Some(path) - } else { - None - } - }) - .collect(); - - let out_path = std::env::args().skip(1).next().expect("No output directory given"); - let out_dir = PathBuf::from(out_path); - fs::create_dir_all(&out_dir).expect("Failed to create output directory"); - protobuf_codegen::Codegen::new() - .protoc() - .includes(&[proto_dir]) - .inputs(protos) - .out_dir(&out_dir) - .run_from_script(); - - // Remove mod.rs because we want to feature-gate some modules manually - fs::remove_file(out_dir.join("mod.rs")).expect("Failed to remove mod.rs"); -} diff --git a/wallet/trezor-client/rustfmt.toml b/wallet/trezor-client/rustfmt.toml deleted file mode 100644 index 422c4f323c..0000000000 --- a/wallet/trezor-client/rustfmt.toml +++ /dev/null @@ -1,11 +0,0 @@ -reorder_imports = true -imports_granularity = "Crate" -use_small_heuristics = "Max" -comment_width = 100 -wrap_comments = true -binop_separator = "Back" -trailing_comma = "Vertical" -trailing_semicolon = false -use_field_init_shorthand = true - -ignore = ["src/protos/messages_*"] diff --git a/wallet/trezor-client/scripts/build_messages b/wallet/trezor-client/scripts/build_messages deleted file mode 100755 index 8e0da67d66..0000000000 --- a/wallet/trezor-client/scripts/build_messages +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python3 - -# Generates the `trezor_message_impl!` macro calls for the `src/messages/mod.rs` file. - -from os import path - -# Path to the `messages.proto` file -PATH = path.abspath(path.join(__file__, "../../../../common/protob/messages.proto")) -# Prefix of the enum variants -PREFIX = "MessageType_" -# Mapping of block name to feature name -FEATURES = { - # no features - "Management": "default", - "Bootloader": "default", - "Crypto": "default", - "Debug": "default", - # - "Bitcoin": "bitcoin", - "Ethereum": "ethereum", - # - "Binance": "binance", - "Cardano": "cardano", - "EOS": "eos", - "Monero": "monero", - "NEM": "nem", - "Ripple": "ripple", - "Solana": "solana", - "Stellar": "stellar", - "Tezos": "tezos", - "WebAuthn": "webauthn", - "Mintlayer": "mintlayer", -} -MACRO = "trezor_message_impl" -INDENT = " " - - -def main(): - blocks = get_blocks() - features = {} - defaults = [] - for block, variants in blocks.items(): - f = FEATURES.get(block) - if not f or f == "default": - defaults.extend(variants) - else: - vs = features.get(f) - if vs: - vs.extend(variants) - else: - features[f] = variants - - items = list(features.items()) - items.sort() - - out = write_block(defaults) - for feature, variants in items: - if variants and feature: - out += "\n" - out += write_block(variants, feature) - print(out.strip()) - - -# Parse feature blocks based on comments in the `messages.proto` file -def get_blocks() -> dict[str, list[str]]: - blocks = {} - current_block = "" - with open(PATH, "r") as file: - in_enum = False - in_block_comment = False - for line in file: - line = line.strip() - - if "/*" in line: - in_block_comment = True - if "*/" in line: - in_block_comment = False - if in_block_comment: - continue - - if line.startswith("enum MessageType {"): - in_enum = True - continue - if in_enum: - if line == "}": - break - if line.startswith("//"): - comment = line.removeprefix("//").strip() - if comment[0].isupper() and len(comment.split(" ")) == 1: - current_block = comment - blocks[current_block] = [] - elif line.startswith(PREFIX): - blocks[current_block].append(line.split(" ")[0]) - return blocks - - -# Writes a macro block -def write_block(variants: list[str], feature: str = "") -> str: - s = "" - if feature: - s += f'#[cfg(feature = "{feature}")]\n' - s += f"{MACRO}! {{\n" - for variant in variants: - s += f"{INDENT}{variant.removeprefix(PREFIX)} => {variant},\n" - s += "}\n" - return s - - -if __name__ == "__main__": - main() diff --git a/wallet/trezor-client/scripts/build_protos b/wallet/trezor-client/scripts/build_protos deleted file mode 100755 index b7a4a97a79..0000000000 --- a/wallet/trezor-client/scripts/build_protos +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -# Generates src/protos/generated and src/messages/generated.rs - -crate_root="$(dirname "$(dirname "$(realpath "$0")")")" - -protos="$crate_root/src/protos/generated" -messages="$crate_root/src/messages/generated.rs" - -if [ "$1" = "--check" ]; then - protos_out=$(mktemp -d) - messages_out=$(mktemp) -else - protos_out=$protos - messages_out=$messages -fi - -cargo run --manifest-path "$crate_root/build/Cargo.toml" -- "$protos_out" - -"$crate_root/scripts/build_messages" > "$messages_out" -rustfmt "$messages_out" - -if [ "$1" = "--check" ]; then - set -e - diff -ur "$protos_out" "$protos" - diff -ur "$messages_out" "$messages" -fi diff --git a/wallet/trezor-client/src/client/bitcoin.rs b/wallet/trezor-client/src/client/bitcoin.rs deleted file mode 100644 index ed3b204a30..0000000000 --- a/wallet/trezor-client/src/client/bitcoin.rs +++ /dev/null @@ -1,95 +0,0 @@ -use super::{Trezor, TrezorResponse}; -use crate::{error::Result, flows::sign_tx::SignTxProgress, protos, utils}; -use bitcoin::{ - address::NetworkUnchecked, bip32, network::Network, psbt, - secp256k1::ecdsa::RecoverableSignature, Address, -}; - -pub use crate::protos::InputScriptType; - -impl Trezor { - pub fn get_public_key( - &mut self, - path: &bip32::DerivationPath, - script_type: InputScriptType, - network: Network, - show_display: bool, - ) -> Result> { - let mut req = protos::GetPublicKey::new(); - req.address_n = utils::convert_path(path); - req.set_show_display(show_display); - req.set_coin_name(utils::coin_name(network)?); - req.set_script_type(script_type); - self.call(req, Box::new(|_, m| Ok(m.xpub().parse()?))) - } - - //TODO(stevenroose) multisig - pub fn get_address( - &mut self, - path: &bip32::DerivationPath, - script_type: InputScriptType, - network: Network, - show_display: bool, - ) -> Result> { - let mut req = protos::GetAddress::new(); - req.address_n = utils::convert_path(path); - req.set_coin_name(utils::coin_name(network)?); - req.set_show_display(show_display); - req.set_script_type(script_type); - self.call(req, Box::new(|_, m| parse_address(m.address()))) - } - - pub fn sign_tx( - &mut self, - psbt: &psbt::Psbt, - network: Network, - ) -> Result, protos::TxRequest>> { - let tx = &psbt.unsigned_tx; - let mut req = protos::SignTx::new(); - req.set_inputs_count(tx.input.len() as u32); - req.set_outputs_count(tx.output.len() as u32); - req.set_coin_name(utils::coin_name(network)?); - req.set_version(tx.version.0 as u32); - req.set_lock_time(tx.lock_time.to_consensus_u32()); - self.call(req, Box::new(|c, m| Ok(SignTxProgress::new(c, m)))) - } - - pub fn sign_message( - &mut self, - message: String, - path: &bip32::DerivationPath, - script_type: InputScriptType, - network: Network, - ) -> Result> { - let mut req = protos::SignMessage::new(); - req.address_n = utils::convert_path(path); - // Normalize to Unicode NFC. - let msg_bytes = nfc_normalize(&message).into_bytes(); - req.set_message(msg_bytes); - req.set_coin_name(utils::coin_name(network)?); - req.set_script_type(script_type); - self.call( - req, - Box::new(|_, m| { - let address = parse_address(m.address())?; - let signature = utils::parse_recoverable_signature(m.signature())?; - Ok((address, signature)) - }), - ) - } -} - -fn parse_address(s: &str) -> Result

{ - let address = s.parse::>()?; - Ok(address.assume_checked()) -} - -// Modified from: -// https://github.com/rust-lang/rust/blob/2a8221dbdfd180a2d56d4b0089f4f3952d8c2bcd/compiler/rustc_parse/src/lexer/mod.rs#LL754C5-L754C5 -fn nfc_normalize(string: &str) -> String { - use unicode_normalization::{is_nfc_quick, IsNormalized, UnicodeNormalization}; - match is_nfc_quick(string.chars()) { - IsNormalized::Yes => string.to_string(), - _ => string.chars().nfc().collect::(), - } -} diff --git a/wallet/trezor-client/src/client/common.rs b/wallet/trezor-client/src/client/common.rs deleted file mode 100644 index 897f849704..0000000000 --- a/wallet/trezor-client/src/client/common.rs +++ /dev/null @@ -1,247 +0,0 @@ -use crate::{ - error::{Error, Result}, - messages::TrezorMessage, - protos, Trezor, -}; -use std::fmt; - -// Some types with raw protos that we use in the public interface so they have to be exported. -pub use protos::{ - button_request::ButtonRequestType, pin_matrix_request::PinMatrixRequestType, Features, -}; - -#[cfg(feature = "bitcoin")] -pub use protos::InputScriptType; - -/// The different options for the number of words in a seed phrase. -pub enum WordCount { - W12 = 12, - W18 = 18, - W24 = 24, -} - -/// The different types of user interactions the Trezor device can request. -#[derive(PartialEq, Eq, Clone, Debug)] -pub enum InteractionType { - Button, - PinMatrix, - Passphrase, - PassphraseState, -} - -//TODO(stevenroose) should this be FnOnce and put in an FnBox? -/// Function to be passed to the `Trezor.call` method to process the Trezor response message into a -/// general-purpose type. -pub type ResultHandler<'a, T, R> = dyn Fn(&'a mut Trezor, R) -> Result; - -/// A button request message sent by the device. -pub struct ButtonRequest<'a, T, R: TrezorMessage> { - pub message: protos::ButtonRequest, - pub client: &'a mut Trezor, - pub result_handler: Box>, -} - -impl<'a, T, R: TrezorMessage> fmt::Debug for ButtonRequest<'a, T, R> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(&self.message, f) - } -} - -impl<'a, T, R: TrezorMessage> ButtonRequest<'a, T, R> { - /// The type of button request. - pub fn request_type(&self) -> ButtonRequestType { - self.message.code() - } - - /// Ack the request and get the next message from the device. - pub fn ack(self) -> Result> { - let req = protos::ButtonAck::new(); - self.client.call(req, self.result_handler) - } -} - -/// A PIN matrix request message sent by the device. -pub struct PinMatrixRequest<'a, T, R: TrezorMessage> { - pub message: protos::PinMatrixRequest, - pub client: &'a mut Trezor, - pub result_handler: Box>, -} - -impl<'a, T, R: TrezorMessage> fmt::Debug for PinMatrixRequest<'a, T, R> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(&self.message, f) - } -} - -impl<'a, T, R: TrezorMessage> PinMatrixRequest<'a, T, R> { - /// The type of PIN matrix request. - pub fn request_type(&self) -> PinMatrixRequestType { - self.message.type_() - } - - /// Ack the request with a PIN and get the next message from the device. - pub fn ack_pin(self, pin: String) -> Result> { - let mut req = protos::PinMatrixAck::new(); - req.set_pin(pin); - self.client.call(req, self.result_handler) - } -} - -/// A passphrase request message sent by the device. -pub struct PassphraseRequest<'a, T, R: TrezorMessage> { - pub message: protos::PassphraseRequest, - pub client: &'a mut Trezor, - pub result_handler: Box>, -} - -impl<'a, T, R: TrezorMessage> fmt::Debug for PassphraseRequest<'a, T, R> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(&self.message, f) - } -} - -impl<'a, T, R: TrezorMessage> PassphraseRequest<'a, T, R> { - /// Check whether the use is supposed to enter the passphrase on the device or not. - pub fn on_device(&self) -> bool { - self.message._on_device() - } - - /// Ack the request with a passphrase and get the next message from the device. - pub fn ack_passphrase(self, passphrase: String) -> Result> { - let mut req = protos::PassphraseAck::new(); - req.set_passphrase(passphrase); - self.client.call(req, self.result_handler) - } - - /// Ack the request without a passphrase to let the user enter it on the device - /// and get the next message from the device. - pub fn ack(self, on_device: bool) -> Result> { - let mut req = protos::PassphraseAck::new(); - if on_device { - req.set_on_device(on_device); - } - self.client.call(req, self.result_handler) - } -} - -/// A response from a Trezor device. On every message exchange, instead of the expected/desired -/// response, the Trezor can ask for some user interaction, or can send a failure. -#[derive(Debug)] -pub enum TrezorResponse<'a, T, R: TrezorMessage> { - Ok(T), - Failure(protos::Failure), - ButtonRequest(ButtonRequest<'a, T, R>), - PinMatrixRequest(PinMatrixRequest<'a, T, R>), - PassphraseRequest(PassphraseRequest<'a, T, R>), - //TODO(stevenroose) This should be taken out of this enum and intrinsically attached to the - // PassphraseRequest variant. However, it's currently impossible to do this. It might be - // possible to do with FnBox (currently nightly) or when Box becomes possible. -} - -impl<'a, T, R: TrezorMessage> fmt::Display for TrezorResponse<'a, T, R> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - // TODO(stevenroose) should we make T: Debug? - TrezorResponse::Ok(ref _m) => f.write_str("Ok"), - TrezorResponse::Failure(ref m) => write!(f, "Failure: {:?}", m), - TrezorResponse::ButtonRequest(ref r) => write!(f, "ButtonRequest: {:?}", r), - TrezorResponse::PinMatrixRequest(ref r) => write!(f, "PinMatrixRequest: {:?}", r), - TrezorResponse::PassphraseRequest(ref r) => write!(f, "PassphraseRequest: {:?}", r), - } - } -} - -impl<'a, T, R: TrezorMessage> TrezorResponse<'a, T, R> { - /// Get the actual `Ok` response value or an error if not `Ok`. - pub fn ok(self) -> Result { - match self { - TrezorResponse::Ok(m) => Ok(m), - TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), - TrezorResponse::ButtonRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) - } - TrezorResponse::PinMatrixRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::PinMatrix)) - } - TrezorResponse::PassphraseRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::Passphrase)) - } - } - } - - /// Get the button request object or an error if not `ButtonRequest`. - pub fn button_request(self) -> Result> { - match self { - TrezorResponse::ButtonRequest(r) => Ok(r), - TrezorResponse::Ok(_) => Err(Error::UnexpectedMessageType(R::MESSAGE_TYPE)), - TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), - TrezorResponse::PinMatrixRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::PinMatrix)) - } - TrezorResponse::PassphraseRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::Passphrase)) - } - } - } - - /// Get the PIN matrix request object or an error if not `PinMatrixRequest`. - pub fn pin_matrix_request(self) -> Result> { - match self { - TrezorResponse::PinMatrixRequest(r) => Ok(r), - TrezorResponse::Ok(_) => Err(Error::UnexpectedMessageType(R::MESSAGE_TYPE)), - TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), - TrezorResponse::ButtonRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) - } - TrezorResponse::PassphraseRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::Passphrase)) - } - } - } - - /// Get the passphrase request object or an error if not `PassphraseRequest`. - pub fn passphrase_request(self) -> Result> { - match self { - TrezorResponse::PassphraseRequest(r) => Ok(r), - TrezorResponse::Ok(_) => Err(Error::UnexpectedMessageType(R::MESSAGE_TYPE)), - TrezorResponse::Failure(m) => Err(Error::FailureResponse(m)), - TrezorResponse::ButtonRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::Button)) - } - TrezorResponse::PinMatrixRequest(_) => { - Err(Error::UnexpectedInteractionRequest(InteractionType::PinMatrix)) - } - } - } -} - -pub fn handle_interaction(resp: TrezorResponse<'_, T, R>) -> Result { - match resp { - TrezorResponse::Ok(res) => Ok(res), - TrezorResponse::Failure(_) => resp.ok(), // assering ok() returns the failure error - TrezorResponse::ButtonRequest(req) => handle_interaction(req.ack()?), - TrezorResponse::PinMatrixRequest(_) => Err(Error::UnsupportedNetwork), - TrezorResponse::PassphraseRequest(req) => handle_interaction({ - let on_device = req.on_device(); - req.ack(!on_device)? - }), - } -} - -/// When resetting the device, it will ask for entropy to aid key generation. -pub struct EntropyRequest<'a> { - pub client: &'a mut Trezor, -} - -impl<'a> EntropyRequest<'a> { - /// Provide exactly 32 bytes or entropy. - pub fn ack_entropy(self, entropy: Vec) -> Result> { - if entropy.len() != 32 { - return Err(Error::InvalidEntropy); - } - - let mut req = protos::EntropyAck::new(); - req.set_entropy(entropy); - self.client.call(req, Box::new(|_, _| Ok(()))) - } -} diff --git a/wallet/trezor-client/src/client/ethereum.rs b/wallet/trezor-client/src/client/ethereum.rs deleted file mode 100644 index 365c124401..0000000000 --- a/wallet/trezor-client/src/client/ethereum.rs +++ /dev/null @@ -1,167 +0,0 @@ -use super::{handle_interaction, Trezor}; -use crate::{ - error::Result, - protos::{self, ethereum_sign_tx_eip1559::EthereumAccessList, EthereumTxRequest}, - Error, -}; - -/// Access list item. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct AccessListItem { - /// Accessed address - pub address: String, - /// Accessed storage keys - pub storage_keys: Vec>, -} - -/// An ECDSA signature. -#[derive(Debug, Clone, PartialEq, Eq, Copy)] -pub struct Signature { - /// R value - pub r: [u8; 32], - /// S Value - pub s: [u8; 32], - /// V value in 'Electrum' notation. - pub v: u64, -} - -impl Trezor { - // ETHEREUM - pub fn ethereum_get_address(&mut self, path: Vec) -> Result { - let mut req = protos::EthereumGetAddress::new(); - req.address_n = path; - let address = handle_interaction( - self.call(req, Box::new(|_, m: protos::EthereumAddress| Ok(m.address().into())))?, - )?; - Ok(address) - } - - pub fn ethereum_sign_message(&mut self, message: Vec, path: Vec) -> Result { - let mut req = protos::EthereumSignMessage::new(); - req.address_n = path; - req.set_message(message); - let signature = handle_interaction(self.call( - req, - Box::new(|_, m: protos::EthereumMessageSignature| { - let signature = m.signature(); - if signature.len() != 65 { - return Err(Error::MalformedSignature); - } - let r = signature[0..32].try_into().unwrap(); - let s = signature[32..64].try_into().unwrap(); - let v = signature[64] as u64; - Ok(Signature { r, s, v }) - }), - )?)?; - - Ok(signature) - } - - #[allow(clippy::too_many_arguments)] - pub fn ethereum_sign_tx( - &mut self, - path: Vec, - nonce: Vec, - gas_price: Vec, - gas_limit: Vec, - to: String, - value: Vec, - data: Vec, - chain_id: Option, - ) -> Result { - let mut req = protos::EthereumSignTx::new(); - let mut data = data; - - req.address_n = path; - req.set_nonce(nonce); - req.set_gas_price(gas_price); - req.set_gas_limit(gas_limit); - req.set_value(value); - if let Some(chain_id) = chain_id { - req.set_chain_id(chain_id); - } - req.set_to(to); - - req.set_data_length(data.len() as u32); - req.set_data_initial_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); - - let mut resp = - handle_interaction(self.call(req, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?)?; - - while resp.data_length() > 0 { - let mut ack = protos::EthereumTxAck::new(); - ack.set_data_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); - - resp = self.call(ack, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?.ok()?; - } - - convert_signature(&resp, chain_id) - } - - #[allow(clippy::too_many_arguments)] - pub fn ethereum_sign_eip1559_tx( - &mut self, - path: Vec, - nonce: Vec, - gas_limit: Vec, - to: String, - value: Vec, - data: Vec, - chain_id: Option, - max_gas_fee: Vec, - max_priority_fee: Vec, - access_list: Vec, - ) -> Result { - let mut req = protos::EthereumSignTxEIP1559::new(); - let mut data = data; - - req.address_n = path; - req.set_nonce(nonce); - req.set_max_gas_fee(max_gas_fee); - req.set_max_priority_fee(max_priority_fee); - req.set_gas_limit(gas_limit); - req.set_value(value); - if let Some(chain_id) = chain_id { - req.set_chain_id(chain_id); - } - req.set_to(to); - - if !access_list.is_empty() { - req.access_list = access_list - .into_iter() - .map(|item| EthereumAccessList { - address: Some(item.address), - storage_keys: item.storage_keys, - ..Default::default() - }) - .collect(); - } - - req.set_data_length(data.len() as u32); - req.set_data_initial_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); - - let mut resp = - handle_interaction(self.call(req, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?)?; - - while resp.data_length() > 0 { - let mut ack = protos::EthereumTxAck::new(); - ack.set_data_chunk(data.splice(..std::cmp::min(1024, data.len()), []).collect()); - - resp = self.call(ack, Box::new(|_, m: protos::EthereumTxRequest| Ok(m)))?.ok()? - } - - convert_signature(&resp, chain_id) - } -} - -fn convert_signature(resp: &EthereumTxRequest, chain_id: Option) -> Result { - let mut v = resp.signature_v() as u64; - if let Some(chain_id) = chain_id { - if v <= 1 { - v = v + 2 * chain_id + 35; - } - } - let r = resp.signature_r().try_into().map_err(|_| Error::MalformedSignature)?; - let s = resp.signature_r().try_into().map_err(|_| Error::MalformedSignature)?; - Ok(Signature { r, s, v }) -} diff --git a/wallet/trezor-client/src/client/mintlayer.rs b/wallet/trezor-client/src/client/mintlayer.rs deleted file mode 100644 index 0cdd93b34c..0000000000 --- a/wallet/trezor-client/src/client/mintlayer.rs +++ /dev/null @@ -1,153 +0,0 @@ -use std::collections::BTreeMap; - -use bitcoin::secp256k1; -use protobuf::MessageField; - -use super::Trezor; -use crate::{ - error::Result, - protos::{ - self, mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper, - mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper, - mintlayer_tx_request::MintlayerRequestType, MintlayerTxAckOutput, MintlayerTxAckUtxoInput, - MintlayerTxInput, MintlayerTxOutput, - }, - Error, -}; - -/// A chain code -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct ChainCode(pub [u8; 32]); - -pub struct XPub { - pub public_key: secp256k1::PublicKey, - pub chain_code: ChainCode, -} - -#[derive(Debug)] -pub struct MintlayerSignature { - pub signature: Vec, - pub multisig_idx: Option, -} - -impl MintlayerSignature { - fn new(signature: Vec, multisig_idx: Option) -> Self { - Self { signature, multisig_idx } - } -} - -impl Trezor { - // Mintlayer - pub fn mintlayer_get_public_key(&mut self, path: Vec) -> Result { - let mut req = protos::MintlayerGetPublicKey::new(); - req.address_n = path; - self.call::<_, _, protos::MintlayerPublicKey>( - req, - Box::new(|_, m| { - Ok(XPub { - public_key: secp256k1::PublicKey::from_slice(m.public_key())?, - chain_code: ChainCode( - m.chain_code().try_into().map_err(|_| Error::InvalidChaincodeFromDevice)?, - ), - }) - }), - )? - .ok() - } - - pub fn mintlayer_sign_message( - &mut self, - path: Vec, - address: String, - message: Vec, - ) -> Result> { - let mut req = protos::MintlayerSignMessage::new(); - req.address_n = path; - req.set_message(message); - req.set_address(address); - let msg = self.call::<_, _, protos::MessageSignature>( - req, - Box::new(|_, m| Ok(m.signature().to_vec())), - )?; - msg.button_request()?.ack()?.button_request()?.ack()?.ok() - } - - pub fn mintlayer_sign_tx( - &mut self, - inputs: Vec, - outputs: Vec, - utxos: BTreeMap<[u8; 32], BTreeMap>, - ) -> Result>> { - let mut req = protos::MintlayerSignTx::new(); - req.set_version(1); - req.set_inputs_count(inputs.len() as u32); - req.set_outputs_count(outputs.len() as u32); - - let mut msg = self.call::<_, _, protos::MintlayerTxRequest>(req, Box::new(|_, m| Ok(m)))?; - let mut should_ack_button = 0; - loop { - if should_ack_button > 0 { - msg = msg.button_request()?.ack()?; - should_ack_button -= 1; - continue; - } - - let response = msg.ok()?; - match response.request_type() { - MintlayerRequestType::TXINPUT => { - let mut req = MintlayerTxAckInputWrapper::new(); - req.input = MessageField::from_option( - inputs.get(response.details.request_index() as usize).cloned(), - ); - let mut req2 = MintlayerTxAckUtxoInput::new(); - req2.tx = MessageField::some(req); - msg = self - .call::<_, _, protos::MintlayerTxRequest>(req2, Box::new(|_, m| Ok(m)))?; - } - MintlayerRequestType::TXOUTPUT => { - let mut req = MintlayerTxAckOutputWrapper::new(); - if response.details.has_tx_hash() { - let tx_id: [u8; 32] = response - .details - .tx_hash() - .try_into() - .map_err(|_| Error::InvalidChaincodeFromDevice)?; - let out = utxos - .get(&tx_id) - .and_then(|tx| tx.get(&response.details.request_index())); - req.output = MessageField::from_option(out.cloned()); - } else { - req.output = MessageField::from_option( - outputs.get(response.details.request_index() as usize).cloned(), - ); - should_ack_button += 2; - if response.details.request_index() as usize == outputs.len() - 1 { - should_ack_button += 1; - } - } - let mut req2 = MintlayerTxAckOutput::new(); - req2.tx = MessageField::some(req); - msg = self - .call::<_, _, protos::MintlayerTxRequest>(req2, Box::new(|_, m| Ok(m)))?; - } - MintlayerRequestType::TXMETA => { - return Err(Error::MalformedMintlayerTxRequest(response)) - } - MintlayerRequestType::TXFINISHED => { - return Ok(response - .serialized - .iter() - .map(|s| { - s.signatures - .iter() - .map(|s| { - MintlayerSignature::new(s.signature().to_vec(), s.multisig_idx) - }) - .collect() - }) - .collect()) - } - } - } - } -} diff --git a/wallet/trezor-client/src/client/mod.rs b/wallet/trezor-client/src/client/mod.rs deleted file mode 100644 index 4ef5e135e1..0000000000 --- a/wallet/trezor-client/src/client/mod.rs +++ /dev/null @@ -1,262 +0,0 @@ -#[cfg(feature = "bitcoin")] -mod bitcoin; -#[cfg(feature = "bitcoin")] -pub use self::bitcoin::*; - -#[cfg(feature = "ethereum")] -mod ethereum; -#[cfg(feature = "ethereum")] -pub use ethereum::*; - -#[cfg(feature = "solana")] -mod solana; -// #[cfg(feature = "solana")] -// pub use solana::*; - -pub mod common; -pub use common::*; - -pub mod mintlayer; -pub use mintlayer::*; - -use crate::{ - error::{Error, Result}, - messages::TrezorMessage, - protos, - protos::MessageType::*, - transport::{ProtoMessage, Transport}, - Model, -}; -use protobuf::MessageField; -use tracing::{debug, trace}; - -/// A Trezor client. -pub struct Trezor { - model: Model, - // Cached features for later inspection. - features: Option, - transport: Box, -} - -/// Create a new Trezor instance with the given transport. -pub fn trezor_with_transport(model: Model, transport: Box) -> Trezor { - Trezor { model, transport, features: None } -} - -impl Trezor { - /// Get the model of the Trezor device. - pub fn model(&self) -> Model { - self.model - } - - /// Get the features of the Trezor device. - pub fn features(&self) -> Option<&protos::Features> { - self.features.as_ref() - } - - /// Sends a message and returns the raw ProtoMessage struct that was responded by the device. - /// This method is only exported for users that want to expand the features of this library - /// f.e. for supporting additional coins etc. - pub fn call_raw(&mut self, message: S) -> Result { - let proto_msg = ProtoMessage(S::MESSAGE_TYPE, message.write_to_bytes()?); - self.transport.write_message(proto_msg).map_err(Error::TransportSendMessage)?; - self.transport.read_message().map_err(Error::TransportReceiveMessage) - } - - /// Sends a message and returns a TrezorResponse with either the expected response message, - /// a failure or an interaction request. - /// This method is only exported for users that want to expand the features of this library - /// f.e. for supporting additional coins etc. - pub fn call<'a, T, S: TrezorMessage, R: TrezorMessage>( - &'a mut self, - message: S, - result_handler: Box>, - ) -> Result> { - trace!("Sending {:?} msg: {:?}", S::MESSAGE_TYPE, message); - let resp = self.call_raw(message)?; - if resp.message_type() == R::MESSAGE_TYPE { - let resp_msg = resp.into_message()?; - trace!("Received {:?} msg: {:?}", R::MESSAGE_TYPE, resp_msg); - Ok(TrezorResponse::Ok(result_handler(self, resp_msg)?)) - } else { - match resp.message_type() { - MessageType_Failure => { - let fail_msg = resp.into_message()?; - debug!("Received failure: {:?}", fail_msg); - Ok(TrezorResponse::Failure(fail_msg)) - } - MessageType_ButtonRequest => { - let req_msg = resp.into_message()?; - trace!("Received ButtonRequest: {:?}", req_msg); - Ok(TrezorResponse::ButtonRequest(ButtonRequest { - message: req_msg, - client: self, - result_handler, - })) - } - MessageType_PinMatrixRequest => { - let req_msg = resp.into_message()?; - trace!("Received PinMatrixRequest: {:?}", req_msg); - Ok(TrezorResponse::PinMatrixRequest(PinMatrixRequest { - message: req_msg, - client: self, - result_handler, - })) - } - MessageType_PassphraseRequest => { - let req_msg = resp.into_message()?; - trace!("Received PassphraseRequest: {:?}", req_msg); - Ok(TrezorResponse::PassphraseRequest(PassphraseRequest { - message: req_msg, - client: self, - result_handler, - })) - } - mtype => { - debug!( - "Received unexpected msg type: {:?}; raw msg: {}", - mtype, - hex::encode(resp.into_payload()) - ); - Err(Error::UnexpectedMessageType(mtype)) - } - } - } - } - - pub fn init_device(&mut self, session_id: Option>) -> Result<()> { - let features = self.initialize(session_id)?.ok()?; - self.features = Some(features); - Ok(()) - } - - pub fn initialize( - &mut self, - session_id: Option>, - ) -> Result> { - let mut req = protos::Initialize::new(); - if let Some(session_id) = session_id { - req.set_session_id(session_id); - } - self.call(req, Box::new(|_, m| Ok(m))) - } - - pub fn ping(&mut self, message: &str) -> Result> { - let mut req = protos::Ping::new(); - req.set_message(message.to_owned()); - self.call(req, Box::new(|_, _| Ok(()))) - } - - pub fn change_pin(&mut self, remove: bool) -> Result> { - let mut req = protos::ChangePin::new(); - req.set_remove(remove); - self.call(req, Box::new(|_, _| Ok(()))) - } - - pub fn wipe_device(&mut self) -> Result> { - let req = protos::WipeDevice::new(); - self.call(req, Box::new(|_, _| Ok(()))) - } - - pub fn recover_device( - &mut self, - word_count: WordCount, - passphrase_protection: bool, - pin_protection: bool, - label: String, - dry_run: bool, - ) -> Result> { - let mut req = protos::RecoveryDevice::new(); - req.set_word_count(word_count as u32); - req.set_passphrase_protection(passphrase_protection); - req.set_pin_protection(pin_protection); - req.set_label(label); - req.set_enforce_wordlist(true); - req.set_dry_run(dry_run); - req.set_type( - protos::recovery_device::RecoveryDeviceType::RecoveryDeviceType_ScrambledWords, - ); - //TODO(stevenroose) support languages - req.set_language("english".to_owned()); - self.call(req, Box::new(|_, _| Ok(()))) - } - - #[allow(clippy::too_many_arguments)] - pub fn reset_device( - &mut self, - display_random: bool, - strength: usize, - passphrase_protection: bool, - pin_protection: bool, - label: String, - skip_backup: bool, - no_backup: bool, - ) -> Result, protos::EntropyRequest>> { - let mut req = protos::ResetDevice::new(); - req.set_display_random(display_random); - req.set_strength(strength as u32); - req.set_passphrase_protection(passphrase_protection); - req.set_pin_protection(pin_protection); - req.set_label(label); - req.set_skip_backup(skip_backup); - req.set_no_backup(no_backup); - self.call(req, Box::new(|c, _| Ok(EntropyRequest { client: c }))) - } - - pub fn backup(&mut self) -> Result> { - let req = protos::BackupDevice::new(); - self.call(req, Box::new(|_, _| Ok(()))) - } - - //TODO(stevenroose) support U2F stuff? currently ignored all - - pub fn apply_settings( - &mut self, - label: Option, - use_passphrase: Option, - homescreen: Option>, - auto_lock_delay_ms: Option, - ) -> Result> { - let mut req = protos::ApplySettings::new(); - if let Some(label) = label { - req.set_label(label); - } - if let Some(use_passphrase) = use_passphrase { - req.set_use_passphrase(use_passphrase); - } - if let Some(homescreen) = homescreen { - req.set_homescreen(homescreen); - } - if let Some(auto_lock_delay_ms) = auto_lock_delay_ms { - req.set_auto_lock_delay_ms(auto_lock_delay_ms as u32); - } - self.call(req, Box::new(|_, _| Ok(()))) - } - - pub fn sign_identity( - &mut self, - identity: protos::IdentityType, - digest: Vec, - curve: String, - ) -> Result, protos::SignedIdentity>> { - let mut req = protos::SignIdentity::new(); - req.identity = MessageField::some(identity); - req.set_challenge_hidden(digest); - req.set_challenge_visual("".to_owned()); - req.set_ecdsa_curve_name(curve); - self.call(req, Box::new(|_, m| Ok(m.signature().to_owned()))) - } - - pub fn get_ecdh_session_key( - &mut self, - identity: protos::IdentityType, - peer_public_key: Vec, - curve: String, - ) -> Result> { - let mut req = protos::GetECDHSessionKey::new(); - req.identity = MessageField::some(identity); - req.set_peer_public_key(peer_public_key); - req.set_ecdsa_curve_name(curve); - self.call(req, Box::new(|_, m| Ok(m))) - } -} diff --git a/wallet/trezor-client/src/client/solana.rs b/wallet/trezor-client/src/client/solana.rs deleted file mode 100644 index 15e3358e84..0000000000 --- a/wallet/trezor-client/src/client/solana.rs +++ /dev/null @@ -1,15 +0,0 @@ -use super::{handle_interaction, Trezor}; -use crate::{error::Result, protos}; - -impl Trezor { - // SOLANA - pub fn solana_get_address(&mut self, path: Vec) -> Result { - let mut req = protos::SolanaGetAddress::new(); - req.address_n = path; - req.show_display = Some(true); - let address = handle_interaction( - self.call(req, Box::new(|_, m: protos::SolanaAddress| Ok(m.address().into())))?, - )?; - Ok(address) - } -} diff --git a/wallet/trezor-client/src/error.rs b/wallet/trezor-client/src/error.rs deleted file mode 100644 index eee7258784..0000000000 --- a/wallet/trezor-client/src/error.rs +++ /dev/null @@ -1,113 +0,0 @@ -//! # Error Handling - -use crate::{client::InteractionType, protos, transport::error::Error as TransportError}; - -/// Trezor result type. Aliased to [`std::result::Result`] with the error type -/// set to [`Error`]. -pub type Result = std::result::Result; - -/// Trezor error. -#[derive(Debug, thiserror::Error)] -pub enum Error { - /// Less than one device was plugged in. - #[error("Trezor device not found")] - NoDeviceFound, - /// More than one device was plugged in. - #[error("multiple Trezor devices found")] - DeviceNotUnique, - /// The device returned an invalid signature. - #[error("device returned invalid signature")] - MalformedSignature, - /// Transport error connecting to device. - #[error("transport connect: {0}")] - TransportConnect(#[source] TransportError), - /// Transport error while beginning a session. - #[error("transport beginning session: {0}")] - TransportBeginSession(#[source] TransportError), - /// Transport error while ending a session. - #[error("transport ending session: {0}")] - TransportEndSession(#[source] TransportError), - /// Transport error while sending a message. - #[error("transport sending message: {0}")] - TransportSendMessage(#[source] TransportError), - /// Transport error while receiving a message. - #[error("transport receiving message: {0}")] - TransportReceiveMessage(#[source] TransportError), - /// Received an unexpected message type from the device. - #[error("received unexpected message type: {0:?}")] - UnexpectedMessageType(protos::MessageType), //TODO(stevenroose) type alias - /// Error reading or writing protobuf messages. - #[error(transparent)] - Protobuf(#[from] protobuf::Error), - /// A failure message was returned by the device. - #[error("failure received: code={:?} message=\"{}\"", .0.code(), .0.message())] - FailureResponse(protos::Failure), - /// An unexpected interaction request was returned by the device. - #[error("unexpected interaction request: {0:?}")] - UnexpectedInteractionRequest(InteractionType), - /// The given Bitcoin network is not supported. - #[error("given network is not supported")] - UnsupportedNetwork, - /// Provided entropy is not 32 bytes. - #[error("provided entropy is not 32 bytes")] - InvalidEntropy, - /// The device erenced a non-existing input or output index. - #[error("device referenced non-existing input or output index: {0}")] - TxRequestInvalidIndex(usize), - - /// User provided invalid PSBT. - #[error("PSBT missing input tx: {0}")] - InvalidPsbt(String), - - // bitcoin - /// Error in Base58 decoding - #[cfg(feature = "bitcoin")] - #[error(transparent)] - Base58(#[from] bitcoin::base58::Error), - /// The device erenced an unknown TXID. - #[cfg(feature = "bitcoin")] - #[error("device referenced unknown TXID: {0}")] - TxRequestUnknownTxid(bitcoin::hashes::sha256d::Hash), - /// The PSBT is missing the full tx for given input. - #[cfg(feature = "bitcoin")] - #[error("PSBT missing input tx: {0}")] - PsbtMissingInputTx(bitcoin::hashes::sha256d::Hash), - /// Device produced invalid TxRequest message. - #[cfg(feature = "bitcoin")] - #[error("malformed TxRequest: {0:?}")] - MalformedTxRequest(protos::TxRequest), - /// Error encoding/decoding a Bitcoin data structure. - #[cfg(feature = "bitcoin")] - #[error(transparent)] - BitcoinEncode(#[from] bitcoin::consensus::encode::Error), - /// Elliptic curve crypto error. - #[cfg(feature = "bitcoin")] - #[error(transparent)] - Secp256k1(#[from] bitcoin::secp256k1::Error), - /// Bip32 error. - #[cfg(feature = "bitcoin")] - #[error(transparent)] - Bip32(#[from] bitcoin::bip32::Error), - /// Address error. - #[cfg(feature = "bitcoin")] - #[error(transparent)] - Address(#[from] bitcoin::address::ParseError), - - // bintlayer - /// Chaincode error. - #[cfg(feature = "mintlayer")] - #[error("Invalid chaincode length returned from device")] - InvalidChaincodeFromDevice, - /// Device produced invalid TxRequest message. - #[cfg(feature = "mintlayer")] - #[error("malformed MintlayerTxRequest: {0:?}")] - MalformedMintlayerTxRequest(protos::MintlayerTxRequest), -} - -impl PartialEq for Error { - fn eq(&self, _other: &Self) -> bool { - false - } -} - -impl Eq for Error {} diff --git a/wallet/trezor-client/src/flows/sign_tx.rs b/wallet/trezor-client/src/flows/sign_tx.rs deleted file mode 100644 index 40c72bdc73..0000000000 --- a/wallet/trezor-client/src/flows/sign_tx.rs +++ /dev/null @@ -1,322 +0,0 @@ -//! Logic to handle the sign_tx command flow. - -use crate::{ - client::*, - error::{Error, Result}, - protos::{ - self, - tx_ack::{ - transaction_type::{TxOutputBinType, TxOutputType}, - TransactionType, - }, - }, - utils, -}; -use bitcoin::{hashes::sha256d, psbt, Network, Transaction}; -use protos::{ - tx_ack::transaction_type::TxInputType, tx_request::RequestType as TxRequestType, - InputScriptType, OutputScriptType, -}; -use tracing::trace; - -/// Fulfill a TxRequest for TXINPUT. -fn ack_input_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { - if req.details.is_none() || !req.details.has_request_index() { - return Err(Error::MalformedTxRequest(req.clone())); - } - - // Choose either the tx we are signing or a dependent tx. - let input_index = req.details.request_index() as usize; - let input = if req.details.has_tx_hash() { - let req_hash: sha256d::Hash = utils::from_rev_bytes(req.details.tx_hash()) - .ok_or_else(|| Error::MalformedTxRequest(req.clone()))?; - trace!("Preparing ack for input {}:{}", req_hash, input_index); - let inp = utils::psbt_find_input(psbt, req_hash)?; - let tx = inp.non_witness_utxo.as_ref().ok_or(Error::PsbtMissingInputTx(req_hash))?; - let opt = &tx.input.get(input_index); - opt.ok_or_else(|| Error::TxRequestInvalidIndex(input_index))? - } else { - trace!("Preparing ack for tx input #{}", input_index); - let opt = &psbt.unsigned_tx.input.get(input_index); - opt.ok_or(Error::TxRequestInvalidIndex(input_index))? - }; - - let mut data_input = TxInputType::new(); - data_input - .set_prev_hash(utils::to_rev_bytes(input.previous_output.txid.as_raw_hash()).to_vec()); - data_input.set_prev_index(input.previous_output.vout); - data_input.set_script_sig(input.script_sig.to_bytes()); - data_input.set_sequence(input.sequence.to_consensus_u32()); - - // Extra data only for currently signing tx. - if !req.details.has_tx_hash() { - let psbt_input = psbt - .inputs - .get(input_index) - .ok_or_else(|| Error::InvalidPsbt("not enough psbt inputs".to_owned()))?; - - // Get the output we are spending from the PSBT input. - let txout = if let Some(ref txout) = psbt_input.witness_utxo { - txout - } else if let Some(ref tx) = psbt_input.non_witness_utxo { - tx.output.get(input.previous_output.vout as usize).ok_or_else(|| { - Error::InvalidPsbt(format!("invalid utxo for PSBT input {}", input_index)) - })? - } else { - return Err(Error::InvalidPsbt(format!("no utxo for PSBT input {}", input_index))); - }; - - // If there is exactly 1 HD keypath known, we can provide it. If more it's multisig. - if psbt_input.bip32_derivation.len() == 1 { - let (_, (_, path)) = psbt_input.bip32_derivation.iter().next().unwrap(); - data_input.address_n = path.as_ref().iter().map(|i| (*i).into()).collect(); - } - - // Since we know the keypath, we probably have to sign it. So update script_type. - let script_type = { - let script_pubkey = &txout.script_pubkey; - - if script_pubkey.is_p2pkh() { - InputScriptType::SPENDADDRESS - } else if script_pubkey.is_p2wpkh() || script_pubkey.is_p2wsh() { - InputScriptType::SPENDWITNESS - } else if script_pubkey.is_p2sh() && psbt_input.witness_script.is_some() { - InputScriptType::SPENDP2SHWITNESS - } else { - //TODO(stevenroose) normal p2sh is probably multisig - InputScriptType::EXTERNAL - } - }; - data_input.set_script_type(script_type); - //TODO(stevenroose) multisig - - data_input.set_amount(txout.value.to_sat()); - } - - trace!("Prepared input to ack: {:?}", data_input); - let mut txdata = TransactionType::new(); - txdata.inputs.push(data_input); - let mut msg = protos::TxAck::new(); - msg.tx = protobuf::MessageField::some(txdata); - Ok(msg) -} - -/// Fulfill a TxRequest for TXOUTPUT. -fn ack_output_request( - req: &protos::TxRequest, - psbt: &psbt::Psbt, - network: Network, -) -> Result { - if req.details.is_none() || !req.details.has_request_index() { - return Err(Error::MalformedTxRequest(req.clone())); - } - - // For outputs, the Trezor only needs bin_outputs to be set for dependent txs and full outputs - // for the signing tx. - let mut txdata = TransactionType::new(); - if req.details.has_tx_hash() { - // Dependent tx, take the output from the PSBT and just create bin_output. - let output_index = req.details.request_index() as usize; - let req_hash: sha256d::Hash = utils::from_rev_bytes(req.details.tx_hash()) - .ok_or_else(|| Error::MalformedTxRequest(req.clone()))?; - trace!("Preparing ack for output {}:{}", req_hash, output_index); - let inp = utils::psbt_find_input(psbt, req_hash)?; - let output = if let Some(ref tx) = inp.non_witness_utxo { - let opt = &tx.output.get(output_index); - opt.ok_or_else(|| Error::TxRequestInvalidIndex(output_index))? - } else if let Some(ref utxo) = inp.witness_utxo { - utxo - } else { - return Err(Error::InvalidPsbt("not all inputs have utxo data".to_owned())); - }; - - let mut bin_output = TxOutputBinType::new(); - bin_output.set_amount(output.value.to_sat()); - bin_output.set_script_pubkey(output.script_pubkey.to_bytes()); - - trace!("Prepared bin_output to ack: {:?}", bin_output); - txdata.bin_outputs.push(bin_output); - } else { - // Signing tx, we need to fill the full output meta object. - let output_index = req.details.request_index() as usize; - trace!("Preparing ack for tx output #{}", output_index); - let opt = &psbt.unsigned_tx.output.get(output_index); - let output = opt.ok_or(Error::TxRequestInvalidIndex(output_index))?; - - let mut data_output = TxOutputType::new(); - data_output.set_amount(output.value.to_sat()); - // Set script type to PAYTOADDRESS unless we find out otherwise from the PSBT. - data_output.set_script_type(OutputScriptType::PAYTOADDRESS); - if let Some(addr) = utils::address_from_script(&output.script_pubkey, network) { - data_output.set_address(addr.to_string()); - } - - let psbt_output = psbt - .outputs - .get(output_index) - .ok_or_else(|| Error::InvalidPsbt("output indices don't match".to_owned()))?; - if psbt_output.bip32_derivation.len() == 1 { - let (_, (_, path)) = psbt_output.bip32_derivation.iter().next().unwrap(); - data_output.address_n = path.as_ref().iter().map(|i| (*i).into()).collect(); - - // Since we know the keypath, it's probably a change output. So update script_type. - let script_pubkey = &psbt.unsigned_tx.output[output_index].script_pubkey; - if script_pubkey.is_op_return() { - data_output.set_script_type(OutputScriptType::PAYTOOPRETURN); - data_output.set_op_return_data(script_pubkey.as_bytes()[1..].to_vec()); - } else if psbt_output.witness_script.is_some() { - if psbt_output.redeem_script.is_some() { - data_output.set_script_type(OutputScriptType::PAYTOP2SHWITNESS); - } else { - data_output.set_script_type(OutputScriptType::PAYTOWITNESS); - } - } else { - data_output.set_script_type(OutputScriptType::PAYTOADDRESS); - } - } - - trace!("Prepared output to ack: {:?}", data_output); - txdata.outputs.push(data_output); - }; - - let mut msg = protos::TxAck::new(); - msg.tx = protobuf::MessageField::some(txdata); - Ok(msg) -} - -/// Fulfill a TxRequest for TXMETA. -fn ack_meta_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result { - if req.details.is_none() { - return Err(Error::MalformedTxRequest(req.clone())); - } - - // Choose either the tx we are signing or a dependent tx. - let tx: &Transaction = if req.details.has_tx_hash() { - // dependeny tx, look for it in PSBT inputs - let req_hash: sha256d::Hash = utils::from_rev_bytes(req.details.tx_hash()) - .ok_or_else(|| Error::MalformedTxRequest(req.clone()))?; - trace!("Preparing ack for tx meta of {}", req_hash); - let inp = utils::psbt_find_input(psbt, req_hash)?; - inp.non_witness_utxo.as_ref().ok_or(Error::PsbtMissingInputTx(req_hash))? - } else { - // currently signing tx - trace!("Preparing ack for tx meta of tx being signed"); - &psbt.unsigned_tx - }; - - let mut txdata = TransactionType::new(); - txdata.set_version(tx.version.0 as u32); - txdata.set_lock_time(tx.lock_time.to_consensus_u32()); - txdata.set_inputs_cnt(tx.input.len() as u32); - txdata.set_outputs_cnt(tx.output.len() as u32); - //TODO(stevenroose) python does something with extra data? - - trace!("Prepared tx meta to ack: {:?}", txdata); - let mut msg = protos::TxAck::new(); - msg.tx = protobuf::MessageField::some(txdata); - Ok(msg) -} - -/// Object to track the progress in the transaction signing flow. The device will ask for various -/// parts of the transaction and dependent transactions and can at any point also ask for user -/// interaction. The information asked for by the device is provided based on a PSBT object and the -/// resulting extra signatures are also added to the PSBT file. -/// -/// It's important to always first check with the `finished()` method if more data is requested by -/// the device. If you're not yet finished you must call the `ack_psbt()` method to send more -/// information to the device. -pub struct SignTxProgress<'a> { - client: &'a mut Trezor, - req: protos::TxRequest, -} - -impl<'a> SignTxProgress<'a> { - /// Only intended for internal usage. - pub fn new(client: &mut Trezor, req: protos::TxRequest) -> SignTxProgress<'_> { - SignTxProgress { client, req } - } - - /// Inspector to the request message received from the device. - pub fn tx_request(&self) -> &protos::TxRequest { - &self.req - } - - /// Check whether or not the signing process is finished. - pub fn finished(&self) -> bool { - self.req.request_type() == TxRequestType::TXFINISHED - } - - /// Check if a signature is provided by the device. - pub fn has_signature(&self) -> bool { - let serialized = &self.req.serialized; - serialized.is_some() && serialized.has_signature_index() && serialized.has_signature() - } - - /// Get the signature provided from the device along with the input index of the signature. - pub fn get_signature(&self) -> Option<(usize, &[u8])> { - if self.has_signature() { - let serialized = &self.req.serialized; - Some((serialized.signature_index() as usize, serialized.signature())) - } else { - None - } - } - - //TODO(stevenroose) We used to have a method here `apply_signature(&mut psbt)` that would put - // the received signature in the correct PSBT input. However, since the signature is just a raw - // signature instead of a scriptSig, this is harder. It can be done, but then we'd have to have - // the pubkey provided in the PSBT (possible thought HD path) and we'd have to do some Script - // inspection to see if we should put it as a p2pkh sciptSig or witness data. - - /// Check if a part of the serialized signed tx is provided by the device. - pub fn has_serialized_tx_part(&self) -> bool { - let serialized = &self.req.serialized; - serialized.is_some() && serialized.has_serialized_tx() - } - - /// Get the part of the serialized signed tx from the device. - pub fn get_serialized_tx_part(&self) -> Option<&[u8]> { - if self.has_serialized_tx_part() { - Some(self.req.serialized.serialized_tx()) - } else { - None - } - } - - /// Manually provide a TxAck message to the device. - /// - /// This method will panic if `finished()` returned true, - /// so it should always be checked in advance. - pub fn ack_msg( - self, - ack: protos::TxAck, - ) -> Result, protos::TxRequest>> { - assert!(!self.finished()); - - self.client.call(ack, Box::new(|c, m| Ok(SignTxProgress::new(c, m)))) - } - - /// Provide additional PSBT information to the device. - /// - /// This method will panic if `apply()` returned true, - /// so it should always be checked in advance. - pub fn ack_psbt( - self, - psbt: &psbt::Psbt, - network: Network, - ) -> Result, protos::TxRequest>> { - assert!(self.req.request_type() != TxRequestType::TXFINISHED); - - let ack = match self.req.request_type() { - TxRequestType::TXINPUT => ack_input_request(&self.req, psbt), - TxRequestType::TXOUTPUT => ack_output_request(&self.req, psbt, network), - TxRequestType::TXMETA => ack_meta_request(&self.req, psbt), - TxRequestType::TXEXTRADATA => unimplemented!(), //TODO(stevenroose) implement - TxRequestType::TXORIGINPUT - | TxRequestType::TXORIGOUTPUT - | TxRequestType::TXPAYMENTREQ => unimplemented!(), - TxRequestType::TXFINISHED => unreachable!(), - }?; - self.ack_msg(ack) - } -} diff --git a/wallet/trezor-client/src/lib.rs b/wallet/trezor-client/src/lib.rs deleted file mode 100644 index 8f204c29bc..0000000000 --- a/wallet/trezor-client/src/lib.rs +++ /dev/null @@ -1,227 +0,0 @@ -//! # Trezor API library -//! -//! ## Connecting -//! -//! Use the public top-level methods `find_devices()` and `unique()` to find devices. When using -//! `find_devices()`, a list of different available devices is returned. To connect to one or more -//! of them, use their `connect()` method. -//! -//! ## Logging -//! -//! We use the log package interface, so any logger that supports log can be attached. -//! Please be aware that `trace` logging can contain sensitive data. - -#![warn(unreachable_pub, rustdoc::all)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![deny(unused_must_use, rust_2018_idioms)] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] - -mod messages; - -pub mod client; -pub mod error; -pub mod protos; -pub mod transport; -#[cfg(feature = "bitcoin")] -pub mod utils; - -mod flows { - #[cfg(feature = "bitcoin")] - pub(crate) mod sign_tx; -} - -pub use client::{ - ButtonRequest, ButtonRequestType, EntropyRequest, Features, PassphraseRequest, - PinMatrixRequest, PinMatrixRequestType, Trezor, TrezorResponse, WordCount, -}; -pub use error::{Error, Result}; -pub use messages::TrezorMessage; - -#[cfg(feature = "bitcoin")] -pub use flows::sign_tx::SignTxProgress; -#[cfg(feature = "bitcoin")] -pub use protos::InputScriptType; - -use std::fmt; -use tracing::{debug, warn}; -use transport::{udp::UdpTransport, webusb::WebUsbTransport}; - -/// The different kind of Trezor device models. -#[derive(PartialEq, Eq, Clone, Debug, Copy)] -pub enum Model { - TrezorLegacy, - Trezor, - TrezorBootloader, - TrezorEmulator, -} - -impl fmt::Display for Model { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(self.as_str()) - } -} - -impl Model { - pub const fn as_str(&self) -> &'static str { - match self { - Model::TrezorLegacy => "Trezor (legacy)", - Model::Trezor => "Trezor", - Model::TrezorBootloader => "Trezor (bootloader)", - Model::TrezorEmulator => "Trezor Emulator", - } - } -} - -/// A device found by the `find_devices()` method. It can be connected to using the `connect()` -/// method. -#[derive(Debug)] -pub struct AvailableDevice { - pub model: Model, - pub debug: bool, - transport: transport::AvailableDeviceTransport, -} - -impl fmt::Display for AvailableDevice { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{} (transport: {}) (debug: {})", self.model, &self.transport, self.debug) - } -} - -impl AvailableDevice { - /// Connect to the device. - pub fn connect(self) -> Result { - let transport = transport::connect(&self).map_err(Error::TransportConnect)?; - Ok(client::trezor_with_transport(self.model, transport)) - } -} - -/// Search for all available devices. -/// Most devices will show up twice both either debugging enables or disabled. -pub fn find_devices(debug: bool) -> Vec { - let mut devices = vec![]; - - match WebUsbTransport::find_devices(debug) { - Ok(usb) => devices.extend(usb), - Err(err) => { - warn!("{}", Error::TransportConnect(err)) - } - }; - - match UdpTransport::find_devices(debug, None) { - Ok(udp) => devices.extend(udp), - Err(err) => { - warn!("{}", Error::TransportConnect(err)) - } - }; - - devices -} - -/// Try to get a single device. Optionally specify whether debug should be enabled or not. -/// Can error if there are multiple or no devices available. -/// For more fine-grained device selection, use `find_devices()`. -/// When using USB mode, the device will show up both with debug and without debug, so it's -/// necessary to specify the debug option in order to find a unique one. -pub fn unique(debug: bool) -> Result { - let mut devices = find_devices(debug); - match devices.len() { - 0 => Err(Error::NoDeviceFound), - 1 => Ok(devices.remove(0).connect()?), - _ => { - debug!("Trezor devices found: {:?}", devices); - Err(Error::DeviceNotUnique) - } - } -} - -#[cfg(feature = "trezor-emulator")] -#[cfg(test)] -mod tests { - use serial_test::serial; - use std::str::FromStr; - - use crate::{client::handle_interaction, protos::IdentityType}; - use bitcoin::{bip32::DerivationPath, hex::FromHex}; - - use super::*; - - fn init_emulator() -> Trezor { - let mut emulator = find_devices(false) - .into_iter() - .find(|t| t.model == Model::TrezorEmulator) - .expect("No emulator found") - .connect() - .expect("Failed to connect to emulator"); - emulator.init_device(None).expect("Failed to intialize device"); - emulator - } - - #[test] - #[serial] - fn test_emulator_find() { - let trezors = find_devices(false); - assert!(!trezors.is_empty()); - assert!(trezors.iter().any(|t| t.model == Model::TrezorEmulator)); - } - - #[test] - #[serial] - fn test_emulator_features() { - let emulator = init_emulator(); - let features = emulator.features().expect("Failed to get features"); - assert_eq!(features.vendor(), "trezor.io"); - assert!(features.initialized()); - assert!(!features.firmware_present()); - assert!(features.initialized()); - assert!(!features.pin_protection()); - assert!(!features.passphrase_protection()); - assert!(["T", "Safe 3"].contains(&features.model())); - } - - #[test] - #[serial] - fn test_bitcoin_address() { - let mut emulator = init_emulator(); - assert_eq!(emulator.features().expect("Failed to get features").label(), "SLIP-0014"); - let path = DerivationPath::from_str("m/44'/1'/0'/0/0").expect("Failed to parse path"); - let address = emulator - .get_address(&path, InputScriptType::SPENDADDRESS, bitcoin::Network::Testnet, false) - .expect("Failed to get address"); - assert_eq!(address.ok().unwrap().to_string(), "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q"); - } - - #[ignore] - #[test] - #[serial] - fn test_ecdh_shared_secret() { - tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init(); - - let mut emulator = init_emulator(); - assert_eq!(emulator.features().expect("Failed to get features").label(), "SLIP-0014"); - - let mut ident = IdentityType::new(); - ident.set_proto("gpg".to_owned()); - ident.set_user("".to_owned()); - ident.set_host("Satoshi Nakamoto ".to_owned()); - ident.set_port("".to_owned()); - ident.set_path("".to_owned()); - ident.set_index(0); - - let peer_public_key = Vec::from_hex("0407f2c6e5becf3213c1d07df0cfbe8e39f70a8c643df7575e5c56859ec52c45ca950499c019719dae0fda04248d851e52cf9d66eeb211d89a77be40de22b6c89d").unwrap(); - let curve_name = "secp256k1".to_owned(); - let response = handle_interaction( - emulator - .get_ecdh_session_key(ident, peer_public_key, curve_name) - .expect("Failed to get ECDH shared secret"), - ) - .unwrap(); - - let expected_session_key = Vec::from_hex("048125883b086746244b0d2c548860ecc723346e14c87e51dc7ba32791bc780d132dbd814fbee77134f318afac6ad6db3c5334efe6a8798628a1038195b96e82e2").unwrap(); - assert_eq!(response.session_key(), &expected_session_key); - - let expected_public_key = - Vec::from_hex("032726ba71aa066b47fc0f90b389f8c3e02fe20b94c858395d71f260e9944e3c65") - .unwrap(); - assert_eq!(response.public_key(), &expected_public_key); - } -} diff --git a/wallet/trezor-client/src/messages/generated.rs b/wallet/trezor-client/src/messages/generated.rs deleted file mode 100644 index 6bc61176fa..0000000000 --- a/wallet/trezor-client/src/messages/generated.rs +++ /dev/null @@ -1,306 +0,0 @@ -trezor_message_impl! { - Initialize => MessageType_Initialize, - Ping => MessageType_Ping, - Success => MessageType_Success, - Failure => MessageType_Failure, - ChangePin => MessageType_ChangePin, - WipeDevice => MessageType_WipeDevice, - GetEntropy => MessageType_GetEntropy, - Entropy => MessageType_Entropy, - LoadDevice => MessageType_LoadDevice, - ResetDevice => MessageType_ResetDevice, - SetBusy => MessageType_SetBusy, - Features => MessageType_Features, - PinMatrixRequest => MessageType_PinMatrixRequest, - PinMatrixAck => MessageType_PinMatrixAck, - Cancel => MessageType_Cancel, - LockDevice => MessageType_LockDevice, - ApplySettings => MessageType_ApplySettings, - ButtonRequest => MessageType_ButtonRequest, - ButtonAck => MessageType_ButtonAck, - ApplyFlags => MessageType_ApplyFlags, - GetNonce => MessageType_GetNonce, - Nonce => MessageType_Nonce, - BackupDevice => MessageType_BackupDevice, - EntropyRequest => MessageType_EntropyRequest, - EntropyAck => MessageType_EntropyAck, - PassphraseRequest => MessageType_PassphraseRequest, - PassphraseAck => MessageType_PassphraseAck, - RecoveryDevice => MessageType_RecoveryDevice, - WordRequest => MessageType_WordRequest, - WordAck => MessageType_WordAck, - GetFeatures => MessageType_GetFeatures, - SdProtect => MessageType_SdProtect, - ChangeWipeCode => MessageType_ChangeWipeCode, - EndSession => MessageType_EndSession, - DoPreauthorized => MessageType_DoPreauthorized, - PreauthorizedRequest => MessageType_PreauthorizedRequest, - CancelAuthorization => MessageType_CancelAuthorization, - RebootToBootloader => MessageType_RebootToBootloader, - GetFirmwareHash => MessageType_GetFirmwareHash, - FirmwareHash => MessageType_FirmwareHash, - UnlockPath => MessageType_UnlockPath, - UnlockedPathRequest => MessageType_UnlockedPathRequest, - ShowDeviceTutorial => MessageType_ShowDeviceTutorial, - UnlockBootloader => MessageType_UnlockBootloader, - AuthenticateDevice => MessageType_AuthenticateDevice, - AuthenticityProof => MessageType_AuthenticityProof, - ChangeLanguage => MessageType_ChangeLanguage, - TranslationDataRequest => MessageType_TranslationDataRequest, - TranslationDataAck => MessageType_TranslationDataAck, - SetU2FCounter => MessageType_SetU2FCounter, - GetNextU2FCounter => MessageType_GetNextU2FCounter, - NextU2FCounter => MessageType_NextU2FCounter, - Deprecated_PassphraseStateRequest => MessageType_Deprecated_PassphraseStateRequest, - Deprecated_PassphraseStateAck => MessageType_Deprecated_PassphraseStateAck, - FirmwareErase => MessageType_FirmwareErase, - FirmwareUpload => MessageType_FirmwareUpload, - FirmwareRequest => MessageType_FirmwareRequest, - ProdTestT1 => MessageType_ProdTestT1, - CipherKeyValue => MessageType_CipherKeyValue, - CipheredKeyValue => MessageType_CipheredKeyValue, - SignIdentity => MessageType_SignIdentity, - SignedIdentity => MessageType_SignedIdentity, - GetECDHSessionKey => MessageType_GetECDHSessionKey, - ECDHSessionKey => MessageType_ECDHSessionKey, - CosiCommit => MessageType_CosiCommit, - CosiCommitment => MessageType_CosiCommitment, - CosiSign => MessageType_CosiSign, - CosiSignature => MessageType_CosiSignature, - DebugLinkDecision => MessageType_DebugLinkDecision, - DebugLinkGetState => MessageType_DebugLinkGetState, - DebugLinkState => MessageType_DebugLinkState, - DebugLinkStop => MessageType_DebugLinkStop, - DebugLinkLog => MessageType_DebugLinkLog, - DebugLinkMemoryRead => MessageType_DebugLinkMemoryRead, - DebugLinkMemory => MessageType_DebugLinkMemory, - DebugLinkMemoryWrite => MessageType_DebugLinkMemoryWrite, - DebugLinkFlashErase => MessageType_DebugLinkFlashErase, - DebugLinkLayout => MessageType_DebugLinkLayout, - DebugLinkReseedRandom => MessageType_DebugLinkReseedRandom, - DebugLinkRecordScreen => MessageType_DebugLinkRecordScreen, - DebugLinkEraseSdCard => MessageType_DebugLinkEraseSdCard, - DebugLinkWatchLayout => MessageType_DebugLinkWatchLayout, - DebugLinkResetDebugEvents => MessageType_DebugLinkResetDebugEvents, -} - -#[cfg(feature = "binance")] -trezor_message_impl! { - BinanceGetAddress => MessageType_BinanceGetAddress, - BinanceAddress => MessageType_BinanceAddress, - BinanceGetPublicKey => MessageType_BinanceGetPublicKey, - BinancePublicKey => MessageType_BinancePublicKey, - BinanceSignTx => MessageType_BinanceSignTx, - BinanceTxRequest => MessageType_BinanceTxRequest, - BinanceTransferMsg => MessageType_BinanceTransferMsg, - BinanceOrderMsg => MessageType_BinanceOrderMsg, - BinanceCancelMsg => MessageType_BinanceCancelMsg, - BinanceSignedTx => MessageType_BinanceSignedTx, -} - -#[cfg(feature = "bitcoin")] -trezor_message_impl! { - GetPublicKey => MessageType_GetPublicKey, - PublicKey => MessageType_PublicKey, - SignTx => MessageType_SignTx, - TxRequest => MessageType_TxRequest, - TxAck => MessageType_TxAck, - GetAddress => MessageType_GetAddress, - Address => MessageType_Address, - TxAckPaymentRequest => MessageType_TxAckPaymentRequest, - SignMessage => MessageType_SignMessage, - VerifyMessage => MessageType_VerifyMessage, - MessageSignature => MessageType_MessageSignature, - GetOwnershipId => MessageType_GetOwnershipId, - OwnershipId => MessageType_OwnershipId, - GetOwnershipProof => MessageType_GetOwnershipProof, - OwnershipProof => MessageType_OwnershipProof, - AuthorizeCoinJoin => MessageType_AuthorizeCoinJoin, -} - -#[cfg(feature = "cardano")] -trezor_message_impl! { - CardanoGetPublicKey => MessageType_CardanoGetPublicKey, - CardanoPublicKey => MessageType_CardanoPublicKey, - CardanoGetAddress => MessageType_CardanoGetAddress, - CardanoAddress => MessageType_CardanoAddress, - CardanoTxItemAck => MessageType_CardanoTxItemAck, - CardanoTxAuxiliaryDataSupplement => MessageType_CardanoTxAuxiliaryDataSupplement, - CardanoTxWitnessRequest => MessageType_CardanoTxWitnessRequest, - CardanoTxWitnessResponse => MessageType_CardanoTxWitnessResponse, - CardanoTxHostAck => MessageType_CardanoTxHostAck, - CardanoTxBodyHash => MessageType_CardanoTxBodyHash, - CardanoSignTxFinished => MessageType_CardanoSignTxFinished, - CardanoSignTxInit => MessageType_CardanoSignTxInit, - CardanoTxInput => MessageType_CardanoTxInput, - CardanoTxOutput => MessageType_CardanoTxOutput, - CardanoAssetGroup => MessageType_CardanoAssetGroup, - CardanoToken => MessageType_CardanoToken, - CardanoTxCertificate => MessageType_CardanoTxCertificate, - CardanoTxWithdrawal => MessageType_CardanoTxWithdrawal, - CardanoTxAuxiliaryData => MessageType_CardanoTxAuxiliaryData, - CardanoPoolOwner => MessageType_CardanoPoolOwner, - CardanoPoolRelayParameters => MessageType_CardanoPoolRelayParameters, - CardanoGetNativeScriptHash => MessageType_CardanoGetNativeScriptHash, - CardanoNativeScriptHash => MessageType_CardanoNativeScriptHash, - CardanoTxMint => MessageType_CardanoTxMint, - CardanoTxCollateralInput => MessageType_CardanoTxCollateralInput, - CardanoTxRequiredSigner => MessageType_CardanoTxRequiredSigner, - CardanoTxInlineDatumChunk => MessageType_CardanoTxInlineDatumChunk, - CardanoTxReferenceScriptChunk => MessageType_CardanoTxReferenceScriptChunk, - CardanoTxReferenceInput => MessageType_CardanoTxReferenceInput, -} - -#[cfg(feature = "eos")] -trezor_message_impl! { - EosGetPublicKey => MessageType_EosGetPublicKey, - EosPublicKey => MessageType_EosPublicKey, - EosSignTx => MessageType_EosSignTx, - EosTxActionRequest => MessageType_EosTxActionRequest, - EosTxActionAck => MessageType_EosTxActionAck, - EosSignedTx => MessageType_EosSignedTx, -} - -#[cfg(feature = "ethereum")] -trezor_message_impl! { - EthereumGetPublicKey => MessageType_EthereumGetPublicKey, - EthereumPublicKey => MessageType_EthereumPublicKey, - EthereumGetAddress => MessageType_EthereumGetAddress, - EthereumAddress => MessageType_EthereumAddress, - EthereumSignTx => MessageType_EthereumSignTx, - EthereumSignTxEIP1559 => MessageType_EthereumSignTxEIP1559, - EthereumTxRequest => MessageType_EthereumTxRequest, - EthereumTxAck => MessageType_EthereumTxAck, - EthereumSignMessage => MessageType_EthereumSignMessage, - EthereumVerifyMessage => MessageType_EthereumVerifyMessage, - EthereumMessageSignature => MessageType_EthereumMessageSignature, - EthereumSignTypedData => MessageType_EthereumSignTypedData, - EthereumTypedDataStructRequest => MessageType_EthereumTypedDataStructRequest, - EthereumTypedDataStructAck => MessageType_EthereumTypedDataStructAck, - EthereumTypedDataValueRequest => MessageType_EthereumTypedDataValueRequest, - EthereumTypedDataValueAck => MessageType_EthereumTypedDataValueAck, - EthereumTypedDataSignature => MessageType_EthereumTypedDataSignature, - EthereumSignTypedHash => MessageType_EthereumSignTypedHash, -} - -#[cfg(feature = "mintlayer")] -trezor_message_impl! { - MintlayerGetAddress => MessageType_MintlayerGetAddress, - MintlayerAddress => MessageType_MintlayerAddress, - MintlayerGetPublicKey => MessageType_MintlayerGetPublicKey, - MintlayerPublicKey => MessageType_MintlayerPublicKey, - MintlayerSignMessage => MessageType_MintlayerSignMessage, - MintlayerSignTx => MessageType_MintlayerSignTx, - MintlayerTxRequest => MessageType_MintlayerTxRequest, - MintlayerTxAckUtxoInput => MessageType_MintlayerTxAckUtxoInput, - MintlayerTxAckOutput => MessageType_MintlayerTxAckOutput, -} - -#[cfg(feature = "monero")] -trezor_message_impl! { - MoneroTransactionInitRequest => MessageType_MoneroTransactionInitRequest, - MoneroTransactionInitAck => MessageType_MoneroTransactionInitAck, - MoneroTransactionSetInputRequest => MessageType_MoneroTransactionSetInputRequest, - MoneroTransactionSetInputAck => MessageType_MoneroTransactionSetInputAck, - MoneroTransactionInputViniRequest => MessageType_MoneroTransactionInputViniRequest, - MoneroTransactionInputViniAck => MessageType_MoneroTransactionInputViniAck, - MoneroTransactionAllInputsSetRequest => MessageType_MoneroTransactionAllInputsSetRequest, - MoneroTransactionAllInputsSetAck => MessageType_MoneroTransactionAllInputsSetAck, - MoneroTransactionSetOutputRequest => MessageType_MoneroTransactionSetOutputRequest, - MoneroTransactionSetOutputAck => MessageType_MoneroTransactionSetOutputAck, - MoneroTransactionAllOutSetRequest => MessageType_MoneroTransactionAllOutSetRequest, - MoneroTransactionAllOutSetAck => MessageType_MoneroTransactionAllOutSetAck, - MoneroTransactionSignInputRequest => MessageType_MoneroTransactionSignInputRequest, - MoneroTransactionSignInputAck => MessageType_MoneroTransactionSignInputAck, - MoneroTransactionFinalRequest => MessageType_MoneroTransactionFinalRequest, - MoneroTransactionFinalAck => MessageType_MoneroTransactionFinalAck, - MoneroKeyImageExportInitRequest => MessageType_MoneroKeyImageExportInitRequest, - MoneroKeyImageExportInitAck => MessageType_MoneroKeyImageExportInitAck, - MoneroKeyImageSyncStepRequest => MessageType_MoneroKeyImageSyncStepRequest, - MoneroKeyImageSyncStepAck => MessageType_MoneroKeyImageSyncStepAck, - MoneroKeyImageSyncFinalRequest => MessageType_MoneroKeyImageSyncFinalRequest, - MoneroKeyImageSyncFinalAck => MessageType_MoneroKeyImageSyncFinalAck, - MoneroGetAddress => MessageType_MoneroGetAddress, - MoneroAddress => MessageType_MoneroAddress, - MoneroGetWatchKey => MessageType_MoneroGetWatchKey, - MoneroWatchKey => MessageType_MoneroWatchKey, - DebugMoneroDiagRequest => MessageType_DebugMoneroDiagRequest, - DebugMoneroDiagAck => MessageType_DebugMoneroDiagAck, - MoneroGetTxKeyRequest => MessageType_MoneroGetTxKeyRequest, - MoneroGetTxKeyAck => MessageType_MoneroGetTxKeyAck, - MoneroLiveRefreshStartRequest => MessageType_MoneroLiveRefreshStartRequest, - MoneroLiveRefreshStartAck => MessageType_MoneroLiveRefreshStartAck, - MoneroLiveRefreshStepRequest => MessageType_MoneroLiveRefreshStepRequest, - MoneroLiveRefreshStepAck => MessageType_MoneroLiveRefreshStepAck, - MoneroLiveRefreshFinalRequest => MessageType_MoneroLiveRefreshFinalRequest, - MoneroLiveRefreshFinalAck => MessageType_MoneroLiveRefreshFinalAck, -} - -#[cfg(feature = "nem")] -trezor_message_impl! { - NEMGetAddress => MessageType_NEMGetAddress, - NEMAddress => MessageType_NEMAddress, - NEMSignTx => MessageType_NEMSignTx, - NEMSignedTx => MessageType_NEMSignedTx, - NEMDecryptMessage => MessageType_NEMDecryptMessage, - NEMDecryptedMessage => MessageType_NEMDecryptedMessage, -} - -#[cfg(feature = "ripple")] -trezor_message_impl! { - RippleGetAddress => MessageType_RippleGetAddress, - RippleAddress => MessageType_RippleAddress, - RippleSignTx => MessageType_RippleSignTx, - RippleSignedTx => MessageType_RippleSignedTx, -} - -#[cfg(feature = "solana")] -trezor_message_impl! { - SolanaGetPublicKey => MessageType_SolanaGetPublicKey, - SolanaPublicKey => MessageType_SolanaPublicKey, - SolanaGetAddress => MessageType_SolanaGetAddress, - SolanaAddress => MessageType_SolanaAddress, - SolanaSignTx => MessageType_SolanaSignTx, - SolanaTxSignature => MessageType_SolanaTxSignature, -} - -#[cfg(feature = "stellar")] -trezor_message_impl! { - StellarSignTx => MessageType_StellarSignTx, - StellarTxOpRequest => MessageType_StellarTxOpRequest, - StellarGetAddress => MessageType_StellarGetAddress, - StellarAddress => MessageType_StellarAddress, - StellarCreateAccountOp => MessageType_StellarCreateAccountOp, - StellarPaymentOp => MessageType_StellarPaymentOp, - StellarPathPaymentStrictReceiveOp => MessageType_StellarPathPaymentStrictReceiveOp, - StellarManageSellOfferOp => MessageType_StellarManageSellOfferOp, - StellarCreatePassiveSellOfferOp => MessageType_StellarCreatePassiveSellOfferOp, - StellarSetOptionsOp => MessageType_StellarSetOptionsOp, - StellarChangeTrustOp => MessageType_StellarChangeTrustOp, - StellarAllowTrustOp => MessageType_StellarAllowTrustOp, - StellarAccountMergeOp => MessageType_StellarAccountMergeOp, - StellarManageDataOp => MessageType_StellarManageDataOp, - StellarBumpSequenceOp => MessageType_StellarBumpSequenceOp, - StellarManageBuyOfferOp => MessageType_StellarManageBuyOfferOp, - StellarPathPaymentStrictSendOp => MessageType_StellarPathPaymentStrictSendOp, - StellarClaimClaimableBalanceOp => MessageType_StellarClaimClaimableBalanceOp, - StellarSignedTx => MessageType_StellarSignedTx, -} - -#[cfg(feature = "tezos")] -trezor_message_impl! { - TezosGetAddress => MessageType_TezosGetAddress, - TezosAddress => MessageType_TezosAddress, - TezosSignTx => MessageType_TezosSignTx, - TezosSignedTx => MessageType_TezosSignedTx, - TezosGetPublicKey => MessageType_TezosGetPublicKey, - TezosPublicKey => MessageType_TezosPublicKey, -} - -#[cfg(feature = "webauthn")] -trezor_message_impl! { - WebAuthnListResidentCredentials => MessageType_WebAuthnListResidentCredentials, - WebAuthnCredentials => MessageType_WebAuthnCredentials, - WebAuthnAddResidentCredential => MessageType_WebAuthnAddResidentCredential, - WebAuthnRemoveResidentCredential => MessageType_WebAuthnRemoveResidentCredential, -} diff --git a/wallet/trezor-client/src/messages/mod.rs b/wallet/trezor-client/src/messages/mod.rs deleted file mode 100644 index f558259bc8..0000000000 --- a/wallet/trezor-client/src/messages/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! This module implements the `message_type` getter for all protobuf message types. - -use crate::protos::{MessageType::*, *}; - -/// Extends the protobuf Message trait to also have a static getter for the message -/// type code. -pub trait TrezorMessage: protobuf::Message + std::fmt::Debug { - const MESSAGE_TYPE: MessageType; - - #[inline] - #[deprecated(note = "Use `MESSAGE_TYPE` instead")] - fn message_type() -> MessageType { - Self::MESSAGE_TYPE - } -} - -/// This macro provides the TrezorMessage trait for a protobuf message. -macro_rules! trezor_message_impl { - ($($struct:ident => $mtype:expr),+ $(,)?) => {$( - impl TrezorMessage for $struct { - const MESSAGE_TYPE: MessageType = $mtype; - } - )+}; -} - -include!("./generated.rs"); diff --git a/wallet/trezor-client/src/protos/generated/messages.rs b/wallet/trezor-client/src/protos/generated/messages.rs deleted file mode 100644 index f28b357c0a..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages.rs +++ /dev/null @@ -1,1963 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.MessageType) -pub enum MessageType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Initialize) - MessageType_Initialize = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Ping) - MessageType_Ping = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Success) - MessageType_Success = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Failure) - MessageType_Failure = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ChangePin) - MessageType_ChangePin = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WipeDevice) - MessageType_WipeDevice = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetEntropy) - MessageType_GetEntropy = 9, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Entropy) - MessageType_Entropy = 10, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_LoadDevice) - MessageType_LoadDevice = 13, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ResetDevice) - MessageType_ResetDevice = 14, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SetBusy) - MessageType_SetBusy = 16, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Features) - MessageType_Features = 17, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PinMatrixRequest) - MessageType_PinMatrixRequest = 18, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PinMatrixAck) - MessageType_PinMatrixAck = 19, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Cancel) - MessageType_Cancel = 20, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_LockDevice) - MessageType_LockDevice = 24, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ApplySettings) - MessageType_ApplySettings = 25, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ButtonRequest) - MessageType_ButtonRequest = 26, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ButtonAck) - MessageType_ButtonAck = 27, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ApplyFlags) - MessageType_ApplyFlags = 28, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetNonce) - MessageType_GetNonce = 31, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Nonce) - MessageType_Nonce = 33, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BackupDevice) - MessageType_BackupDevice = 34, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EntropyRequest) - MessageType_EntropyRequest = 35, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EntropyAck) - MessageType_EntropyAck = 36, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PassphraseRequest) - MessageType_PassphraseRequest = 41, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PassphraseAck) - MessageType_PassphraseAck = 42, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RecoveryDevice) - MessageType_RecoveryDevice = 45, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WordRequest) - MessageType_WordRequest = 46, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WordAck) - MessageType_WordAck = 47, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetFeatures) - MessageType_GetFeatures = 55, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SdProtect) - MessageType_SdProtect = 79, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ChangeWipeCode) - MessageType_ChangeWipeCode = 82, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EndSession) - MessageType_EndSession = 83, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DoPreauthorized) - MessageType_DoPreauthorized = 84, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PreauthorizedRequest) - MessageType_PreauthorizedRequest = 85, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CancelAuthorization) - MessageType_CancelAuthorization = 86, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RebootToBootloader) - MessageType_RebootToBootloader = 87, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetFirmwareHash) - MessageType_GetFirmwareHash = 88, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareHash) - MessageType_FirmwareHash = 89, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_UnlockPath) - MessageType_UnlockPath = 93, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_UnlockedPathRequest) - MessageType_UnlockedPathRequest = 94, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ShowDeviceTutorial) - MessageType_ShowDeviceTutorial = 95, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_UnlockBootloader) - MessageType_UnlockBootloader = 96, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_AuthenticateDevice) - MessageType_AuthenticateDevice = 97, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_AuthenticityProof) - MessageType_AuthenticityProof = 98, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ChangeLanguage) - MessageType_ChangeLanguage = 990, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TranslationDataRequest) - MessageType_TranslationDataRequest = 991, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TranslationDataAck) - MessageType_TranslationDataAck = 992, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SetU2FCounter) - MessageType_SetU2FCounter = 63, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetNextU2FCounter) - MessageType_GetNextU2FCounter = 80, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NextU2FCounter) - MessageType_NextU2FCounter = 81, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Deprecated_PassphraseStateRequest) - MessageType_Deprecated_PassphraseStateRequest = 77, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Deprecated_PassphraseStateAck) - MessageType_Deprecated_PassphraseStateAck = 78, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareErase) - MessageType_FirmwareErase = 6, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareUpload) - MessageType_FirmwareUpload = 7, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_FirmwareRequest) - MessageType_FirmwareRequest = 8, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ProdTestT1) - MessageType_ProdTestT1 = 32, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetPublicKey) - MessageType_GetPublicKey = 11, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_PublicKey) - MessageType_PublicKey = 12, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignTx) - MessageType_SignTx = 15, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TxRequest) - MessageType_TxRequest = 21, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TxAck) - MessageType_TxAck = 22, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetAddress) - MessageType_GetAddress = 29, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_Address) - MessageType_Address = 30, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TxAckPaymentRequest) - MessageType_TxAckPaymentRequest = 37, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignMessage) - MessageType_SignMessage = 38, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_VerifyMessage) - MessageType_VerifyMessage = 39, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MessageSignature) - MessageType_MessageSignature = 40, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetOwnershipId) - MessageType_GetOwnershipId = 43, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_OwnershipId) - MessageType_OwnershipId = 44, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetOwnershipProof) - MessageType_GetOwnershipProof = 49, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_OwnershipProof) - MessageType_OwnershipProof = 50, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_AuthorizeCoinJoin) - MessageType_AuthorizeCoinJoin = 51, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CipherKeyValue) - MessageType_CipherKeyValue = 23, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CipheredKeyValue) - MessageType_CipheredKeyValue = 48, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignIdentity) - MessageType_SignIdentity = 53, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SignedIdentity) - MessageType_SignedIdentity = 54, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_GetECDHSessionKey) - MessageType_GetECDHSessionKey = 61, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ECDHSessionKey) - MessageType_ECDHSessionKey = 62, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiCommit) - MessageType_CosiCommit = 71, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiCommitment) - MessageType_CosiCommitment = 72, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiSign) - MessageType_CosiSign = 73, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CosiSignature) - MessageType_CosiSignature = 74, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkDecision) - MessageType_DebugLinkDecision = 100, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkGetState) - MessageType_DebugLinkGetState = 101, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkState) - MessageType_DebugLinkState = 102, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkStop) - MessageType_DebugLinkStop = 103, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkLog) - MessageType_DebugLinkLog = 104, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkMemoryRead) - MessageType_DebugLinkMemoryRead = 110, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkMemory) - MessageType_DebugLinkMemory = 111, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkMemoryWrite) - MessageType_DebugLinkMemoryWrite = 112, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkFlashErase) - MessageType_DebugLinkFlashErase = 113, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkLayout) - MessageType_DebugLinkLayout = 9001, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkReseedRandom) - MessageType_DebugLinkReseedRandom = 9002, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkRecordScreen) - MessageType_DebugLinkRecordScreen = 9003, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkEraseSdCard) - MessageType_DebugLinkEraseSdCard = 9005, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkWatchLayout) - MessageType_DebugLinkWatchLayout = 9006, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugLinkResetDebugEvents) - MessageType_DebugLinkResetDebugEvents = 9007, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumGetPublicKey) - MessageType_EthereumGetPublicKey = 450, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumPublicKey) - MessageType_EthereumPublicKey = 451, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumGetAddress) - MessageType_EthereumGetAddress = 56, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumAddress) - MessageType_EthereumAddress = 57, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTx) - MessageType_EthereumSignTx = 58, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTxEIP1559) - MessageType_EthereumSignTxEIP1559 = 452, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTxRequest) - MessageType_EthereumTxRequest = 59, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTxAck) - MessageType_EthereumTxAck = 60, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignMessage) - MessageType_EthereumSignMessage = 64, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumVerifyMessage) - MessageType_EthereumVerifyMessage = 65, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumMessageSignature) - MessageType_EthereumMessageSignature = 66, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTypedData) - MessageType_EthereumSignTypedData = 464, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataStructRequest) - MessageType_EthereumTypedDataStructRequest = 465, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataStructAck) - MessageType_EthereumTypedDataStructAck = 466, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataValueRequest) - MessageType_EthereumTypedDataValueRequest = 467, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataValueAck) - MessageType_EthereumTypedDataValueAck = 468, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumTypedDataSignature) - MessageType_EthereumTypedDataSignature = 469, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EthereumSignTypedHash) - MessageType_EthereumSignTypedHash = 470, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMGetAddress) - MessageType_NEMGetAddress = 67, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMAddress) - MessageType_NEMAddress = 68, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMSignTx) - MessageType_NEMSignTx = 69, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMSignedTx) - MessageType_NEMSignedTx = 70, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMDecryptMessage) - MessageType_NEMDecryptMessage = 75, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NEMDecryptedMessage) - MessageType_NEMDecryptedMessage = 76, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosGetAddress) - MessageType_TezosGetAddress = 150, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosAddress) - MessageType_TezosAddress = 151, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosSignTx) - MessageType_TezosSignTx = 152, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosSignedTx) - MessageType_TezosSignedTx = 153, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosGetPublicKey) - MessageType_TezosGetPublicKey = 154, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_TezosPublicKey) - MessageType_TezosPublicKey = 155, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarSignTx) - MessageType_StellarSignTx = 202, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarTxOpRequest) - MessageType_StellarTxOpRequest = 203, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarGetAddress) - MessageType_StellarGetAddress = 207, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarAddress) - MessageType_StellarAddress = 208, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarCreateAccountOp) - MessageType_StellarCreateAccountOp = 210, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarPaymentOp) - MessageType_StellarPaymentOp = 211, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarPathPaymentStrictReceiveOp) - MessageType_StellarPathPaymentStrictReceiveOp = 212, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarManageSellOfferOp) - MessageType_StellarManageSellOfferOp = 213, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarCreatePassiveSellOfferOp) - MessageType_StellarCreatePassiveSellOfferOp = 214, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarSetOptionsOp) - MessageType_StellarSetOptionsOp = 215, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarChangeTrustOp) - MessageType_StellarChangeTrustOp = 216, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarAllowTrustOp) - MessageType_StellarAllowTrustOp = 217, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarAccountMergeOp) - MessageType_StellarAccountMergeOp = 218, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarManageDataOp) - MessageType_StellarManageDataOp = 220, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarBumpSequenceOp) - MessageType_StellarBumpSequenceOp = 221, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarManageBuyOfferOp) - MessageType_StellarManageBuyOfferOp = 222, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarPathPaymentStrictSendOp) - MessageType_StellarPathPaymentStrictSendOp = 223, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarClaimClaimableBalanceOp) - MessageType_StellarClaimClaimableBalanceOp = 225, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_StellarSignedTx) - MessageType_StellarSignedTx = 230, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoGetPublicKey) - MessageType_CardanoGetPublicKey = 305, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoPublicKey) - MessageType_CardanoPublicKey = 306, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoGetAddress) - MessageType_CardanoGetAddress = 307, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoAddress) - MessageType_CardanoAddress = 308, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxItemAck) - MessageType_CardanoTxItemAck = 313, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxAuxiliaryDataSupplement) - MessageType_CardanoTxAuxiliaryDataSupplement = 314, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxWitnessRequest) - MessageType_CardanoTxWitnessRequest = 315, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxWitnessResponse) - MessageType_CardanoTxWitnessResponse = 316, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxHostAck) - MessageType_CardanoTxHostAck = 317, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxBodyHash) - MessageType_CardanoTxBodyHash = 318, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoSignTxFinished) - MessageType_CardanoSignTxFinished = 319, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoSignTxInit) - MessageType_CardanoSignTxInit = 320, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxInput) - MessageType_CardanoTxInput = 321, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxOutput) - MessageType_CardanoTxOutput = 322, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoAssetGroup) - MessageType_CardanoAssetGroup = 323, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoToken) - MessageType_CardanoToken = 324, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxCertificate) - MessageType_CardanoTxCertificate = 325, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxWithdrawal) - MessageType_CardanoTxWithdrawal = 326, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxAuxiliaryData) - MessageType_CardanoTxAuxiliaryData = 327, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoPoolOwner) - MessageType_CardanoPoolOwner = 328, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoPoolRelayParameters) - MessageType_CardanoPoolRelayParameters = 329, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoGetNativeScriptHash) - MessageType_CardanoGetNativeScriptHash = 330, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoNativeScriptHash) - MessageType_CardanoNativeScriptHash = 331, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxMint) - MessageType_CardanoTxMint = 332, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxCollateralInput) - MessageType_CardanoTxCollateralInput = 333, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxRequiredSigner) - MessageType_CardanoTxRequiredSigner = 334, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxInlineDatumChunk) - MessageType_CardanoTxInlineDatumChunk = 335, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxReferenceScriptChunk) - MessageType_CardanoTxReferenceScriptChunk = 336, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CardanoTxReferenceInput) - MessageType_CardanoTxReferenceInput = 337, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleGetAddress) - MessageType_RippleGetAddress = 400, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleAddress) - MessageType_RippleAddress = 401, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleSignTx) - MessageType_RippleSignTx = 402, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_RippleSignedTx) - MessageType_RippleSignedTx = 403, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInitRequest) - MessageType_MoneroTransactionInitRequest = 501, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInitAck) - MessageType_MoneroTransactionInitAck = 502, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetInputRequest) - MessageType_MoneroTransactionSetInputRequest = 503, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetInputAck) - MessageType_MoneroTransactionSetInputAck = 504, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInputViniRequest) - MessageType_MoneroTransactionInputViniRequest = 507, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionInputViniAck) - MessageType_MoneroTransactionInputViniAck = 508, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllInputsSetRequest) - MessageType_MoneroTransactionAllInputsSetRequest = 509, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllInputsSetAck) - MessageType_MoneroTransactionAllInputsSetAck = 510, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetOutputRequest) - MessageType_MoneroTransactionSetOutputRequest = 511, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSetOutputAck) - MessageType_MoneroTransactionSetOutputAck = 512, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllOutSetRequest) - MessageType_MoneroTransactionAllOutSetRequest = 513, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionAllOutSetAck) - MessageType_MoneroTransactionAllOutSetAck = 514, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSignInputRequest) - MessageType_MoneroTransactionSignInputRequest = 515, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionSignInputAck) - MessageType_MoneroTransactionSignInputAck = 516, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionFinalRequest) - MessageType_MoneroTransactionFinalRequest = 517, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroTransactionFinalAck) - MessageType_MoneroTransactionFinalAck = 518, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageExportInitRequest) - MessageType_MoneroKeyImageExportInitRequest = 530, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageExportInitAck) - MessageType_MoneroKeyImageExportInitAck = 531, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncStepRequest) - MessageType_MoneroKeyImageSyncStepRequest = 532, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncStepAck) - MessageType_MoneroKeyImageSyncStepAck = 533, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncFinalRequest) - MessageType_MoneroKeyImageSyncFinalRequest = 534, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroKeyImageSyncFinalAck) - MessageType_MoneroKeyImageSyncFinalAck = 535, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetAddress) - MessageType_MoneroGetAddress = 540, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroAddress) - MessageType_MoneroAddress = 541, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetWatchKey) - MessageType_MoneroGetWatchKey = 542, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroWatchKey) - MessageType_MoneroWatchKey = 543, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugMoneroDiagRequest) - MessageType_DebugMoneroDiagRequest = 546, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_DebugMoneroDiagAck) - MessageType_DebugMoneroDiagAck = 547, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetTxKeyRequest) - MessageType_MoneroGetTxKeyRequest = 550, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroGetTxKeyAck) - MessageType_MoneroGetTxKeyAck = 551, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStartRequest) - MessageType_MoneroLiveRefreshStartRequest = 552, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStartAck) - MessageType_MoneroLiveRefreshStartAck = 553, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStepRequest) - MessageType_MoneroLiveRefreshStepRequest = 554, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshStepAck) - MessageType_MoneroLiveRefreshStepAck = 555, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshFinalRequest) - MessageType_MoneroLiveRefreshFinalRequest = 556, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MoneroLiveRefreshFinalAck) - MessageType_MoneroLiveRefreshFinalAck = 557, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosGetPublicKey) - MessageType_EosGetPublicKey = 600, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosPublicKey) - MessageType_EosPublicKey = 601, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosSignTx) - MessageType_EosSignTx = 602, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosTxActionRequest) - MessageType_EosTxActionRequest = 603, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosTxActionAck) - MessageType_EosTxActionAck = 604, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_EosSignedTx) - MessageType_EosSignedTx = 605, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceGetAddress) - MessageType_BinanceGetAddress = 700, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceAddress) - MessageType_BinanceAddress = 701, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceGetPublicKey) - MessageType_BinanceGetPublicKey = 702, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinancePublicKey) - MessageType_BinancePublicKey = 703, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceSignTx) - MessageType_BinanceSignTx = 704, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceTxRequest) - MessageType_BinanceTxRequest = 705, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceTransferMsg) - MessageType_BinanceTransferMsg = 706, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceOrderMsg) - MessageType_BinanceOrderMsg = 707, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceCancelMsg) - MessageType_BinanceCancelMsg = 708, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BinanceSignedTx) - MessageType_BinanceSignedTx = 709, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnListResidentCredentials) - MessageType_WebAuthnListResidentCredentials = 800, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnCredentials) - MessageType_WebAuthnCredentials = 801, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnAddResidentCredential) - MessageType_WebAuthnAddResidentCredential = 802, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_WebAuthnRemoveResidentCredential) - MessageType_WebAuthnRemoveResidentCredential = 803, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaGetPublicKey) - MessageType_SolanaGetPublicKey = 900, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaPublicKey) - MessageType_SolanaPublicKey = 901, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaGetAddress) - MessageType_SolanaGetAddress = 902, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaAddress) - MessageType_SolanaAddress = 903, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaSignTx) - MessageType_SolanaSignTx = 904, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaTxSignature) - MessageType_SolanaTxSignature = 905, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerGetAddress) - MessageType_MintlayerGetAddress = 1000, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerAddress) - MessageType_MintlayerAddress = 1001, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerGetPublicKey) - MessageType_MintlayerGetPublicKey = 1002, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerPublicKey) - MessageType_MintlayerPublicKey = 1003, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerSignMessage) - MessageType_MintlayerSignMessage = 1004, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerSignTx) - MessageType_MintlayerSignTx = 1005, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerTxRequest) - MessageType_MintlayerTxRequest = 1006, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerTxAckUtxoInput) - MessageType_MintlayerTxAckUtxoInput = 1007, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_MintlayerTxAckOutput) - MessageType_MintlayerTxAckOutput = 1008, -} - -impl ::protobuf::Enum for MessageType { - const NAME: &'static str = "MessageType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(MessageType::MessageType_Initialize), - 1 => ::std::option::Option::Some(MessageType::MessageType_Ping), - 2 => ::std::option::Option::Some(MessageType::MessageType_Success), - 3 => ::std::option::Option::Some(MessageType::MessageType_Failure), - 4 => ::std::option::Option::Some(MessageType::MessageType_ChangePin), - 5 => ::std::option::Option::Some(MessageType::MessageType_WipeDevice), - 9 => ::std::option::Option::Some(MessageType::MessageType_GetEntropy), - 10 => ::std::option::Option::Some(MessageType::MessageType_Entropy), - 13 => ::std::option::Option::Some(MessageType::MessageType_LoadDevice), - 14 => ::std::option::Option::Some(MessageType::MessageType_ResetDevice), - 16 => ::std::option::Option::Some(MessageType::MessageType_SetBusy), - 17 => ::std::option::Option::Some(MessageType::MessageType_Features), - 18 => ::std::option::Option::Some(MessageType::MessageType_PinMatrixRequest), - 19 => ::std::option::Option::Some(MessageType::MessageType_PinMatrixAck), - 20 => ::std::option::Option::Some(MessageType::MessageType_Cancel), - 24 => ::std::option::Option::Some(MessageType::MessageType_LockDevice), - 25 => ::std::option::Option::Some(MessageType::MessageType_ApplySettings), - 26 => ::std::option::Option::Some(MessageType::MessageType_ButtonRequest), - 27 => ::std::option::Option::Some(MessageType::MessageType_ButtonAck), - 28 => ::std::option::Option::Some(MessageType::MessageType_ApplyFlags), - 31 => ::std::option::Option::Some(MessageType::MessageType_GetNonce), - 33 => ::std::option::Option::Some(MessageType::MessageType_Nonce), - 34 => ::std::option::Option::Some(MessageType::MessageType_BackupDevice), - 35 => ::std::option::Option::Some(MessageType::MessageType_EntropyRequest), - 36 => ::std::option::Option::Some(MessageType::MessageType_EntropyAck), - 41 => ::std::option::Option::Some(MessageType::MessageType_PassphraseRequest), - 42 => ::std::option::Option::Some(MessageType::MessageType_PassphraseAck), - 45 => ::std::option::Option::Some(MessageType::MessageType_RecoveryDevice), - 46 => ::std::option::Option::Some(MessageType::MessageType_WordRequest), - 47 => ::std::option::Option::Some(MessageType::MessageType_WordAck), - 55 => ::std::option::Option::Some(MessageType::MessageType_GetFeatures), - 79 => ::std::option::Option::Some(MessageType::MessageType_SdProtect), - 82 => ::std::option::Option::Some(MessageType::MessageType_ChangeWipeCode), - 83 => ::std::option::Option::Some(MessageType::MessageType_EndSession), - 84 => ::std::option::Option::Some(MessageType::MessageType_DoPreauthorized), - 85 => ::std::option::Option::Some(MessageType::MessageType_PreauthorizedRequest), - 86 => ::std::option::Option::Some(MessageType::MessageType_CancelAuthorization), - 87 => ::std::option::Option::Some(MessageType::MessageType_RebootToBootloader), - 88 => ::std::option::Option::Some(MessageType::MessageType_GetFirmwareHash), - 89 => ::std::option::Option::Some(MessageType::MessageType_FirmwareHash), - 93 => ::std::option::Option::Some(MessageType::MessageType_UnlockPath), - 94 => ::std::option::Option::Some(MessageType::MessageType_UnlockedPathRequest), - 95 => ::std::option::Option::Some(MessageType::MessageType_ShowDeviceTutorial), - 96 => ::std::option::Option::Some(MessageType::MessageType_UnlockBootloader), - 97 => ::std::option::Option::Some(MessageType::MessageType_AuthenticateDevice), - 98 => ::std::option::Option::Some(MessageType::MessageType_AuthenticityProof), - 990 => ::std::option::Option::Some(MessageType::MessageType_ChangeLanguage), - 991 => ::std::option::Option::Some(MessageType::MessageType_TranslationDataRequest), - 992 => ::std::option::Option::Some(MessageType::MessageType_TranslationDataAck), - 63 => ::std::option::Option::Some(MessageType::MessageType_SetU2FCounter), - 80 => ::std::option::Option::Some(MessageType::MessageType_GetNextU2FCounter), - 81 => ::std::option::Option::Some(MessageType::MessageType_NextU2FCounter), - 77 => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateRequest), - 78 => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateAck), - 6 => ::std::option::Option::Some(MessageType::MessageType_FirmwareErase), - 7 => ::std::option::Option::Some(MessageType::MessageType_FirmwareUpload), - 8 => ::std::option::Option::Some(MessageType::MessageType_FirmwareRequest), - 32 => ::std::option::Option::Some(MessageType::MessageType_ProdTestT1), - 11 => ::std::option::Option::Some(MessageType::MessageType_GetPublicKey), - 12 => ::std::option::Option::Some(MessageType::MessageType_PublicKey), - 15 => ::std::option::Option::Some(MessageType::MessageType_SignTx), - 21 => ::std::option::Option::Some(MessageType::MessageType_TxRequest), - 22 => ::std::option::Option::Some(MessageType::MessageType_TxAck), - 29 => ::std::option::Option::Some(MessageType::MessageType_GetAddress), - 30 => ::std::option::Option::Some(MessageType::MessageType_Address), - 37 => ::std::option::Option::Some(MessageType::MessageType_TxAckPaymentRequest), - 38 => ::std::option::Option::Some(MessageType::MessageType_SignMessage), - 39 => ::std::option::Option::Some(MessageType::MessageType_VerifyMessage), - 40 => ::std::option::Option::Some(MessageType::MessageType_MessageSignature), - 43 => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipId), - 44 => ::std::option::Option::Some(MessageType::MessageType_OwnershipId), - 49 => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipProof), - 50 => ::std::option::Option::Some(MessageType::MessageType_OwnershipProof), - 51 => ::std::option::Option::Some(MessageType::MessageType_AuthorizeCoinJoin), - 23 => ::std::option::Option::Some(MessageType::MessageType_CipherKeyValue), - 48 => ::std::option::Option::Some(MessageType::MessageType_CipheredKeyValue), - 53 => ::std::option::Option::Some(MessageType::MessageType_SignIdentity), - 54 => ::std::option::Option::Some(MessageType::MessageType_SignedIdentity), - 61 => ::std::option::Option::Some(MessageType::MessageType_GetECDHSessionKey), - 62 => ::std::option::Option::Some(MessageType::MessageType_ECDHSessionKey), - 71 => ::std::option::Option::Some(MessageType::MessageType_CosiCommit), - 72 => ::std::option::Option::Some(MessageType::MessageType_CosiCommitment), - 73 => ::std::option::Option::Some(MessageType::MessageType_CosiSign), - 74 => ::std::option::Option::Some(MessageType::MessageType_CosiSignature), - 100 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkDecision), - 101 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkGetState), - 102 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkState), - 103 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkStop), - 104 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLog), - 110 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryRead), - 111 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemory), - 112 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryWrite), - 113 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkFlashErase), - 9001 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLayout), - 9002 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkReseedRandom), - 9003 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkRecordScreen), - 9005 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkEraseSdCard), - 9006 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkWatchLayout), - 9007 => ::std::option::Option::Some(MessageType::MessageType_DebugLinkResetDebugEvents), - 450 => ::std::option::Option::Some(MessageType::MessageType_EthereumGetPublicKey), - 451 => ::std::option::Option::Some(MessageType::MessageType_EthereumPublicKey), - 56 => ::std::option::Option::Some(MessageType::MessageType_EthereumGetAddress), - 57 => ::std::option::Option::Some(MessageType::MessageType_EthereumAddress), - 58 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTx), - 452 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTxEIP1559), - 59 => ::std::option::Option::Some(MessageType::MessageType_EthereumTxRequest), - 60 => ::std::option::Option::Some(MessageType::MessageType_EthereumTxAck), - 64 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignMessage), - 65 => ::std::option::Option::Some(MessageType::MessageType_EthereumVerifyMessage), - 66 => ::std::option::Option::Some(MessageType::MessageType_EthereumMessageSignature), - 464 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedData), - 465 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructRequest), - 466 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructAck), - 467 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueRequest), - 468 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueAck), - 469 => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataSignature), - 470 => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedHash), - 67 => ::std::option::Option::Some(MessageType::MessageType_NEMGetAddress), - 68 => ::std::option::Option::Some(MessageType::MessageType_NEMAddress), - 69 => ::std::option::Option::Some(MessageType::MessageType_NEMSignTx), - 70 => ::std::option::Option::Some(MessageType::MessageType_NEMSignedTx), - 75 => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptMessage), - 76 => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptedMessage), - 150 => ::std::option::Option::Some(MessageType::MessageType_TezosGetAddress), - 151 => ::std::option::Option::Some(MessageType::MessageType_TezosAddress), - 152 => ::std::option::Option::Some(MessageType::MessageType_TezosSignTx), - 153 => ::std::option::Option::Some(MessageType::MessageType_TezosSignedTx), - 154 => ::std::option::Option::Some(MessageType::MessageType_TezosGetPublicKey), - 155 => ::std::option::Option::Some(MessageType::MessageType_TezosPublicKey), - 202 => ::std::option::Option::Some(MessageType::MessageType_StellarSignTx), - 203 => ::std::option::Option::Some(MessageType::MessageType_StellarTxOpRequest), - 207 => ::std::option::Option::Some(MessageType::MessageType_StellarGetAddress), - 208 => ::std::option::Option::Some(MessageType::MessageType_StellarAddress), - 210 => ::std::option::Option::Some(MessageType::MessageType_StellarCreateAccountOp), - 211 => ::std::option::Option::Some(MessageType::MessageType_StellarPaymentOp), - 212 => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictReceiveOp), - 213 => ::std::option::Option::Some(MessageType::MessageType_StellarManageSellOfferOp), - 214 => ::std::option::Option::Some(MessageType::MessageType_StellarCreatePassiveSellOfferOp), - 215 => ::std::option::Option::Some(MessageType::MessageType_StellarSetOptionsOp), - 216 => ::std::option::Option::Some(MessageType::MessageType_StellarChangeTrustOp), - 217 => ::std::option::Option::Some(MessageType::MessageType_StellarAllowTrustOp), - 218 => ::std::option::Option::Some(MessageType::MessageType_StellarAccountMergeOp), - 220 => ::std::option::Option::Some(MessageType::MessageType_StellarManageDataOp), - 221 => ::std::option::Option::Some(MessageType::MessageType_StellarBumpSequenceOp), - 222 => ::std::option::Option::Some(MessageType::MessageType_StellarManageBuyOfferOp), - 223 => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictSendOp), - 225 => ::std::option::Option::Some(MessageType::MessageType_StellarClaimClaimableBalanceOp), - 230 => ::std::option::Option::Some(MessageType::MessageType_StellarSignedTx), - 305 => ::std::option::Option::Some(MessageType::MessageType_CardanoGetPublicKey), - 306 => ::std::option::Option::Some(MessageType::MessageType_CardanoPublicKey), - 307 => ::std::option::Option::Some(MessageType::MessageType_CardanoGetAddress), - 308 => ::std::option::Option::Some(MessageType::MessageType_CardanoAddress), - 313 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxItemAck), - 314 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryDataSupplement), - 315 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessRequest), - 316 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessResponse), - 317 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxHostAck), - 318 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxBodyHash), - 319 => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxFinished), - 320 => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxInit), - 321 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInput), - 322 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxOutput), - 323 => ::std::option::Option::Some(MessageType::MessageType_CardanoAssetGroup), - 324 => ::std::option::Option::Some(MessageType::MessageType_CardanoToken), - 325 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCertificate), - 326 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWithdrawal), - 327 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryData), - 328 => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolOwner), - 329 => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolRelayParameters), - 330 => ::std::option::Option::Some(MessageType::MessageType_CardanoGetNativeScriptHash), - 331 => ::std::option::Option::Some(MessageType::MessageType_CardanoNativeScriptHash), - 332 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxMint), - 333 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCollateralInput), - 334 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxRequiredSigner), - 335 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInlineDatumChunk), - 336 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceScriptChunk), - 337 => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceInput), - 400 => ::std::option::Option::Some(MessageType::MessageType_RippleGetAddress), - 401 => ::std::option::Option::Some(MessageType::MessageType_RippleAddress), - 402 => ::std::option::Option::Some(MessageType::MessageType_RippleSignTx), - 403 => ::std::option::Option::Some(MessageType::MessageType_RippleSignedTx), - 501 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitRequest), - 502 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitAck), - 503 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputRequest), - 504 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputAck), - 507 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniRequest), - 508 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniAck), - 509 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetRequest), - 510 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetAck), - 511 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputRequest), - 512 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputAck), - 513 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetRequest), - 514 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetAck), - 515 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputRequest), - 516 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputAck), - 517 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalRequest), - 518 => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalAck), - 530 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitRequest), - 531 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitAck), - 532 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepRequest), - 533 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepAck), - 534 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalRequest), - 535 => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalAck), - 540 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetAddress), - 541 => ::std::option::Option::Some(MessageType::MessageType_MoneroAddress), - 542 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetWatchKey), - 543 => ::std::option::Option::Some(MessageType::MessageType_MoneroWatchKey), - 546 => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagRequest), - 547 => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagAck), - 550 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyRequest), - 551 => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyAck), - 552 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartRequest), - 553 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartAck), - 554 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepRequest), - 555 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepAck), - 556 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalRequest), - 557 => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalAck), - 600 => ::std::option::Option::Some(MessageType::MessageType_EosGetPublicKey), - 601 => ::std::option::Option::Some(MessageType::MessageType_EosPublicKey), - 602 => ::std::option::Option::Some(MessageType::MessageType_EosSignTx), - 603 => ::std::option::Option::Some(MessageType::MessageType_EosTxActionRequest), - 604 => ::std::option::Option::Some(MessageType::MessageType_EosTxActionAck), - 605 => ::std::option::Option::Some(MessageType::MessageType_EosSignedTx), - 700 => ::std::option::Option::Some(MessageType::MessageType_BinanceGetAddress), - 701 => ::std::option::Option::Some(MessageType::MessageType_BinanceAddress), - 702 => ::std::option::Option::Some(MessageType::MessageType_BinanceGetPublicKey), - 703 => ::std::option::Option::Some(MessageType::MessageType_BinancePublicKey), - 704 => ::std::option::Option::Some(MessageType::MessageType_BinanceSignTx), - 705 => ::std::option::Option::Some(MessageType::MessageType_BinanceTxRequest), - 706 => ::std::option::Option::Some(MessageType::MessageType_BinanceTransferMsg), - 707 => ::std::option::Option::Some(MessageType::MessageType_BinanceOrderMsg), - 708 => ::std::option::Option::Some(MessageType::MessageType_BinanceCancelMsg), - 709 => ::std::option::Option::Some(MessageType::MessageType_BinanceSignedTx), - 800 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnListResidentCredentials), - 801 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnCredentials), - 802 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnAddResidentCredential), - 803 => ::std::option::Option::Some(MessageType::MessageType_WebAuthnRemoveResidentCredential), - 900 => ::std::option::Option::Some(MessageType::MessageType_SolanaGetPublicKey), - 901 => ::std::option::Option::Some(MessageType::MessageType_SolanaPublicKey), - 902 => ::std::option::Option::Some(MessageType::MessageType_SolanaGetAddress), - 903 => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress), - 904 => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx), - 905 => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature), - 1000 => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetAddress), - 1001 => ::std::option::Option::Some(MessageType::MessageType_MintlayerAddress), - 1002 => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetPublicKey), - 1003 => ::std::option::Option::Some(MessageType::MessageType_MintlayerPublicKey), - 1004 => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignMessage), - 1005 => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignTx), - 1006 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxRequest), - 1007 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckUtxoInput), - 1008 => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckOutput), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "MessageType_Initialize" => ::std::option::Option::Some(MessageType::MessageType_Initialize), - "MessageType_Ping" => ::std::option::Option::Some(MessageType::MessageType_Ping), - "MessageType_Success" => ::std::option::Option::Some(MessageType::MessageType_Success), - "MessageType_Failure" => ::std::option::Option::Some(MessageType::MessageType_Failure), - "MessageType_ChangePin" => ::std::option::Option::Some(MessageType::MessageType_ChangePin), - "MessageType_WipeDevice" => ::std::option::Option::Some(MessageType::MessageType_WipeDevice), - "MessageType_GetEntropy" => ::std::option::Option::Some(MessageType::MessageType_GetEntropy), - "MessageType_Entropy" => ::std::option::Option::Some(MessageType::MessageType_Entropy), - "MessageType_LoadDevice" => ::std::option::Option::Some(MessageType::MessageType_LoadDevice), - "MessageType_ResetDevice" => ::std::option::Option::Some(MessageType::MessageType_ResetDevice), - "MessageType_SetBusy" => ::std::option::Option::Some(MessageType::MessageType_SetBusy), - "MessageType_Features" => ::std::option::Option::Some(MessageType::MessageType_Features), - "MessageType_PinMatrixRequest" => ::std::option::Option::Some(MessageType::MessageType_PinMatrixRequest), - "MessageType_PinMatrixAck" => ::std::option::Option::Some(MessageType::MessageType_PinMatrixAck), - "MessageType_Cancel" => ::std::option::Option::Some(MessageType::MessageType_Cancel), - "MessageType_LockDevice" => ::std::option::Option::Some(MessageType::MessageType_LockDevice), - "MessageType_ApplySettings" => ::std::option::Option::Some(MessageType::MessageType_ApplySettings), - "MessageType_ButtonRequest" => ::std::option::Option::Some(MessageType::MessageType_ButtonRequest), - "MessageType_ButtonAck" => ::std::option::Option::Some(MessageType::MessageType_ButtonAck), - "MessageType_ApplyFlags" => ::std::option::Option::Some(MessageType::MessageType_ApplyFlags), - "MessageType_GetNonce" => ::std::option::Option::Some(MessageType::MessageType_GetNonce), - "MessageType_Nonce" => ::std::option::Option::Some(MessageType::MessageType_Nonce), - "MessageType_BackupDevice" => ::std::option::Option::Some(MessageType::MessageType_BackupDevice), - "MessageType_EntropyRequest" => ::std::option::Option::Some(MessageType::MessageType_EntropyRequest), - "MessageType_EntropyAck" => ::std::option::Option::Some(MessageType::MessageType_EntropyAck), - "MessageType_PassphraseRequest" => ::std::option::Option::Some(MessageType::MessageType_PassphraseRequest), - "MessageType_PassphraseAck" => ::std::option::Option::Some(MessageType::MessageType_PassphraseAck), - "MessageType_RecoveryDevice" => ::std::option::Option::Some(MessageType::MessageType_RecoveryDevice), - "MessageType_WordRequest" => ::std::option::Option::Some(MessageType::MessageType_WordRequest), - "MessageType_WordAck" => ::std::option::Option::Some(MessageType::MessageType_WordAck), - "MessageType_GetFeatures" => ::std::option::Option::Some(MessageType::MessageType_GetFeatures), - "MessageType_SdProtect" => ::std::option::Option::Some(MessageType::MessageType_SdProtect), - "MessageType_ChangeWipeCode" => ::std::option::Option::Some(MessageType::MessageType_ChangeWipeCode), - "MessageType_EndSession" => ::std::option::Option::Some(MessageType::MessageType_EndSession), - "MessageType_DoPreauthorized" => ::std::option::Option::Some(MessageType::MessageType_DoPreauthorized), - "MessageType_PreauthorizedRequest" => ::std::option::Option::Some(MessageType::MessageType_PreauthorizedRequest), - "MessageType_CancelAuthorization" => ::std::option::Option::Some(MessageType::MessageType_CancelAuthorization), - "MessageType_RebootToBootloader" => ::std::option::Option::Some(MessageType::MessageType_RebootToBootloader), - "MessageType_GetFirmwareHash" => ::std::option::Option::Some(MessageType::MessageType_GetFirmwareHash), - "MessageType_FirmwareHash" => ::std::option::Option::Some(MessageType::MessageType_FirmwareHash), - "MessageType_UnlockPath" => ::std::option::Option::Some(MessageType::MessageType_UnlockPath), - "MessageType_UnlockedPathRequest" => ::std::option::Option::Some(MessageType::MessageType_UnlockedPathRequest), - "MessageType_ShowDeviceTutorial" => ::std::option::Option::Some(MessageType::MessageType_ShowDeviceTutorial), - "MessageType_UnlockBootloader" => ::std::option::Option::Some(MessageType::MessageType_UnlockBootloader), - "MessageType_AuthenticateDevice" => ::std::option::Option::Some(MessageType::MessageType_AuthenticateDevice), - "MessageType_AuthenticityProof" => ::std::option::Option::Some(MessageType::MessageType_AuthenticityProof), - "MessageType_ChangeLanguage" => ::std::option::Option::Some(MessageType::MessageType_ChangeLanguage), - "MessageType_TranslationDataRequest" => ::std::option::Option::Some(MessageType::MessageType_TranslationDataRequest), - "MessageType_TranslationDataAck" => ::std::option::Option::Some(MessageType::MessageType_TranslationDataAck), - "MessageType_SetU2FCounter" => ::std::option::Option::Some(MessageType::MessageType_SetU2FCounter), - "MessageType_GetNextU2FCounter" => ::std::option::Option::Some(MessageType::MessageType_GetNextU2FCounter), - "MessageType_NextU2FCounter" => ::std::option::Option::Some(MessageType::MessageType_NextU2FCounter), - "MessageType_Deprecated_PassphraseStateRequest" => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateRequest), - "MessageType_Deprecated_PassphraseStateAck" => ::std::option::Option::Some(MessageType::MessageType_Deprecated_PassphraseStateAck), - "MessageType_FirmwareErase" => ::std::option::Option::Some(MessageType::MessageType_FirmwareErase), - "MessageType_FirmwareUpload" => ::std::option::Option::Some(MessageType::MessageType_FirmwareUpload), - "MessageType_FirmwareRequest" => ::std::option::Option::Some(MessageType::MessageType_FirmwareRequest), - "MessageType_ProdTestT1" => ::std::option::Option::Some(MessageType::MessageType_ProdTestT1), - "MessageType_GetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_GetPublicKey), - "MessageType_PublicKey" => ::std::option::Option::Some(MessageType::MessageType_PublicKey), - "MessageType_SignTx" => ::std::option::Option::Some(MessageType::MessageType_SignTx), - "MessageType_TxRequest" => ::std::option::Option::Some(MessageType::MessageType_TxRequest), - "MessageType_TxAck" => ::std::option::Option::Some(MessageType::MessageType_TxAck), - "MessageType_GetAddress" => ::std::option::Option::Some(MessageType::MessageType_GetAddress), - "MessageType_Address" => ::std::option::Option::Some(MessageType::MessageType_Address), - "MessageType_TxAckPaymentRequest" => ::std::option::Option::Some(MessageType::MessageType_TxAckPaymentRequest), - "MessageType_SignMessage" => ::std::option::Option::Some(MessageType::MessageType_SignMessage), - "MessageType_VerifyMessage" => ::std::option::Option::Some(MessageType::MessageType_VerifyMessage), - "MessageType_MessageSignature" => ::std::option::Option::Some(MessageType::MessageType_MessageSignature), - "MessageType_GetOwnershipId" => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipId), - "MessageType_OwnershipId" => ::std::option::Option::Some(MessageType::MessageType_OwnershipId), - "MessageType_GetOwnershipProof" => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipProof), - "MessageType_OwnershipProof" => ::std::option::Option::Some(MessageType::MessageType_OwnershipProof), - "MessageType_AuthorizeCoinJoin" => ::std::option::Option::Some(MessageType::MessageType_AuthorizeCoinJoin), - "MessageType_CipherKeyValue" => ::std::option::Option::Some(MessageType::MessageType_CipherKeyValue), - "MessageType_CipheredKeyValue" => ::std::option::Option::Some(MessageType::MessageType_CipheredKeyValue), - "MessageType_SignIdentity" => ::std::option::Option::Some(MessageType::MessageType_SignIdentity), - "MessageType_SignedIdentity" => ::std::option::Option::Some(MessageType::MessageType_SignedIdentity), - "MessageType_GetECDHSessionKey" => ::std::option::Option::Some(MessageType::MessageType_GetECDHSessionKey), - "MessageType_ECDHSessionKey" => ::std::option::Option::Some(MessageType::MessageType_ECDHSessionKey), - "MessageType_CosiCommit" => ::std::option::Option::Some(MessageType::MessageType_CosiCommit), - "MessageType_CosiCommitment" => ::std::option::Option::Some(MessageType::MessageType_CosiCommitment), - "MessageType_CosiSign" => ::std::option::Option::Some(MessageType::MessageType_CosiSign), - "MessageType_CosiSignature" => ::std::option::Option::Some(MessageType::MessageType_CosiSignature), - "MessageType_DebugLinkDecision" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkDecision), - "MessageType_DebugLinkGetState" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkGetState), - "MessageType_DebugLinkState" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkState), - "MessageType_DebugLinkStop" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkStop), - "MessageType_DebugLinkLog" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLog), - "MessageType_DebugLinkMemoryRead" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryRead), - "MessageType_DebugLinkMemory" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemory), - "MessageType_DebugLinkMemoryWrite" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkMemoryWrite), - "MessageType_DebugLinkFlashErase" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkFlashErase), - "MessageType_DebugLinkLayout" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkLayout), - "MessageType_DebugLinkReseedRandom" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkReseedRandom), - "MessageType_DebugLinkRecordScreen" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkRecordScreen), - "MessageType_DebugLinkEraseSdCard" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkEraseSdCard), - "MessageType_DebugLinkWatchLayout" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkWatchLayout), - "MessageType_DebugLinkResetDebugEvents" => ::std::option::Option::Some(MessageType::MessageType_DebugLinkResetDebugEvents), - "MessageType_EthereumGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EthereumGetPublicKey), - "MessageType_EthereumPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EthereumPublicKey), - "MessageType_EthereumGetAddress" => ::std::option::Option::Some(MessageType::MessageType_EthereumGetAddress), - "MessageType_EthereumAddress" => ::std::option::Option::Some(MessageType::MessageType_EthereumAddress), - "MessageType_EthereumSignTx" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTx), - "MessageType_EthereumSignTxEIP1559" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTxEIP1559), - "MessageType_EthereumTxRequest" => ::std::option::Option::Some(MessageType::MessageType_EthereumTxRequest), - "MessageType_EthereumTxAck" => ::std::option::Option::Some(MessageType::MessageType_EthereumTxAck), - "MessageType_EthereumSignMessage" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignMessage), - "MessageType_EthereumVerifyMessage" => ::std::option::Option::Some(MessageType::MessageType_EthereumVerifyMessage), - "MessageType_EthereumMessageSignature" => ::std::option::Option::Some(MessageType::MessageType_EthereumMessageSignature), - "MessageType_EthereumSignTypedData" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedData), - "MessageType_EthereumTypedDataStructRequest" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructRequest), - "MessageType_EthereumTypedDataStructAck" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataStructAck), - "MessageType_EthereumTypedDataValueRequest" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueRequest), - "MessageType_EthereumTypedDataValueAck" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataValueAck), - "MessageType_EthereumTypedDataSignature" => ::std::option::Option::Some(MessageType::MessageType_EthereumTypedDataSignature), - "MessageType_EthereumSignTypedHash" => ::std::option::Option::Some(MessageType::MessageType_EthereumSignTypedHash), - "MessageType_NEMGetAddress" => ::std::option::Option::Some(MessageType::MessageType_NEMGetAddress), - "MessageType_NEMAddress" => ::std::option::Option::Some(MessageType::MessageType_NEMAddress), - "MessageType_NEMSignTx" => ::std::option::Option::Some(MessageType::MessageType_NEMSignTx), - "MessageType_NEMSignedTx" => ::std::option::Option::Some(MessageType::MessageType_NEMSignedTx), - "MessageType_NEMDecryptMessage" => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptMessage), - "MessageType_NEMDecryptedMessage" => ::std::option::Option::Some(MessageType::MessageType_NEMDecryptedMessage), - "MessageType_TezosGetAddress" => ::std::option::Option::Some(MessageType::MessageType_TezosGetAddress), - "MessageType_TezosAddress" => ::std::option::Option::Some(MessageType::MessageType_TezosAddress), - "MessageType_TezosSignTx" => ::std::option::Option::Some(MessageType::MessageType_TezosSignTx), - "MessageType_TezosSignedTx" => ::std::option::Option::Some(MessageType::MessageType_TezosSignedTx), - "MessageType_TezosGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_TezosGetPublicKey), - "MessageType_TezosPublicKey" => ::std::option::Option::Some(MessageType::MessageType_TezosPublicKey), - "MessageType_StellarSignTx" => ::std::option::Option::Some(MessageType::MessageType_StellarSignTx), - "MessageType_StellarTxOpRequest" => ::std::option::Option::Some(MessageType::MessageType_StellarTxOpRequest), - "MessageType_StellarGetAddress" => ::std::option::Option::Some(MessageType::MessageType_StellarGetAddress), - "MessageType_StellarAddress" => ::std::option::Option::Some(MessageType::MessageType_StellarAddress), - "MessageType_StellarCreateAccountOp" => ::std::option::Option::Some(MessageType::MessageType_StellarCreateAccountOp), - "MessageType_StellarPaymentOp" => ::std::option::Option::Some(MessageType::MessageType_StellarPaymentOp), - "MessageType_StellarPathPaymentStrictReceiveOp" => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictReceiveOp), - "MessageType_StellarManageSellOfferOp" => ::std::option::Option::Some(MessageType::MessageType_StellarManageSellOfferOp), - "MessageType_StellarCreatePassiveSellOfferOp" => ::std::option::Option::Some(MessageType::MessageType_StellarCreatePassiveSellOfferOp), - "MessageType_StellarSetOptionsOp" => ::std::option::Option::Some(MessageType::MessageType_StellarSetOptionsOp), - "MessageType_StellarChangeTrustOp" => ::std::option::Option::Some(MessageType::MessageType_StellarChangeTrustOp), - "MessageType_StellarAllowTrustOp" => ::std::option::Option::Some(MessageType::MessageType_StellarAllowTrustOp), - "MessageType_StellarAccountMergeOp" => ::std::option::Option::Some(MessageType::MessageType_StellarAccountMergeOp), - "MessageType_StellarManageDataOp" => ::std::option::Option::Some(MessageType::MessageType_StellarManageDataOp), - "MessageType_StellarBumpSequenceOp" => ::std::option::Option::Some(MessageType::MessageType_StellarBumpSequenceOp), - "MessageType_StellarManageBuyOfferOp" => ::std::option::Option::Some(MessageType::MessageType_StellarManageBuyOfferOp), - "MessageType_StellarPathPaymentStrictSendOp" => ::std::option::Option::Some(MessageType::MessageType_StellarPathPaymentStrictSendOp), - "MessageType_StellarClaimClaimableBalanceOp" => ::std::option::Option::Some(MessageType::MessageType_StellarClaimClaimableBalanceOp), - "MessageType_StellarSignedTx" => ::std::option::Option::Some(MessageType::MessageType_StellarSignedTx), - "MessageType_CardanoGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_CardanoGetPublicKey), - "MessageType_CardanoPublicKey" => ::std::option::Option::Some(MessageType::MessageType_CardanoPublicKey), - "MessageType_CardanoGetAddress" => ::std::option::Option::Some(MessageType::MessageType_CardanoGetAddress), - "MessageType_CardanoAddress" => ::std::option::Option::Some(MessageType::MessageType_CardanoAddress), - "MessageType_CardanoTxItemAck" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxItemAck), - "MessageType_CardanoTxAuxiliaryDataSupplement" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryDataSupplement), - "MessageType_CardanoTxWitnessRequest" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessRequest), - "MessageType_CardanoTxWitnessResponse" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWitnessResponse), - "MessageType_CardanoTxHostAck" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxHostAck), - "MessageType_CardanoTxBodyHash" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxBodyHash), - "MessageType_CardanoSignTxFinished" => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxFinished), - "MessageType_CardanoSignTxInit" => ::std::option::Option::Some(MessageType::MessageType_CardanoSignTxInit), - "MessageType_CardanoTxInput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInput), - "MessageType_CardanoTxOutput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxOutput), - "MessageType_CardanoAssetGroup" => ::std::option::Option::Some(MessageType::MessageType_CardanoAssetGroup), - "MessageType_CardanoToken" => ::std::option::Option::Some(MessageType::MessageType_CardanoToken), - "MessageType_CardanoTxCertificate" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCertificate), - "MessageType_CardanoTxWithdrawal" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxWithdrawal), - "MessageType_CardanoTxAuxiliaryData" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxAuxiliaryData), - "MessageType_CardanoPoolOwner" => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolOwner), - "MessageType_CardanoPoolRelayParameters" => ::std::option::Option::Some(MessageType::MessageType_CardanoPoolRelayParameters), - "MessageType_CardanoGetNativeScriptHash" => ::std::option::Option::Some(MessageType::MessageType_CardanoGetNativeScriptHash), - "MessageType_CardanoNativeScriptHash" => ::std::option::Option::Some(MessageType::MessageType_CardanoNativeScriptHash), - "MessageType_CardanoTxMint" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxMint), - "MessageType_CardanoTxCollateralInput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxCollateralInput), - "MessageType_CardanoTxRequiredSigner" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxRequiredSigner), - "MessageType_CardanoTxInlineDatumChunk" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxInlineDatumChunk), - "MessageType_CardanoTxReferenceScriptChunk" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceScriptChunk), - "MessageType_CardanoTxReferenceInput" => ::std::option::Option::Some(MessageType::MessageType_CardanoTxReferenceInput), - "MessageType_RippleGetAddress" => ::std::option::Option::Some(MessageType::MessageType_RippleGetAddress), - "MessageType_RippleAddress" => ::std::option::Option::Some(MessageType::MessageType_RippleAddress), - "MessageType_RippleSignTx" => ::std::option::Option::Some(MessageType::MessageType_RippleSignTx), - "MessageType_RippleSignedTx" => ::std::option::Option::Some(MessageType::MessageType_RippleSignedTx), - "MessageType_MoneroTransactionInitRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitRequest), - "MessageType_MoneroTransactionInitAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInitAck), - "MessageType_MoneroTransactionSetInputRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputRequest), - "MessageType_MoneroTransactionSetInputAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetInputAck), - "MessageType_MoneroTransactionInputViniRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniRequest), - "MessageType_MoneroTransactionInputViniAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionInputViniAck), - "MessageType_MoneroTransactionAllInputsSetRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetRequest), - "MessageType_MoneroTransactionAllInputsSetAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllInputsSetAck), - "MessageType_MoneroTransactionSetOutputRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputRequest), - "MessageType_MoneroTransactionSetOutputAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSetOutputAck), - "MessageType_MoneroTransactionAllOutSetRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetRequest), - "MessageType_MoneroTransactionAllOutSetAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionAllOutSetAck), - "MessageType_MoneroTransactionSignInputRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputRequest), - "MessageType_MoneroTransactionSignInputAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionSignInputAck), - "MessageType_MoneroTransactionFinalRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalRequest), - "MessageType_MoneroTransactionFinalAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroTransactionFinalAck), - "MessageType_MoneroKeyImageExportInitRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitRequest), - "MessageType_MoneroKeyImageExportInitAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageExportInitAck), - "MessageType_MoneroKeyImageSyncStepRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepRequest), - "MessageType_MoneroKeyImageSyncStepAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncStepAck), - "MessageType_MoneroKeyImageSyncFinalRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalRequest), - "MessageType_MoneroKeyImageSyncFinalAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroKeyImageSyncFinalAck), - "MessageType_MoneroGetAddress" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetAddress), - "MessageType_MoneroAddress" => ::std::option::Option::Some(MessageType::MessageType_MoneroAddress), - "MessageType_MoneroGetWatchKey" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetWatchKey), - "MessageType_MoneroWatchKey" => ::std::option::Option::Some(MessageType::MessageType_MoneroWatchKey), - "MessageType_DebugMoneroDiagRequest" => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagRequest), - "MessageType_DebugMoneroDiagAck" => ::std::option::Option::Some(MessageType::MessageType_DebugMoneroDiagAck), - "MessageType_MoneroGetTxKeyRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyRequest), - "MessageType_MoneroGetTxKeyAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroGetTxKeyAck), - "MessageType_MoneroLiveRefreshStartRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartRequest), - "MessageType_MoneroLiveRefreshStartAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStartAck), - "MessageType_MoneroLiveRefreshStepRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepRequest), - "MessageType_MoneroLiveRefreshStepAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshStepAck), - "MessageType_MoneroLiveRefreshFinalRequest" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalRequest), - "MessageType_MoneroLiveRefreshFinalAck" => ::std::option::Option::Some(MessageType::MessageType_MoneroLiveRefreshFinalAck), - "MessageType_EosGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EosGetPublicKey), - "MessageType_EosPublicKey" => ::std::option::Option::Some(MessageType::MessageType_EosPublicKey), - "MessageType_EosSignTx" => ::std::option::Option::Some(MessageType::MessageType_EosSignTx), - "MessageType_EosTxActionRequest" => ::std::option::Option::Some(MessageType::MessageType_EosTxActionRequest), - "MessageType_EosTxActionAck" => ::std::option::Option::Some(MessageType::MessageType_EosTxActionAck), - "MessageType_EosSignedTx" => ::std::option::Option::Some(MessageType::MessageType_EosSignedTx), - "MessageType_BinanceGetAddress" => ::std::option::Option::Some(MessageType::MessageType_BinanceGetAddress), - "MessageType_BinanceAddress" => ::std::option::Option::Some(MessageType::MessageType_BinanceAddress), - "MessageType_BinanceGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_BinanceGetPublicKey), - "MessageType_BinancePublicKey" => ::std::option::Option::Some(MessageType::MessageType_BinancePublicKey), - "MessageType_BinanceSignTx" => ::std::option::Option::Some(MessageType::MessageType_BinanceSignTx), - "MessageType_BinanceTxRequest" => ::std::option::Option::Some(MessageType::MessageType_BinanceTxRequest), - "MessageType_BinanceTransferMsg" => ::std::option::Option::Some(MessageType::MessageType_BinanceTransferMsg), - "MessageType_BinanceOrderMsg" => ::std::option::Option::Some(MessageType::MessageType_BinanceOrderMsg), - "MessageType_BinanceCancelMsg" => ::std::option::Option::Some(MessageType::MessageType_BinanceCancelMsg), - "MessageType_BinanceSignedTx" => ::std::option::Option::Some(MessageType::MessageType_BinanceSignedTx), - "MessageType_WebAuthnListResidentCredentials" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnListResidentCredentials), - "MessageType_WebAuthnCredentials" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnCredentials), - "MessageType_WebAuthnAddResidentCredential" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnAddResidentCredential), - "MessageType_WebAuthnRemoveResidentCredential" => ::std::option::Option::Some(MessageType::MessageType_WebAuthnRemoveResidentCredential), - "MessageType_SolanaGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_SolanaGetPublicKey), - "MessageType_SolanaPublicKey" => ::std::option::Option::Some(MessageType::MessageType_SolanaPublicKey), - "MessageType_SolanaGetAddress" => ::std::option::Option::Some(MessageType::MessageType_SolanaGetAddress), - "MessageType_SolanaAddress" => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress), - "MessageType_SolanaSignTx" => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx), - "MessageType_SolanaTxSignature" => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature), - "MessageType_MintlayerGetAddress" => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetAddress), - "MessageType_MintlayerAddress" => ::std::option::Option::Some(MessageType::MessageType_MintlayerAddress), - "MessageType_MintlayerGetPublicKey" => ::std::option::Option::Some(MessageType::MessageType_MintlayerGetPublicKey), - "MessageType_MintlayerPublicKey" => ::std::option::Option::Some(MessageType::MessageType_MintlayerPublicKey), - "MessageType_MintlayerSignMessage" => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignMessage), - "MessageType_MintlayerSignTx" => ::std::option::Option::Some(MessageType::MessageType_MintlayerSignTx), - "MessageType_MintlayerTxRequest" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxRequest), - "MessageType_MintlayerTxAckUtxoInput" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckUtxoInput), - "MessageType_MintlayerTxAckOutput" => ::std::option::Option::Some(MessageType::MessageType_MintlayerTxAckOutput), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [MessageType] = &[ - MessageType::MessageType_Initialize, - MessageType::MessageType_Ping, - MessageType::MessageType_Success, - MessageType::MessageType_Failure, - MessageType::MessageType_ChangePin, - MessageType::MessageType_WipeDevice, - MessageType::MessageType_GetEntropy, - MessageType::MessageType_Entropy, - MessageType::MessageType_LoadDevice, - MessageType::MessageType_ResetDevice, - MessageType::MessageType_SetBusy, - MessageType::MessageType_Features, - MessageType::MessageType_PinMatrixRequest, - MessageType::MessageType_PinMatrixAck, - MessageType::MessageType_Cancel, - MessageType::MessageType_LockDevice, - MessageType::MessageType_ApplySettings, - MessageType::MessageType_ButtonRequest, - MessageType::MessageType_ButtonAck, - MessageType::MessageType_ApplyFlags, - MessageType::MessageType_GetNonce, - MessageType::MessageType_Nonce, - MessageType::MessageType_BackupDevice, - MessageType::MessageType_EntropyRequest, - MessageType::MessageType_EntropyAck, - MessageType::MessageType_PassphraseRequest, - MessageType::MessageType_PassphraseAck, - MessageType::MessageType_RecoveryDevice, - MessageType::MessageType_WordRequest, - MessageType::MessageType_WordAck, - MessageType::MessageType_GetFeatures, - MessageType::MessageType_SdProtect, - MessageType::MessageType_ChangeWipeCode, - MessageType::MessageType_EndSession, - MessageType::MessageType_DoPreauthorized, - MessageType::MessageType_PreauthorizedRequest, - MessageType::MessageType_CancelAuthorization, - MessageType::MessageType_RebootToBootloader, - MessageType::MessageType_GetFirmwareHash, - MessageType::MessageType_FirmwareHash, - MessageType::MessageType_UnlockPath, - MessageType::MessageType_UnlockedPathRequest, - MessageType::MessageType_ShowDeviceTutorial, - MessageType::MessageType_UnlockBootloader, - MessageType::MessageType_AuthenticateDevice, - MessageType::MessageType_AuthenticityProof, - MessageType::MessageType_ChangeLanguage, - MessageType::MessageType_TranslationDataRequest, - MessageType::MessageType_TranslationDataAck, - MessageType::MessageType_SetU2FCounter, - MessageType::MessageType_GetNextU2FCounter, - MessageType::MessageType_NextU2FCounter, - MessageType::MessageType_Deprecated_PassphraseStateRequest, - MessageType::MessageType_Deprecated_PassphraseStateAck, - MessageType::MessageType_FirmwareErase, - MessageType::MessageType_FirmwareUpload, - MessageType::MessageType_FirmwareRequest, - MessageType::MessageType_ProdTestT1, - MessageType::MessageType_GetPublicKey, - MessageType::MessageType_PublicKey, - MessageType::MessageType_SignTx, - MessageType::MessageType_TxRequest, - MessageType::MessageType_TxAck, - MessageType::MessageType_GetAddress, - MessageType::MessageType_Address, - MessageType::MessageType_TxAckPaymentRequest, - MessageType::MessageType_SignMessage, - MessageType::MessageType_VerifyMessage, - MessageType::MessageType_MessageSignature, - MessageType::MessageType_GetOwnershipId, - MessageType::MessageType_OwnershipId, - MessageType::MessageType_GetOwnershipProof, - MessageType::MessageType_OwnershipProof, - MessageType::MessageType_AuthorizeCoinJoin, - MessageType::MessageType_CipherKeyValue, - MessageType::MessageType_CipheredKeyValue, - MessageType::MessageType_SignIdentity, - MessageType::MessageType_SignedIdentity, - MessageType::MessageType_GetECDHSessionKey, - MessageType::MessageType_ECDHSessionKey, - MessageType::MessageType_CosiCommit, - MessageType::MessageType_CosiCommitment, - MessageType::MessageType_CosiSign, - MessageType::MessageType_CosiSignature, - MessageType::MessageType_DebugLinkDecision, - MessageType::MessageType_DebugLinkGetState, - MessageType::MessageType_DebugLinkState, - MessageType::MessageType_DebugLinkStop, - MessageType::MessageType_DebugLinkLog, - MessageType::MessageType_DebugLinkMemoryRead, - MessageType::MessageType_DebugLinkMemory, - MessageType::MessageType_DebugLinkMemoryWrite, - MessageType::MessageType_DebugLinkFlashErase, - MessageType::MessageType_DebugLinkLayout, - MessageType::MessageType_DebugLinkReseedRandom, - MessageType::MessageType_DebugLinkRecordScreen, - MessageType::MessageType_DebugLinkEraseSdCard, - MessageType::MessageType_DebugLinkWatchLayout, - MessageType::MessageType_DebugLinkResetDebugEvents, - MessageType::MessageType_EthereumGetPublicKey, - MessageType::MessageType_EthereumPublicKey, - MessageType::MessageType_EthereumGetAddress, - MessageType::MessageType_EthereumAddress, - MessageType::MessageType_EthereumSignTx, - MessageType::MessageType_EthereumSignTxEIP1559, - MessageType::MessageType_EthereumTxRequest, - MessageType::MessageType_EthereumTxAck, - MessageType::MessageType_EthereumSignMessage, - MessageType::MessageType_EthereumVerifyMessage, - MessageType::MessageType_EthereumMessageSignature, - MessageType::MessageType_EthereumSignTypedData, - MessageType::MessageType_EthereumTypedDataStructRequest, - MessageType::MessageType_EthereumTypedDataStructAck, - MessageType::MessageType_EthereumTypedDataValueRequest, - MessageType::MessageType_EthereumTypedDataValueAck, - MessageType::MessageType_EthereumTypedDataSignature, - MessageType::MessageType_EthereumSignTypedHash, - MessageType::MessageType_NEMGetAddress, - MessageType::MessageType_NEMAddress, - MessageType::MessageType_NEMSignTx, - MessageType::MessageType_NEMSignedTx, - MessageType::MessageType_NEMDecryptMessage, - MessageType::MessageType_NEMDecryptedMessage, - MessageType::MessageType_TezosGetAddress, - MessageType::MessageType_TezosAddress, - MessageType::MessageType_TezosSignTx, - MessageType::MessageType_TezosSignedTx, - MessageType::MessageType_TezosGetPublicKey, - MessageType::MessageType_TezosPublicKey, - MessageType::MessageType_StellarSignTx, - MessageType::MessageType_StellarTxOpRequest, - MessageType::MessageType_StellarGetAddress, - MessageType::MessageType_StellarAddress, - MessageType::MessageType_StellarCreateAccountOp, - MessageType::MessageType_StellarPaymentOp, - MessageType::MessageType_StellarPathPaymentStrictReceiveOp, - MessageType::MessageType_StellarManageSellOfferOp, - MessageType::MessageType_StellarCreatePassiveSellOfferOp, - MessageType::MessageType_StellarSetOptionsOp, - MessageType::MessageType_StellarChangeTrustOp, - MessageType::MessageType_StellarAllowTrustOp, - MessageType::MessageType_StellarAccountMergeOp, - MessageType::MessageType_StellarManageDataOp, - MessageType::MessageType_StellarBumpSequenceOp, - MessageType::MessageType_StellarManageBuyOfferOp, - MessageType::MessageType_StellarPathPaymentStrictSendOp, - MessageType::MessageType_StellarClaimClaimableBalanceOp, - MessageType::MessageType_StellarSignedTx, - MessageType::MessageType_CardanoGetPublicKey, - MessageType::MessageType_CardanoPublicKey, - MessageType::MessageType_CardanoGetAddress, - MessageType::MessageType_CardanoAddress, - MessageType::MessageType_CardanoTxItemAck, - MessageType::MessageType_CardanoTxAuxiliaryDataSupplement, - MessageType::MessageType_CardanoTxWitnessRequest, - MessageType::MessageType_CardanoTxWitnessResponse, - MessageType::MessageType_CardanoTxHostAck, - MessageType::MessageType_CardanoTxBodyHash, - MessageType::MessageType_CardanoSignTxFinished, - MessageType::MessageType_CardanoSignTxInit, - MessageType::MessageType_CardanoTxInput, - MessageType::MessageType_CardanoTxOutput, - MessageType::MessageType_CardanoAssetGroup, - MessageType::MessageType_CardanoToken, - MessageType::MessageType_CardanoTxCertificate, - MessageType::MessageType_CardanoTxWithdrawal, - MessageType::MessageType_CardanoTxAuxiliaryData, - MessageType::MessageType_CardanoPoolOwner, - MessageType::MessageType_CardanoPoolRelayParameters, - MessageType::MessageType_CardanoGetNativeScriptHash, - MessageType::MessageType_CardanoNativeScriptHash, - MessageType::MessageType_CardanoTxMint, - MessageType::MessageType_CardanoTxCollateralInput, - MessageType::MessageType_CardanoTxRequiredSigner, - MessageType::MessageType_CardanoTxInlineDatumChunk, - MessageType::MessageType_CardanoTxReferenceScriptChunk, - MessageType::MessageType_CardanoTxReferenceInput, - MessageType::MessageType_RippleGetAddress, - MessageType::MessageType_RippleAddress, - MessageType::MessageType_RippleSignTx, - MessageType::MessageType_RippleSignedTx, - MessageType::MessageType_MoneroTransactionInitRequest, - MessageType::MessageType_MoneroTransactionInitAck, - MessageType::MessageType_MoneroTransactionSetInputRequest, - MessageType::MessageType_MoneroTransactionSetInputAck, - MessageType::MessageType_MoneroTransactionInputViniRequest, - MessageType::MessageType_MoneroTransactionInputViniAck, - MessageType::MessageType_MoneroTransactionAllInputsSetRequest, - MessageType::MessageType_MoneroTransactionAllInputsSetAck, - MessageType::MessageType_MoneroTransactionSetOutputRequest, - MessageType::MessageType_MoneroTransactionSetOutputAck, - MessageType::MessageType_MoneroTransactionAllOutSetRequest, - MessageType::MessageType_MoneroTransactionAllOutSetAck, - MessageType::MessageType_MoneroTransactionSignInputRequest, - MessageType::MessageType_MoneroTransactionSignInputAck, - MessageType::MessageType_MoneroTransactionFinalRequest, - MessageType::MessageType_MoneroTransactionFinalAck, - MessageType::MessageType_MoneroKeyImageExportInitRequest, - MessageType::MessageType_MoneroKeyImageExportInitAck, - MessageType::MessageType_MoneroKeyImageSyncStepRequest, - MessageType::MessageType_MoneroKeyImageSyncStepAck, - MessageType::MessageType_MoneroKeyImageSyncFinalRequest, - MessageType::MessageType_MoneroKeyImageSyncFinalAck, - MessageType::MessageType_MoneroGetAddress, - MessageType::MessageType_MoneroAddress, - MessageType::MessageType_MoneroGetWatchKey, - MessageType::MessageType_MoneroWatchKey, - MessageType::MessageType_DebugMoneroDiagRequest, - MessageType::MessageType_DebugMoneroDiagAck, - MessageType::MessageType_MoneroGetTxKeyRequest, - MessageType::MessageType_MoneroGetTxKeyAck, - MessageType::MessageType_MoneroLiveRefreshStartRequest, - MessageType::MessageType_MoneroLiveRefreshStartAck, - MessageType::MessageType_MoneroLiveRefreshStepRequest, - MessageType::MessageType_MoneroLiveRefreshStepAck, - MessageType::MessageType_MoneroLiveRefreshFinalRequest, - MessageType::MessageType_MoneroLiveRefreshFinalAck, - MessageType::MessageType_EosGetPublicKey, - MessageType::MessageType_EosPublicKey, - MessageType::MessageType_EosSignTx, - MessageType::MessageType_EosTxActionRequest, - MessageType::MessageType_EosTxActionAck, - MessageType::MessageType_EosSignedTx, - MessageType::MessageType_BinanceGetAddress, - MessageType::MessageType_BinanceAddress, - MessageType::MessageType_BinanceGetPublicKey, - MessageType::MessageType_BinancePublicKey, - MessageType::MessageType_BinanceSignTx, - MessageType::MessageType_BinanceTxRequest, - MessageType::MessageType_BinanceTransferMsg, - MessageType::MessageType_BinanceOrderMsg, - MessageType::MessageType_BinanceCancelMsg, - MessageType::MessageType_BinanceSignedTx, - MessageType::MessageType_WebAuthnListResidentCredentials, - MessageType::MessageType_WebAuthnCredentials, - MessageType::MessageType_WebAuthnAddResidentCredential, - MessageType::MessageType_WebAuthnRemoveResidentCredential, - MessageType::MessageType_SolanaGetPublicKey, - MessageType::MessageType_SolanaPublicKey, - MessageType::MessageType_SolanaGetAddress, - MessageType::MessageType_SolanaAddress, - MessageType::MessageType_SolanaSignTx, - MessageType::MessageType_SolanaTxSignature, - MessageType::MessageType_MintlayerGetAddress, - MessageType::MessageType_MintlayerAddress, - MessageType::MessageType_MintlayerGetPublicKey, - MessageType::MessageType_MintlayerPublicKey, - MessageType::MessageType_MintlayerSignMessage, - MessageType::MessageType_MintlayerSignTx, - MessageType::MessageType_MintlayerTxRequest, - MessageType::MessageType_MintlayerTxAckUtxoInput, - MessageType::MessageType_MintlayerTxAckOutput, - ]; -} - -impl ::protobuf::EnumFull for MessageType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("MessageType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - MessageType::MessageType_Initialize => 0, - MessageType::MessageType_Ping => 1, - MessageType::MessageType_Success => 2, - MessageType::MessageType_Failure => 3, - MessageType::MessageType_ChangePin => 4, - MessageType::MessageType_WipeDevice => 5, - MessageType::MessageType_GetEntropy => 6, - MessageType::MessageType_Entropy => 7, - MessageType::MessageType_LoadDevice => 8, - MessageType::MessageType_ResetDevice => 9, - MessageType::MessageType_SetBusy => 10, - MessageType::MessageType_Features => 11, - MessageType::MessageType_PinMatrixRequest => 12, - MessageType::MessageType_PinMatrixAck => 13, - MessageType::MessageType_Cancel => 14, - MessageType::MessageType_LockDevice => 15, - MessageType::MessageType_ApplySettings => 16, - MessageType::MessageType_ButtonRequest => 17, - MessageType::MessageType_ButtonAck => 18, - MessageType::MessageType_ApplyFlags => 19, - MessageType::MessageType_GetNonce => 20, - MessageType::MessageType_Nonce => 21, - MessageType::MessageType_BackupDevice => 22, - MessageType::MessageType_EntropyRequest => 23, - MessageType::MessageType_EntropyAck => 24, - MessageType::MessageType_PassphraseRequest => 25, - MessageType::MessageType_PassphraseAck => 26, - MessageType::MessageType_RecoveryDevice => 27, - MessageType::MessageType_WordRequest => 28, - MessageType::MessageType_WordAck => 29, - MessageType::MessageType_GetFeatures => 30, - MessageType::MessageType_SdProtect => 31, - MessageType::MessageType_ChangeWipeCode => 32, - MessageType::MessageType_EndSession => 33, - MessageType::MessageType_DoPreauthorized => 34, - MessageType::MessageType_PreauthorizedRequest => 35, - MessageType::MessageType_CancelAuthorization => 36, - MessageType::MessageType_RebootToBootloader => 37, - MessageType::MessageType_GetFirmwareHash => 38, - MessageType::MessageType_FirmwareHash => 39, - MessageType::MessageType_UnlockPath => 40, - MessageType::MessageType_UnlockedPathRequest => 41, - MessageType::MessageType_ShowDeviceTutorial => 42, - MessageType::MessageType_UnlockBootloader => 43, - MessageType::MessageType_AuthenticateDevice => 44, - MessageType::MessageType_AuthenticityProof => 45, - MessageType::MessageType_ChangeLanguage => 46, - MessageType::MessageType_TranslationDataRequest => 47, - MessageType::MessageType_TranslationDataAck => 48, - MessageType::MessageType_SetU2FCounter => 49, - MessageType::MessageType_GetNextU2FCounter => 50, - MessageType::MessageType_NextU2FCounter => 51, - MessageType::MessageType_Deprecated_PassphraseStateRequest => 52, - MessageType::MessageType_Deprecated_PassphraseStateAck => 53, - MessageType::MessageType_FirmwareErase => 54, - MessageType::MessageType_FirmwareUpload => 55, - MessageType::MessageType_FirmwareRequest => 56, - MessageType::MessageType_ProdTestT1 => 57, - MessageType::MessageType_GetPublicKey => 58, - MessageType::MessageType_PublicKey => 59, - MessageType::MessageType_SignTx => 60, - MessageType::MessageType_TxRequest => 61, - MessageType::MessageType_TxAck => 62, - MessageType::MessageType_GetAddress => 63, - MessageType::MessageType_Address => 64, - MessageType::MessageType_TxAckPaymentRequest => 65, - MessageType::MessageType_SignMessage => 66, - MessageType::MessageType_VerifyMessage => 67, - MessageType::MessageType_MessageSignature => 68, - MessageType::MessageType_GetOwnershipId => 69, - MessageType::MessageType_OwnershipId => 70, - MessageType::MessageType_GetOwnershipProof => 71, - MessageType::MessageType_OwnershipProof => 72, - MessageType::MessageType_AuthorizeCoinJoin => 73, - MessageType::MessageType_CipherKeyValue => 74, - MessageType::MessageType_CipheredKeyValue => 75, - MessageType::MessageType_SignIdentity => 76, - MessageType::MessageType_SignedIdentity => 77, - MessageType::MessageType_GetECDHSessionKey => 78, - MessageType::MessageType_ECDHSessionKey => 79, - MessageType::MessageType_CosiCommit => 80, - MessageType::MessageType_CosiCommitment => 81, - MessageType::MessageType_CosiSign => 82, - MessageType::MessageType_CosiSignature => 83, - MessageType::MessageType_DebugLinkDecision => 84, - MessageType::MessageType_DebugLinkGetState => 85, - MessageType::MessageType_DebugLinkState => 86, - MessageType::MessageType_DebugLinkStop => 87, - MessageType::MessageType_DebugLinkLog => 88, - MessageType::MessageType_DebugLinkMemoryRead => 89, - MessageType::MessageType_DebugLinkMemory => 90, - MessageType::MessageType_DebugLinkMemoryWrite => 91, - MessageType::MessageType_DebugLinkFlashErase => 92, - MessageType::MessageType_DebugLinkLayout => 93, - MessageType::MessageType_DebugLinkReseedRandom => 94, - MessageType::MessageType_DebugLinkRecordScreen => 95, - MessageType::MessageType_DebugLinkEraseSdCard => 96, - MessageType::MessageType_DebugLinkWatchLayout => 97, - MessageType::MessageType_DebugLinkResetDebugEvents => 98, - MessageType::MessageType_EthereumGetPublicKey => 99, - MessageType::MessageType_EthereumPublicKey => 100, - MessageType::MessageType_EthereumGetAddress => 101, - MessageType::MessageType_EthereumAddress => 102, - MessageType::MessageType_EthereumSignTx => 103, - MessageType::MessageType_EthereumSignTxEIP1559 => 104, - MessageType::MessageType_EthereumTxRequest => 105, - MessageType::MessageType_EthereumTxAck => 106, - MessageType::MessageType_EthereumSignMessage => 107, - MessageType::MessageType_EthereumVerifyMessage => 108, - MessageType::MessageType_EthereumMessageSignature => 109, - MessageType::MessageType_EthereumSignTypedData => 110, - MessageType::MessageType_EthereumTypedDataStructRequest => 111, - MessageType::MessageType_EthereumTypedDataStructAck => 112, - MessageType::MessageType_EthereumTypedDataValueRequest => 113, - MessageType::MessageType_EthereumTypedDataValueAck => 114, - MessageType::MessageType_EthereumTypedDataSignature => 115, - MessageType::MessageType_EthereumSignTypedHash => 116, - MessageType::MessageType_NEMGetAddress => 117, - MessageType::MessageType_NEMAddress => 118, - MessageType::MessageType_NEMSignTx => 119, - MessageType::MessageType_NEMSignedTx => 120, - MessageType::MessageType_NEMDecryptMessage => 121, - MessageType::MessageType_NEMDecryptedMessage => 122, - MessageType::MessageType_TezosGetAddress => 123, - MessageType::MessageType_TezosAddress => 124, - MessageType::MessageType_TezosSignTx => 125, - MessageType::MessageType_TezosSignedTx => 126, - MessageType::MessageType_TezosGetPublicKey => 127, - MessageType::MessageType_TezosPublicKey => 128, - MessageType::MessageType_StellarSignTx => 129, - MessageType::MessageType_StellarTxOpRequest => 130, - MessageType::MessageType_StellarGetAddress => 131, - MessageType::MessageType_StellarAddress => 132, - MessageType::MessageType_StellarCreateAccountOp => 133, - MessageType::MessageType_StellarPaymentOp => 134, - MessageType::MessageType_StellarPathPaymentStrictReceiveOp => 135, - MessageType::MessageType_StellarManageSellOfferOp => 136, - MessageType::MessageType_StellarCreatePassiveSellOfferOp => 137, - MessageType::MessageType_StellarSetOptionsOp => 138, - MessageType::MessageType_StellarChangeTrustOp => 139, - MessageType::MessageType_StellarAllowTrustOp => 140, - MessageType::MessageType_StellarAccountMergeOp => 141, - MessageType::MessageType_StellarManageDataOp => 142, - MessageType::MessageType_StellarBumpSequenceOp => 143, - MessageType::MessageType_StellarManageBuyOfferOp => 144, - MessageType::MessageType_StellarPathPaymentStrictSendOp => 145, - MessageType::MessageType_StellarClaimClaimableBalanceOp => 146, - MessageType::MessageType_StellarSignedTx => 147, - MessageType::MessageType_CardanoGetPublicKey => 148, - MessageType::MessageType_CardanoPublicKey => 149, - MessageType::MessageType_CardanoGetAddress => 150, - MessageType::MessageType_CardanoAddress => 151, - MessageType::MessageType_CardanoTxItemAck => 152, - MessageType::MessageType_CardanoTxAuxiliaryDataSupplement => 153, - MessageType::MessageType_CardanoTxWitnessRequest => 154, - MessageType::MessageType_CardanoTxWitnessResponse => 155, - MessageType::MessageType_CardanoTxHostAck => 156, - MessageType::MessageType_CardanoTxBodyHash => 157, - MessageType::MessageType_CardanoSignTxFinished => 158, - MessageType::MessageType_CardanoSignTxInit => 159, - MessageType::MessageType_CardanoTxInput => 160, - MessageType::MessageType_CardanoTxOutput => 161, - MessageType::MessageType_CardanoAssetGroup => 162, - MessageType::MessageType_CardanoToken => 163, - MessageType::MessageType_CardanoTxCertificate => 164, - MessageType::MessageType_CardanoTxWithdrawal => 165, - MessageType::MessageType_CardanoTxAuxiliaryData => 166, - MessageType::MessageType_CardanoPoolOwner => 167, - MessageType::MessageType_CardanoPoolRelayParameters => 168, - MessageType::MessageType_CardanoGetNativeScriptHash => 169, - MessageType::MessageType_CardanoNativeScriptHash => 170, - MessageType::MessageType_CardanoTxMint => 171, - MessageType::MessageType_CardanoTxCollateralInput => 172, - MessageType::MessageType_CardanoTxRequiredSigner => 173, - MessageType::MessageType_CardanoTxInlineDatumChunk => 174, - MessageType::MessageType_CardanoTxReferenceScriptChunk => 175, - MessageType::MessageType_CardanoTxReferenceInput => 176, - MessageType::MessageType_RippleGetAddress => 177, - MessageType::MessageType_RippleAddress => 178, - MessageType::MessageType_RippleSignTx => 179, - MessageType::MessageType_RippleSignedTx => 180, - MessageType::MessageType_MoneroTransactionInitRequest => 181, - MessageType::MessageType_MoneroTransactionInitAck => 182, - MessageType::MessageType_MoneroTransactionSetInputRequest => 183, - MessageType::MessageType_MoneroTransactionSetInputAck => 184, - MessageType::MessageType_MoneroTransactionInputViniRequest => 185, - MessageType::MessageType_MoneroTransactionInputViniAck => 186, - MessageType::MessageType_MoneroTransactionAllInputsSetRequest => 187, - MessageType::MessageType_MoneroTransactionAllInputsSetAck => 188, - MessageType::MessageType_MoneroTransactionSetOutputRequest => 189, - MessageType::MessageType_MoneroTransactionSetOutputAck => 190, - MessageType::MessageType_MoneroTransactionAllOutSetRequest => 191, - MessageType::MessageType_MoneroTransactionAllOutSetAck => 192, - MessageType::MessageType_MoneroTransactionSignInputRequest => 193, - MessageType::MessageType_MoneroTransactionSignInputAck => 194, - MessageType::MessageType_MoneroTransactionFinalRequest => 195, - MessageType::MessageType_MoneroTransactionFinalAck => 196, - MessageType::MessageType_MoneroKeyImageExportInitRequest => 197, - MessageType::MessageType_MoneroKeyImageExportInitAck => 198, - MessageType::MessageType_MoneroKeyImageSyncStepRequest => 199, - MessageType::MessageType_MoneroKeyImageSyncStepAck => 200, - MessageType::MessageType_MoneroKeyImageSyncFinalRequest => 201, - MessageType::MessageType_MoneroKeyImageSyncFinalAck => 202, - MessageType::MessageType_MoneroGetAddress => 203, - MessageType::MessageType_MoneroAddress => 204, - MessageType::MessageType_MoneroGetWatchKey => 205, - MessageType::MessageType_MoneroWatchKey => 206, - MessageType::MessageType_DebugMoneroDiagRequest => 207, - MessageType::MessageType_DebugMoneroDiagAck => 208, - MessageType::MessageType_MoneroGetTxKeyRequest => 209, - MessageType::MessageType_MoneroGetTxKeyAck => 210, - MessageType::MessageType_MoneroLiveRefreshStartRequest => 211, - MessageType::MessageType_MoneroLiveRefreshStartAck => 212, - MessageType::MessageType_MoneroLiveRefreshStepRequest => 213, - MessageType::MessageType_MoneroLiveRefreshStepAck => 214, - MessageType::MessageType_MoneroLiveRefreshFinalRequest => 215, - MessageType::MessageType_MoneroLiveRefreshFinalAck => 216, - MessageType::MessageType_EosGetPublicKey => 217, - MessageType::MessageType_EosPublicKey => 218, - MessageType::MessageType_EosSignTx => 219, - MessageType::MessageType_EosTxActionRequest => 220, - MessageType::MessageType_EosTxActionAck => 221, - MessageType::MessageType_EosSignedTx => 222, - MessageType::MessageType_BinanceGetAddress => 223, - MessageType::MessageType_BinanceAddress => 224, - MessageType::MessageType_BinanceGetPublicKey => 225, - MessageType::MessageType_BinancePublicKey => 226, - MessageType::MessageType_BinanceSignTx => 227, - MessageType::MessageType_BinanceTxRequest => 228, - MessageType::MessageType_BinanceTransferMsg => 229, - MessageType::MessageType_BinanceOrderMsg => 230, - MessageType::MessageType_BinanceCancelMsg => 231, - MessageType::MessageType_BinanceSignedTx => 232, - MessageType::MessageType_WebAuthnListResidentCredentials => 233, - MessageType::MessageType_WebAuthnCredentials => 234, - MessageType::MessageType_WebAuthnAddResidentCredential => 235, - MessageType::MessageType_WebAuthnRemoveResidentCredential => 236, - MessageType::MessageType_SolanaGetPublicKey => 237, - MessageType::MessageType_SolanaPublicKey => 238, - MessageType::MessageType_SolanaGetAddress => 239, - MessageType::MessageType_SolanaAddress => 240, - MessageType::MessageType_SolanaSignTx => 241, - MessageType::MessageType_SolanaTxSignature => 242, - MessageType::MessageType_MintlayerGetAddress => 243, - MessageType::MessageType_MintlayerAddress => 244, - MessageType::MessageType_MintlayerGetPublicKey => 245, - MessageType::MessageType_MintlayerPublicKey => 246, - MessageType::MessageType_MintlayerSignMessage => 247, - MessageType::MessageType_MintlayerSignTx => 248, - MessageType::MessageType_MintlayerTxRequest => 249, - MessageType::MessageType_MintlayerTxAckUtxoInput => 250, - MessageType::MessageType_MintlayerTxAckOutput => 251, - }; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for MessageType { - fn default() -> Self { - MessageType::MessageType_Initialize - } -} - -impl MessageType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MessageType") - } -} - -/// Extension fields -pub mod exts { - - pub const wire_in: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50002, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const wire_out: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50003, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const wire_debug_in: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50004, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const wire_debug_out: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50005, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const wire_tiny: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50006, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const wire_bootloader: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50007, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const wire_no_fsm: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(50008, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const bitcoin_only: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(60000, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const has_bitcoin_only_values: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(51001, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const experimental_message: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(52001, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const wire_type: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, u32> = ::protobuf::ext::ExtFieldOptional::new(52002, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_UINT32); - - pub const experimental_field: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FieldOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(53001, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); - - pub const include_in_bitcoin_only: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, bool> = ::protobuf::ext::ExtFieldOptional::new(60000, ::protobuf::descriptor::field_descriptor_proto::Type::TYPE_BOOL); -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\x20google/protobuf/de\ - scriptor.proto*\xa5W\n\x0bMessageType\x12(\n\x16MessageType_Initialize\ - \x10\0\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12\x1e\n\ - \x10MessageType_Ping\x10\x01\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\ - %\n\x13MessageType_Success\x10\x02\x1a\x0c\x80\xa6\x1d\x01\xa8\xb5\x18\ - \x01\x98\xb5\x18\x01\x12%\n\x13MessageType_Failure\x10\x03\x1a\x0c\x80\ - \xa6\x1d\x01\xa8\xb5\x18\x01\x98\xb5\x18\x01\x12#\n\x15MessageType_Chang\ - ePin\x10\x04\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16MessageTy\ - pe_WipeDevice\x10\x05\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16\ - MessageType_GetEntropy\x10\t\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\ - !\n\x13MessageType_Entropy\x10\n\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\ - \x12$\n\x16MessageType_LoadDevice\x10\r\x1a\x08\x80\xa6\x1d\x01\x90\xb5\ - \x18\x01\x12%\n\x17MessageType_ResetDevice\x10\x0e\x1a\x08\x80\xa6\x1d\ - \x01\x90\xb5\x18\x01\x12!\n\x13MessageType_SetBusy\x10\x10\x1a\x08\x80\ - \xa6\x1d\x01\x90\xb5\x18\x01\x12\"\n\x14MessageType_Features\x10\x11\x1a\ - \x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12*\n\x1cMessageType_PinMatrixRequ\ - est\x10\x12\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12.\n\x18MessageTyp\ - e_PinMatrixAck\x10\x13\x1a\x10\xc0\xb5\x18\x01\xb0\xb5\x18\x01\x80\xa6\ - \x1d\x01\x90\xb5\x18\x01\x12$\n\x12MessageType_Cancel\x10\x14\x1a\x0c\ - \x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12$\n\x16MessageType_L\ - ockDevice\x10\x18\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12'\n\x19Mess\ - ageType_ApplySettings\x10\x19\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ - \x12'\n\x19MessageType_ButtonRequest\x10\x1a\x1a\x08\x80\xa6\x1d\x01\x98\ - \xb5\x18\x01\x12+\n\x15MessageType_ButtonAck\x10\x1b\x1a\x10\xc0\xb5\x18\ - \x01\xb0\xb5\x18\x01\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16MessageTy\ - pe_ApplyFlags\x10\x1c\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\"\n\ - \x14MessageType_GetNonce\x10\x1f\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ - \x12\x1f\n\x11MessageType_Nonce\x10!\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\ - \x01\x12&\n\x18MessageType_BackupDevice\x10\"\x1a\x08\x80\xa6\x1d\x01\ - \x90\xb5\x18\x01\x12(\n\x1aMessageType_EntropyRequest\x10#\x1a\x08\x80\ - \xa6\x1d\x01\x98\xb5\x18\x01\x12$\n\x16MessageType_EntropyAck\x10$\x1a\ - \x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12+\n\x1dMessageType_PassphraseReq\ - uest\x10)\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12/\n\x19MessageType_\ - PassphraseAck\x10*\x1a\x10\xc0\xb5\x18\x01\xb0\xb5\x18\x01\x80\xa6\x1d\ - \x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_RecoveryDevice\x10-\x1a\x08\ - \x80\xa6\x1d\x01\x90\xb5\x18\x01\x12%\n\x17MessageType_WordRequest\x10.\ - \x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12!\n\x13MessageType_WordAck\ - \x10/\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12%\n\x17MessageType_GetF\ - eatures\x107\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12#\n\x15MessageTy\ - pe_SdProtect\x10O\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMess\ - ageType_ChangeWipeCode\x10R\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12$\ - \n\x16MessageType_EndSession\x10S\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\ - \x01\x12)\n\x1bMessageType_DoPreauthorized\x10T\x1a\x08\x80\xa6\x1d\x01\ - \x90\xb5\x18\x01\x12.\n\x20MessageType_PreauthorizedRequest\x10U\x1a\x08\ - \x80\xa6\x1d\x01\x98\xb5\x18\x01\x12-\n\x1fMessageType_CancelAuthorizati\ - on\x10V\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12,\n\x1eMessageType_Re\ - bootToBootloader\x10W\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12)\n\x1b\ - MessageType_GetFirmwareHash\x10X\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ - \x12&\n\x18MessageType_FirmwareHash\x10Y\x1a\x08\x80\xa6\x1d\x01\x98\xb5\ - \x18\x01\x12$\n\x16MessageType_UnlockPath\x10]\x1a\x08\x80\xa6\x1d\x01\ - \x90\xb5\x18\x01\x12-\n\x1fMessageType_UnlockedPathRequest\x10^\x1a\x08\ - \x80\xa6\x1d\x01\x98\xb5\x18\x01\x12,\n\x1eMessageType_ShowDeviceTutoria\ - l\x10_\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12*\n\x1cMessageType_Unl\ - ockBootloader\x10`\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12,\n\x1eMes\ - sageType_AuthenticateDevice\x10a\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\ - \x12+\n\x1dMessageType_AuthenticityProof\x10b\x1a\x08\x80\xa6\x1d\x01\ - \x90\xb5\x18\x01\x12)\n\x1aMessageType_ChangeLanguage\x10\xde\x07\x1a\ - \x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x121\n\"MessageType_TranslationData\ - Request\x10\xdf\x07\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12-\n\x1eMe\ - ssageType_TranslationDataAck\x10\xe0\x07\x1a\x08\x80\xa6\x1d\x01\x90\xb5\ - \x18\x01\x12#\n\x19MessageType_SetU2FCounter\x10?\x1a\x04\x90\xb5\x18\ - \x01\x12'\n\x1dMessageType_GetNextU2FCounter\x10P\x1a\x04\x90\xb5\x18\ - \x01\x12$\n\x1aMessageType_NextU2FCounter\x10Q\x1a\x04\x98\xb5\x18\x01\ - \x125\n-MessageType_Deprecated_PassphraseStateRequest\x10M\x1a\x02\x08\ - \x01\x121\n)MessageType_Deprecated_PassphraseStateAck\x10N\x1a\x02\x08\ - \x01\x12+\n\x19MessageType_FirmwareErase\x10\x06\x1a\x0c\xb8\xb5\x18\x01\ - \x80\xa6\x1d\x01\x90\xb5\x18\x01\x12,\n\x1aMessageType_FirmwareUpload\ - \x10\x07\x1a\x0c\xb8\xb5\x18\x01\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12-\n\ - \x1bMessageType_FirmwareRequest\x10\x08\x1a\x0c\xb8\xb5\x18\x01\x80\xa6\ - \x1d\x01\x98\xb5\x18\x01\x12(\n\x16MessageType_ProdTestT1\x10\x20\x1a\ - \x0c\xb8\xb5\x18\x01\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12&\n\x18MessageTy\ - pe_GetPublicKey\x10\x0b\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12#\n\ - \x15MessageType_PublicKey\x10\x0c\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\ - \x01\x12\x20\n\x12MessageType_SignTx\x10\x0f\x1a\x08\x80\xa6\x1d\x01\x90\ - \xb5\x18\x01\x12#\n\x15MessageType_TxRequest\x10\x15\x1a\x08\x80\xa6\x1d\ - \x01\x98\xb5\x18\x01\x12\x1f\n\x11MessageType_TxAck\x10\x16\x1a\x08\x80\ - \xa6\x1d\x01\x90\xb5\x18\x01\x12$\n\x16MessageType_GetAddress\x10\x1d\ - \x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12!\n\x13MessageType_Address\ - \x10\x1e\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12)\n\x1fMessageType_T\ - xAckPaymentRequest\x10%\x1a\x04\x90\xb5\x18\x01\x12%\n\x17MessageType_Si\ - gnMessage\x10&\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12'\n\x19Message\ - Type_VerifyMessage\x10'\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12*\n\ - \x1cMessageType_MessageSignature\x10(\x1a\x08\x80\xa6\x1d\x01\x98\xb5\ - \x18\x01\x12(\n\x1aMessageType_GetOwnershipId\x10+\x1a\x08\x80\xa6\x1d\ - \x01\x90\xb5\x18\x01\x12%\n\x17MessageType_OwnershipId\x10,\x1a\x08\x80\ - \xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageType_GetOwnershipProof\x10\ - 1\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_Ownershi\ - pProof\x102\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageTyp\ - e_AuthorizeCoinJoin\x103\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\ - \x1aMessageType_CipherKeyValue\x10\x17\x1a\x08\x80\xa6\x1d\x01\x90\xb5\ - \x18\x01\x12*\n\x1cMessageType_CipheredKeyValue\x100\x1a\x08\x80\xa6\x1d\ - \x01\x98\xb5\x18\x01\x12&\n\x18MessageType_SignIdentity\x105\x1a\x08\x80\ - \xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_SignedIdentity\x106\ - \x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageType_GetECDHSe\ - ssionKey\x10=\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageT\ - ype_ECDHSessionKey\x10>\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12$\n\ - \x16MessageType_CosiCommit\x10G\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\ - \x12(\n\x1aMessageType_CosiCommitment\x10H\x1a\x08\x80\xa6\x1d\x01\x98\ - \xb5\x18\x01\x12\"\n\x14MessageType_CosiSign\x10I\x1a\x08\x80\xa6\x1d\ - \x01\x90\xb5\x18\x01\x12'\n\x19MessageType_CosiSignature\x10J\x1a\x08\ - \x80\xa6\x1d\x01\x98\xb5\x18\x01\x123\n\x1dMessageType_DebugLinkDecision\ - \x10d\x1a\x10\xc0\xb5\x18\x01\xb0\xb5\x18\x01\x80\xa6\x1d\x01\xa0\xb5\ - \x18\x01\x12/\n\x1dMessageType_DebugLinkGetState\x10e\x1a\x0c\x80\xa6\ - \x1d\x01\xb0\xb5\x18\x01\xa0\xb5\x18\x01\x12(\n\x1aMessageType_DebugLink\ - State\x10f\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12'\n\x19MessageType\ - _DebugLinkStop\x10g\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12&\n\x18Me\ - ssageType_DebugLinkLog\x10h\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12-\ - \n\x1fMessageType_DebugLinkMemoryRead\x10n\x1a\x08\x80\xa6\x1d\x01\xa0\ - \xb5\x18\x01\x12)\n\x1bMessageType_DebugLinkMemory\x10o\x1a\x08\x80\xa6\ - \x1d\x01\xa8\xb5\x18\x01\x12.\n\x20MessageType_DebugLinkMemoryWrite\x10p\ - \x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12-\n\x1fMessageType_DebugLink\ - FlashErase\x10q\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12*\n\x1bMessag\ - eType_DebugLinkLayout\x10\xa9F\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\ - \x120\n!MessageType_DebugLinkReseedRandom\x10\xaaF\x1a\x08\x80\xa6\x1d\ - \x01\xa0\xb5\x18\x01\x120\n!MessageType_DebugLinkRecordScreen\x10\xabF\ - \x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12/\n\x20MessageType_DebugLink\ - EraseSdCard\x10\xadF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12/\n\x20M\ - essageType_DebugLinkWatchLayout\x10\xaeF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\ - \x18\x01\x124\n%MessageType_DebugLinkResetDebugEvents\x10\xafF\x1a\x08\ - \x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12+\n\x20MessageType_EthereumGetPublic\ - Key\x10\xc2\x03\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_EthereumPu\ - blicKey\x10\xc3\x03\x1a\x04\x98\xb5\x18\x01\x12(\n\x1eMessageType_Ethere\ - umGetAddress\x108\x1a\x04\x90\xb5\x18\x01\x12%\n\x1bMessageType_Ethereum\ - Address\x109\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_EthereumSignT\ - x\x10:\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_EthereumSignTxEIP1559\ - \x10\xc4\x03\x1a\x04\x90\xb5\x18\x01\x12'\n\x1dMessageType_EthereumTxReq\ - uest\x10;\x1a\x04\x98\xb5\x18\x01\x12#\n\x19MessageType_EthereumTxAck\ - \x10<\x1a\x04\x90\xb5\x18\x01\x12)\n\x1fMessageType_EthereumSignMessage\ - \x10@\x1a\x04\x90\xb5\x18\x01\x12+\n!MessageType_EthereumVerifyMessage\ - \x10A\x1a\x04\x90\xb5\x18\x01\x12.\n$MessageType_EthereumMessageSignatur\ - e\x10B\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedData\ - \x10\xd0\x03\x1a\x04\x90\xb5\x18\x01\x125\n*MessageType_EthereumTypedDat\ - aStructRequest\x10\xd1\x03\x1a\x04\x98\xb5\x18\x01\x121\n&MessageType_Et\ - hereumTypedDataStructAck\x10\xd2\x03\x1a\x04\x90\xb5\x18\x01\x124\n)Mess\ - ageType_EthereumTypedDataValueRequest\x10\xd3\x03\x1a\x04\x98\xb5\x18\ - \x01\x120\n%MessageType_EthereumTypedDataValueAck\x10\xd4\x03\x1a\x04\ - \x90\xb5\x18\x01\x121\n&MessageType_EthereumTypedDataSignature\x10\xd5\ - \x03\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedHash\ - \x10\xd6\x03\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_NEMGetAddress\ - \x10C\x1a\x04\x90\xb5\x18\x01\x12\x20\n\x16MessageType_NEMAddress\x10D\ - \x1a\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_NEMSignTx\x10E\x1a\x04\ - \x90\xb5\x18\x01\x12!\n\x17MessageType_NEMSignedTx\x10F\x1a\x04\x98\xb5\ - \x18\x01\x12'\n\x1dMessageType_NEMDecryptMessage\x10K\x1a\x04\x90\xb5\ - \x18\x01\x12)\n\x1fMessageType_NEMDecryptedMessage\x10L\x1a\x04\x98\xb5\ - \x18\x01\x12&\n\x1bMessageType_TezosGetAddress\x10\x96\x01\x1a\x04\x90\ - \xb5\x18\x01\x12#\n\x18MessageType_TezosAddress\x10\x97\x01\x1a\x04\x98\ - \xb5\x18\x01\x12\"\n\x17MessageType_TezosSignTx\x10\x98\x01\x1a\x04\x90\ - \xb5\x18\x01\x12$\n\x19MessageType_TezosSignedTx\x10\x99\x01\x1a\x04\x98\ - \xb5\x18\x01\x12(\n\x1dMessageType_TezosGetPublicKey\x10\x9a\x01\x1a\x04\ - \x90\xb5\x18\x01\x12%\n\x1aMessageType_TezosPublicKey\x10\x9b\x01\x1a\ - \x04\x98\xb5\x18\x01\x12$\n\x19MessageType_StellarSignTx\x10\xca\x01\x1a\ - \x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_StellarTxOpRequest\x10\xcb\ - \x01\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_StellarGetAddress\x10\ - \xcf\x01\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_StellarAddress\ - \x10\xd0\x01\x1a\x04\x98\xb5\x18\x01\x12-\n\"MessageType_StellarCreateAc\ - countOp\x10\xd2\x01\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_Stella\ - rPaymentOp\x10\xd3\x01\x1a\x04\x90\xb5\x18\x01\x128\n-MessageType_Stella\ - rPathPaymentStrictReceiveOp\x10\xd4\x01\x1a\x04\x90\xb5\x18\x01\x12/\n$M\ - essageType_StellarManageSellOfferOp\x10\xd5\x01\x1a\x04\x90\xb5\x18\x01\ - \x126\n+MessageType_StellarCreatePassiveSellOfferOp\x10\xd6\x01\x1a\x04\ - \x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarSetOptionsOp\x10\xd7\x01\ - \x1a\x04\x90\xb5\x18\x01\x12+\n\x20MessageType_StellarChangeTrustOp\x10\ - \xd8\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarAllowTrust\ - Op\x10\xd9\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_StellarAccount\ - MergeOp\x10\xda\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_Stella\ - rManageDataOp\x10\xdc\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_Ste\ - llarBumpSequenceOp\x10\xdd\x01\x1a\x04\x90\xb5\x18\x01\x12.\n#MessageTyp\ - e_StellarManageBuyOfferOp\x10\xde\x01\x1a\x04\x90\xb5\x18\x01\x125\n*Mes\ - sageType_StellarPathPaymentStrictSendOp\x10\xdf\x01\x1a\x04\x90\xb5\x18\ - \x01\x125\n*MessageType_StellarClaimClaimableBalanceOp\x10\xe1\x01\x1a\ - \x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_StellarSignedTx\x10\xe6\x01\ - \x1a\x04\x98\xb5\x18\x01\x12*\n\x1fMessageType_CardanoGetPublicKey\x10\ - \xb1\x02\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_CardanoPublicKey\ - \x10\xb2\x02\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_CardanoGetAdd\ - ress\x10\xb3\x02\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_CardanoAd\ - dress\x10\xb4\x02\x1a\x04\x98\xb5\x18\x01\x12'\n\x1cMessageType_CardanoT\ - xItemAck\x10\xb9\x02\x1a\x04\x98\xb5\x18\x01\x127\n,MessageType_CardanoT\ - xAuxiliaryDataSupplement\x10\xba\x02\x1a\x04\x98\xb5\x18\x01\x12.\n#Mess\ - ageType_CardanoTxWitnessRequest\x10\xbb\x02\x1a\x04\x90\xb5\x18\x01\x12/\ - \n$MessageType_CardanoTxWitnessResponse\x10\xbc\x02\x1a\x04\x98\xb5\x18\ - \x01\x12'\n\x1cMessageType_CardanoTxHostAck\x10\xbd\x02\x1a\x04\x90\xb5\ - \x18\x01\x12(\n\x1dMessageType_CardanoTxBodyHash\x10\xbe\x02\x1a\x04\x98\ - \xb5\x18\x01\x12,\n!MessageType_CardanoSignTxFinished\x10\xbf\x02\x1a\ - \x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_CardanoSignTxInit\x10\xc0\x02\ - \x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_CardanoTxInput\x10\xc1\ - \x02\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_CardanoTxOutput\x10\ - \xc2\x02\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_CardanoAssetGroup\ - \x10\xc3\x02\x1a\x04\x90\xb5\x18\x01\x12#\n\x18MessageType_CardanoToken\ - \x10\xc4\x02\x1a\x04\x90\xb5\x18\x01\x12+\n\x20MessageType_CardanoTxCert\ - ificate\x10\xc5\x02\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_Cardan\ - oTxWithdrawal\x10\xc6\x02\x1a\x04\x90\xb5\x18\x01\x12-\n\"MessageType_Ca\ - rdanoTxAuxiliaryData\x10\xc7\x02\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessa\ - geType_CardanoPoolOwner\x10\xc8\x02\x1a\x04\x90\xb5\x18\x01\x121\n&Messa\ - geType_CardanoPoolRelayParameters\x10\xc9\x02\x1a\x04\x90\xb5\x18\x01\ - \x121\n&MessageType_CardanoGetNativeScriptHash\x10\xca\x02\x1a\x04\x90\ - \xb5\x18\x01\x12.\n#MessageType_CardanoNativeScriptHash\x10\xcb\x02\x1a\ - \x04\x98\xb5\x18\x01\x12$\n\x19MessageType_CardanoTxMint\x10\xcc\x02\x1a\ - \x04\x90\xb5\x18\x01\x12/\n$MessageType_CardanoTxCollateralInput\x10\xcd\ - \x02\x1a\x04\x90\xb5\x18\x01\x12.\n#MessageType_CardanoTxRequiredSigner\ - \x10\xce\x02\x1a\x04\x90\xb5\x18\x01\x120\n%MessageType_CardanoTxInlineD\ - atumChunk\x10\xcf\x02\x1a\x04\x90\xb5\x18\x01\x124\n)MessageType_Cardano\ - TxReferenceScriptChunk\x10\xd0\x02\x1a\x04\x90\xb5\x18\x01\x12.\n#Messag\ - eType_CardanoTxReferenceInput\x10\xd1\x02\x1a\x04\x90\xb5\x18\x01\x12'\n\ - \x1cMessageType_RippleGetAddress\x10\x90\x03\x1a\x04\x90\xb5\x18\x01\x12\ - $\n\x19MessageType_RippleAddress\x10\x91\x03\x1a\x04\x98\xb5\x18\x01\x12\ - #\n\x18MessageType_RippleSignTx\x10\x92\x03\x1a\x04\x90\xb5\x18\x01\x12%\ - \n\x1aMessageType_RippleSignedTx\x10\x93\x03\x1a\x04\x90\xb5\x18\x01\x12\ - 3\n(MessageType_MoneroTransactionInitRequest\x10\xf5\x03\x1a\x04\x98\xb5\ - \x18\x01\x12/\n$MessageType_MoneroTransactionInitAck\x10\xf6\x03\x1a\x04\ - \x98\xb5\x18\x01\x127\n,MessageType_MoneroTransactionSetInputRequest\x10\ - \xf7\x03\x1a\x04\x98\xb5\x18\x01\x123\n(MessageType_MoneroTransactionSet\ - InputAck\x10\xf8\x03\x1a\x04\x98\xb5\x18\x01\x128\n-MessageType_MoneroTr\ - ansactionInputViniRequest\x10\xfb\x03\x1a\x04\x98\xb5\x18\x01\x124\n)Mes\ - sageType_MoneroTransactionInputViniAck\x10\xfc\x03\x1a\x04\x98\xb5\x18\ - \x01\x12;\n0MessageType_MoneroTransactionAllInputsSetRequest\x10\xfd\x03\ - \x1a\x04\x98\xb5\x18\x01\x127\n,MessageType_MoneroTransactionAllInputsSe\ - tAck\x10\xfe\x03\x1a\x04\x98\xb5\x18\x01\x128\n-MessageType_MoneroTransa\ - ctionSetOutputRequest\x10\xff\x03\x1a\x04\x98\xb5\x18\x01\x124\n)Message\ - Type_MoneroTransactionSetOutputAck\x10\x80\x04\x1a\x04\x98\xb5\x18\x01\ - \x128\n-MessageType_MoneroTransactionAllOutSetRequest\x10\x81\x04\x1a\ - \x04\x98\xb5\x18\x01\x124\n)MessageType_MoneroTransactionAllOutSetAck\ - \x10\x82\x04\x1a\x04\x98\xb5\x18\x01\x128\n-MessageType_MoneroTransactio\ - nSignInputRequest\x10\x83\x04\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType\ - _MoneroTransactionSignInputAck\x10\x84\x04\x1a\x04\x98\xb5\x18\x01\x124\ - \n)MessageType_MoneroTransactionFinalRequest\x10\x85\x04\x1a\x04\x98\xb5\ - \x18\x01\x120\n%MessageType_MoneroTransactionFinalAck\x10\x86\x04\x1a\ - \x04\x98\xb5\x18\x01\x126\n+MessageType_MoneroKeyImageExportInitRequest\ - \x10\x92\x04\x1a\x04\x98\xb5\x18\x01\x122\n'MessageType_MoneroKeyImageEx\ - portInitAck\x10\x93\x04\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType_Moner\ - oKeyImageSyncStepRequest\x10\x94\x04\x1a\x04\x98\xb5\x18\x01\x120\n%Mess\ - ageType_MoneroKeyImageSyncStepAck\x10\x95\x04\x1a\x04\x98\xb5\x18\x01\ - \x125\n*MessageType_MoneroKeyImageSyncFinalRequest\x10\x96\x04\x1a\x04\ - \x98\xb5\x18\x01\x121\n&MessageType_MoneroKeyImageSyncFinalAck\x10\x97\ - \x04\x1a\x04\x98\xb5\x18\x01\x12'\n\x1cMessageType_MoneroGetAddress\x10\ - \x9c\x04\x1a\x04\x90\xb5\x18\x01\x12$\n\x19MessageType_MoneroAddress\x10\ - \x9d\x04\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_MoneroGetWatchKey\ - \x10\x9e\x04\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_MoneroWatchKe\ - y\x10\x9f\x04\x1a\x04\x98\xb5\x18\x01\x12-\n\"MessageType_DebugMoneroDia\ - gRequest\x10\xa2\x04\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_Debug\ - MoneroDiagAck\x10\xa3\x04\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_Mon\ - eroGetTxKeyRequest\x10\xa6\x04\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessage\ - Type_MoneroGetTxKeyAck\x10\xa7\x04\x1a\x04\x98\xb5\x18\x01\x124\n)Messag\ - eType_MoneroLiveRefreshStartRequest\x10\xa8\x04\x1a\x04\x90\xb5\x18\x01\ - \x120\n%MessageType_MoneroLiveRefreshStartAck\x10\xa9\x04\x1a\x04\x98\ - \xb5\x18\x01\x123\n(MessageType_MoneroLiveRefreshStepRequest\x10\xaa\x04\ - \x1a\x04\x90\xb5\x18\x01\x12/\n$MessageType_MoneroLiveRefreshStepAck\x10\ - \xab\x04\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType_MoneroLiveRefreshFin\ - alRequest\x10\xac\x04\x1a\x04\x90\xb5\x18\x01\x120\n%MessageType_MoneroL\ - iveRefreshFinalAck\x10\xad\x04\x1a\x04\x98\xb5\x18\x01\x12&\n\x1bMessage\ - Type_EosGetPublicKey\x10\xd8\x04\x1a\x04\x90\xb5\x18\x01\x12#\n\x18Messa\ - geType_EosPublicKey\x10\xd9\x04\x1a\x04\x98\xb5\x18\x01\x12\x20\n\x15Mes\ - sageType_EosSignTx\x10\xda\x04\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMessage\ - Type_EosTxActionRequest\x10\xdb\x04\x1a\x04\x98\xb5\x18\x01\x12%\n\x1aMe\ - ssageType_EosTxActionAck\x10\xdc\x04\x1a\x04\x90\xb5\x18\x01\x12\"\n\x17\ - MessageType_EosSignedTx\x10\xdd\x04\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMe\ - ssageType_BinanceGetAddress\x10\xbc\x05\x1a\x04\x90\xb5\x18\x01\x12%\n\ - \x1aMessageType_BinanceAddress\x10\xbd\x05\x1a\x04\x98\xb5\x18\x01\x12*\ - \n\x1fMessageType_BinanceGetPublicKey\x10\xbe\x05\x1a\x04\x90\xb5\x18\ - \x01\x12'\n\x1cMessageType_BinancePublicKey\x10\xbf\x05\x1a\x04\x98\xb5\ - \x18\x01\x12$\n\x19MessageType_BinanceSignTx\x10\xc0\x05\x1a\x04\x90\xb5\ - \x18\x01\x12'\n\x1cMessageType_BinanceTxRequest\x10\xc1\x05\x1a\x04\x98\ - \xb5\x18\x01\x12)\n\x1eMessageType_BinanceTransferMsg\x10\xc2\x05\x1a\ - \x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_BinanceOrderMsg\x10\xc3\x05\ - \x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_BinanceCancelMsg\x10\xc4\ - \x05\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_BinanceSignedTx\x10\ - \xc5\x05\x1a\x04\x98\xb5\x18\x01\x126\n+MessageType_WebAuthnListResident\ - Credentials\x10\xa0\x06\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_We\ - bAuthnCredentials\x10\xa1\x06\x1a\x04\x98\xb5\x18\x01\x124\n)MessageType\ - _WebAuthnAddResidentCredential\x10\xa2\x06\x1a\x04\x90\xb5\x18\x01\x127\ - \n,MessageType_WebAuthnRemoveResidentCredential\x10\xa3\x06\x1a\x04\x90\ - \xb5\x18\x01\x12)\n\x1eMessageType_SolanaGetPublicKey\x10\x84\x07\x1a\ - \x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_SolanaPublicKey\x10\x85\x07\ - \x1a\x04\x98\xb5\x18\x01\x12'\n\x1cMessageType_SolanaGetAddress\x10\x86\ - \x07\x1a\x04\x90\xb5\x18\x01\x12$\n\x19MessageType_SolanaAddress\x10\x87\ - \x07\x1a\x04\x98\xb5\x18\x01\x12#\n\x18MessageType_SolanaSignTx\x10\x88\ - \x07\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_SolanaTxSignature\x10\ - \x89\x07\x1a\x04\x98\xb5\x18\x01\x12*\n\x1fMessageType_MintlayerGetAddre\ - ss\x10\xe8\x07\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_MintlayerAd\ - dress\x10\xe9\x07\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_MintlayerGe\ - tPublicKey\x10\xea\x07\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_Min\ - tlayerPublicKey\x10\xeb\x07\x1a\x04\x98\xb5\x18\x01\x12+\n\x20MessageTyp\ - e_MintlayerSignMessage\x10\xec\x07\x1a\x04\x90\xb5\x18\x01\x12&\n\x1bMes\ - sageType_MintlayerSignTx\x10\xed\x07\x1a\x04\x90\xb5\x18\x01\x12)\n\x1eM\ - essageType_MintlayerTxRequest\x10\xee\x07\x1a\x04\x98\xb5\x18\x01\x12.\n\ - #MessageType_MintlayerTxAckUtxoInput\x10\xef\x07\x1a\x04\x90\xb5\x18\x01\ - \x12+\n\x20MessageType_MintlayerTxAckOutput\x10\xf0\x07\x1a\x04\x90\xb5\ - \x18\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\\\"\x04\x08r\x10z\"\x06\ - \x08\xdb\x01\x10\xdb\x01\"\x06\x08\xe0\x01\x10\xe0\x01\"\x06\x08\xac\x02\ - \x10\xb0\x02\"\x06\x08\xb5\x02\x10\xb8\x02:<\n\x07wire_in\x18\xd2\x86\ - \x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x06wireIn:>\n\ - \x08wire_out\x18\xd3\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValue\ - OptionsR\x07wireOut:G\n\rwire_debug_in\x18\xd4\x86\x03\x20\x01(\x08\x12!\ - .google.protobuf.EnumValueOptionsR\x0bwireDebugIn:I\n\x0ewire_debug_out\ - \x18\xd5\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0c\ - wireDebugOut:@\n\twire_tiny\x18\xd6\x86\x03\x20\x01(\x08\x12!.google.pro\ - tobuf.EnumValueOptionsR\x08wireTiny:L\n\x0fwire_bootloader\x18\xd7\x86\ - \x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0ewireBootload\ - er:C\n\x0bwire_no_fsm\x18\xd8\x86\x03\x20\x01(\x08\x12!.google.protobuf.\ - EnumValueOptionsR\twireNoFsm:F\n\x0cbitcoin_only\x18\xe0\xd4\x03\x20\x01\ - (\x08\x12!.google.protobuf.EnumValueOptionsR\x0bbitcoinOnly:U\n\x17has_b\ - itcoin_only_values\x18\xb9\x8e\x03\x20\x01(\x08\x12\x1c.google.protobuf.\ - EnumOptionsR\x14hasBitcoinOnlyValues:T\n\x14experimental_message\x18\xa1\ - \x96\x03\x20\x01(\x08\x12\x1f.google.protobuf.MessageOptionsR\x13experim\ - entalMessage:>\n\twire_type\x18\xa2\x96\x03\x20\x01(\r\x12\x1f.google.pr\ - otobuf.MessageOptionsR\x08wireType:N\n\x12experimental_field\x18\x89\x9e\ - \x03\x20\x01(\x08\x12\x1d.google.protobuf.FieldOptionsR\x11experimentalF\ - ield:U\n\x17include_in_bitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12\x1c\ - .google.protobuf.FileOptionsR\x14includeInBitcoinOnlyB8\n#com.satoshilab\ - s.trezor.lib.protobufB\rTrezorMessage\x80\xa6\x1d\x01\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(1); - deps.push(::protobuf::descriptor::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(0); - let mut enums = ::std::vec::Vec::with_capacity(1); - enums.push(MessageType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_binance.rs b/wallet/trezor-client/src/protos/generated/messages_binance.rs deleted file mode 100644 index 4612b354f7..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_binance.rs +++ /dev/null @@ -1,3083 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-binance.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceGetAddress { - fn default() -> &'a BinanceGetAddress { - ::default_instance() - } -} - -impl BinanceGetAddress { - pub fn new() -> BinanceGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &BinanceGetAddress| { &m.address_n }, - |m: &mut BinanceGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &BinanceGetAddress| { &m.show_display }, - |m: &mut BinanceGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &BinanceGetAddress| { &m.chunkify }, - |m: &mut BinanceGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceGetAddress { - const NAME: &'static str = "BinanceGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceGetAddress { - BinanceGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceGetAddress { - static instance: BinanceGetAddress = BinanceGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceAddress { - fn default() -> &'a BinanceAddress { - ::default_instance() - } -} - -impl BinanceAddress { - pub fn new() -> BinanceAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &BinanceAddress| { &m.address }, - |m: &mut BinanceAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceAddress { - const NAME: &'static str = "BinanceAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceAddress { - BinanceAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceAddress { - static instance: BinanceAddress = BinanceAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceGetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceGetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceGetPublicKey.show_display) - pub show_display: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceGetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceGetPublicKey { - fn default() -> &'a BinanceGetPublicKey { - ::default_instance() - } -} - -impl BinanceGetPublicKey { - pub fn new() -> BinanceGetPublicKey { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &BinanceGetPublicKey| { &m.address_n }, - |m: &mut BinanceGetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &BinanceGetPublicKey| { &m.show_display }, - |m: &mut BinanceGetPublicKey| { &mut m.show_display }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceGetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceGetPublicKey { - const NAME: &'static str = "BinanceGetPublicKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceGetPublicKey { - BinanceGetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceGetPublicKey { - static instance: BinanceGetPublicKey = BinanceGetPublicKey { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceGetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceGetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceGetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceGetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinancePublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinancePublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinancePublicKey.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinancePublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinancePublicKey { - fn default() -> &'a BinancePublicKey { - ::default_instance() - } -} - -impl BinancePublicKey { - pub fn new() -> BinancePublicKey { - ::std::default::Default::default() - } - - // required bytes public_key = 1; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &BinancePublicKey| { &m.public_key }, - |m: &mut BinancePublicKey| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinancePublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinancePublicKey { - const NAME: &'static str = "BinancePublicKey"; - - fn is_initialized(&self) -> bool { - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinancePublicKey { - BinancePublicKey::new() - } - - fn clear(&mut self) { - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinancePublicKey { - static instance: BinancePublicKey = BinancePublicKey { - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinancePublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinancePublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinancePublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinancePublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.msg_count) - pub msg_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.account_number) - pub account_number: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.chain_id) - pub chain_id: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.memo) - pub memo: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.source) - pub source: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceSignTx { - fn default() -> &'a BinanceSignTx { - ::default_instance() - } -} - -impl BinanceSignTx { - pub fn new() -> BinanceSignTx { - ::std::default::Default::default() - } - - // required uint32 msg_count = 2; - - pub fn msg_count(&self) -> u32 { - self.msg_count.unwrap_or(0) - } - - pub fn clear_msg_count(&mut self) { - self.msg_count = ::std::option::Option::None; - } - - pub fn has_msg_count(&self) -> bool { - self.msg_count.is_some() - } - - // Param is passed by value, moved - pub fn set_msg_count(&mut self, v: u32) { - self.msg_count = ::std::option::Option::Some(v); - } - - // required sint64 account_number = 3; - - pub fn account_number(&self) -> i64 { - self.account_number.unwrap_or(0) - } - - pub fn clear_account_number(&mut self) { - self.account_number = ::std::option::Option::None; - } - - pub fn has_account_number(&self) -> bool { - self.account_number.is_some() - } - - // Param is passed by value, moved - pub fn set_account_number(&mut self, v: i64) { - self.account_number = ::std::option::Option::Some(v); - } - - // optional string chain_id = 4; - - pub fn chain_id(&self) -> &str { - match self.chain_id.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_chain_id(&mut self) { - self.chain_id = ::std::option::Option::None; - } - - pub fn has_chain_id(&self) -> bool { - self.chain_id.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_id(&mut self, v: ::std::string::String) { - self.chain_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_chain_id(&mut self) -> &mut ::std::string::String { - if self.chain_id.is_none() { - self.chain_id = ::std::option::Option::Some(::std::string::String::new()); - } - self.chain_id.as_mut().unwrap() - } - - // Take field - pub fn take_chain_id(&mut self) -> ::std::string::String { - self.chain_id.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string memo = 5; - - pub fn memo(&self) -> &str { - match self.memo.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_memo(&mut self) { - self.memo = ::std::option::Option::None; - } - - pub fn has_memo(&self) -> bool { - self.memo.is_some() - } - - // Param is passed by value, moved - pub fn set_memo(&mut self, v: ::std::string::String) { - self.memo = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_memo(&mut self) -> &mut ::std::string::String { - if self.memo.is_none() { - self.memo = ::std::option::Option::Some(::std::string::String::new()); - } - self.memo.as_mut().unwrap() - } - - // Take field - pub fn take_memo(&mut self) -> ::std::string::String { - self.memo.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 sequence = 6; - - pub fn sequence(&self) -> i64 { - self.sequence.unwrap_or(0) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: i64) { - self.sequence = ::std::option::Option::Some(v); - } - - // required sint64 source = 7; - - pub fn source(&self) -> i64 { - self.source.unwrap_or(0) - } - - pub fn clear_source(&mut self) { - self.source = ::std::option::Option::None; - } - - pub fn has_source(&self) -> bool { - self.source.is_some() - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: i64) { - self.source = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 8; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &BinanceSignTx| { &m.address_n }, - |m: &mut BinanceSignTx| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "msg_count", - |m: &BinanceSignTx| { &m.msg_count }, - |m: &mut BinanceSignTx| { &mut m.msg_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account_number", - |m: &BinanceSignTx| { &m.account_number }, - |m: &mut BinanceSignTx| { &mut m.account_number }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_id", - |m: &BinanceSignTx| { &m.chain_id }, - |m: &mut BinanceSignTx| { &mut m.chain_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memo", - |m: &BinanceSignTx| { &m.memo }, - |m: &mut BinanceSignTx| { &mut m.memo }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &BinanceSignTx| { &m.sequence }, - |m: &mut BinanceSignTx| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source", - |m: &BinanceSignTx| { &m.source }, - |m: &mut BinanceSignTx| { &mut m.source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &BinanceSignTx| { &m.chunkify }, - |m: &mut BinanceSignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceSignTx { - const NAME: &'static str = "BinanceSignTx"; - - fn is_initialized(&self) -> bool { - if self.msg_count.is_none() { - return false; - } - if self.account_number.is_none() { - return false; - } - if self.sequence.is_none() { - return false; - } - if self.source.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.msg_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.account_number = ::std::option::Option::Some(is.read_sint64()?); - }, - 34 => { - self.chain_id = ::std::option::Option::Some(is.read_string()?); - }, - 42 => { - self.memo = ::std::option::Option::Some(is.read_string()?); - }, - 48 => { - self.sequence = ::std::option::Option::Some(is.read_sint64()?); - }, - 56 => { - self.source = ::std::option::Option::Some(is.read_sint64()?); - }, - 64 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.msg_count { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.account_number { - my_size += ::protobuf::rt::sint64_size(3, v); - } - if let Some(v) = self.chain_id.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.memo.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::sint64_size(6, v); - } - if let Some(v) = self.source { - my_size += ::protobuf::rt::sint64_size(7, v); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.msg_count { - os.write_uint32(2, v)?; - } - if let Some(v) = self.account_number { - os.write_sint64(3, v)?; - } - if let Some(v) = self.chain_id.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.memo.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.sequence { - os.write_sint64(6, v)?; - } - if let Some(v) = self.source { - os.write_sint64(7, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(8, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceSignTx { - BinanceSignTx::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.msg_count = ::std::option::Option::None; - self.account_number = ::std::option::Option::None; - self.chain_id = ::std::option::Option::None; - self.memo = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.source = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceSignTx { - static instance: BinanceSignTx = BinanceSignTx { - address_n: ::std::vec::Vec::new(), - msg_count: ::std::option::Option::None, - account_number: ::std::option::Option::None, - chain_id: ::std::option::Option::None, - memo: ::std::option::Option::None, - sequence: ::std::option::Option::None, - source: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTxRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceTxRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTxRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceTxRequest { - fn default() -> &'a BinanceTxRequest { - ::default_instance() - } -} - -impl BinanceTxRequest { - pub fn new() -> BinanceTxRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceTxRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceTxRequest { - const NAME: &'static str = "BinanceTxRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceTxRequest { - BinanceTxRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceTxRequest { - static instance: BinanceTxRequest = BinanceTxRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceTxRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceTxRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceTxRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceTxRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTransferMsg) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceTransferMsg { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.inputs) - pub inputs: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.outputs) - pub outputs: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTransferMsg.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceTransferMsg { - fn default() -> &'a BinanceTransferMsg { - ::default_instance() - } -} - -impl BinanceTransferMsg { - pub fn new() -> BinanceTransferMsg { - ::std::default::Default::default() - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "inputs", - |m: &BinanceTransferMsg| { &m.inputs }, - |m: &mut BinanceTransferMsg| { &mut m.inputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "outputs", - |m: &BinanceTransferMsg| { &m.outputs }, - |m: &mut BinanceTransferMsg| { &mut m.outputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &BinanceTransferMsg| { &m.chunkify }, - |m: &mut BinanceTransferMsg| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceTransferMsg", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceTransferMsg { - const NAME: &'static str = "BinanceTransferMsg"; - - fn is_initialized(&self) -> bool { - for v in &self.inputs { - if !v.is_initialized() { - return false; - } - }; - for v in &self.outputs { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.inputs.push(is.read_message()?); - }, - 18 => { - self.outputs.push(is.read_message()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.inputs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.outputs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.inputs { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - for v in &self.outputs { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceTransferMsg { - BinanceTransferMsg::new() - } - - fn clear(&mut self) { - self.inputs.clear(); - self.outputs.clear(); - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceTransferMsg { - static instance: BinanceTransferMsg = BinanceTransferMsg { - inputs: ::std::vec::Vec::new(), - outputs: ::std::vec::Vec::new(), - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceTransferMsg { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceTransferMsg").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceTransferMsg { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceTransferMsg { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `BinanceTransferMsg` -pub mod binance_transfer_msg { - // @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct BinanceInputOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput.coins) - pub coins: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceInputOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a BinanceInputOutput { - fn default() -> &'a BinanceInputOutput { - ::default_instance() - } - } - - impl BinanceInputOutput { - pub fn new() -> BinanceInputOutput { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &BinanceInputOutput| { &m.address }, - |m: &mut BinanceInputOutput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "coins", - |m: &BinanceInputOutput| { &m.coins }, - |m: &mut BinanceInputOutput| { &mut m.coins }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceTransferMsg.BinanceInputOutput", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for BinanceInputOutput { - const NAME: &'static str = "BinanceInputOutput"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - for v in &self.coins { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.coins.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - for value in &self.coins { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - for v in &self.coins { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceInputOutput { - BinanceInputOutput::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.coins.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceInputOutput { - static instance: BinanceInputOutput = BinanceInputOutput { - address: ::std::option::Option::None, - coins: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for BinanceInputOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BinanceTransferMsg.BinanceInputOutput").unwrap()).clone() - } - } - - impl ::std::fmt::Display for BinanceInputOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for BinanceInputOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct BinanceCoin { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin.denom) - pub denom: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoin.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a BinanceCoin { - fn default() -> &'a BinanceCoin { - ::default_instance() - } - } - - impl BinanceCoin { - pub fn new() -> BinanceCoin { - ::std::default::Default::default() - } - - // required sint64 amount = 1; - - pub fn amount(&self) -> i64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: i64) { - self.amount = ::std::option::Option::Some(v); - } - - // required string denom = 2; - - pub fn denom(&self) -> &str { - match self.denom.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_denom(&mut self) { - self.denom = ::std::option::Option::None; - } - - pub fn has_denom(&self) -> bool { - self.denom.is_some() - } - - // Param is passed by value, moved - pub fn set_denom(&mut self, v: ::std::string::String) { - self.denom = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_denom(&mut self) -> &mut ::std::string::String { - if self.denom.is_none() { - self.denom = ::std::option::Option::Some(::std::string::String::new()); - } - self.denom.as_mut().unwrap() - } - - // Take field - pub fn take_denom(&mut self) -> ::std::string::String { - self.denom.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &BinanceCoin| { &m.amount }, - |m: &mut BinanceCoin| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "denom", - |m: &BinanceCoin| { &m.denom }, - |m: &mut BinanceCoin| { &mut m.denom }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceTransferMsg.BinanceCoin", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for BinanceCoin { - const NAME: &'static str = "BinanceCoin"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - if self.denom.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.amount = ::std::option::Option::Some(is.read_sint64()?); - }, - 18 => { - self.denom = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::sint64_size(1, v); - } - if let Some(v) = self.denom.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount { - os.write_sint64(1, v)?; - } - if let Some(v) = self.denom.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceCoin { - BinanceCoin::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.denom = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceCoin { - static instance: BinanceCoin = BinanceCoin { - amount: ::std::option::Option::None, - denom: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for BinanceCoin { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BinanceTransferMsg.BinanceCoin").unwrap()).clone() - } - } - - impl ::std::fmt::Display for BinanceCoin { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for BinanceCoin { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceOrderMsg) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceOrderMsg { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.id) - pub id: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.ordertype) - pub ordertype: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.price) - pub price: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.quantity) - pub quantity: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.sender) - pub sender: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.side) - pub side: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.symbol) - pub symbol: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceOrderMsg.timeinforce) - pub timeinforce: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceOrderMsg.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceOrderMsg { - fn default() -> &'a BinanceOrderMsg { - ::default_instance() - } -} - -impl BinanceOrderMsg { - pub fn new() -> BinanceOrderMsg { - ::std::default::Default::default() - } - - // optional string id = 1; - - pub fn id(&self) -> &str { - match self.id.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_id(&mut self) { - self.id = ::std::option::Option::None; - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::string::String) { - self.id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::string::String { - if self.id.is_none() { - self.id = ::std::option::Option::Some(::std::string::String::new()); - } - self.id.as_mut().unwrap() - } - - // Take field - pub fn take_id(&mut self) -> ::std::string::String { - self.id.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required .hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType ordertype = 2; - - pub fn ordertype(&self) -> binance_order_msg::BinanceOrderType { - match self.ordertype { - Some(e) => e.enum_value_or(binance_order_msg::BinanceOrderType::OT_UNKNOWN), - None => binance_order_msg::BinanceOrderType::OT_UNKNOWN, - } - } - - pub fn clear_ordertype(&mut self) { - self.ordertype = ::std::option::Option::None; - } - - pub fn has_ordertype(&self) -> bool { - self.ordertype.is_some() - } - - // Param is passed by value, moved - pub fn set_ordertype(&mut self, v: binance_order_msg::BinanceOrderType) { - self.ordertype = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required sint64 price = 3; - - pub fn price(&self) -> i64 { - self.price.unwrap_or(0) - } - - pub fn clear_price(&mut self) { - self.price = ::std::option::Option::None; - } - - pub fn has_price(&self) -> bool { - self.price.is_some() - } - - // Param is passed by value, moved - pub fn set_price(&mut self, v: i64) { - self.price = ::std::option::Option::Some(v); - } - - // required sint64 quantity = 4; - - pub fn quantity(&self) -> i64 { - self.quantity.unwrap_or(0) - } - - pub fn clear_quantity(&mut self) { - self.quantity = ::std::option::Option::None; - } - - pub fn has_quantity(&self) -> bool { - self.quantity.is_some() - } - - // Param is passed by value, moved - pub fn set_quantity(&mut self, v: i64) { - self.quantity = ::std::option::Option::Some(v); - } - - // optional string sender = 5; - - pub fn sender(&self) -> &str { - match self.sender.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_sender(&mut self) { - self.sender = ::std::option::Option::None; - } - - pub fn has_sender(&self) -> bool { - self.sender.is_some() - } - - // Param is passed by value, moved - pub fn set_sender(&mut self, v: ::std::string::String) { - self.sender = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sender(&mut self) -> &mut ::std::string::String { - if self.sender.is_none() { - self.sender = ::std::option::Option::Some(::std::string::String::new()); - } - self.sender.as_mut().unwrap() - } - - // Take field - pub fn take_sender(&mut self) -> ::std::string::String { - self.sender.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required .hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide side = 6; - - pub fn side(&self) -> binance_order_msg::BinanceOrderSide { - match self.side { - Some(e) => e.enum_value_or(binance_order_msg::BinanceOrderSide::SIDE_UNKNOWN), - None => binance_order_msg::BinanceOrderSide::SIDE_UNKNOWN, - } - } - - pub fn clear_side(&mut self) { - self.side = ::std::option::Option::None; - } - - pub fn has_side(&self) -> bool { - self.side.is_some() - } - - // Param is passed by value, moved - pub fn set_side(&mut self, v: binance_order_msg::BinanceOrderSide) { - self.side = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional string symbol = 7; - - pub fn symbol(&self) -> &str { - match self.symbol.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_symbol(&mut self) { - self.symbol = ::std::option::Option::None; - } - - pub fn has_symbol(&self) -> bool { - self.symbol.is_some() - } - - // Param is passed by value, moved - pub fn set_symbol(&mut self, v: ::std::string::String) { - self.symbol = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_symbol(&mut self) -> &mut ::std::string::String { - if self.symbol.is_none() { - self.symbol = ::std::option::Option::Some(::std::string::String::new()); - } - self.symbol.as_mut().unwrap() - } - - // Take field - pub fn take_symbol(&mut self) -> ::std::string::String { - self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required .hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce timeinforce = 8; - - pub fn timeinforce(&self) -> binance_order_msg::BinanceTimeInForce { - match self.timeinforce { - Some(e) => e.enum_value_or(binance_order_msg::BinanceTimeInForce::TIF_UNKNOWN), - None => binance_order_msg::BinanceTimeInForce::TIF_UNKNOWN, - } - } - - pub fn clear_timeinforce(&mut self) { - self.timeinforce = ::std::option::Option::None; - } - - pub fn has_timeinforce(&self) -> bool { - self.timeinforce.is_some() - } - - // Param is passed by value, moved - pub fn set_timeinforce(&mut self, v: binance_order_msg::BinanceTimeInForce) { - self.timeinforce = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "id", - |m: &BinanceOrderMsg| { &m.id }, - |m: &mut BinanceOrderMsg| { &mut m.id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ordertype", - |m: &BinanceOrderMsg| { &m.ordertype }, - |m: &mut BinanceOrderMsg| { &mut m.ordertype }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "price", - |m: &BinanceOrderMsg| { &m.price }, - |m: &mut BinanceOrderMsg| { &mut m.price }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "quantity", - |m: &BinanceOrderMsg| { &m.quantity }, - |m: &mut BinanceOrderMsg| { &mut m.quantity }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sender", - |m: &BinanceOrderMsg| { &m.sender }, - |m: &mut BinanceOrderMsg| { &mut m.sender }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "side", - |m: &BinanceOrderMsg| { &m.side }, - |m: &mut BinanceOrderMsg| { &mut m.side }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "symbol", - |m: &BinanceOrderMsg| { &m.symbol }, - |m: &mut BinanceOrderMsg| { &mut m.symbol }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "timeinforce", - |m: &BinanceOrderMsg| { &m.timeinforce }, - |m: &mut BinanceOrderMsg| { &mut m.timeinforce }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceOrderMsg", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceOrderMsg { - const NAME: &'static str = "BinanceOrderMsg"; - - fn is_initialized(&self) -> bool { - if self.ordertype.is_none() { - return false; - } - if self.price.is_none() { - return false; - } - if self.quantity.is_none() { - return false; - } - if self.side.is_none() { - return false; - } - if self.timeinforce.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.id = ::std::option::Option::Some(is.read_string()?); - }, - 16 => { - self.ordertype = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 24 => { - self.price = ::std::option::Option::Some(is.read_sint64()?); - }, - 32 => { - self.quantity = ::std::option::Option::Some(is.read_sint64()?); - }, - 42 => { - self.sender = ::std::option::Option::Some(is.read_string()?); - }, - 48 => { - self.side = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 58 => { - self.symbol = ::std::option::Option::Some(is.read_string()?); - }, - 64 => { - self.timeinforce = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.id.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.ordertype { - my_size += ::protobuf::rt::int32_size(2, v.value()); - } - if let Some(v) = self.price { - my_size += ::protobuf::rt::sint64_size(3, v); - } - if let Some(v) = self.quantity { - my_size += ::protobuf::rt::sint64_size(4, v); - } - if let Some(v) = self.sender.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.side { - my_size += ::protobuf::rt::int32_size(6, v.value()); - } - if let Some(v) = self.symbol.as_ref() { - my_size += ::protobuf::rt::string_size(7, &v); - } - if let Some(v) = self.timeinforce { - my_size += ::protobuf::rt::int32_size(8, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.id.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.ordertype { - os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.price { - os.write_sint64(3, v)?; - } - if let Some(v) = self.quantity { - os.write_sint64(4, v)?; - } - if let Some(v) = self.sender.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.side { - os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.symbol.as_ref() { - os.write_string(7, v)?; - } - if let Some(v) = self.timeinforce { - os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceOrderMsg { - BinanceOrderMsg::new() - } - - fn clear(&mut self) { - self.id = ::std::option::Option::None; - self.ordertype = ::std::option::Option::None; - self.price = ::std::option::Option::None; - self.quantity = ::std::option::Option::None; - self.sender = ::std::option::Option::None; - self.side = ::std::option::Option::None; - self.symbol = ::std::option::Option::None; - self.timeinforce = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceOrderMsg { - static instance: BinanceOrderMsg = BinanceOrderMsg { - id: ::std::option::Option::None, - ordertype: ::std::option::Option::None, - price: ::std::option::Option::None, - quantity: ::std::option::Option::None, - sender: ::std::option::Option::None, - side: ::std::option::Option::None, - symbol: ::std::option::Option::None, - timeinforce: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceOrderMsg { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceOrderMsg").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceOrderMsg { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceOrderMsg { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `BinanceOrderMsg` -pub mod binance_order_msg { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType) - pub enum BinanceOrderType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.OT_UNKNOWN) - OT_UNKNOWN = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.MARKET) - MARKET = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.LIMIT) - LIMIT = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderType.OT_RESERVED) - OT_RESERVED = 3, - } - - impl ::protobuf::Enum for BinanceOrderType { - const NAME: &'static str = "BinanceOrderType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(BinanceOrderType::OT_UNKNOWN), - 1 => ::std::option::Option::Some(BinanceOrderType::MARKET), - 2 => ::std::option::Option::Some(BinanceOrderType::LIMIT), - 3 => ::std::option::Option::Some(BinanceOrderType::OT_RESERVED), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "OT_UNKNOWN" => ::std::option::Option::Some(BinanceOrderType::OT_UNKNOWN), - "MARKET" => ::std::option::Option::Some(BinanceOrderType::MARKET), - "LIMIT" => ::std::option::Option::Some(BinanceOrderType::LIMIT), - "OT_RESERVED" => ::std::option::Option::Some(BinanceOrderType::OT_RESERVED), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [BinanceOrderType] = &[ - BinanceOrderType::OT_UNKNOWN, - BinanceOrderType::MARKET, - BinanceOrderType::LIMIT, - BinanceOrderType::OT_RESERVED, - ]; - } - - impl ::protobuf::EnumFull for BinanceOrderType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("BinanceOrderMsg.BinanceOrderType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for BinanceOrderType { - fn default() -> Self { - BinanceOrderType::OT_UNKNOWN - } - } - - impl BinanceOrderType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BinanceOrderMsg.BinanceOrderType") - } - } - - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide) - pub enum BinanceOrderSide { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide.SIDE_UNKNOWN) - SIDE_UNKNOWN = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide.BUY) - BUY = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSide.SELL) - SELL = 2, - } - - impl ::protobuf::Enum for BinanceOrderSide { - const NAME: &'static str = "BinanceOrderSide"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(BinanceOrderSide::SIDE_UNKNOWN), - 1 => ::std::option::Option::Some(BinanceOrderSide::BUY), - 2 => ::std::option::Option::Some(BinanceOrderSide::SELL), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "SIDE_UNKNOWN" => ::std::option::Option::Some(BinanceOrderSide::SIDE_UNKNOWN), - "BUY" => ::std::option::Option::Some(BinanceOrderSide::BUY), - "SELL" => ::std::option::Option::Some(BinanceOrderSide::SELL), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [BinanceOrderSide] = &[ - BinanceOrderSide::SIDE_UNKNOWN, - BinanceOrderSide::BUY, - BinanceOrderSide::SELL, - ]; - } - - impl ::protobuf::EnumFull for BinanceOrderSide { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("BinanceOrderMsg.BinanceOrderSide").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for BinanceOrderSide { - fn default() -> Self { - BinanceOrderSide::SIDE_UNKNOWN - } - } - - impl BinanceOrderSide { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BinanceOrderMsg.BinanceOrderSide") - } - } - - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce) - pub enum BinanceTimeInForce { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.TIF_UNKNOWN) - TIF_UNKNOWN = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.GTE) - GTE = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.TIF_RESERVED) - TIF_RESERVED = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.binance.BinanceOrderMsg.BinanceTimeInForce.IOC) - IOC = 3, - } - - impl ::protobuf::Enum for BinanceTimeInForce { - const NAME: &'static str = "BinanceTimeInForce"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(BinanceTimeInForce::TIF_UNKNOWN), - 1 => ::std::option::Option::Some(BinanceTimeInForce::GTE), - 2 => ::std::option::Option::Some(BinanceTimeInForce::TIF_RESERVED), - 3 => ::std::option::Option::Some(BinanceTimeInForce::IOC), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "TIF_UNKNOWN" => ::std::option::Option::Some(BinanceTimeInForce::TIF_UNKNOWN), - "GTE" => ::std::option::Option::Some(BinanceTimeInForce::GTE), - "TIF_RESERVED" => ::std::option::Option::Some(BinanceTimeInForce::TIF_RESERVED), - "IOC" => ::std::option::Option::Some(BinanceTimeInForce::IOC), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [BinanceTimeInForce] = &[ - BinanceTimeInForce::TIF_UNKNOWN, - BinanceTimeInForce::GTE, - BinanceTimeInForce::TIF_RESERVED, - BinanceTimeInForce::IOC, - ]; - } - - impl ::protobuf::EnumFull for BinanceTimeInForce { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("BinanceOrderMsg.BinanceTimeInForce").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for BinanceTimeInForce { - fn default() -> Self { - BinanceTimeInForce::TIF_UNKNOWN - } - } - - impl BinanceTimeInForce { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BinanceOrderMsg.BinanceTimeInForce") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceCancelMsg) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceCancelMsg { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceCancelMsg.refid) - pub refid: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceCancelMsg.sender) - pub sender: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceCancelMsg.symbol) - pub symbol: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceCancelMsg.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceCancelMsg { - fn default() -> &'a BinanceCancelMsg { - ::default_instance() - } -} - -impl BinanceCancelMsg { - pub fn new() -> BinanceCancelMsg { - ::std::default::Default::default() - } - - // optional string refid = 1; - - pub fn refid(&self) -> &str { - match self.refid.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_refid(&mut self) { - self.refid = ::std::option::Option::None; - } - - pub fn has_refid(&self) -> bool { - self.refid.is_some() - } - - // Param is passed by value, moved - pub fn set_refid(&mut self, v: ::std::string::String) { - self.refid = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_refid(&mut self) -> &mut ::std::string::String { - if self.refid.is_none() { - self.refid = ::std::option::Option::Some(::std::string::String::new()); - } - self.refid.as_mut().unwrap() - } - - // Take field - pub fn take_refid(&mut self) -> ::std::string::String { - self.refid.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string sender = 2; - - pub fn sender(&self) -> &str { - match self.sender.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_sender(&mut self) { - self.sender = ::std::option::Option::None; - } - - pub fn has_sender(&self) -> bool { - self.sender.is_some() - } - - // Param is passed by value, moved - pub fn set_sender(&mut self, v: ::std::string::String) { - self.sender = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sender(&mut self) -> &mut ::std::string::String { - if self.sender.is_none() { - self.sender = ::std::option::Option::Some(::std::string::String::new()); - } - self.sender.as_mut().unwrap() - } - - // Take field - pub fn take_sender(&mut self) -> ::std::string::String { - self.sender.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string symbol = 3; - - pub fn symbol(&self) -> &str { - match self.symbol.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_symbol(&mut self) { - self.symbol = ::std::option::Option::None; - } - - pub fn has_symbol(&self) -> bool { - self.symbol.is_some() - } - - // Param is passed by value, moved - pub fn set_symbol(&mut self, v: ::std::string::String) { - self.symbol = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_symbol(&mut self) -> &mut ::std::string::String { - if self.symbol.is_none() { - self.symbol = ::std::option::Option::Some(::std::string::String::new()); - } - self.symbol.as_mut().unwrap() - } - - // Take field - pub fn take_symbol(&mut self) -> ::std::string::String { - self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "refid", - |m: &BinanceCancelMsg| { &m.refid }, - |m: &mut BinanceCancelMsg| { &mut m.refid }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sender", - |m: &BinanceCancelMsg| { &m.sender }, - |m: &mut BinanceCancelMsg| { &mut m.sender }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "symbol", - |m: &BinanceCancelMsg| { &m.symbol }, - |m: &mut BinanceCancelMsg| { &mut m.symbol }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceCancelMsg", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceCancelMsg { - const NAME: &'static str = "BinanceCancelMsg"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.refid = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.sender = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.symbol = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.refid.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.sender.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.symbol.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.refid.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.sender.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.symbol.as_ref() { - os.write_string(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceCancelMsg { - BinanceCancelMsg::new() - } - - fn clear(&mut self) { - self.refid = ::std::option::Option::None; - self.sender = ::std::option::Option::None; - self.symbol = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceCancelMsg { - static instance: BinanceCancelMsg = BinanceCancelMsg { - refid: ::std::option::Option::None, - sender: ::std::option::Option::None, - symbol: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceCancelMsg { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceCancelMsg").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceCancelMsg { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceCancelMsg { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.binance.BinanceSignedTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BinanceSignedTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignedTx.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.binance.BinanceSignedTx.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.binance.BinanceSignedTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BinanceSignedTx { - fn default() -> &'a BinanceSignedTx { - ::default_instance() - } -} - -impl BinanceSignedTx { - pub fn new() -> BinanceSignedTx { - ::std::default::Default::default() - } - - // required bytes signature = 1; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes public_key = 2; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &BinanceSignedTx| { &m.signature }, - |m: &mut BinanceSignedTx| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &BinanceSignedTx| { &m.public_key }, - |m: &mut BinanceSignedTx| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BinanceSignedTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BinanceSignedTx { - const NAME: &'static str = "BinanceSignedTx"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BinanceSignedTx { - BinanceSignedTx::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static BinanceSignedTx { - static instance: BinanceSignedTx = BinanceSignedTx { - signature: ::std::option::Option::None, - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BinanceSignedTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BinanceSignedTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BinanceSignedTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BinanceSignedTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x16messages-binance.proto\x12\x1ahw.trezor.messages.binance\"o\n\x11B\ - inanceGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\ - \x08chunkify\x18\x03\x20\x01(\x08R\x08chunkify\"*\n\x0eBinanceAddress\ - \x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"U\n\x13BinanceGetP\ - ublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0c\ - show_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"1\n\x10BinancePublicK\ - ey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\"\xef\x01\n\rB\ - inanceSignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\ - \x1b\n\tmsg_count\x18\x02\x20\x02(\rR\x08msgCount\x12%\n\x0eaccount_numb\ - er\x18\x03\x20\x02(\x12R\raccountNumber\x12\x19\n\x08chain_id\x18\x04\ - \x20\x01(\tR\x07chainId\x12\x12\n\x04memo\x18\x05\x20\x01(\tR\x04memo\ - \x12\x1a\n\x08sequence\x18\x06\x20\x02(\x12R\x08sequence\x12\x16\n\x06so\ - urce\x18\x07\x20\x02(\x12R\x06source\x12\x1a\n\x08chunkify\x18\x08\x20\ - \x01(\x08R\x08chunkify\"\x12\n\x10BinanceTxRequest\"\xa8\x03\n\x12Binanc\ - eTransferMsg\x12Y\n\x06inputs\x18\x01\x20\x03(\x0b2A.hw.trezor.messages.\ - binance.BinanceTransferMsg.BinanceInputOutputR\x06inputs\x12[\n\x07outpu\ - ts\x18\x02\x20\x03(\x0b2A.hw.trezor.messages.binance.BinanceTransferMsg.\ - BinanceInputOutputR\x07outputs\x12\x1a\n\x08chunkify\x18\x03\x20\x01(\ - \x08R\x08chunkify\x1a\x80\x01\n\x12BinanceInputOutput\x12\x18\n\x07addre\ - ss\x18\x01\x20\x02(\tR\x07address\x12P\n\x05coins\x18\x02\x20\x03(\x0b2:\ - .hw.trezor.messages.binance.BinanceTransferMsg.BinanceCoinR\x05coins\x1a\ - ;\n\x0bBinanceCoin\x12\x16\n\x06amount\x18\x01\x20\x02(\x12R\x06amount\ - \x12\x14\n\x05denom\x18\x02\x20\x02(\tR\x05denom\"\xe3\x04\n\x0fBinanceO\ - rderMsg\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12Z\n\tordertype\x18\ - \x02\x20\x02(\x0e2<.hw.trezor.messages.binance.BinanceOrderMsg.BinanceOr\ - derTypeR\tordertype\x12\x14\n\x05price\x18\x03\x20\x02(\x12R\x05price\ - \x12\x1a\n\x08quantity\x18\x04\x20\x02(\x12R\x08quantity\x12\x16\n\x06se\ - nder\x18\x05\x20\x01(\tR\x06sender\x12P\n\x04side\x18\x06\x20\x02(\x0e2<\ - .hw.trezor.messages.binance.BinanceOrderMsg.BinanceOrderSideR\x04side\ - \x12\x16\n\x06symbol\x18\x07\x20\x01(\tR\x06symbol\x12`\n\x0btimeinforce\ - \x18\x08\x20\x02(\x0e2>.hw.trezor.messages.binance.BinanceOrderMsg.Binan\ - ceTimeInForceR\x0btimeinforce\"J\n\x10BinanceOrderType\x12\x0e\n\nOT_UNK\ - NOWN\x10\0\x12\n\n\x06MARKET\x10\x01\x12\t\n\x05LIMIT\x10\x02\x12\x0f\n\ - \x0bOT_RESERVED\x10\x03\"7\n\x10BinanceOrderSide\x12\x10\n\x0cSIDE_UNKNO\ - WN\x10\0\x12\x07\n\x03BUY\x10\x01\x12\x08\n\x04SELL\x10\x02\"I\n\x12Bina\ - nceTimeInForce\x12\x0f\n\x0bTIF_UNKNOWN\x10\0\x12\x07\n\x03GTE\x10\x01\ - \x12\x10\n\x0cTIF_RESERVED\x10\x02\x12\x07\n\x03IOC\x10\x03\"X\n\x10Bina\ - nceCancelMsg\x12\x14\n\x05refid\x18\x01\x20\x01(\tR\x05refid\x12\x16\n\ - \x06sender\x18\x02\x20\x01(\tR\x06sender\x12\x16\n\x06symbol\x18\x03\x20\ - \x01(\tR\x06symbol\"N\n\x0fBinanceSignedTx\x12\x1c\n\tsignature\x18\x01\ - \x20\x02(\x0cR\tsignature\x12\x1d\n\npublic_key\x18\x02\x20\x02(\x0cR\tp\ - ublicKeyB;\n#com.satoshilabs.trezor.lib.protobufB\x14TrezorMessageBinanc\ - e\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(12); - messages.push(BinanceGetAddress::generated_message_descriptor_data()); - messages.push(BinanceAddress::generated_message_descriptor_data()); - messages.push(BinanceGetPublicKey::generated_message_descriptor_data()); - messages.push(BinancePublicKey::generated_message_descriptor_data()); - messages.push(BinanceSignTx::generated_message_descriptor_data()); - messages.push(BinanceTxRequest::generated_message_descriptor_data()); - messages.push(BinanceTransferMsg::generated_message_descriptor_data()); - messages.push(BinanceOrderMsg::generated_message_descriptor_data()); - messages.push(BinanceCancelMsg::generated_message_descriptor_data()); - messages.push(BinanceSignedTx::generated_message_descriptor_data()); - messages.push(binance_transfer_msg::BinanceInputOutput::generated_message_descriptor_data()); - messages.push(binance_transfer_msg::BinanceCoin::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(3); - enums.push(binance_order_msg::BinanceOrderType::generated_enum_descriptor_data()); - enums.push(binance_order_msg::BinanceOrderSide::generated_enum_descriptor_data()); - enums.push(binance_order_msg::BinanceTimeInForce::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs b/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs deleted file mode 100644 index 5d99647cc1..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_bitcoin.rs +++ /dev/null @@ -1,13677 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-bitcoin.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.MultisigRedeemScriptType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MultisigRedeemScriptType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.pubkeys) - pub pubkeys: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.signatures) - pub signatures: ::std::vec::Vec<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.m) - pub m: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.nodes) - pub nodes: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.address_n) - pub address_n: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MultisigRedeemScriptType { - fn default() -> &'a MultisigRedeemScriptType { - ::default_instance() - } -} - -impl MultisigRedeemScriptType { - pub fn new() -> MultisigRedeemScriptType { - ::std::default::Default::default() - } - - // required uint32 m = 3; - - pub fn m(&self) -> u32 { - self.m.unwrap_or(0) - } - - pub fn clear_m(&mut self) { - self.m = ::std::option::Option::None; - } - - pub fn has_m(&self) -> bool { - self.m.is_some() - } - - // Param is passed by value, moved - pub fn set_m(&mut self, v: u32) { - self.m = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "pubkeys", - |m: &MultisigRedeemScriptType| { &m.pubkeys }, - |m: &mut MultisigRedeemScriptType| { &mut m.pubkeys }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "signatures", - |m: &MultisigRedeemScriptType| { &m.signatures }, - |m: &mut MultisigRedeemScriptType| { &mut m.signatures }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "m", - |m: &MultisigRedeemScriptType| { &m.m }, - |m: &mut MultisigRedeemScriptType| { &mut m.m }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "nodes", - |m: &MultisigRedeemScriptType| { &m.nodes }, - |m: &mut MultisigRedeemScriptType| { &mut m.nodes }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MultisigRedeemScriptType| { &m.address_n }, - |m: &mut MultisigRedeemScriptType| { &mut m.address_n }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MultisigRedeemScriptType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MultisigRedeemScriptType { - const NAME: &'static str = "MultisigRedeemScriptType"; - - fn is_initialized(&self) -> bool { - if self.m.is_none() { - return false; - } - for v in &self.pubkeys { - if !v.is_initialized() { - return false; - } - }; - for v in &self.nodes { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.pubkeys.push(is.read_message()?); - }, - 18 => { - self.signatures.push(is.read_bytes()?); - }, - 24 => { - self.m = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - self.nodes.push(is.read_message()?); - }, - 42 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 40 => { - self.address_n.push(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.pubkeys { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.signatures { - my_size += ::protobuf::rt::bytes_size(2, &value); - }; - if let Some(v) = self.m { - my_size += ::protobuf::rt::uint32_size(3, v); - } - for value in &self.nodes { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(5, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.pubkeys { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - for v in &self.signatures { - os.write_bytes(2, &v)?; - }; - if let Some(v) = self.m { - os.write_uint32(3, v)?; - } - for v in &self.nodes { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - }; - for v in &self.address_n { - os.write_uint32(5, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MultisigRedeemScriptType { - MultisigRedeemScriptType::new() - } - - fn clear(&mut self) { - self.pubkeys.clear(); - self.signatures.clear(); - self.m = ::std::option::Option::None; - self.nodes.clear(); - self.address_n.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MultisigRedeemScriptType { - static instance: MultisigRedeemScriptType = MultisigRedeemScriptType { - pubkeys: ::std::vec::Vec::new(), - signatures: ::std::vec::Vec::new(), - m: ::std::option::Option::None, - nodes: ::std::vec::Vec::new(), - address_n: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MultisigRedeemScriptType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MultisigRedeemScriptType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MultisigRedeemScriptType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MultisigRedeemScriptType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MultisigRedeemScriptType` -pub mod multisig_redeem_script_type { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct HDNodePathType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType.node) - pub node: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType.address_n) - pub address_n: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.MultisigRedeemScriptType.HDNodePathType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a HDNodePathType { - fn default() -> &'a HDNodePathType { - ::default_instance() - } - } - - impl HDNodePathType { - pub fn new() -> HDNodePathType { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::messages_common::HDNodeType>( - "node", - |m: &HDNodePathType| { &m.node }, - |m: &mut HDNodePathType| { &mut m.node }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &HDNodePathType| { &m.address_n }, - |m: &mut HDNodePathType| { &mut m.address_n }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MultisigRedeemScriptType.HDNodePathType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for HDNodePathType { - const NAME: &'static str = "HDNodePathType"; - - fn is_initialized(&self) -> bool { - if self.node.is_none() { - return false; - } - for v in &self.node { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.node.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.node.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> HDNodePathType { - HDNodePathType::new() - } - - fn clear(&mut self) { - self.node.clear(); - self.address_n.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static HDNodePathType { - static instance: HDNodePathType = HDNodePathType { - node: ::protobuf::MessageField::none(), - address_n: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for HDNodePathType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MultisigRedeemScriptType.HDNodePathType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for HDNodePathType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for HDNodePathType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.ecdsa_curve_name) - pub ecdsa_curve_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.ignore_xpub_magic) - pub ignore_xpub_magic: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetPublicKey { - fn default() -> &'a GetPublicKey { - ::default_instance() - } -} - -impl GetPublicKey { - pub fn new() -> GetPublicKey { - ::std::default::Default::default() - } - - // optional string ecdsa_curve_name = 2; - - pub fn ecdsa_curve_name(&self) -> &str { - match self.ecdsa_curve_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_ecdsa_curve_name(&mut self) { - self.ecdsa_curve_name = ::std::option::Option::None; - } - - pub fn has_ecdsa_curve_name(&self) -> bool { - self.ecdsa_curve_name.is_some() - } - - // Param is passed by value, moved - pub fn set_ecdsa_curve_name(&mut self, v: ::std::string::String) { - self.ecdsa_curve_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ecdsa_curve_name(&mut self) -> &mut ::std::string::String { - if self.ecdsa_curve_name.is_none() { - self.ecdsa_curve_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.ecdsa_curve_name.as_mut().unwrap() - } - - // Take field - pub fn take_ecdsa_curve_name(&mut self) -> ::std::string::String { - self.ecdsa_curve_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool show_display = 3; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional string coin_name = 4; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 5; - - pub fn script_type(&self) -> InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), - None => InputScriptType::SPENDADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool ignore_xpub_magic = 6; - - pub fn ignore_xpub_magic(&self) -> bool { - self.ignore_xpub_magic.unwrap_or(false) - } - - pub fn clear_ignore_xpub_magic(&mut self) { - self.ignore_xpub_magic = ::std::option::Option::None; - } - - pub fn has_ignore_xpub_magic(&self) -> bool { - self.ignore_xpub_magic.is_some() - } - - // Param is passed by value, moved - pub fn set_ignore_xpub_magic(&mut self, v: bool) { - self.ignore_xpub_magic = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &GetPublicKey| { &m.address_n }, - |m: &mut GetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ecdsa_curve_name", - |m: &GetPublicKey| { &m.ecdsa_curve_name }, - |m: &mut GetPublicKey| { &mut m.ecdsa_curve_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &GetPublicKey| { &m.show_display }, - |m: &mut GetPublicKey| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &GetPublicKey| { &m.coin_name }, - |m: &mut GetPublicKey| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &GetPublicKey| { &m.script_type }, - |m: &mut GetPublicKey| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ignore_xpub_magic", - |m: &GetPublicKey| { &m.ignore_xpub_magic }, - |m: &mut GetPublicKey| { &mut m.ignore_xpub_magic }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetPublicKey { - const NAME: &'static str = "GetPublicKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.ecdsa_curve_name = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 34 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 40 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 48 => { - self.ignore_xpub_magic = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.ecdsa_curve_name.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(5, v.value()); - } - if let Some(v) = self.ignore_xpub_magic { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.ecdsa_curve_name.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.show_display { - os.write_bool(3, v)?; - } - if let Some(v) = self.coin_name.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.ignore_xpub_magic { - os.write_bool(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetPublicKey { - GetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.ecdsa_curve_name = ::std::option::Option::None; - self.show_display = ::std::option::Option::None; - self.coin_name = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.ignore_xpub_magic = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetPublicKey { - static instance: GetPublicKey = GetPublicKey { - address_n: ::std::vec::Vec::new(), - ecdsa_curve_name: ::std::option::Option::None, - show_display: ::std::option::Option::None, - coin_name: ::std::option::Option::None, - script_type: ::std::option::Option::None, - ignore_xpub_magic: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.node) - pub node: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.xpub) - pub xpub: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.root_fingerprint) - pub root_fingerprint: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PublicKey.descriptor) - pub descriptor: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PublicKey { - fn default() -> &'a PublicKey { - ::default_instance() - } -} - -impl PublicKey { - pub fn new() -> PublicKey { - ::std::default::Default::default() - } - - // required string xpub = 2; - - pub fn xpub(&self) -> &str { - match self.xpub.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_xpub(&mut self) { - self.xpub = ::std::option::Option::None; - } - - pub fn has_xpub(&self) -> bool { - self.xpub.is_some() - } - - // Param is passed by value, moved - pub fn set_xpub(&mut self, v: ::std::string::String) { - self.xpub = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_xpub(&mut self) -> &mut ::std::string::String { - if self.xpub.is_none() { - self.xpub = ::std::option::Option::Some(::std::string::String::new()); - } - self.xpub.as_mut().unwrap() - } - - // Take field - pub fn take_xpub(&mut self) -> ::std::string::String { - self.xpub.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 root_fingerprint = 3; - - pub fn root_fingerprint(&self) -> u32 { - self.root_fingerprint.unwrap_or(0) - } - - pub fn clear_root_fingerprint(&mut self) { - self.root_fingerprint = ::std::option::Option::None; - } - - pub fn has_root_fingerprint(&self) -> bool { - self.root_fingerprint.is_some() - } - - // Param is passed by value, moved - pub fn set_root_fingerprint(&mut self, v: u32) { - self.root_fingerprint = ::std::option::Option::Some(v); - } - - // optional string descriptor = 4; - - pub fn descriptor(&self) -> &str { - match self.descriptor.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_descriptor(&mut self) { - self.descriptor = ::std::option::Option::None; - } - - pub fn has_descriptor(&self) -> bool { - self.descriptor.is_some() - } - - // Param is passed by value, moved - pub fn set_descriptor(&mut self, v: ::std::string::String) { - self.descriptor = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_descriptor(&mut self) -> &mut ::std::string::String { - if self.descriptor.is_none() { - self.descriptor = ::std::option::Option::Some(::std::string::String::new()); - } - self.descriptor.as_mut().unwrap() - } - - // Take field - pub fn take_descriptor(&mut self) -> ::std::string::String { - self.descriptor.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( - "node", - |m: &PublicKey| { &m.node }, - |m: &mut PublicKey| { &mut m.node }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "xpub", - |m: &PublicKey| { &m.xpub }, - |m: &mut PublicKey| { &mut m.xpub }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "root_fingerprint", - |m: &PublicKey| { &m.root_fingerprint }, - |m: &mut PublicKey| { &mut m.root_fingerprint }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "descriptor", - |m: &PublicKey| { &m.descriptor }, - |m: &mut PublicKey| { &mut m.descriptor }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PublicKey { - const NAME: &'static str = "PublicKey"; - - fn is_initialized(&self) -> bool { - if self.node.is_none() { - return false; - } - if self.xpub.is_none() { - return false; - } - for v in &self.node { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; - }, - 18 => { - self.xpub = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.root_fingerprint = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - self.descriptor = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.node.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.xpub.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.root_fingerprint { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.descriptor.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.node.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.xpub.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.root_fingerprint { - os.write_uint32(3, v)?; - } - if let Some(v) = self.descriptor.as_ref() { - os.write_string(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PublicKey { - PublicKey::new() - } - - fn clear(&mut self) { - self.node.clear(); - self.xpub = ::std::option::Option::None; - self.root_fingerprint = ::std::option::Option::None; - self.descriptor = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PublicKey { - static instance: PublicKey = PublicKey { - node: ::protobuf::MessageField::none(), - xpub: ::std::option::Option::None, - root_fingerprint: ::std::option::Option::None, - descriptor: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.ignore_xpub_magic) - pub ignore_xpub_magic: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetAddress { - fn default() -> &'a GetAddress { - ::default_instance() - } -} - -impl GetAddress { - pub fn new() -> GetAddress { - ::std::default::Default::default() - } - - // optional string coin_name = 2; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool show_display = 3; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 5; - - pub fn script_type(&self) -> InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), - None => InputScriptType::SPENDADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool ignore_xpub_magic = 6; - - pub fn ignore_xpub_magic(&self) -> bool { - self.ignore_xpub_magic.unwrap_or(false) - } - - pub fn clear_ignore_xpub_magic(&mut self) { - self.ignore_xpub_magic = ::std::option::Option::None; - } - - pub fn has_ignore_xpub_magic(&self) -> bool { - self.ignore_xpub_magic.is_some() - } - - // Param is passed by value, moved - pub fn set_ignore_xpub_magic(&mut self, v: bool) { - self.ignore_xpub_magic = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 7; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &GetAddress| { &m.address_n }, - |m: &mut GetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &GetAddress| { &m.coin_name }, - |m: &mut GetAddress| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &GetAddress| { &m.show_display }, - |m: &mut GetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( - "multisig", - |m: &GetAddress| { &m.multisig }, - |m: &mut GetAddress| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &GetAddress| { &m.script_type }, - |m: &mut GetAddress| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ignore_xpub_magic", - |m: &GetAddress| { &m.ignore_xpub_magic }, - |m: &mut GetAddress| { &mut m.ignore_xpub_magic }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &GetAddress| { &m.chunkify }, - |m: &mut GetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetAddress { - const NAME: &'static str = "GetAddress"; - - fn is_initialized(&self) -> bool { - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 40 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 48 => { - self.ignore_xpub_magic = ::std::option::Option::Some(is.read_bool()?); - }, - 56 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(5, v.value()); - } - if let Some(v) = self.ignore_xpub_magic { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.coin_name.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.show_display { - os.write_bool(3, v)?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.script_type { - os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.ignore_xpub_magic { - os.write_bool(6, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetAddress { - GetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.coin_name = ::std::option::Option::None; - self.show_display = ::std::option::Option::None; - self.multisig.clear(); - self.script_type = ::std::option::Option::None; - self.ignore_xpub_magic = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetAddress { - static instance: GetAddress = GetAddress { - address_n: ::std::vec::Vec::new(), - coin_name: ::std::option::Option::None, - show_display: ::std::option::Option::None, - multisig: ::protobuf::MessageField::none(), - script_type: ::std::option::Option::None, - ignore_xpub_magic: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.Address) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Address { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.Address.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.Address.mac) - pub mac: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.Address.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Address { - fn default() -> &'a Address { -
::default_instance() - } -} - -impl Address { - pub fn new() -> Address { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bytes mac = 2; - - pub fn mac(&self) -> &[u8] { - match self.mac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mac(&mut self) { - self.mac = ::std::option::Option::None; - } - - pub fn has_mac(&self) -> bool { - self.mac.is_some() - } - - // Param is passed by value, moved - pub fn set_mac(&mut self, v: ::std::vec::Vec) { - self.mac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { - if self.mac.is_none() { - self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mac.as_mut().unwrap() - } - - // Take field - pub fn take_mac(&mut self) -> ::std::vec::Vec { - self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &Address| { &m.address }, - |m: &mut Address| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mac", - |m: &Address| { &m.mac }, - |m: &mut Address| { &mut m.mac }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::
( - "Address", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Address { - const NAME: &'static str = "Address"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.mac = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.mac.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.mac.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Address { - Address::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.mac = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Address { - static instance: Address = Address { - address: ::std::option::Option::None, - mac: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Address { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Address").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Address { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Address { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetOwnershipId) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetOwnershipId { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipId.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetOwnershipId.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetOwnershipId { - fn default() -> &'a GetOwnershipId { - ::default_instance() - } -} - -impl GetOwnershipId { - pub fn new() -> GetOwnershipId { - ::std::default::Default::default() - } - - // optional string coin_name = 2; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 4; - - pub fn script_type(&self) -> InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), - None => InputScriptType::SPENDADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &GetOwnershipId| { &m.address_n }, - |m: &mut GetOwnershipId| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &GetOwnershipId| { &m.coin_name }, - |m: &mut GetOwnershipId| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( - "multisig", - |m: &GetOwnershipId| { &m.multisig }, - |m: &mut GetOwnershipId| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &GetOwnershipId| { &m.script_type }, - |m: &mut GetOwnershipId| { &mut m.script_type }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetOwnershipId", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetOwnershipId { - const NAME: &'static str = "GetOwnershipId"; - - fn is_initialized(&self) -> bool { - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 32 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(4, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.coin_name.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.script_type { - os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetOwnershipId { - GetOwnershipId::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.coin_name = ::std::option::Option::None; - self.multisig.clear(); - self.script_type = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetOwnershipId { - static instance: GetOwnershipId = GetOwnershipId { - address_n: ::std::vec::Vec::new(), - coin_name: ::std::option::Option::None, - multisig: ::protobuf::MessageField::none(), - script_type: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetOwnershipId { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetOwnershipId").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetOwnershipId { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetOwnershipId { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.OwnershipId) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct OwnershipId { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.OwnershipId.ownership_id) - pub ownership_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.OwnershipId.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a OwnershipId { - fn default() -> &'a OwnershipId { - ::default_instance() - } -} - -impl OwnershipId { - pub fn new() -> OwnershipId { - ::std::default::Default::default() - } - - // required bytes ownership_id = 1; - - pub fn ownership_id(&self) -> &[u8] { - match self.ownership_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ownership_id(&mut self) { - self.ownership_id = ::std::option::Option::None; - } - - pub fn has_ownership_id(&self) -> bool { - self.ownership_id.is_some() - } - - // Param is passed by value, moved - pub fn set_ownership_id(&mut self, v: ::std::vec::Vec) { - self.ownership_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ownership_id(&mut self) -> &mut ::std::vec::Vec { - if self.ownership_id.is_none() { - self.ownership_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ownership_id.as_mut().unwrap() - } - - // Take field - pub fn take_ownership_id(&mut self) -> ::std::vec::Vec { - self.ownership_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ownership_id", - |m: &OwnershipId| { &m.ownership_id }, - |m: &mut OwnershipId| { &mut m.ownership_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "OwnershipId", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for OwnershipId { - const NAME: &'static str = "OwnershipId"; - - fn is_initialized(&self) -> bool { - if self.ownership_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.ownership_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.ownership_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.ownership_id.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> OwnershipId { - OwnershipId::new() - } - - fn clear(&mut self) { - self.ownership_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static OwnershipId { - static instance: OwnershipId = OwnershipId { - ownership_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for OwnershipId { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("OwnershipId").unwrap()).clone() - } -} - -impl ::std::fmt::Display for OwnershipId { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for OwnershipId { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.SignMessage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SignMessage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.message) - pub message: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.no_script_type) - pub no_script_type: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignMessage.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.SignMessage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SignMessage { - fn default() -> &'a SignMessage { - ::default_instance() - } -} - -impl SignMessage { - pub fn new() -> SignMessage { - ::std::default::Default::default() - } - - // required bytes message = 2; - - pub fn message(&self) -> &[u8] { - match self.message.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::vec::Vec) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::vec::Vec { - self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string coin_name = 3; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 4; - - pub fn script_type(&self) -> InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), - None => InputScriptType::SPENDADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool no_script_type = 5; - - pub fn no_script_type(&self) -> bool { - self.no_script_type.unwrap_or(false) - } - - pub fn clear_no_script_type(&mut self) { - self.no_script_type = ::std::option::Option::None; - } - - pub fn has_no_script_type(&self) -> bool { - self.no_script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_no_script_type(&mut self, v: bool) { - self.no_script_type = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 6; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &SignMessage| { &m.address_n }, - |m: &mut SignMessage| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &SignMessage| { &m.message }, - |m: &mut SignMessage| { &mut m.message }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &SignMessage| { &m.coin_name }, - |m: &mut SignMessage| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &SignMessage| { &m.script_type }, - |m: &mut SignMessage| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "no_script_type", - |m: &SignMessage| { &m.no_script_type }, - |m: &mut SignMessage| { &mut m.no_script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &SignMessage| { &m.chunkify }, - |m: &mut SignMessage| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SignMessage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SignMessage { - const NAME: &'static str = "SignMessage"; - - fn is_initialized(&self) -> bool { - if self.message.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.message = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 32 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 40 => { - self.no_script_type = ::std::option::Option::Some(is.read_bool()?); - }, - 48 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(4, v.value()); - } - if let Some(v) = self.no_script_type { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.message.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.coin_name.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.no_script_type { - os.write_bool(5, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SignMessage { - SignMessage::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.message = ::std::option::Option::None; - self.coin_name = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.no_script_type = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SignMessage { - static instance: SignMessage = SignMessage { - address_n: ::std::vec::Vec::new(), - message: ::std::option::Option::None, - coin_name: ::std::option::Option::None, - script_type: ::std::option::Option::None, - no_script_type: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SignMessage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SignMessage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SignMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SignMessage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.MessageSignature) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MessageSignature { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MessageSignature.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.MessageSignature.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.MessageSignature.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MessageSignature { - fn default() -> &'a MessageSignature { - ::default_instance() - } -} - -impl MessageSignature { - pub fn new() -> MessageSignature { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MessageSignature| { &m.address }, - |m: &mut MessageSignature| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &MessageSignature| { &m.signature }, - |m: &mut MessageSignature| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MessageSignature", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MessageSignature { - const NAME: &'static str = "MessageSignature"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MessageSignature { - MessageSignature::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MessageSignature { - static instance: MessageSignature = MessageSignature { - address: ::std::option::Option::None, - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MessageSignature { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MessageSignature").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MessageSignature { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MessageSignature { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.VerifyMessage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct VerifyMessage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.message) - pub message: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.VerifyMessage.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.VerifyMessage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a VerifyMessage { - fn default() -> &'a VerifyMessage { - ::default_instance() - } -} - -impl VerifyMessage { - pub fn new() -> VerifyMessage { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes message = 3; - - pub fn message(&self) -> &[u8] { - match self.message.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::vec::Vec) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::vec::Vec { - self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string coin_name = 4; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool chunkify = 5; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &VerifyMessage| { &m.address }, - |m: &mut VerifyMessage| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &VerifyMessage| { &m.signature }, - |m: &mut VerifyMessage| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &VerifyMessage| { &m.message }, - |m: &mut VerifyMessage| { &mut m.message }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &VerifyMessage| { &m.coin_name }, - |m: &mut VerifyMessage| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &VerifyMessage| { &m.chunkify }, - |m: &mut VerifyMessage| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "VerifyMessage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for VerifyMessage { - const NAME: &'static str = "VerifyMessage"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - if self.message.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.message = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 40 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.message.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.coin_name.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> VerifyMessage { - VerifyMessage::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.message = ::std::option::Option::None; - self.coin_name = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static VerifyMessage { - static instance: VerifyMessage = VerifyMessage { - address: ::std::option::Option::None, - signature: ::std::option::Option::None, - message: ::std::option::Option::None, - coin_name: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for VerifyMessage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("VerifyMessage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for VerifyMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for VerifyMessage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.SignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.outputs_count) - pub outputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.inputs_count) - pub inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.lock_time) - pub lock_time: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.expiry) - pub expiry: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.overwintered) - pub overwintered: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.version_group_id) - pub version_group_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.timestamp) - pub timestamp: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.branch_id) - pub branch_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.amount_unit) - pub amount_unit: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.decred_staking_ticket) - pub decred_staking_ticket: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.serialize) - pub serialize: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.coinjoin_request) - pub coinjoin_request: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.SignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SignTx { - fn default() -> &'a SignTx { - ::default_instance() - } -} - -impl SignTx { - pub fn new() -> SignTx { - ::std::default::Default::default() - } - - // required uint32 outputs_count = 1; - - pub fn outputs_count(&self) -> u32 { - self.outputs_count.unwrap_or(0) - } - - pub fn clear_outputs_count(&mut self) { - self.outputs_count = ::std::option::Option::None; - } - - pub fn has_outputs_count(&self) -> bool { - self.outputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_outputs_count(&mut self, v: u32) { - self.outputs_count = ::std::option::Option::Some(v); - } - - // required uint32 inputs_count = 2; - - pub fn inputs_count(&self) -> u32 { - self.inputs_count.unwrap_or(0) - } - - pub fn clear_inputs_count(&mut self) { - self.inputs_count = ::std::option::Option::None; - } - - pub fn has_inputs_count(&self) -> bool { - self.inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_inputs_count(&mut self, v: u32) { - self.inputs_count = ::std::option::Option::Some(v); - } - - // optional string coin_name = 3; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 version = 4; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(1u32) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // optional uint32 lock_time = 5; - - pub fn lock_time(&self) -> u32 { - self.lock_time.unwrap_or(0u32) - } - - pub fn clear_lock_time(&mut self) { - self.lock_time = ::std::option::Option::None; - } - - pub fn has_lock_time(&self) -> bool { - self.lock_time.is_some() - } - - // Param is passed by value, moved - pub fn set_lock_time(&mut self, v: u32) { - self.lock_time = ::std::option::Option::Some(v); - } - - // optional uint32 expiry = 6; - - pub fn expiry(&self) -> u32 { - self.expiry.unwrap_or(0) - } - - pub fn clear_expiry(&mut self) { - self.expiry = ::std::option::Option::None; - } - - pub fn has_expiry(&self) -> bool { - self.expiry.is_some() - } - - // Param is passed by value, moved - pub fn set_expiry(&mut self, v: u32) { - self.expiry = ::std::option::Option::Some(v); - } - - // optional bool overwintered = 7; - - pub fn overwintered(&self) -> bool { - self.overwintered.unwrap_or(false) - } - - pub fn clear_overwintered(&mut self) { - self.overwintered = ::std::option::Option::None; - } - - pub fn has_overwintered(&self) -> bool { - self.overwintered.is_some() - } - - // Param is passed by value, moved - pub fn set_overwintered(&mut self, v: bool) { - self.overwintered = ::std::option::Option::Some(v); - } - - // optional uint32 version_group_id = 8; - - pub fn version_group_id(&self) -> u32 { - self.version_group_id.unwrap_or(0) - } - - pub fn clear_version_group_id(&mut self) { - self.version_group_id = ::std::option::Option::None; - } - - pub fn has_version_group_id(&self) -> bool { - self.version_group_id.is_some() - } - - // Param is passed by value, moved - pub fn set_version_group_id(&mut self, v: u32) { - self.version_group_id = ::std::option::Option::Some(v); - } - - // optional uint32 timestamp = 9; - - pub fn timestamp(&self) -> u32 { - self.timestamp.unwrap_or(0) - } - - pub fn clear_timestamp(&mut self) { - self.timestamp = ::std::option::Option::None; - } - - pub fn has_timestamp(&self) -> bool { - self.timestamp.is_some() - } - - // Param is passed by value, moved - pub fn set_timestamp(&mut self, v: u32) { - self.timestamp = ::std::option::Option::Some(v); - } - - // optional uint32 branch_id = 10; - - pub fn branch_id(&self) -> u32 { - self.branch_id.unwrap_or(0) - } - - pub fn clear_branch_id(&mut self) { - self.branch_id = ::std::option::Option::None; - } - - pub fn has_branch_id(&self) -> bool { - self.branch_id.is_some() - } - - // Param is passed by value, moved - pub fn set_branch_id(&mut self, v: u32) { - self.branch_id = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.AmountUnit amount_unit = 11; - - pub fn amount_unit(&self) -> AmountUnit { - match self.amount_unit { - Some(e) => e.enum_value_or(AmountUnit::BITCOIN), - None => AmountUnit::BITCOIN, - } - } - - pub fn clear_amount_unit(&mut self) { - self.amount_unit = ::std::option::Option::None; - } - - pub fn has_amount_unit(&self) -> bool { - self.amount_unit.is_some() - } - - // Param is passed by value, moved - pub fn set_amount_unit(&mut self, v: AmountUnit) { - self.amount_unit = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool decred_staking_ticket = 12; - - pub fn decred_staking_ticket(&self) -> bool { - self.decred_staking_ticket.unwrap_or(false) - } - - pub fn clear_decred_staking_ticket(&mut self) { - self.decred_staking_ticket = ::std::option::Option::None; - } - - pub fn has_decred_staking_ticket(&self) -> bool { - self.decred_staking_ticket.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_staking_ticket(&mut self, v: bool) { - self.decred_staking_ticket = ::std::option::Option::Some(v); - } - - // optional bool serialize = 13; - - pub fn serialize(&self) -> bool { - self.serialize.unwrap_or(true) - } - - pub fn clear_serialize(&mut self) { - self.serialize = ::std::option::Option::None; - } - - pub fn has_serialize(&self) -> bool { - self.serialize.is_some() - } - - // Param is passed by value, moved - pub fn set_serialize(&mut self, v: bool) { - self.serialize = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 15; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(15); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "outputs_count", - |m: &SignTx| { &m.outputs_count }, - |m: &mut SignTx| { &mut m.outputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inputs_count", - |m: &SignTx| { &m.inputs_count }, - |m: &mut SignTx| { &mut m.inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &SignTx| { &m.coin_name }, - |m: &mut SignTx| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version", - |m: &SignTx| { &m.version }, - |m: &mut SignTx| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "lock_time", - |m: &SignTx| { &m.lock_time }, - |m: &mut SignTx| { &mut m.lock_time }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "expiry", - |m: &SignTx| { &m.expiry }, - |m: &mut SignTx| { &mut m.expiry }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "overwintered", - |m: &SignTx| { &m.overwintered }, - |m: &mut SignTx| { &mut m.overwintered }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version_group_id", - |m: &SignTx| { &m.version_group_id }, - |m: &mut SignTx| { &mut m.version_group_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "timestamp", - |m: &SignTx| { &m.timestamp }, - |m: &mut SignTx| { &mut m.timestamp }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "branch_id", - |m: &SignTx| { &m.branch_id }, - |m: &mut SignTx| { &mut m.branch_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount_unit", - |m: &SignTx| { &m.amount_unit }, - |m: &mut SignTx| { &mut m.amount_unit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_staking_ticket", - |m: &SignTx| { &m.decred_staking_ticket }, - |m: &mut SignTx| { &mut m.decred_staking_ticket }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "serialize", - |m: &SignTx| { &m.serialize }, - |m: &mut SignTx| { &mut m.serialize }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, sign_tx::CoinJoinRequest>( - "coinjoin_request", - |m: &SignTx| { &m.coinjoin_request }, - |m: &mut SignTx| { &mut m.coinjoin_request }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &SignTx| { &m.chunkify }, - |m: &mut SignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SignTx { - const NAME: &'static str = "SignTx"; - - fn is_initialized(&self) -> bool { - if self.outputs_count.is_none() { - return false; - } - if self.inputs_count.is_none() { - return false; - } - for v in &self.coinjoin_request { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 26 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 32 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.lock_time = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.expiry = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.overwintered = ::std::option::Option::Some(is.read_bool()?); - }, - 64 => { - self.version_group_id = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.timestamp = ::std::option::Option::Some(is.read_uint32()?); - }, - 80 => { - self.branch_id = ::std::option::Option::Some(is.read_uint32()?); - }, - 88 => { - self.amount_unit = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 96 => { - self.decred_staking_ticket = ::std::option::Option::Some(is.read_bool()?); - }, - 104 => { - self.serialize = ::std::option::Option::Some(is.read_bool()?); - }, - 114 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.coinjoin_request)?; - }, - 120 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.outputs_count { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.inputs_count { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.lock_time { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.expiry { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.overwintered { - my_size += 1 + 1; - } - if let Some(v) = self.version_group_id { - my_size += ::protobuf::rt::uint32_size(8, v); - } - if let Some(v) = self.timestamp { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.branch_id { - my_size += ::protobuf::rt::uint32_size(10, v); - } - if let Some(v) = self.amount_unit { - my_size += ::protobuf::rt::int32_size(11, v.value()); - } - if let Some(v) = self.decred_staking_ticket { - my_size += 1 + 1; - } - if let Some(v) = self.serialize { - my_size += 1 + 1; - } - if let Some(v) = self.coinjoin_request.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.outputs_count { - os.write_uint32(1, v)?; - } - if let Some(v) = self.inputs_count { - os.write_uint32(2, v)?; - } - if let Some(v) = self.coin_name.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.version { - os.write_uint32(4, v)?; - } - if let Some(v) = self.lock_time { - os.write_uint32(5, v)?; - } - if let Some(v) = self.expiry { - os.write_uint32(6, v)?; - } - if let Some(v) = self.overwintered { - os.write_bool(7, v)?; - } - if let Some(v) = self.version_group_id { - os.write_uint32(8, v)?; - } - if let Some(v) = self.timestamp { - os.write_uint32(9, v)?; - } - if let Some(v) = self.branch_id { - os.write_uint32(10, v)?; - } - if let Some(v) = self.amount_unit { - os.write_enum(11, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.decred_staking_ticket { - os.write_bool(12, v)?; - } - if let Some(v) = self.serialize { - os.write_bool(13, v)?; - } - if let Some(v) = self.coinjoin_request.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(14, v, os)?; - } - if let Some(v) = self.chunkify { - os.write_bool(15, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SignTx { - SignTx::new() - } - - fn clear(&mut self) { - self.outputs_count = ::std::option::Option::None; - self.inputs_count = ::std::option::Option::None; - self.coin_name = ::std::option::Option::None; - self.version = ::std::option::Option::None; - self.lock_time = ::std::option::Option::None; - self.expiry = ::std::option::Option::None; - self.overwintered = ::std::option::Option::None; - self.version_group_id = ::std::option::Option::None; - self.timestamp = ::std::option::Option::None; - self.branch_id = ::std::option::Option::None; - self.amount_unit = ::std::option::Option::None; - self.decred_staking_ticket = ::std::option::Option::None; - self.serialize = ::std::option::Option::None; - self.coinjoin_request.clear(); - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SignTx { - static instance: SignTx = SignTx { - outputs_count: ::std::option::Option::None, - inputs_count: ::std::option::Option::None, - coin_name: ::std::option::Option::None, - version: ::std::option::Option::None, - lock_time: ::std::option::Option::None, - expiry: ::std::option::Option::None, - overwintered: ::std::option::Option::None, - version_group_id: ::std::option::Option::None, - timestamp: ::std::option::Option::None, - branch_id: ::std::option::Option::None, - amount_unit: ::std::option::Option::None, - decred_staking_ticket: ::std::option::Option::None, - serialize: ::std::option::Option::None, - coinjoin_request: ::protobuf::MessageField::none(), - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `SignTx` -pub mod sign_tx { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct CoinJoinRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.fee_rate) - pub fee_rate: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.no_fee_threshold) - pub no_fee_threshold: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.min_registrable_amount) - pub min_registrable_amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.mask_public_key) - pub mask_public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.SignTx.CoinJoinRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a CoinJoinRequest { - fn default() -> &'a CoinJoinRequest { - ::default_instance() - } - } - - impl CoinJoinRequest { - pub fn new() -> CoinJoinRequest { - ::std::default::Default::default() - } - - // required uint32 fee_rate = 1; - - pub fn fee_rate(&self) -> u32 { - self.fee_rate.unwrap_or(0) - } - - pub fn clear_fee_rate(&mut self) { - self.fee_rate = ::std::option::Option::None; - } - - pub fn has_fee_rate(&self) -> bool { - self.fee_rate.is_some() - } - - // Param is passed by value, moved - pub fn set_fee_rate(&mut self, v: u32) { - self.fee_rate = ::std::option::Option::Some(v); - } - - // required uint64 no_fee_threshold = 2; - - pub fn no_fee_threshold(&self) -> u64 { - self.no_fee_threshold.unwrap_or(0) - } - - pub fn clear_no_fee_threshold(&mut self) { - self.no_fee_threshold = ::std::option::Option::None; - } - - pub fn has_no_fee_threshold(&self) -> bool { - self.no_fee_threshold.is_some() - } - - // Param is passed by value, moved - pub fn set_no_fee_threshold(&mut self, v: u64) { - self.no_fee_threshold = ::std::option::Option::Some(v); - } - - // required uint64 min_registrable_amount = 3; - - pub fn min_registrable_amount(&self) -> u64 { - self.min_registrable_amount.unwrap_or(0) - } - - pub fn clear_min_registrable_amount(&mut self) { - self.min_registrable_amount = ::std::option::Option::None; - } - - pub fn has_min_registrable_amount(&self) -> bool { - self.min_registrable_amount.is_some() - } - - // Param is passed by value, moved - pub fn set_min_registrable_amount(&mut self, v: u64) { - self.min_registrable_amount = ::std::option::Option::Some(v); - } - - // required bytes mask_public_key = 4; - - pub fn mask_public_key(&self) -> &[u8] { - match self.mask_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mask_public_key(&mut self) { - self.mask_public_key = ::std::option::Option::None; - } - - pub fn has_mask_public_key(&self) -> bool { - self.mask_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_mask_public_key(&mut self, v: ::std::vec::Vec) { - self.mask_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mask_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.mask_public_key.is_none() { - self.mask_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mask_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_mask_public_key(&mut self) -> ::std::vec::Vec { - self.mask_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes signature = 5; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee_rate", - |m: &CoinJoinRequest| { &m.fee_rate }, - |m: &mut CoinJoinRequest| { &mut m.fee_rate }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "no_fee_threshold", - |m: &CoinJoinRequest| { &m.no_fee_threshold }, - |m: &mut CoinJoinRequest| { &mut m.no_fee_threshold }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "min_registrable_amount", - |m: &CoinJoinRequest| { &m.min_registrable_amount }, - |m: &mut CoinJoinRequest| { &mut m.min_registrable_amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mask_public_key", - |m: &CoinJoinRequest| { &m.mask_public_key }, - |m: &mut CoinJoinRequest| { &mut m.mask_public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &CoinJoinRequest| { &m.signature }, - |m: &mut CoinJoinRequest| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SignTx.CoinJoinRequest", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for CoinJoinRequest { - const NAME: &'static str = "CoinJoinRequest"; - - fn is_initialized(&self) -> bool { - if self.fee_rate.is_none() { - return false; - } - if self.no_fee_threshold.is_none() { - return false; - } - if self.min_registrable_amount.is_none() { - return false; - } - if self.mask_public_key.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.fee_rate = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.no_fee_threshold = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.min_registrable_amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 34 => { - self.mask_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.fee_rate { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.no_fee_threshold { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.min_registrable_amount { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.mask_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.fee_rate { - os.write_uint32(1, v)?; - } - if let Some(v) = self.no_fee_threshold { - os.write_uint64(2, v)?; - } - if let Some(v) = self.min_registrable_amount { - os.write_uint64(3, v)?; - } - if let Some(v) = self.mask_public_key.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CoinJoinRequest { - CoinJoinRequest::new() - } - - fn clear(&mut self) { - self.fee_rate = ::std::option::Option::None; - self.no_fee_threshold = ::std::option::Option::None; - self.min_registrable_amount = ::std::option::Option::None; - self.mask_public_key = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CoinJoinRequest { - static instance: CoinJoinRequest = CoinJoinRequest { - fee_rate: ::std::option::Option::None, - no_fee_threshold: ::std::option::Option::None, - min_registrable_amount: ::std::option::Option::None, - mask_public_key: ::std::option::Option::None, - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for CoinJoinRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("SignTx.CoinJoinRequest").unwrap()).clone() - } - } - - impl ::std::fmt::Display for CoinJoinRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for CoinJoinRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.request_type) - pub request_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.details) - pub details: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.serialized) - pub serialized: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxRequest { - fn default() -> &'a TxRequest { - ::default_instance() - } -} - -impl TxRequest { - pub fn new() -> TxRequest { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.bitcoin.TxRequest.RequestType request_type = 1; - - pub fn request_type(&self) -> tx_request::RequestType { - match self.request_type { - Some(e) => e.enum_value_or(tx_request::RequestType::TXINPUT), - None => tx_request::RequestType::TXINPUT, - } - } - - pub fn clear_request_type(&mut self) { - self.request_type = ::std::option::Option::None; - } - - pub fn has_request_type(&self) -> bool { - self.request_type.is_some() - } - - // Param is passed by value, moved - pub fn set_request_type(&mut self, v: tx_request::RequestType) { - self.request_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "request_type", - |m: &TxRequest| { &m.request_type }, - |m: &mut TxRequest| { &mut m.request_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_request::TxRequestDetailsType>( - "details", - |m: &TxRequest| { &m.details }, - |m: &mut TxRequest| { &mut m.details }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_request::TxRequestSerializedType>( - "serialized", - |m: &TxRequest| { &m.serialized }, - |m: &mut TxRequest| { &mut m.serialized }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxRequest { - const NAME: &'static str = "TxRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.request_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.details)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.serialized)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.request_type { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.details.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.serialized.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.request_type { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.details.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.serialized.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxRequest { - TxRequest::new() - } - - fn clear(&mut self) { - self.request_type = ::std::option::Option::None; - self.details.clear(); - self.serialized.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxRequest { - static instance: TxRequest = TxRequest { - request_type: ::std::option::Option::None, - details: ::protobuf::MessageField::none(), - serialized: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxRequest` -pub mod tx_request { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxRequestDetailsType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.request_index) - pub request_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.tx_hash) - pub tx_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.extra_data_len) - pub extra_data_len: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.extra_data_offset) - pub extra_data_offset: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxRequest.TxRequestDetailsType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxRequestDetailsType { - fn default() -> &'a TxRequestDetailsType { - ::default_instance() - } - } - - impl TxRequestDetailsType { - pub fn new() -> TxRequestDetailsType { - ::std::default::Default::default() - } - - // optional uint32 request_index = 1; - - pub fn request_index(&self) -> u32 { - self.request_index.unwrap_or(0) - } - - pub fn clear_request_index(&mut self) { - self.request_index = ::std::option::Option::None; - } - - pub fn has_request_index(&self) -> bool { - self.request_index.is_some() - } - - // Param is passed by value, moved - pub fn set_request_index(&mut self, v: u32) { - self.request_index = ::std::option::Option::Some(v); - } - - // optional bytes tx_hash = 2; - - pub fn tx_hash(&self) -> &[u8] { - match self.tx_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_hash(&mut self) { - self.tx_hash = ::std::option::Option::None; - } - - pub fn has_tx_hash(&self) -> bool { - self.tx_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_hash(&mut self, v: ::std::vec::Vec) { - self.tx_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_hash(&mut self) -> &mut ::std::vec::Vec { - if self.tx_hash.is_none() { - self.tx_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_hash.as_mut().unwrap() - } - - // Take field - pub fn take_tx_hash(&mut self) -> ::std::vec::Vec { - self.tx_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 extra_data_len = 3; - - pub fn extra_data_len(&self) -> u32 { - self.extra_data_len.unwrap_or(0) - } - - pub fn clear_extra_data_len(&mut self) { - self.extra_data_len = ::std::option::Option::None; - } - - pub fn has_extra_data_len(&self) -> bool { - self.extra_data_len.is_some() - } - - // Param is passed by value, moved - pub fn set_extra_data_len(&mut self, v: u32) { - self.extra_data_len = ::std::option::Option::Some(v); - } - - // optional uint32 extra_data_offset = 4; - - pub fn extra_data_offset(&self) -> u32 { - self.extra_data_offset.unwrap_or(0) - } - - pub fn clear_extra_data_offset(&mut self) { - self.extra_data_offset = ::std::option::Option::None; - } - - pub fn has_extra_data_offset(&self) -> bool { - self.extra_data_offset.is_some() - } - - // Param is passed by value, moved - pub fn set_extra_data_offset(&mut self, v: u32) { - self.extra_data_offset = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "request_index", - |m: &TxRequestDetailsType| { &m.request_index }, - |m: &mut TxRequestDetailsType| { &mut m.request_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_hash", - |m: &TxRequestDetailsType| { &m.tx_hash }, - |m: &mut TxRequestDetailsType| { &mut m.tx_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "extra_data_len", - |m: &TxRequestDetailsType| { &m.extra_data_len }, - |m: &mut TxRequestDetailsType| { &mut m.extra_data_len }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "extra_data_offset", - |m: &TxRequestDetailsType| { &m.extra_data_offset }, - |m: &mut TxRequestDetailsType| { &mut m.extra_data_offset }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxRequest.TxRequestDetailsType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxRequestDetailsType { - const NAME: &'static str = "TxRequestDetailsType"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.request_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.tx_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.extra_data_len = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.extra_data_offset = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.request_index { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.tx_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.extra_data_len { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.extra_data_offset { - my_size += ::protobuf::rt::uint32_size(4, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.request_index { - os.write_uint32(1, v)?; - } - if let Some(v) = self.tx_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.extra_data_len { - os.write_uint32(3, v)?; - } - if let Some(v) = self.extra_data_offset { - os.write_uint32(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxRequestDetailsType { - TxRequestDetailsType::new() - } - - fn clear(&mut self) { - self.request_index = ::std::option::Option::None; - self.tx_hash = ::std::option::Option::None; - self.extra_data_len = ::std::option::Option::None; - self.extra_data_offset = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxRequestDetailsType { - static instance: TxRequestDetailsType = TxRequestDetailsType { - request_index: ::std::option::Option::None, - tx_hash: ::std::option::Option::None, - extra_data_len: ::std::option::Option::None, - extra_data_offset: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxRequestDetailsType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxRequest.TxRequestDetailsType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxRequestDetailsType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxRequestDetailsType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxRequestSerializedType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.signature_index) - pub signature_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.serialized_tx) - pub serialized_tx: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxRequest.TxRequestSerializedType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxRequestSerializedType { - fn default() -> &'a TxRequestSerializedType { - ::default_instance() - } - } - - impl TxRequestSerializedType { - pub fn new() -> TxRequestSerializedType { - ::std::default::Default::default() - } - - // optional uint32 signature_index = 1; - - pub fn signature_index(&self) -> u32 { - self.signature_index.unwrap_or(0) - } - - pub fn clear_signature_index(&mut self) { - self.signature_index = ::std::option::Option::None; - } - - pub fn has_signature_index(&self) -> bool { - self.signature_index.is_some() - } - - // Param is passed by value, moved - pub fn set_signature_index(&mut self, v: u32) { - self.signature_index = ::std::option::Option::Some(v); - } - - // optional bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes serialized_tx = 3; - - pub fn serialized_tx(&self) -> &[u8] { - match self.serialized_tx.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_serialized_tx(&mut self) { - self.serialized_tx = ::std::option::Option::None; - } - - pub fn has_serialized_tx(&self) -> bool { - self.serialized_tx.is_some() - } - - // Param is passed by value, moved - pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { - self.serialized_tx = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { - if self.serialized_tx.is_none() { - self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.serialized_tx.as_mut().unwrap() - } - - // Take field - pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { - self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature_index", - |m: &TxRequestSerializedType| { &m.signature_index }, - |m: &mut TxRequestSerializedType| { &mut m.signature_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &TxRequestSerializedType| { &m.signature }, - |m: &mut TxRequestSerializedType| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "serialized_tx", - |m: &TxRequestSerializedType| { &m.serialized_tx }, - |m: &mut TxRequestSerializedType| { &mut m.serialized_tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxRequest.TxRequestSerializedType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxRequestSerializedType { - const NAME: &'static str = "TxRequestSerializedType"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.signature_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature_index { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.serialized_tx.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature_index { - os.write_uint32(1, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.serialized_tx.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxRequestSerializedType { - TxRequestSerializedType::new() - } - - fn clear(&mut self) { - self.signature_index = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.serialized_tx = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxRequestSerializedType { - static instance: TxRequestSerializedType = TxRequestSerializedType { - signature_index: ::std::option::Option::None, - signature: ::std::option::Option::None, - serialized_tx: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxRequestSerializedType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxRequest.TxRequestSerializedType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxRequestSerializedType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxRequestSerializedType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.TxRequest.RequestType) - pub enum RequestType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXINPUT) - TXINPUT = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXOUTPUT) - TXOUTPUT = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXMETA) - TXMETA = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXFINISHED) - TXFINISHED = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXEXTRADATA) - TXEXTRADATA = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXORIGINPUT) - TXORIGINPUT = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXORIGOUTPUT) - TXORIGOUTPUT = 6, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.TxRequest.RequestType.TXPAYMENTREQ) - TXPAYMENTREQ = 7, - } - - impl ::protobuf::Enum for RequestType { - const NAME: &'static str = "RequestType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(RequestType::TXINPUT), - 1 => ::std::option::Option::Some(RequestType::TXOUTPUT), - 2 => ::std::option::Option::Some(RequestType::TXMETA), - 3 => ::std::option::Option::Some(RequestType::TXFINISHED), - 4 => ::std::option::Option::Some(RequestType::TXEXTRADATA), - 5 => ::std::option::Option::Some(RequestType::TXORIGINPUT), - 6 => ::std::option::Option::Some(RequestType::TXORIGOUTPUT), - 7 => ::std::option::Option::Some(RequestType::TXPAYMENTREQ), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "TXINPUT" => ::std::option::Option::Some(RequestType::TXINPUT), - "TXOUTPUT" => ::std::option::Option::Some(RequestType::TXOUTPUT), - "TXMETA" => ::std::option::Option::Some(RequestType::TXMETA), - "TXFINISHED" => ::std::option::Option::Some(RequestType::TXFINISHED), - "TXEXTRADATA" => ::std::option::Option::Some(RequestType::TXEXTRADATA), - "TXORIGINPUT" => ::std::option::Option::Some(RequestType::TXORIGINPUT), - "TXORIGOUTPUT" => ::std::option::Option::Some(RequestType::TXORIGOUTPUT), - "TXPAYMENTREQ" => ::std::option::Option::Some(RequestType::TXPAYMENTREQ), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [RequestType] = &[ - RequestType::TXINPUT, - RequestType::TXOUTPUT, - RequestType::TXMETA, - RequestType::TXFINISHED, - RequestType::TXEXTRADATA, - RequestType::TXORIGINPUT, - RequestType::TXORIGOUTPUT, - RequestType::TXPAYMENTREQ, - ]; - } - - impl ::protobuf::EnumFull for RequestType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("TxRequest.RequestType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for RequestType { - fn default() -> Self { - RequestType::TXINPUT - } - } - - impl RequestType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("TxRequest.RequestType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAck { - fn default() -> &'a TxAck { - ::default_instance() - } -} - -impl TxAck { - pub fn new() -> TxAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack::TransactionType>( - "tx", - |m: &TxAck| { &m.tx }, - |m: &mut TxAck| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAck { - const NAME: &'static str = "TxAck"; - - fn is_initialized(&self) -> bool { - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAck { - TxAck::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAck { - static instance: TxAck = TxAck { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxAck` -pub mod tx_ack { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TransactionType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.inputs) - pub inputs: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.bin_outputs) - pub bin_outputs: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.lock_time) - pub lock_time: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.outputs) - pub outputs: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.inputs_cnt) - pub inputs_cnt: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.outputs_cnt) - pub outputs_cnt: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.extra_data) - pub extra_data: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.extra_data_len) - pub extra_data_len: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.expiry) - pub expiry: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.overwintered) - pub overwintered: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.version_group_id) - pub version_group_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.timestamp) - pub timestamp: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.branch_id) - pub branch_id: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TransactionType { - fn default() -> &'a TransactionType { - ::default_instance() - } - } - - impl TransactionType { - pub fn new() -> TransactionType { - ::std::default::Default::default() - } - - // optional uint32 version = 1; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(0) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // optional uint32 lock_time = 4; - - pub fn lock_time(&self) -> u32 { - self.lock_time.unwrap_or(0) - } - - pub fn clear_lock_time(&mut self) { - self.lock_time = ::std::option::Option::None; - } - - pub fn has_lock_time(&self) -> bool { - self.lock_time.is_some() - } - - // Param is passed by value, moved - pub fn set_lock_time(&mut self, v: u32) { - self.lock_time = ::std::option::Option::Some(v); - } - - // optional uint32 inputs_cnt = 6; - - pub fn inputs_cnt(&self) -> u32 { - self.inputs_cnt.unwrap_or(0) - } - - pub fn clear_inputs_cnt(&mut self) { - self.inputs_cnt = ::std::option::Option::None; - } - - pub fn has_inputs_cnt(&self) -> bool { - self.inputs_cnt.is_some() - } - - // Param is passed by value, moved - pub fn set_inputs_cnt(&mut self, v: u32) { - self.inputs_cnt = ::std::option::Option::Some(v); - } - - // optional uint32 outputs_cnt = 7; - - pub fn outputs_cnt(&self) -> u32 { - self.outputs_cnt.unwrap_or(0) - } - - pub fn clear_outputs_cnt(&mut self) { - self.outputs_cnt = ::std::option::Option::None; - } - - pub fn has_outputs_cnt(&self) -> bool { - self.outputs_cnt.is_some() - } - - // Param is passed by value, moved - pub fn set_outputs_cnt(&mut self, v: u32) { - self.outputs_cnt = ::std::option::Option::Some(v); - } - - // optional bytes extra_data = 8; - - pub fn extra_data(&self) -> &[u8] { - match self.extra_data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_extra_data(&mut self) { - self.extra_data = ::std::option::Option::None; - } - - pub fn has_extra_data(&self) -> bool { - self.extra_data.is_some() - } - - // Param is passed by value, moved - pub fn set_extra_data(&mut self, v: ::std::vec::Vec) { - self.extra_data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_extra_data(&mut self) -> &mut ::std::vec::Vec { - if self.extra_data.is_none() { - self.extra_data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.extra_data.as_mut().unwrap() - } - - // Take field - pub fn take_extra_data(&mut self) -> ::std::vec::Vec { - self.extra_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 extra_data_len = 9; - - pub fn extra_data_len(&self) -> u32 { - self.extra_data_len.unwrap_or(0) - } - - pub fn clear_extra_data_len(&mut self) { - self.extra_data_len = ::std::option::Option::None; - } - - pub fn has_extra_data_len(&self) -> bool { - self.extra_data_len.is_some() - } - - // Param is passed by value, moved - pub fn set_extra_data_len(&mut self, v: u32) { - self.extra_data_len = ::std::option::Option::Some(v); - } - - // optional uint32 expiry = 10; - - pub fn expiry(&self) -> u32 { - self.expiry.unwrap_or(0) - } - - pub fn clear_expiry(&mut self) { - self.expiry = ::std::option::Option::None; - } - - pub fn has_expiry(&self) -> bool { - self.expiry.is_some() - } - - // Param is passed by value, moved - pub fn set_expiry(&mut self, v: u32) { - self.expiry = ::std::option::Option::Some(v); - } - - // optional bool overwintered = 11; - - pub fn overwintered(&self) -> bool { - self.overwintered.unwrap_or(false) - } - - pub fn clear_overwintered(&mut self) { - self.overwintered = ::std::option::Option::None; - } - - pub fn has_overwintered(&self) -> bool { - self.overwintered.is_some() - } - - // Param is passed by value, moved - pub fn set_overwintered(&mut self, v: bool) { - self.overwintered = ::std::option::Option::Some(v); - } - - // optional uint32 version_group_id = 12; - - pub fn version_group_id(&self) -> u32 { - self.version_group_id.unwrap_or(0) - } - - pub fn clear_version_group_id(&mut self) { - self.version_group_id = ::std::option::Option::None; - } - - pub fn has_version_group_id(&self) -> bool { - self.version_group_id.is_some() - } - - // Param is passed by value, moved - pub fn set_version_group_id(&mut self, v: u32) { - self.version_group_id = ::std::option::Option::Some(v); - } - - // optional uint32 timestamp = 13; - - pub fn timestamp(&self) -> u32 { - self.timestamp.unwrap_or(0) - } - - pub fn clear_timestamp(&mut self) { - self.timestamp = ::std::option::Option::None; - } - - pub fn has_timestamp(&self) -> bool { - self.timestamp.is_some() - } - - // Param is passed by value, moved - pub fn set_timestamp(&mut self, v: u32) { - self.timestamp = ::std::option::Option::Some(v); - } - - // optional uint32 branch_id = 14; - - pub fn branch_id(&self) -> u32 { - self.branch_id.unwrap_or(0) - } - - pub fn clear_branch_id(&mut self) { - self.branch_id = ::std::option::Option::None; - } - - pub fn has_branch_id(&self) -> bool { - self.branch_id.is_some() - } - - // Param is passed by value, moved - pub fn set_branch_id(&mut self, v: u32) { - self.branch_id = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(14); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version", - |m: &TransactionType| { &m.version }, - |m: &mut TransactionType| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "inputs", - |m: &TransactionType| { &m.inputs }, - |m: &mut TransactionType| { &mut m.inputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "bin_outputs", - |m: &TransactionType| { &m.bin_outputs }, - |m: &mut TransactionType| { &mut m.bin_outputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "lock_time", - |m: &TransactionType| { &m.lock_time }, - |m: &mut TransactionType| { &mut m.lock_time }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "outputs", - |m: &TransactionType| { &m.outputs }, - |m: &mut TransactionType| { &mut m.outputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inputs_cnt", - |m: &TransactionType| { &m.inputs_cnt }, - |m: &mut TransactionType| { &mut m.inputs_cnt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "outputs_cnt", - |m: &TransactionType| { &m.outputs_cnt }, - |m: &mut TransactionType| { &mut m.outputs_cnt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "extra_data", - |m: &TransactionType| { &m.extra_data }, - |m: &mut TransactionType| { &mut m.extra_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "extra_data_len", - |m: &TransactionType| { &m.extra_data_len }, - |m: &mut TransactionType| { &mut m.extra_data_len }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "expiry", - |m: &TransactionType| { &m.expiry }, - |m: &mut TransactionType| { &mut m.expiry }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "overwintered", - |m: &TransactionType| { &m.overwintered }, - |m: &mut TransactionType| { &mut m.overwintered }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version_group_id", - |m: &TransactionType| { &m.version_group_id }, - |m: &mut TransactionType| { &mut m.version_group_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "timestamp", - |m: &TransactionType| { &m.timestamp }, - |m: &mut TransactionType| { &mut m.timestamp }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "branch_id", - |m: &TransactionType| { &m.branch_id }, - |m: &mut TransactionType| { &mut m.branch_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAck.TransactionType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TransactionType { - const NAME: &'static str = "TransactionType"; - - fn is_initialized(&self) -> bool { - for v in &self.inputs { - if !v.is_initialized() { - return false; - } - }; - for v in &self.bin_outputs { - if !v.is_initialized() { - return false; - } - }; - for v in &self.outputs { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.inputs.push(is.read_message()?); - }, - 26 => { - self.bin_outputs.push(is.read_message()?); - }, - 32 => { - self.lock_time = ::std::option::Option::Some(is.read_uint32()?); - }, - 42 => { - self.outputs.push(is.read_message()?); - }, - 48 => { - self.inputs_cnt = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.outputs_cnt = ::std::option::Option::Some(is.read_uint32()?); - }, - 66 => { - self.extra_data = ::std::option::Option::Some(is.read_bytes()?); - }, - 72 => { - self.extra_data_len = ::std::option::Option::Some(is.read_uint32()?); - }, - 80 => { - self.expiry = ::std::option::Option::Some(is.read_uint32()?); - }, - 88 => { - self.overwintered = ::std::option::Option::Some(is.read_bool()?); - }, - 96 => { - self.version_group_id = ::std::option::Option::Some(is.read_uint32()?); - }, - 104 => { - self.timestamp = ::std::option::Option::Some(is.read_uint32()?); - }, - 112 => { - self.branch_id = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(1, v); - } - for value in &self.inputs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.bin_outputs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.lock_time { - my_size += ::protobuf::rt::uint32_size(4, v); - } - for value in &self.outputs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.inputs_cnt { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.outputs_cnt { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.extra_data.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - if let Some(v) = self.extra_data_len { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.expiry { - my_size += ::protobuf::rt::uint32_size(10, v); - } - if let Some(v) = self.overwintered { - my_size += 1 + 1; - } - if let Some(v) = self.version_group_id { - my_size += ::protobuf::rt::uint32_size(12, v); - } - if let Some(v) = self.timestamp { - my_size += ::protobuf::rt::uint32_size(13, v); - } - if let Some(v) = self.branch_id { - my_size += ::protobuf::rt::uint32_size(14, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.version { - os.write_uint32(1, v)?; - } - for v in &self.inputs { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - for v in &self.bin_outputs { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - }; - if let Some(v) = self.lock_time { - os.write_uint32(4, v)?; - } - for v in &self.outputs { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - }; - if let Some(v) = self.inputs_cnt { - os.write_uint32(6, v)?; - } - if let Some(v) = self.outputs_cnt { - os.write_uint32(7, v)?; - } - if let Some(v) = self.extra_data.as_ref() { - os.write_bytes(8, v)?; - } - if let Some(v) = self.extra_data_len { - os.write_uint32(9, v)?; - } - if let Some(v) = self.expiry { - os.write_uint32(10, v)?; - } - if let Some(v) = self.overwintered { - os.write_bool(11, v)?; - } - if let Some(v) = self.version_group_id { - os.write_uint32(12, v)?; - } - if let Some(v) = self.timestamp { - os.write_uint32(13, v)?; - } - if let Some(v) = self.branch_id { - os.write_uint32(14, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TransactionType { - TransactionType::new() - } - - fn clear(&mut self) { - self.version = ::std::option::Option::None; - self.inputs.clear(); - self.bin_outputs.clear(); - self.lock_time = ::std::option::Option::None; - self.outputs.clear(); - self.inputs_cnt = ::std::option::Option::None; - self.outputs_cnt = ::std::option::Option::None; - self.extra_data = ::std::option::Option::None; - self.extra_data_len = ::std::option::Option::None; - self.expiry = ::std::option::Option::None; - self.overwintered = ::std::option::Option::None; - self.version_group_id = ::std::option::Option::None; - self.timestamp = ::std::option::Option::None; - self.branch_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TransactionType { - static instance: TransactionType = TransactionType { - version: ::std::option::Option::None, - inputs: ::std::vec::Vec::new(), - bin_outputs: ::std::vec::Vec::new(), - lock_time: ::std::option::Option::None, - outputs: ::std::vec::Vec::new(), - inputs_cnt: ::std::option::Option::None, - outputs_cnt: ::std::option::Option::None, - extra_data: ::std::option::Option::None, - extra_data_len: ::std::option::Option::None, - expiry: ::std::option::Option::None, - overwintered: ::std::option::Option::None, - version_group_id: ::std::option::Option::None, - timestamp: ::std::option::Option::None, - branch_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TransactionType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TransactionType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TransactionType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `TransactionType` - pub mod transaction_type { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxInputType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.prev_index) - pub prev_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.script_sig) - pub script_sig: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.decred_tree) - pub decred_tree: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.witness) - pub witness: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.ownership_proof) - pub ownership_proof: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.commitment_data) - pub commitment_data: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.orig_hash) - pub orig_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.orig_index) - pub orig_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.decred_staking_spend) - pub decred_staking_spend: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.script_pubkey) - pub script_pubkey: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.coinjoin_flags) - pub coinjoin_flags: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxInputType { - fn default() -> &'a TxInputType { - ::default_instance() - } - } - - impl TxInputType { - pub fn new() -> TxInputType { - ::std::default::Default::default() - } - - // required bytes prev_hash = 2; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 3; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - // optional bytes script_sig = 4; - - pub fn script_sig(&self) -> &[u8] { - match self.script_sig.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_sig(&mut self) { - self.script_sig = ::std::option::Option::None; - } - - pub fn has_script_sig(&self) -> bool { - self.script_sig.is_some() - } - - // Param is passed by value, moved - pub fn set_script_sig(&mut self, v: ::std::vec::Vec) { - self.script_sig = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_sig(&mut self) -> &mut ::std::vec::Vec { - if self.script_sig.is_none() { - self.script_sig = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_sig.as_mut().unwrap() - } - - // Take field - pub fn take_script_sig(&mut self) -> ::std::vec::Vec { - self.script_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 sequence = 5; - - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(4294967295u32) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 6; - - pub fn script_type(&self) -> super::super::InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(super::super::InputScriptType::SPENDADDRESS), - None => super::super::InputScriptType::SPENDADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: super::super::InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint64 amount = 8; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional uint32 decred_tree = 9; - - pub fn decred_tree(&self) -> u32 { - self.decred_tree.unwrap_or(0) - } - - pub fn clear_decred_tree(&mut self) { - self.decred_tree = ::std::option::Option::None; - } - - pub fn has_decred_tree(&self) -> bool { - self.decred_tree.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_tree(&mut self, v: u32) { - self.decred_tree = ::std::option::Option::Some(v); - } - - // optional bytes witness = 13; - - pub fn witness(&self) -> &[u8] { - match self.witness.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_witness(&mut self) { - self.witness = ::std::option::Option::None; - } - - pub fn has_witness(&self) -> bool { - self.witness.is_some() - } - - // Param is passed by value, moved - pub fn set_witness(&mut self, v: ::std::vec::Vec) { - self.witness = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_witness(&mut self) -> &mut ::std::vec::Vec { - if self.witness.is_none() { - self.witness = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.witness.as_mut().unwrap() - } - - // Take field - pub fn take_witness(&mut self) -> ::std::vec::Vec { - self.witness.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes ownership_proof = 14; - - pub fn ownership_proof(&self) -> &[u8] { - match self.ownership_proof.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ownership_proof(&mut self) { - self.ownership_proof = ::std::option::Option::None; - } - - pub fn has_ownership_proof(&self) -> bool { - self.ownership_proof.is_some() - } - - // Param is passed by value, moved - pub fn set_ownership_proof(&mut self, v: ::std::vec::Vec) { - self.ownership_proof = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ownership_proof(&mut self) -> &mut ::std::vec::Vec { - if self.ownership_proof.is_none() { - self.ownership_proof = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ownership_proof.as_mut().unwrap() - } - - // Take field - pub fn take_ownership_proof(&mut self) -> ::std::vec::Vec { - self.ownership_proof.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes commitment_data = 15; - - pub fn commitment_data(&self) -> &[u8] { - match self.commitment_data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_commitment_data(&mut self) { - self.commitment_data = ::std::option::Option::None; - } - - pub fn has_commitment_data(&self) -> bool { - self.commitment_data.is_some() - } - - // Param is passed by value, moved - pub fn set_commitment_data(&mut self, v: ::std::vec::Vec) { - self.commitment_data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_commitment_data(&mut self) -> &mut ::std::vec::Vec { - if self.commitment_data.is_none() { - self.commitment_data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.commitment_data.as_mut().unwrap() - } - - // Take field - pub fn take_commitment_data(&mut self) -> ::std::vec::Vec { - self.commitment_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes orig_hash = 16; - - pub fn orig_hash(&self) -> &[u8] { - match self.orig_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_orig_hash(&mut self) { - self.orig_hash = ::std::option::Option::None; - } - - pub fn has_orig_hash(&self) -> bool { - self.orig_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { - self.orig_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { - if self.orig_hash.is_none() { - self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.orig_hash.as_mut().unwrap() - } - - // Take field - pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { - self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 orig_index = 17; - - pub fn orig_index(&self) -> u32 { - self.orig_index.unwrap_or(0) - } - - pub fn clear_orig_index(&mut self) { - self.orig_index = ::std::option::Option::None; - } - - pub fn has_orig_index(&self) -> bool { - self.orig_index.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_index(&mut self, v: u32) { - self.orig_index = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.DecredStakingSpendType decred_staking_spend = 18; - - pub fn decred_staking_spend(&self) -> super::super::DecredStakingSpendType { - match self.decred_staking_spend { - Some(e) => e.enum_value_or(super::super::DecredStakingSpendType::SSGen), - None => super::super::DecredStakingSpendType::SSGen, - } - } - - pub fn clear_decred_staking_spend(&mut self) { - self.decred_staking_spend = ::std::option::Option::None; - } - - pub fn has_decred_staking_spend(&self) -> bool { - self.decred_staking_spend.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_staking_spend(&mut self, v: super::super::DecredStakingSpendType) { - self.decred_staking_spend = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes script_pubkey = 19; - - pub fn script_pubkey(&self) -> &[u8] { - match self.script_pubkey.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_pubkey(&mut self) { - self.script_pubkey = ::std::option::Option::None; - } - - pub fn has_script_pubkey(&self) -> bool { - self.script_pubkey.is_some() - } - - // Param is passed by value, moved - pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { - self.script_pubkey = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { - if self.script_pubkey.is_none() { - self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_pubkey.as_mut().unwrap() - } - - // Take field - pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { - self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 coinjoin_flags = 20; - - pub fn coinjoin_flags(&self) -> u32 { - self.coinjoin_flags.unwrap_or(0u32) - } - - pub fn clear_coinjoin_flags(&mut self) { - self.coinjoin_flags = ::std::option::Option::None; - } - - pub fn has_coinjoin_flags(&self) -> bool { - self.coinjoin_flags.is_some() - } - - // Param is passed by value, moved - pub fn set_coinjoin_flags(&mut self, v: u32) { - self.coinjoin_flags = ::std::option::Option::Some(v); - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(17); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &TxInputType| { &m.address_n }, - |m: &mut TxInputType| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &TxInputType| { &m.prev_hash }, - |m: &mut TxInputType| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &TxInputType| { &m.prev_index }, - |m: &mut TxInputType| { &mut m.prev_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_sig", - |m: &TxInputType| { &m.script_sig }, - |m: &mut TxInputType| { &mut m.script_sig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &TxInputType| { &m.sequence }, - |m: &mut TxInputType| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &TxInputType| { &m.script_type }, - |m: &mut TxInputType| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::MultisigRedeemScriptType>( - "multisig", - |m: &TxInputType| { &m.multisig }, - |m: &mut TxInputType| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TxInputType| { &m.amount }, - |m: &mut TxInputType| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_tree", - |m: &TxInputType| { &m.decred_tree }, - |m: &mut TxInputType| { &mut m.decred_tree }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "witness", - |m: &TxInputType| { &m.witness }, - |m: &mut TxInputType| { &mut m.witness }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ownership_proof", - |m: &TxInputType| { &m.ownership_proof }, - |m: &mut TxInputType| { &mut m.ownership_proof }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "commitment_data", - |m: &TxInputType| { &m.commitment_data }, - |m: &mut TxInputType| { &mut m.commitment_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_hash", - |m: &TxInputType| { &m.orig_hash }, - |m: &mut TxInputType| { &mut m.orig_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_index", - |m: &TxInputType| { &m.orig_index }, - |m: &mut TxInputType| { &mut m.orig_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_staking_spend", - |m: &TxInputType| { &m.decred_staking_spend }, - |m: &mut TxInputType| { &mut m.decred_staking_spend }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_pubkey", - |m: &TxInputType| { &m.script_pubkey }, - |m: &mut TxInputType| { &mut m.script_pubkey }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coinjoin_flags", - |m: &TxInputType| { &m.coinjoin_flags }, - |m: &mut TxInputType| { &mut m.coinjoin_flags }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAck.TransactionType.TxInputType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxInputType { - const NAME: &'static str = "TxInputType"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - self.script_sig = ::std::option::Option::Some(is.read_bytes()?); - }, - 40 => { - self.sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 64 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 72 => { - self.decred_tree = ::std::option::Option::Some(is.read_uint32()?); - }, - 106 => { - self.witness = ::std::option::Option::Some(is.read_bytes()?); - }, - 114 => { - self.ownership_proof = ::std::option::Option::Some(is.read_bytes()?); - }, - 122 => { - self.commitment_data = ::std::option::Option::Some(is.read_bytes()?); - }, - 130 => { - self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 136 => { - self.orig_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 144 => { - self.decred_staking_spend = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 154 => { - self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); - }, - 160 => { - self.coinjoin_flags = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.script_sig.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(6, v.value()); - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(8, v); - } - if let Some(v) = self.decred_tree { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.witness.as_ref() { - my_size += ::protobuf::rt::bytes_size(13, &v); - } - if let Some(v) = self.ownership_proof.as_ref() { - my_size += ::protobuf::rt::bytes_size(14, &v); - } - if let Some(v) = self.commitment_data.as_ref() { - my_size += ::protobuf::rt::bytes_size(15, &v); - } - if let Some(v) = self.orig_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(16, &v); - } - if let Some(v) = self.orig_index { - my_size += ::protobuf::rt::uint32_size(17, v); - } - if let Some(v) = self.decred_staking_spend { - my_size += ::protobuf::rt::int32_size(18, v.value()); - } - if let Some(v) = self.script_pubkey.as_ref() { - my_size += ::protobuf::rt::bytes_size(19, &v); - } - if let Some(v) = self.coinjoin_flags { - my_size += ::protobuf::rt::uint32_size(20, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(3, v)?; - } - if let Some(v) = self.script_sig.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.sequence { - os.write_uint32(5, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.amount { - os.write_uint64(8, v)?; - } - if let Some(v) = self.decred_tree { - os.write_uint32(9, v)?; - } - if let Some(v) = self.witness.as_ref() { - os.write_bytes(13, v)?; - } - if let Some(v) = self.ownership_proof.as_ref() { - os.write_bytes(14, v)?; - } - if let Some(v) = self.commitment_data.as_ref() { - os.write_bytes(15, v)?; - } - if let Some(v) = self.orig_hash.as_ref() { - os.write_bytes(16, v)?; - } - if let Some(v) = self.orig_index { - os.write_uint32(17, v)?; - } - if let Some(v) = self.decred_staking_spend { - os.write_enum(18, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.script_pubkey.as_ref() { - os.write_bytes(19, v)?; - } - if let Some(v) = self.coinjoin_flags { - os.write_uint32(20, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxInputType { - TxInputType::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.script_sig = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.multisig.clear(); - self.amount = ::std::option::Option::None; - self.decred_tree = ::std::option::Option::None; - self.witness = ::std::option::Option::None; - self.ownership_proof = ::std::option::Option::None; - self.commitment_data = ::std::option::Option::None; - self.orig_hash = ::std::option::Option::None; - self.orig_index = ::std::option::Option::None; - self.decred_staking_spend = ::std::option::Option::None; - self.script_pubkey = ::std::option::Option::None; - self.coinjoin_flags = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxInputType { - static instance: TxInputType = TxInputType { - address_n: ::std::vec::Vec::new(), - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - script_sig: ::std::option::Option::None, - sequence: ::std::option::Option::None, - script_type: ::std::option::Option::None, - multisig: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - decred_tree: ::std::option::Option::None, - witness: ::std::option::Option::None, - ownership_proof: ::std::option::Option::None, - commitment_data: ::std::option::Option::None, - orig_hash: ::std::option::Option::None, - orig_index: ::std::option::Option::None, - decred_staking_spend: ::std::option::Option::None, - script_pubkey: ::std::option::Option::None, - coinjoin_flags: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxInputType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType.TxInputType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxInputType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxInputType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxOutputBinType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.script_pubkey) - pub script_pubkey: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.decred_script_version) - pub decred_script_version: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputBinType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxOutputBinType { - fn default() -> &'a TxOutputBinType { - ::default_instance() - } - } - - impl TxOutputBinType { - pub fn new() -> TxOutputBinType { - ::std::default::Default::default() - } - - // required uint64 amount = 1; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // required bytes script_pubkey = 2; - - pub fn script_pubkey(&self) -> &[u8] { - match self.script_pubkey.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_pubkey(&mut self) { - self.script_pubkey = ::std::option::Option::None; - } - - pub fn has_script_pubkey(&self) -> bool { - self.script_pubkey.is_some() - } - - // Param is passed by value, moved - pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { - self.script_pubkey = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { - if self.script_pubkey.is_none() { - self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_pubkey.as_mut().unwrap() - } - - // Take field - pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { - self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 decred_script_version = 3; - - pub fn decred_script_version(&self) -> u32 { - self.decred_script_version.unwrap_or(0) - } - - pub fn clear_decred_script_version(&mut self) { - self.decred_script_version = ::std::option::Option::None; - } - - pub fn has_decred_script_version(&self) -> bool { - self.decred_script_version.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_script_version(&mut self, v: u32) { - self.decred_script_version = ::std::option::Option::Some(v); - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TxOutputBinType| { &m.amount }, - |m: &mut TxOutputBinType| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_pubkey", - |m: &TxOutputBinType| { &m.script_pubkey }, - |m: &mut TxOutputBinType| { &mut m.script_pubkey }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_script_version", - |m: &TxOutputBinType| { &m.decred_script_version }, - |m: &mut TxOutputBinType| { &mut m.decred_script_version }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAck.TransactionType.TxOutputBinType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxOutputBinType { - const NAME: &'static str = "TxOutputBinType"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - if self.script_pubkey.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.decred_script_version = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.script_pubkey.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.decred_script_version { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount { - os.write_uint64(1, v)?; - } - if let Some(v) = self.script_pubkey.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.decred_script_version { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxOutputBinType { - TxOutputBinType::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.script_pubkey = ::std::option::Option::None; - self.decred_script_version = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxOutputBinType { - static instance: TxOutputBinType = TxOutputBinType { - amount: ::std::option::Option::None, - script_pubkey: ::std::option::Option::None, - decred_script_version: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxOutputBinType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType.TxOutputBinType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxOutputBinType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxOutputBinType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxOutputType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.op_return_data) - pub op_return_data: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.orig_hash) - pub orig_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.orig_index) - pub orig_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.payment_req_index) - pub payment_req_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutputType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxOutputType { - fn default() -> &'a TxOutputType { - ::default_instance() - } - } - - impl TxOutputType { - pub fn new() -> TxOutputType { - ::std::default::Default::default() - } - - // optional string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 amount = 3; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.OutputScriptType script_type = 4; - - pub fn script_type(&self) -> super::super::OutputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(super::super::OutputScriptType::PAYTOADDRESS), - None => super::super::OutputScriptType::PAYTOADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: super::super::OutputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes op_return_data = 6; - - pub fn op_return_data(&self) -> &[u8] { - match self.op_return_data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_op_return_data(&mut self) { - self.op_return_data = ::std::option::Option::None; - } - - pub fn has_op_return_data(&self) -> bool { - self.op_return_data.is_some() - } - - // Param is passed by value, moved - pub fn set_op_return_data(&mut self, v: ::std::vec::Vec) { - self.op_return_data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_op_return_data(&mut self) -> &mut ::std::vec::Vec { - if self.op_return_data.is_none() { - self.op_return_data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.op_return_data.as_mut().unwrap() - } - - // Take field - pub fn take_op_return_data(&mut self) -> ::std::vec::Vec { - self.op_return_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes orig_hash = 10; - - pub fn orig_hash(&self) -> &[u8] { - match self.orig_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_orig_hash(&mut self) { - self.orig_hash = ::std::option::Option::None; - } - - pub fn has_orig_hash(&self) -> bool { - self.orig_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { - self.orig_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { - if self.orig_hash.is_none() { - self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.orig_hash.as_mut().unwrap() - } - - // Take field - pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { - self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 orig_index = 11; - - pub fn orig_index(&self) -> u32 { - self.orig_index.unwrap_or(0) - } - - pub fn clear_orig_index(&mut self) { - self.orig_index = ::std::option::Option::None; - } - - pub fn has_orig_index(&self) -> bool { - self.orig_index.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_index(&mut self, v: u32) { - self.orig_index = ::std::option::Option::Some(v); - } - - // optional uint32 payment_req_index = 12; - - pub fn payment_req_index(&self) -> u32 { - self.payment_req_index.unwrap_or(0) - } - - pub fn clear_payment_req_index(&mut self) { - self.payment_req_index = ::std::option::Option::None; - } - - pub fn has_payment_req_index(&self) -> bool { - self.payment_req_index.is_some() - } - - // Param is passed by value, moved - pub fn set_payment_req_index(&mut self, v: u32) { - self.payment_req_index = ::std::option::Option::Some(v); - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(9); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &TxOutputType| { &m.address }, - |m: &mut TxOutputType| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &TxOutputType| { &m.address_n }, - |m: &mut TxOutputType| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TxOutputType| { &m.amount }, - |m: &mut TxOutputType| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &TxOutputType| { &m.script_type }, - |m: &mut TxOutputType| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::MultisigRedeemScriptType>( - "multisig", - |m: &TxOutputType| { &m.multisig }, - |m: &mut TxOutputType| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "op_return_data", - |m: &TxOutputType| { &m.op_return_data }, - |m: &mut TxOutputType| { &mut m.op_return_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_hash", - |m: &TxOutputType| { &m.orig_hash }, - |m: &mut TxOutputType| { &mut m.orig_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_index", - |m: &TxOutputType| { &m.orig_index }, - |m: &mut TxOutputType| { &mut m.orig_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payment_req_index", - |m: &TxOutputType| { &m.payment_req_index }, - |m: &mut TxOutputType| { &mut m.payment_req_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAck.TransactionType.TxOutputType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxOutputType { - const NAME: &'static str = "TxOutputType"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 24 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 50 => { - self.op_return_data = ::std::option::Option::Some(is.read_bytes()?); - }, - 82 => { - self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 88 => { - self.orig_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 96 => { - self.payment_req_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(4, v.value()); - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.op_return_data.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.orig_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(10, &v); - } - if let Some(v) = self.orig_index { - my_size += ::protobuf::rt::uint32_size(11, v); - } - if let Some(v) = self.payment_req_index { - my_size += ::protobuf::rt::uint32_size(12, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; - if let Some(v) = self.amount { - os.write_uint64(3, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.op_return_data.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.orig_hash.as_ref() { - os.write_bytes(10, v)?; - } - if let Some(v) = self.orig_index { - os.write_uint32(11, v)?; - } - if let Some(v) = self.payment_req_index { - os.write_uint32(12, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxOutputType { - TxOutputType::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.address_n.clear(); - self.amount = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.multisig.clear(); - self.op_return_data = ::std::option::Option::None; - self.orig_hash = ::std::option::Option::None; - self.orig_index = ::std::option::Option::None; - self.payment_req_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxOutputType { - static instance: TxOutputType = TxOutputType { - address: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - amount: ::std::option::Option::None, - script_type: ::std::option::Option::None, - multisig: ::protobuf::MessageField::none(), - op_return_data: ::std::option::Option::None, - orig_hash: ::std::option::Option::None, - orig_index: ::std::option::Option::None, - payment_req_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxOutputType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TxAck.TransactionType.TxOutputType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxOutputType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxOutputType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.prev_index) - pub prev_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.script_sig) - pub script_sig: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.decred_tree) - pub decred_tree: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.witness) - pub witness: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.ownership_proof) - pub ownership_proof: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.commitment_data) - pub commitment_data: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.orig_hash) - pub orig_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.orig_index) - pub orig_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.decred_staking_spend) - pub decred_staking_spend: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.script_pubkey) - pub script_pubkey: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxInput.coinjoin_flags) - pub coinjoin_flags: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxInput { - fn default() -> &'a TxInput { - ::default_instance() - } -} - -impl TxInput { - pub fn new() -> TxInput { - ::std::default::Default::default() - } - - // required bytes prev_hash = 2; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 3; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - // optional bytes script_sig = 4; - - pub fn script_sig(&self) -> &[u8] { - match self.script_sig.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_sig(&mut self) { - self.script_sig = ::std::option::Option::None; - } - - pub fn has_script_sig(&self) -> bool { - self.script_sig.is_some() - } - - // Param is passed by value, moved - pub fn set_script_sig(&mut self, v: ::std::vec::Vec) { - self.script_sig = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_sig(&mut self) -> &mut ::std::vec::Vec { - if self.script_sig.is_none() { - self.script_sig = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_sig.as_mut().unwrap() - } - - // Take field - pub fn take_script_sig(&mut self) -> ::std::vec::Vec { - self.script_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 sequence = 5; - - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(4294967295u32) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 6; - - pub fn script_type(&self) -> InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), - None => InputScriptType::SPENDADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required uint64 amount = 8; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional uint32 decred_tree = 9; - - pub fn decred_tree(&self) -> u32 { - self.decred_tree.unwrap_or(0) - } - - pub fn clear_decred_tree(&mut self) { - self.decred_tree = ::std::option::Option::None; - } - - pub fn has_decred_tree(&self) -> bool { - self.decred_tree.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_tree(&mut self, v: u32) { - self.decred_tree = ::std::option::Option::Some(v); - } - - // optional bytes witness = 13; - - pub fn witness(&self) -> &[u8] { - match self.witness.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_witness(&mut self) { - self.witness = ::std::option::Option::None; - } - - pub fn has_witness(&self) -> bool { - self.witness.is_some() - } - - // Param is passed by value, moved - pub fn set_witness(&mut self, v: ::std::vec::Vec) { - self.witness = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_witness(&mut self) -> &mut ::std::vec::Vec { - if self.witness.is_none() { - self.witness = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.witness.as_mut().unwrap() - } - - // Take field - pub fn take_witness(&mut self) -> ::std::vec::Vec { - self.witness.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes ownership_proof = 14; - - pub fn ownership_proof(&self) -> &[u8] { - match self.ownership_proof.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ownership_proof(&mut self) { - self.ownership_proof = ::std::option::Option::None; - } - - pub fn has_ownership_proof(&self) -> bool { - self.ownership_proof.is_some() - } - - // Param is passed by value, moved - pub fn set_ownership_proof(&mut self, v: ::std::vec::Vec) { - self.ownership_proof = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ownership_proof(&mut self) -> &mut ::std::vec::Vec { - if self.ownership_proof.is_none() { - self.ownership_proof = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ownership_proof.as_mut().unwrap() - } - - // Take field - pub fn take_ownership_proof(&mut self) -> ::std::vec::Vec { - self.ownership_proof.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes commitment_data = 15; - - pub fn commitment_data(&self) -> &[u8] { - match self.commitment_data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_commitment_data(&mut self) { - self.commitment_data = ::std::option::Option::None; - } - - pub fn has_commitment_data(&self) -> bool { - self.commitment_data.is_some() - } - - // Param is passed by value, moved - pub fn set_commitment_data(&mut self, v: ::std::vec::Vec) { - self.commitment_data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_commitment_data(&mut self) -> &mut ::std::vec::Vec { - if self.commitment_data.is_none() { - self.commitment_data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.commitment_data.as_mut().unwrap() - } - - // Take field - pub fn take_commitment_data(&mut self) -> ::std::vec::Vec { - self.commitment_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes orig_hash = 16; - - pub fn orig_hash(&self) -> &[u8] { - match self.orig_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_orig_hash(&mut self) { - self.orig_hash = ::std::option::Option::None; - } - - pub fn has_orig_hash(&self) -> bool { - self.orig_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { - self.orig_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { - if self.orig_hash.is_none() { - self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.orig_hash.as_mut().unwrap() - } - - // Take field - pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { - self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 orig_index = 17; - - pub fn orig_index(&self) -> u32 { - self.orig_index.unwrap_or(0) - } - - pub fn clear_orig_index(&mut self) { - self.orig_index = ::std::option::Option::None; - } - - pub fn has_orig_index(&self) -> bool { - self.orig_index.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_index(&mut self, v: u32) { - self.orig_index = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.DecredStakingSpendType decred_staking_spend = 18; - - pub fn decred_staking_spend(&self) -> DecredStakingSpendType { - match self.decred_staking_spend { - Some(e) => e.enum_value_or(DecredStakingSpendType::SSGen), - None => DecredStakingSpendType::SSGen, - } - } - - pub fn clear_decred_staking_spend(&mut self) { - self.decred_staking_spend = ::std::option::Option::None; - } - - pub fn has_decred_staking_spend(&self) -> bool { - self.decred_staking_spend.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_staking_spend(&mut self, v: DecredStakingSpendType) { - self.decred_staking_spend = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes script_pubkey = 19; - - pub fn script_pubkey(&self) -> &[u8] { - match self.script_pubkey.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_pubkey(&mut self) { - self.script_pubkey = ::std::option::Option::None; - } - - pub fn has_script_pubkey(&self) -> bool { - self.script_pubkey.is_some() - } - - // Param is passed by value, moved - pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { - self.script_pubkey = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { - if self.script_pubkey.is_none() { - self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_pubkey.as_mut().unwrap() - } - - // Take field - pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { - self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 coinjoin_flags = 20; - - pub fn coinjoin_flags(&self) -> u32 { - self.coinjoin_flags.unwrap_or(0u32) - } - - pub fn clear_coinjoin_flags(&mut self) { - self.coinjoin_flags = ::std::option::Option::None; - } - - pub fn has_coinjoin_flags(&self) -> bool { - self.coinjoin_flags.is_some() - } - - // Param is passed by value, moved - pub fn set_coinjoin_flags(&mut self, v: u32) { - self.coinjoin_flags = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(17); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &TxInput| { &m.address_n }, - |m: &mut TxInput| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &TxInput| { &m.prev_hash }, - |m: &mut TxInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &TxInput| { &m.prev_index }, - |m: &mut TxInput| { &mut m.prev_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_sig", - |m: &TxInput| { &m.script_sig }, - |m: &mut TxInput| { &mut m.script_sig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &TxInput| { &m.sequence }, - |m: &mut TxInput| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &TxInput| { &m.script_type }, - |m: &mut TxInput| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( - "multisig", - |m: &TxInput| { &m.multisig }, - |m: &mut TxInput| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TxInput| { &m.amount }, - |m: &mut TxInput| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_tree", - |m: &TxInput| { &m.decred_tree }, - |m: &mut TxInput| { &mut m.decred_tree }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "witness", - |m: &TxInput| { &m.witness }, - |m: &mut TxInput| { &mut m.witness }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ownership_proof", - |m: &TxInput| { &m.ownership_proof }, - |m: &mut TxInput| { &mut m.ownership_proof }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "commitment_data", - |m: &TxInput| { &m.commitment_data }, - |m: &mut TxInput| { &mut m.commitment_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_hash", - |m: &TxInput| { &m.orig_hash }, - |m: &mut TxInput| { &mut m.orig_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_index", - |m: &TxInput| { &m.orig_index }, - |m: &mut TxInput| { &mut m.orig_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_staking_spend", - |m: &TxInput| { &m.decred_staking_spend }, - |m: &mut TxInput| { &mut m.decred_staking_spend }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_pubkey", - |m: &TxInput| { &m.script_pubkey }, - |m: &mut TxInput| { &mut m.script_pubkey }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coinjoin_flags", - |m: &TxInput| { &m.coinjoin_flags }, - |m: &mut TxInput| { &mut m.coinjoin_flags }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxInput { - const NAME: &'static str = "TxInput"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - self.script_sig = ::std::option::Option::Some(is.read_bytes()?); - }, - 40 => { - self.sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 64 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 72 => { - self.decred_tree = ::std::option::Option::Some(is.read_uint32()?); - }, - 106 => { - self.witness = ::std::option::Option::Some(is.read_bytes()?); - }, - 114 => { - self.ownership_proof = ::std::option::Option::Some(is.read_bytes()?); - }, - 122 => { - self.commitment_data = ::std::option::Option::Some(is.read_bytes()?); - }, - 130 => { - self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 136 => { - self.orig_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 144 => { - self.decred_staking_spend = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 154 => { - self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); - }, - 160 => { - self.coinjoin_flags = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.script_sig.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(6, v.value()); - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(8, v); - } - if let Some(v) = self.decred_tree { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.witness.as_ref() { - my_size += ::protobuf::rt::bytes_size(13, &v); - } - if let Some(v) = self.ownership_proof.as_ref() { - my_size += ::protobuf::rt::bytes_size(14, &v); - } - if let Some(v) = self.commitment_data.as_ref() { - my_size += ::protobuf::rt::bytes_size(15, &v); - } - if let Some(v) = self.orig_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(16, &v); - } - if let Some(v) = self.orig_index { - my_size += ::protobuf::rt::uint32_size(17, v); - } - if let Some(v) = self.decred_staking_spend { - my_size += ::protobuf::rt::int32_size(18, v.value()); - } - if let Some(v) = self.script_pubkey.as_ref() { - my_size += ::protobuf::rt::bytes_size(19, &v); - } - if let Some(v) = self.coinjoin_flags { - my_size += ::protobuf::rt::uint32_size(20, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(3, v)?; - } - if let Some(v) = self.script_sig.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.sequence { - os.write_uint32(5, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.amount { - os.write_uint64(8, v)?; - } - if let Some(v) = self.decred_tree { - os.write_uint32(9, v)?; - } - if let Some(v) = self.witness.as_ref() { - os.write_bytes(13, v)?; - } - if let Some(v) = self.ownership_proof.as_ref() { - os.write_bytes(14, v)?; - } - if let Some(v) = self.commitment_data.as_ref() { - os.write_bytes(15, v)?; - } - if let Some(v) = self.orig_hash.as_ref() { - os.write_bytes(16, v)?; - } - if let Some(v) = self.orig_index { - os.write_uint32(17, v)?; - } - if let Some(v) = self.decred_staking_spend { - os.write_enum(18, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.script_pubkey.as_ref() { - os.write_bytes(19, v)?; - } - if let Some(v) = self.coinjoin_flags { - os.write_uint32(20, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxInput { - TxInput::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.script_sig = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.multisig.clear(); - self.amount = ::std::option::Option::None; - self.decred_tree = ::std::option::Option::None; - self.witness = ::std::option::Option::None; - self.ownership_proof = ::std::option::Option::None; - self.commitment_data = ::std::option::Option::None; - self.orig_hash = ::std::option::Option::None; - self.orig_index = ::std::option::Option::None; - self.decred_staking_spend = ::std::option::Option::None; - self.script_pubkey = ::std::option::Option::None; - self.coinjoin_flags = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxInput { - static instance: TxInput = TxInput { - address_n: ::std::vec::Vec::new(), - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - script_sig: ::std::option::Option::None, - sequence: ::std::option::Option::None, - script_type: ::std::option::Option::None, - multisig: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - decred_tree: ::std::option::Option::None, - witness: ::std::option::Option::None, - ownership_proof: ::std::option::Option::None, - commitment_data: ::std::option::Option::None, - orig_hash: ::std::option::Option::None, - orig_index: ::std::option::Option::None, - decred_staking_spend: ::std::option::Option::None, - script_pubkey: ::std::option::Option::None, - coinjoin_flags: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.op_return_data) - pub op_return_data: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.orig_hash) - pub orig_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.orig_index) - pub orig_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.payment_req_index) - pub payment_req_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxOutput { - fn default() -> &'a TxOutput { - ::default_instance() - } -} - -impl TxOutput { - pub fn new() -> TxOutput { - ::std::default::Default::default() - } - - // optional string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 amount = 3; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.bitcoin.OutputScriptType script_type = 4; - - pub fn script_type(&self) -> OutputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(OutputScriptType::PAYTOADDRESS), - None => OutputScriptType::PAYTOADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: OutputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes op_return_data = 6; - - pub fn op_return_data(&self) -> &[u8] { - match self.op_return_data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_op_return_data(&mut self) { - self.op_return_data = ::std::option::Option::None; - } - - pub fn has_op_return_data(&self) -> bool { - self.op_return_data.is_some() - } - - // Param is passed by value, moved - pub fn set_op_return_data(&mut self, v: ::std::vec::Vec) { - self.op_return_data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_op_return_data(&mut self) -> &mut ::std::vec::Vec { - if self.op_return_data.is_none() { - self.op_return_data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.op_return_data.as_mut().unwrap() - } - - // Take field - pub fn take_op_return_data(&mut self) -> ::std::vec::Vec { - self.op_return_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes orig_hash = 10; - - pub fn orig_hash(&self) -> &[u8] { - match self.orig_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_orig_hash(&mut self) { - self.orig_hash = ::std::option::Option::None; - } - - pub fn has_orig_hash(&self) -> bool { - self.orig_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_hash(&mut self, v: ::std::vec::Vec) { - self.orig_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_orig_hash(&mut self) -> &mut ::std::vec::Vec { - if self.orig_hash.is_none() { - self.orig_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.orig_hash.as_mut().unwrap() - } - - // Take field - pub fn take_orig_hash(&mut self) -> ::std::vec::Vec { - self.orig_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 orig_index = 11; - - pub fn orig_index(&self) -> u32 { - self.orig_index.unwrap_or(0) - } - - pub fn clear_orig_index(&mut self) { - self.orig_index = ::std::option::Option::None; - } - - pub fn has_orig_index(&self) -> bool { - self.orig_index.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_index(&mut self, v: u32) { - self.orig_index = ::std::option::Option::Some(v); - } - - // optional uint32 payment_req_index = 12; - - pub fn payment_req_index(&self) -> u32 { - self.payment_req_index.unwrap_or(0) - } - - pub fn clear_payment_req_index(&mut self) { - self.payment_req_index = ::std::option::Option::None; - } - - pub fn has_payment_req_index(&self) -> bool { - self.payment_req_index.is_some() - } - - // Param is passed by value, moved - pub fn set_payment_req_index(&mut self, v: u32) { - self.payment_req_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(9); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &TxOutput| { &m.address }, - |m: &mut TxOutput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &TxOutput| { &m.address_n }, - |m: &mut TxOutput| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TxOutput| { &m.amount }, - |m: &mut TxOutput| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &TxOutput| { &m.script_type }, - |m: &mut TxOutput| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( - "multisig", - |m: &TxOutput| { &m.multisig }, - |m: &mut TxOutput| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "op_return_data", - |m: &TxOutput| { &m.op_return_data }, - |m: &mut TxOutput| { &mut m.op_return_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_hash", - |m: &TxOutput| { &m.orig_hash }, - |m: &mut TxOutput| { &mut m.orig_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_index", - |m: &TxOutput| { &m.orig_index }, - |m: &mut TxOutput| { &mut m.orig_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payment_req_index", - |m: &TxOutput| { &m.payment_req_index }, - |m: &mut TxOutput| { &mut m.payment_req_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxOutput { - const NAME: &'static str = "TxOutput"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 24 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 50 => { - self.op_return_data = ::std::option::Option::Some(is.read_bytes()?); - }, - 82 => { - self.orig_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 88 => { - self.orig_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 96 => { - self.payment_req_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(4, v.value()); - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.op_return_data.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.orig_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(10, &v); - } - if let Some(v) = self.orig_index { - my_size += ::protobuf::rt::uint32_size(11, v); - } - if let Some(v) = self.payment_req_index { - my_size += ::protobuf::rt::uint32_size(12, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; - if let Some(v) = self.amount { - os.write_uint64(3, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.op_return_data.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.orig_hash.as_ref() { - os.write_bytes(10, v)?; - } - if let Some(v) = self.orig_index { - os.write_uint32(11, v)?; - } - if let Some(v) = self.payment_req_index { - os.write_uint32(12, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxOutput { - TxOutput::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.address_n.clear(); - self.amount = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.multisig.clear(); - self.op_return_data = ::std::option::Option::None; - self.orig_hash = ::std::option::Option::None; - self.orig_index = ::std::option::Option::None; - self.payment_req_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxOutput { - static instance: TxOutput = TxOutput { - address: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - amount: ::std::option::Option::None, - script_type: ::std::option::Option::None, - multisig: ::protobuf::MessageField::none(), - op_return_data: ::std::option::Option::None, - orig_hash: ::std::option::Option::None, - orig_index: ::std::option::Option::None, - payment_req_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PrevTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PrevTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.lock_time) - pub lock_time: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.inputs_count) - pub inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.outputs_count) - pub outputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.extra_data_len) - pub extra_data_len: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.expiry) - pub expiry: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.version_group_id) - pub version_group_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.timestamp) - pub timestamp: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevTx.branch_id) - pub branch_id: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PrevTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PrevTx { - fn default() -> &'a PrevTx { - ::default_instance() - } -} - -impl PrevTx { - pub fn new() -> PrevTx { - ::std::default::Default::default() - } - - // required uint32 version = 1; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(0) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // required uint32 lock_time = 4; - - pub fn lock_time(&self) -> u32 { - self.lock_time.unwrap_or(0) - } - - pub fn clear_lock_time(&mut self) { - self.lock_time = ::std::option::Option::None; - } - - pub fn has_lock_time(&self) -> bool { - self.lock_time.is_some() - } - - // Param is passed by value, moved - pub fn set_lock_time(&mut self, v: u32) { - self.lock_time = ::std::option::Option::Some(v); - } - - // required uint32 inputs_count = 6; - - pub fn inputs_count(&self) -> u32 { - self.inputs_count.unwrap_or(0) - } - - pub fn clear_inputs_count(&mut self) { - self.inputs_count = ::std::option::Option::None; - } - - pub fn has_inputs_count(&self) -> bool { - self.inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_inputs_count(&mut self, v: u32) { - self.inputs_count = ::std::option::Option::Some(v); - } - - // required uint32 outputs_count = 7; - - pub fn outputs_count(&self) -> u32 { - self.outputs_count.unwrap_or(0) - } - - pub fn clear_outputs_count(&mut self) { - self.outputs_count = ::std::option::Option::None; - } - - pub fn has_outputs_count(&self) -> bool { - self.outputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_outputs_count(&mut self, v: u32) { - self.outputs_count = ::std::option::Option::Some(v); - } - - // optional uint32 extra_data_len = 9; - - pub fn extra_data_len(&self) -> u32 { - self.extra_data_len.unwrap_or(0u32) - } - - pub fn clear_extra_data_len(&mut self) { - self.extra_data_len = ::std::option::Option::None; - } - - pub fn has_extra_data_len(&self) -> bool { - self.extra_data_len.is_some() - } - - // Param is passed by value, moved - pub fn set_extra_data_len(&mut self, v: u32) { - self.extra_data_len = ::std::option::Option::Some(v); - } - - // optional uint32 expiry = 10; - - pub fn expiry(&self) -> u32 { - self.expiry.unwrap_or(0) - } - - pub fn clear_expiry(&mut self) { - self.expiry = ::std::option::Option::None; - } - - pub fn has_expiry(&self) -> bool { - self.expiry.is_some() - } - - // Param is passed by value, moved - pub fn set_expiry(&mut self, v: u32) { - self.expiry = ::std::option::Option::Some(v); - } - - // optional uint32 version_group_id = 12; - - pub fn version_group_id(&self) -> u32 { - self.version_group_id.unwrap_or(0) - } - - pub fn clear_version_group_id(&mut self) { - self.version_group_id = ::std::option::Option::None; - } - - pub fn has_version_group_id(&self) -> bool { - self.version_group_id.is_some() - } - - // Param is passed by value, moved - pub fn set_version_group_id(&mut self, v: u32) { - self.version_group_id = ::std::option::Option::Some(v); - } - - // optional uint32 timestamp = 13; - - pub fn timestamp(&self) -> u32 { - self.timestamp.unwrap_or(0) - } - - pub fn clear_timestamp(&mut self) { - self.timestamp = ::std::option::Option::None; - } - - pub fn has_timestamp(&self) -> bool { - self.timestamp.is_some() - } - - // Param is passed by value, moved - pub fn set_timestamp(&mut self, v: u32) { - self.timestamp = ::std::option::Option::Some(v); - } - - // optional uint32 branch_id = 14; - - pub fn branch_id(&self) -> u32 { - self.branch_id.unwrap_or(0) - } - - pub fn clear_branch_id(&mut self) { - self.branch_id = ::std::option::Option::None; - } - - pub fn has_branch_id(&self) -> bool { - self.branch_id.is_some() - } - - // Param is passed by value, moved - pub fn set_branch_id(&mut self, v: u32) { - self.branch_id = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(9); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version", - |m: &PrevTx| { &m.version }, - |m: &mut PrevTx| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "lock_time", - |m: &PrevTx| { &m.lock_time }, - |m: &mut PrevTx| { &mut m.lock_time }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inputs_count", - |m: &PrevTx| { &m.inputs_count }, - |m: &mut PrevTx| { &mut m.inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "outputs_count", - |m: &PrevTx| { &m.outputs_count }, - |m: &mut PrevTx| { &mut m.outputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "extra_data_len", - |m: &PrevTx| { &m.extra_data_len }, - |m: &mut PrevTx| { &mut m.extra_data_len }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "expiry", - |m: &PrevTx| { &m.expiry }, - |m: &mut PrevTx| { &mut m.expiry }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version_group_id", - |m: &PrevTx| { &m.version_group_id }, - |m: &mut PrevTx| { &mut m.version_group_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "timestamp", - |m: &PrevTx| { &m.timestamp }, - |m: &mut PrevTx| { &mut m.timestamp }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "branch_id", - |m: &PrevTx| { &m.branch_id }, - |m: &mut PrevTx| { &mut m.branch_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PrevTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PrevTx { - const NAME: &'static str = "PrevTx"; - - fn is_initialized(&self) -> bool { - if self.version.is_none() { - return false; - } - if self.lock_time.is_none() { - return false; - } - if self.inputs_count.is_none() { - return false; - } - if self.outputs_count.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.lock_time = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.extra_data_len = ::std::option::Option::Some(is.read_uint32()?); - }, - 80 => { - self.expiry = ::std::option::Option::Some(is.read_uint32()?); - }, - 96 => { - self.version_group_id = ::std::option::Option::Some(is.read_uint32()?); - }, - 104 => { - self.timestamp = ::std::option::Option::Some(is.read_uint32()?); - }, - 112 => { - self.branch_id = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.lock_time { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.inputs_count { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.outputs_count { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.extra_data_len { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.expiry { - my_size += ::protobuf::rt::uint32_size(10, v); - } - if let Some(v) = self.version_group_id { - my_size += ::protobuf::rt::uint32_size(12, v); - } - if let Some(v) = self.timestamp { - my_size += ::protobuf::rt::uint32_size(13, v); - } - if let Some(v) = self.branch_id { - my_size += ::protobuf::rt::uint32_size(14, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.version { - os.write_uint32(1, v)?; - } - if let Some(v) = self.lock_time { - os.write_uint32(4, v)?; - } - if let Some(v) = self.inputs_count { - os.write_uint32(6, v)?; - } - if let Some(v) = self.outputs_count { - os.write_uint32(7, v)?; - } - if let Some(v) = self.extra_data_len { - os.write_uint32(9, v)?; - } - if let Some(v) = self.expiry { - os.write_uint32(10, v)?; - } - if let Some(v) = self.version_group_id { - os.write_uint32(12, v)?; - } - if let Some(v) = self.timestamp { - os.write_uint32(13, v)?; - } - if let Some(v) = self.branch_id { - os.write_uint32(14, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PrevTx { - PrevTx::new() - } - - fn clear(&mut self) { - self.version = ::std::option::Option::None; - self.lock_time = ::std::option::Option::None; - self.inputs_count = ::std::option::Option::None; - self.outputs_count = ::std::option::Option::None; - self.extra_data_len = ::std::option::Option::None; - self.expiry = ::std::option::Option::None; - self.version_group_id = ::std::option::Option::None; - self.timestamp = ::std::option::Option::None; - self.branch_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PrevTx { - static instance: PrevTx = PrevTx { - version: ::std::option::Option::None, - lock_time: ::std::option::Option::None, - inputs_count: ::std::option::Option::None, - outputs_count: ::std::option::Option::None, - extra_data_len: ::std::option::Option::None, - expiry: ::std::option::Option::None, - version_group_id: ::std::option::Option::None, - timestamp: ::std::option::Option::None, - branch_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PrevTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PrevTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PrevTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PrevTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PrevInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PrevInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.prev_index) - pub prev_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.script_sig) - pub script_sig: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevInput.decred_tree) - pub decred_tree: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PrevInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PrevInput { - fn default() -> &'a PrevInput { - ::default_instance() - } -} - -impl PrevInput { - pub fn new() -> PrevInput { - ::std::default::Default::default() - } - - // required bytes prev_hash = 2; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 3; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - // required bytes script_sig = 4; - - pub fn script_sig(&self) -> &[u8] { - match self.script_sig.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_sig(&mut self) { - self.script_sig = ::std::option::Option::None; - } - - pub fn has_script_sig(&self) -> bool { - self.script_sig.is_some() - } - - // Param is passed by value, moved - pub fn set_script_sig(&mut self, v: ::std::vec::Vec) { - self.script_sig = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_sig(&mut self) -> &mut ::std::vec::Vec { - if self.script_sig.is_none() { - self.script_sig = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_sig.as_mut().unwrap() - } - - // Take field - pub fn take_script_sig(&mut self) -> ::std::vec::Vec { - self.script_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 sequence = 5; - - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(0) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); - } - - // optional uint32 decred_tree = 9; - - pub fn decred_tree(&self) -> u32 { - self.decred_tree.unwrap_or(0) - } - - pub fn clear_decred_tree(&mut self) { - self.decred_tree = ::std::option::Option::None; - } - - pub fn has_decred_tree(&self) -> bool { - self.decred_tree.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_tree(&mut self, v: u32) { - self.decred_tree = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &PrevInput| { &m.prev_hash }, - |m: &mut PrevInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &PrevInput| { &m.prev_index }, - |m: &mut PrevInput| { &mut m.prev_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_sig", - |m: &PrevInput| { &m.script_sig }, - |m: &mut PrevInput| { &mut m.script_sig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &PrevInput| { &m.sequence }, - |m: &mut PrevInput| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_tree", - |m: &PrevInput| { &m.decred_tree }, - |m: &mut PrevInput| { &mut m.decred_tree }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PrevInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PrevInput { - const NAME: &'static str = "PrevInput"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - if self.script_sig.is_none() { - return false; - } - if self.sequence.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - self.script_sig = ::std::option::Option::Some(is.read_bytes()?); - }, - 40 => { - self.sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.decred_tree = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.script_sig.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.decred_tree { - my_size += ::protobuf::rt::uint32_size(9, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(3, v)?; - } - if let Some(v) = self.script_sig.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.sequence { - os.write_uint32(5, v)?; - } - if let Some(v) = self.decred_tree { - os.write_uint32(9, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PrevInput { - PrevInput::new() - } - - fn clear(&mut self) { - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.script_sig = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.decred_tree = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PrevInput { - static instance: PrevInput = PrevInput { - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - script_sig: ::std::option::Option::None, - sequence: ::std::option::Option::None, - decred_tree: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PrevInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PrevInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PrevInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PrevInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.PrevOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PrevOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevOutput.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevOutput.script_pubkey) - pub script_pubkey: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.PrevOutput.decred_script_version) - pub decred_script_version: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.PrevOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PrevOutput { - fn default() -> &'a PrevOutput { - ::default_instance() - } -} - -impl PrevOutput { - pub fn new() -> PrevOutput { - ::std::default::Default::default() - } - - // required uint64 amount = 1; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // required bytes script_pubkey = 2; - - pub fn script_pubkey(&self) -> &[u8] { - match self.script_pubkey.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_pubkey(&mut self) { - self.script_pubkey = ::std::option::Option::None; - } - - pub fn has_script_pubkey(&self) -> bool { - self.script_pubkey.is_some() - } - - // Param is passed by value, moved - pub fn set_script_pubkey(&mut self, v: ::std::vec::Vec) { - self.script_pubkey = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_pubkey(&mut self) -> &mut ::std::vec::Vec { - if self.script_pubkey.is_none() { - self.script_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_pubkey.as_mut().unwrap() - } - - // Take field - pub fn take_script_pubkey(&mut self) -> ::std::vec::Vec { - self.script_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 decred_script_version = 3; - - pub fn decred_script_version(&self) -> u32 { - self.decred_script_version.unwrap_or(0) - } - - pub fn clear_decred_script_version(&mut self) { - self.decred_script_version = ::std::option::Option::None; - } - - pub fn has_decred_script_version(&self) -> bool { - self.decred_script_version.is_some() - } - - // Param is passed by value, moved - pub fn set_decred_script_version(&mut self, v: u32) { - self.decred_script_version = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &PrevOutput| { &m.amount }, - |m: &mut PrevOutput| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_pubkey", - |m: &PrevOutput| { &m.script_pubkey }, - |m: &mut PrevOutput| { &mut m.script_pubkey }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decred_script_version", - |m: &PrevOutput| { &m.decred_script_version }, - |m: &mut PrevOutput| { &mut m.decred_script_version }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PrevOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PrevOutput { - const NAME: &'static str = "PrevOutput"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - if self.script_pubkey.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - self.script_pubkey = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.decred_script_version = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.script_pubkey.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.decred_script_version { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount { - os.write_uint64(1, v)?; - } - if let Some(v) = self.script_pubkey.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.decred_script_version { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PrevOutput { - PrevOutput::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.script_pubkey = ::std::option::Option::None; - self.decred_script_version = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PrevOutput { - static instance: PrevOutput = PrevOutput { - amount: ::std::option::Option::None, - script_pubkey: ::std::option::Option::None, - decred_script_version: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PrevOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PrevOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PrevOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PrevOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAckPaymentRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.nonce) - pub nonce: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.recipient_name) - pub recipient_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.memos) - pub memos: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAckPaymentRequest { - fn default() -> &'a TxAckPaymentRequest { - ::default_instance() - } -} - -impl TxAckPaymentRequest { - pub fn new() -> TxAckPaymentRequest { - ::std::default::Default::default() - } - - // optional bytes nonce = 1; - - pub fn nonce(&self) -> &[u8] { - match self.nonce.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_nonce(&mut self) { - self.nonce = ::std::option::Option::None; - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: ::std::vec::Vec) { - self.nonce = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { - if self.nonce.is_none() { - self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.nonce.as_mut().unwrap() - } - - // Take field - pub fn take_nonce(&mut self) -> ::std::vec::Vec { - self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string recipient_name = 2; - - pub fn recipient_name(&self) -> &str { - match self.recipient_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_recipient_name(&mut self) { - self.recipient_name = ::std::option::Option::None; - } - - pub fn has_recipient_name(&self) -> bool { - self.recipient_name.is_some() - } - - // Param is passed by value, moved - pub fn set_recipient_name(&mut self, v: ::std::string::String) { - self.recipient_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_recipient_name(&mut self) -> &mut ::std::string::String { - if self.recipient_name.is_none() { - self.recipient_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.recipient_name.as_mut().unwrap() - } - - // Take field - pub fn take_recipient_name(&mut self) -> ::std::string::String { - self.recipient_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint64 amount = 4; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // required bytes signature = 5; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "nonce", - |m: &TxAckPaymentRequest| { &m.nonce }, - |m: &mut TxAckPaymentRequest| { &mut m.nonce }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "recipient_name", - |m: &TxAckPaymentRequest| { &m.recipient_name }, - |m: &mut TxAckPaymentRequest| { &mut m.recipient_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "memos", - |m: &TxAckPaymentRequest| { &m.memos }, - |m: &mut TxAckPaymentRequest| { &mut m.memos }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TxAckPaymentRequest| { &m.amount }, - |m: &mut TxAckPaymentRequest| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &TxAckPaymentRequest| { &m.signature }, - |m: &mut TxAckPaymentRequest| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPaymentRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAckPaymentRequest { - const NAME: &'static str = "TxAckPaymentRequest"; - - fn is_initialized(&self) -> bool { - if self.recipient_name.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - for v in &self.memos { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.nonce = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.recipient_name = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.memos.push(is.read_message()?); - }, - 32 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 42 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.nonce.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.recipient_name.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - for value in &self.memos { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.nonce.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.recipient_name.as_ref() { - os.write_string(2, v)?; - } - for v in &self.memos { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - }; - if let Some(v) = self.amount { - os.write_uint64(4, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPaymentRequest { - TxAckPaymentRequest::new() - } - - fn clear(&mut self) { - self.nonce = ::std::option::Option::None; - self.recipient_name = ::std::option::Option::None; - self.memos.clear(); - self.amount = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPaymentRequest { - static instance: TxAckPaymentRequest = TxAckPaymentRequest { - nonce: ::std::option::Option::None, - recipient_name: ::std::option::Option::None, - memos: ::std::vec::Vec::new(), - amount: ::std::option::Option::None, - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAckPaymentRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPaymentRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAckPaymentRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAckPaymentRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxAckPaymentRequest` -pub mod tx_ack_payment_request { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct PaymentRequestMemo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.text_memo) - pub text_memo: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.refund_memo) - pub refund_memo: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.coin_purchase_memo) - pub coin_purchase_memo: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemo.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a PaymentRequestMemo { - fn default() -> &'a PaymentRequestMemo { - ::default_instance() - } - } - - impl PaymentRequestMemo { - pub fn new() -> PaymentRequestMemo { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, TextMemo>( - "text_memo", - |m: &PaymentRequestMemo| { &m.text_memo }, - |m: &mut PaymentRequestMemo| { &mut m.text_memo }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RefundMemo>( - "refund_memo", - |m: &PaymentRequestMemo| { &m.refund_memo }, - |m: &mut PaymentRequestMemo| { &mut m.refund_memo }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CoinPurchaseMemo>( - "coin_purchase_memo", - |m: &PaymentRequestMemo| { &m.coin_purchase_memo }, - |m: &mut PaymentRequestMemo| { &mut m.coin_purchase_memo }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPaymentRequest.PaymentRequestMemo", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for PaymentRequestMemo { - const NAME: &'static str = "PaymentRequestMemo"; - - fn is_initialized(&self) -> bool { - for v in &self.text_memo { - if !v.is_initialized() { - return false; - } - }; - for v in &self.refund_memo { - if !v.is_initialized() { - return false; - } - }; - for v in &self.coin_purchase_memo { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.text_memo)?; - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.refund_memo)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.coin_purchase_memo)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.text_memo.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.refund_memo.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.coin_purchase_memo.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.text_memo.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.refund_memo.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.coin_purchase_memo.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PaymentRequestMemo { - PaymentRequestMemo::new() - } - - fn clear(&mut self) { - self.text_memo.clear(); - self.refund_memo.clear(); - self.coin_purchase_memo.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static PaymentRequestMemo { - static instance: PaymentRequestMemo = PaymentRequestMemo { - text_memo: ::protobuf::MessageField::none(), - refund_memo: ::protobuf::MessageField::none(), - coin_purchase_memo: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for PaymentRequestMemo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.PaymentRequestMemo").unwrap()).clone() - } - } - - impl ::std::fmt::Display for PaymentRequestMemo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for PaymentRequestMemo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.TextMemo) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TextMemo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.TextMemo.text) - pub text: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.TextMemo.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TextMemo { - fn default() -> &'a TextMemo { - ::default_instance() - } - } - - impl TextMemo { - pub fn new() -> TextMemo { - ::std::default::Default::default() - } - - // required string text = 1; - - pub fn text(&self) -> &str { - match self.text.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_text(&mut self) { - self.text = ::std::option::Option::None; - } - - pub fn has_text(&self) -> bool { - self.text.is_some() - } - - // Param is passed by value, moved - pub fn set_text(&mut self, v: ::std::string::String) { - self.text = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_text(&mut self) -> &mut ::std::string::String { - if self.text.is_none() { - self.text = ::std::option::Option::Some(::std::string::String::new()); - } - self.text.as_mut().unwrap() - } - - // Take field - pub fn take_text(&mut self) -> ::std::string::String { - self.text.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "text", - |m: &TextMemo| { &m.text }, - |m: &mut TextMemo| { &mut m.text }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPaymentRequest.TextMemo", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TextMemo { - const NAME: &'static str = "TextMemo"; - - fn is_initialized(&self) -> bool { - if self.text.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.text = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.text.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.text.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TextMemo { - TextMemo::new() - } - - fn clear(&mut self) { - self.text = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TextMemo { - static instance: TextMemo = TextMemo { - text: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TextMemo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.TextMemo").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TextMemo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TextMemo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct RefundMemo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo.mac) - pub mac: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemo.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a RefundMemo { - fn default() -> &'a RefundMemo { - ::default_instance() - } - } - - impl RefundMemo { - pub fn new() -> RefundMemo { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes mac = 2; - - pub fn mac(&self) -> &[u8] { - match self.mac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mac(&mut self) { - self.mac = ::std::option::Option::None; - } - - pub fn has_mac(&self) -> bool { - self.mac.is_some() - } - - // Param is passed by value, moved - pub fn set_mac(&mut self, v: ::std::vec::Vec) { - self.mac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { - if self.mac.is_none() { - self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mac.as_mut().unwrap() - } - - // Take field - pub fn take_mac(&mut self) -> ::std::vec::Vec { - self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &RefundMemo| { &m.address }, - |m: &mut RefundMemo| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mac", - |m: &RefundMemo| { &m.mac }, - |m: &mut RefundMemo| { &mut m.mac }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPaymentRequest.RefundMemo", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for RefundMemo { - const NAME: &'static str = "RefundMemo"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.mac.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.mac = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.mac.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.mac.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RefundMemo { - RefundMemo::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.mac = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RefundMemo { - static instance: RefundMemo = RefundMemo { - address: ::std::option::Option::None, - mac: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for RefundMemo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.RefundMemo").unwrap()).clone() - } - } - - impl ::std::fmt::Display for RefundMemo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for RefundMemo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct CoinPurchaseMemo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.coin_type) - pub coin_type: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.amount) - pub amount: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.mac) - pub mac: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemo.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a CoinPurchaseMemo { - fn default() -> &'a CoinPurchaseMemo { - ::default_instance() - } - } - - impl CoinPurchaseMemo { - pub fn new() -> CoinPurchaseMemo { - ::std::default::Default::default() - } - - // required uint32 coin_type = 1; - - pub fn coin_type(&self) -> u32 { - self.coin_type.unwrap_or(0) - } - - pub fn clear_coin_type(&mut self) { - self.coin_type = ::std::option::Option::None; - } - - pub fn has_coin_type(&self) -> bool { - self.coin_type.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_type(&mut self, v: u32) { - self.coin_type = ::std::option::Option::Some(v); - } - - // required string amount = 2; - - pub fn amount(&self) -> &str { - match self.amount.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: ::std::string::String) { - self.amount = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_amount(&mut self) -> &mut ::std::string::String { - if self.amount.is_none() { - self.amount = ::std::option::Option::Some(::std::string::String::new()); - } - self.amount.as_mut().unwrap() - } - - // Take field - pub fn take_amount(&mut self) -> ::std::string::String { - self.amount.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string address = 3; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes mac = 4; - - pub fn mac(&self) -> &[u8] { - match self.mac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mac(&mut self) { - self.mac = ::std::option::Option::None; - } - - pub fn has_mac(&self) -> bool { - self.mac.is_some() - } - - // Param is passed by value, moved - pub fn set_mac(&mut self, v: ::std::vec::Vec) { - self.mac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { - if self.mac.is_none() { - self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mac.as_mut().unwrap() - } - - // Take field - pub fn take_mac(&mut self) -> ::std::vec::Vec { - self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_type", - |m: &CoinPurchaseMemo| { &m.coin_type }, - |m: &mut CoinPurchaseMemo| { &mut m.coin_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &CoinPurchaseMemo| { &m.amount }, - |m: &mut CoinPurchaseMemo| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &CoinPurchaseMemo| { &m.address }, - |m: &mut CoinPurchaseMemo| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mac", - |m: &CoinPurchaseMemo| { &m.mac }, - |m: &mut CoinPurchaseMemo| { &mut m.mac }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPaymentRequest.CoinPurchaseMemo", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for CoinPurchaseMemo { - const NAME: &'static str = "CoinPurchaseMemo"; - - fn is_initialized(&self) -> bool { - if self.coin_type.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - if self.address.is_none() { - return false; - } - if self.mac.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.coin_type = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.amount = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.mac = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.coin_type { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.amount.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.mac.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.coin_type { - os.write_uint32(1, v)?; - } - if let Some(v) = self.amount.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.address.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.mac.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CoinPurchaseMemo { - CoinPurchaseMemo::new() - } - - fn clear(&mut self) { - self.coin_type = ::std::option::Option::None; - self.amount = ::std::option::Option::None; - self.address = ::std::option::Option::None; - self.mac = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CoinPurchaseMemo { - static instance: CoinPurchaseMemo = CoinPurchaseMemo { - coin_type: ::std::option::Option::None, - amount: ::std::option::Option::None, - address: ::std::option::Option::None, - mac: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for CoinPurchaseMemo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPaymentRequest.CoinPurchaseMemo").unwrap()).clone() - } - } - - impl ::std::fmt::Display for CoinPurchaseMemo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for CoinPurchaseMemo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAckInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckInput.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAckInput { - fn default() -> &'a TxAckInput { - ::default_instance() - } -} - -impl TxAckInput { - pub fn new() -> TxAckInput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_input::TxAckInputWrapper>( - "tx", - |m: &TxAckInput| { &m.tx }, - |m: &mut TxAckInput| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAckInput { - const NAME: &'static str = "TxAckInput"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckInput { - TxAckInput::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckInput { - static instance: TxAckInput = TxAckInput { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAckInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAckInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAckInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxAckInput` -pub mod tx_ack_input { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckInput.TxAckInputWrapper) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxAckInputWrapper { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckInput.TxAckInputWrapper.input) - pub input: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckInput.TxAckInputWrapper.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxAckInputWrapper { - fn default() -> &'a TxAckInputWrapper { - ::default_instance() - } - } - - impl TxAckInputWrapper { - pub fn new() -> TxAckInputWrapper { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::TxInput>( - "input", - |m: &TxAckInputWrapper| { &m.input }, - |m: &mut TxAckInputWrapper| { &mut m.input }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckInput.TxAckInputWrapper", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxAckInputWrapper { - const NAME: &'static str = "TxAckInputWrapper"; - - fn is_initialized(&self) -> bool { - if self.input.is_none() { - return false; - } - for v in &self.input { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.input)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.input.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.input.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckInputWrapper { - TxAckInputWrapper::new() - } - - fn clear(&mut self) { - self.input.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckInputWrapper { - static instance: TxAckInputWrapper = TxAckInputWrapper { - input: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxAckInputWrapper { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckInput.TxAckInputWrapper").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxAckInputWrapper { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxAckInputWrapper { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAckOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckOutput.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAckOutput { - fn default() -> &'a TxAckOutput { - ::default_instance() - } -} - -impl TxAckOutput { - pub fn new() -> TxAckOutput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_output::TxAckOutputWrapper>( - "tx", - |m: &TxAckOutput| { &m.tx }, - |m: &mut TxAckOutput| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAckOutput { - const NAME: &'static str = "TxAckOutput"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckOutput { - TxAckOutput::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckOutput { - static instance: TxAckOutput = TxAckOutput { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAckOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAckOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAckOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxAckOutput` -pub mod tx_ack_output { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckOutput.TxAckOutputWrapper) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxAckOutputWrapper { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckOutput.TxAckOutputWrapper.output) - pub output: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckOutput.TxAckOutputWrapper.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxAckOutputWrapper { - fn default() -> &'a TxAckOutputWrapper { - ::default_instance() - } - } - - impl TxAckOutputWrapper { - pub fn new() -> TxAckOutputWrapper { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::TxOutput>( - "output", - |m: &TxAckOutputWrapper| { &m.output }, - |m: &mut TxAckOutputWrapper| { &mut m.output }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckOutput.TxAckOutputWrapper", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxAckOutputWrapper { - const NAME: &'static str = "TxAckOutputWrapper"; - - fn is_initialized(&self) -> bool { - if self.output.is_none() { - return false; - } - for v in &self.output { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.output)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.output.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.output.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckOutputWrapper { - TxAckOutputWrapper::new() - } - - fn clear(&mut self) { - self.output.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckOutputWrapper { - static instance: TxAckOutputWrapper = TxAckOutputWrapper { - output: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxAckOutputWrapper { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckOutput.TxAckOutputWrapper").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxAckOutputWrapper { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxAckOutputWrapper { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevMeta) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAckPrevMeta { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevMeta.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevMeta.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAckPrevMeta { - fn default() -> &'a TxAckPrevMeta { - ::default_instance() - } -} - -impl TxAckPrevMeta { - pub fn new() -> TxAckPrevMeta { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, PrevTx>( - "tx", - |m: &TxAckPrevMeta| { &m.tx }, - |m: &mut TxAckPrevMeta| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPrevMeta", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAckPrevMeta { - const NAME: &'static str = "TxAckPrevMeta"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPrevMeta { - TxAckPrevMeta::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPrevMeta { - static instance: TxAckPrevMeta = TxAckPrevMeta { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAckPrevMeta { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevMeta").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAckPrevMeta { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAckPrevMeta { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAckPrevInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevInput.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAckPrevInput { - fn default() -> &'a TxAckPrevInput { - ::default_instance() - } -} - -impl TxAckPrevInput { - pub fn new() -> TxAckPrevInput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_prev_input::TxAckPrevInputWrapper>( - "tx", - |m: &TxAckPrevInput| { &m.tx }, - |m: &mut TxAckPrevInput| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPrevInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAckPrevInput { - const NAME: &'static str = "TxAckPrevInput"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPrevInput { - TxAckPrevInput::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPrevInput { - static instance: TxAckPrevInput = TxAckPrevInput { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAckPrevInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAckPrevInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAckPrevInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxAckPrevInput` -pub mod tx_ack_prev_input { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapper) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxAckPrevInputWrapper { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapper.input) - pub input: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapper.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxAckPrevInputWrapper { - fn default() -> &'a TxAckPrevInputWrapper { - ::default_instance() - } - } - - impl TxAckPrevInputWrapper { - pub fn new() -> TxAckPrevInputWrapper { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::PrevInput>( - "input", - |m: &TxAckPrevInputWrapper| { &m.input }, - |m: &mut TxAckPrevInputWrapper| { &mut m.input }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPrevInput.TxAckPrevInputWrapper", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxAckPrevInputWrapper { - const NAME: &'static str = "TxAckPrevInputWrapper"; - - fn is_initialized(&self) -> bool { - if self.input.is_none() { - return false; - } - for v in &self.input { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.input)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.input.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.input.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPrevInputWrapper { - TxAckPrevInputWrapper::new() - } - - fn clear(&mut self) { - self.input.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPrevInputWrapper { - static instance: TxAckPrevInputWrapper = TxAckPrevInputWrapper { - input: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxAckPrevInputWrapper { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPrevInput.TxAckPrevInputWrapper").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxAckPrevInputWrapper { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxAckPrevInputWrapper { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAckPrevOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevOutput.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAckPrevOutput { - fn default() -> &'a TxAckPrevOutput { - ::default_instance() - } -} - -impl TxAckPrevOutput { - pub fn new() -> TxAckPrevOutput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_prev_output::TxAckPrevOutputWrapper>( - "tx", - |m: &TxAckPrevOutput| { &m.tx }, - |m: &mut TxAckPrevOutput| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPrevOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAckPrevOutput { - const NAME: &'static str = "TxAckPrevOutput"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPrevOutput { - TxAckPrevOutput::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPrevOutput { - static instance: TxAckPrevOutput = TxAckPrevOutput { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAckPrevOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAckPrevOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAckPrevOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxAckPrevOutput` -pub mod tx_ack_prev_output { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevOutput.TxAckPrevOutputWrapper) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxAckPrevOutputWrapper { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevOutput.TxAckPrevOutputWrapper.output) - pub output: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevOutput.TxAckPrevOutputWrapper.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxAckPrevOutputWrapper { - fn default() -> &'a TxAckPrevOutputWrapper { - ::default_instance() - } - } - - impl TxAckPrevOutputWrapper { - pub fn new() -> TxAckPrevOutputWrapper { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::PrevOutput>( - "output", - |m: &TxAckPrevOutputWrapper| { &m.output }, - |m: &mut TxAckPrevOutputWrapper| { &mut m.output }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPrevOutput.TxAckPrevOutputWrapper", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxAckPrevOutputWrapper { - const NAME: &'static str = "TxAckPrevOutputWrapper"; - - fn is_initialized(&self) -> bool { - if self.output.is_none() { - return false; - } - for v in &self.output { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.output)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.output.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.output.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPrevOutputWrapper { - TxAckPrevOutputWrapper::new() - } - - fn clear(&mut self) { - self.output.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPrevOutputWrapper { - static instance: TxAckPrevOutputWrapper = TxAckPrevOutputWrapper { - output: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxAckPrevOutputWrapper { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPrevOutput.TxAckPrevOutputWrapper").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxAckPrevOutputWrapper { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxAckPrevOutputWrapper { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevExtraData) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TxAckPrevExtraData { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TxAckPrevExtraData { - fn default() -> &'a TxAckPrevExtraData { - ::default_instance() - } -} - -impl TxAckPrevExtraData { - pub fn new() -> TxAckPrevExtraData { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tx_ack_prev_extra_data::TxAckPrevExtraDataWrapper>( - "tx", - |m: &TxAckPrevExtraData| { &m.tx }, - |m: &mut TxAckPrevExtraData| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPrevExtraData", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TxAckPrevExtraData { - const NAME: &'static str = "TxAckPrevExtraData"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPrevExtraData { - TxAckPrevExtraData::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPrevExtraData { - static instance: TxAckPrevExtraData = TxAckPrevExtraData { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TxAckPrevExtraData { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TxAckPrevExtraData").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TxAckPrevExtraData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TxAckPrevExtraData { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TxAckPrevExtraData` -pub mod tx_ack_prev_extra_data { - // @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.TxAckPrevExtraData.TxAckPrevExtraDataWrapper) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TxAckPrevExtraDataWrapper { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.TxAckPrevExtraDataWrapper.extra_data_chunk) - pub extra_data_chunk: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxAckPrevExtraData.TxAckPrevExtraDataWrapper.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TxAckPrevExtraDataWrapper { - fn default() -> &'a TxAckPrevExtraDataWrapper { - ::default_instance() - } - } - - impl TxAckPrevExtraDataWrapper { - pub fn new() -> TxAckPrevExtraDataWrapper { - ::std::default::Default::default() - } - - // required bytes extra_data_chunk = 8; - - pub fn extra_data_chunk(&self) -> &[u8] { - match self.extra_data_chunk.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_extra_data_chunk(&mut self) { - self.extra_data_chunk = ::std::option::Option::None; - } - - pub fn has_extra_data_chunk(&self) -> bool { - self.extra_data_chunk.is_some() - } - - // Param is passed by value, moved - pub fn set_extra_data_chunk(&mut self, v: ::std::vec::Vec) { - self.extra_data_chunk = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_extra_data_chunk(&mut self) -> &mut ::std::vec::Vec { - if self.extra_data_chunk.is_none() { - self.extra_data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.extra_data_chunk.as_mut().unwrap() - } - - // Take field - pub fn take_extra_data_chunk(&mut self) -> ::std::vec::Vec { - self.extra_data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "extra_data_chunk", - |m: &TxAckPrevExtraDataWrapper| { &m.extra_data_chunk }, - |m: &mut TxAckPrevExtraDataWrapper| { &mut m.extra_data_chunk }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TxAckPrevExtraData.TxAckPrevExtraDataWrapper", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TxAckPrevExtraDataWrapper { - const NAME: &'static str = "TxAckPrevExtraDataWrapper"; - - fn is_initialized(&self) -> bool { - if self.extra_data_chunk.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 66 => { - self.extra_data_chunk = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.extra_data_chunk.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.extra_data_chunk.as_ref() { - os.write_bytes(8, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TxAckPrevExtraDataWrapper { - TxAckPrevExtraDataWrapper::new() - } - - fn clear(&mut self) { - self.extra_data_chunk = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TxAckPrevExtraDataWrapper { - static instance: TxAckPrevExtraDataWrapper = TxAckPrevExtraDataWrapper { - extra_data_chunk: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TxAckPrevExtraDataWrapper { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TxAckPrevExtraData.TxAckPrevExtraDataWrapper").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TxAckPrevExtraDataWrapper { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TxAckPrevExtraDataWrapper { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.GetOwnershipProof) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetOwnershipProof { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.user_confirmation) - pub user_confirmation: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.ownership_ids) - pub ownership_ids: ::std::vec::Vec<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetOwnershipProof.commitment_data) - pub commitment_data: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetOwnershipProof.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetOwnershipProof { - fn default() -> &'a GetOwnershipProof { - ::default_instance() - } -} - -impl GetOwnershipProof { - pub fn new() -> GetOwnershipProof { - ::std::default::Default::default() - } - - // optional string coin_name = 2; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 3; - - pub fn script_type(&self) -> InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(InputScriptType::SPENDWITNESS), - None => InputScriptType::SPENDWITNESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool user_confirmation = 5; - - pub fn user_confirmation(&self) -> bool { - self.user_confirmation.unwrap_or(false) - } - - pub fn clear_user_confirmation(&mut self) { - self.user_confirmation = ::std::option::Option::None; - } - - pub fn has_user_confirmation(&self) -> bool { - self.user_confirmation.is_some() - } - - // Param is passed by value, moved - pub fn set_user_confirmation(&mut self, v: bool) { - self.user_confirmation = ::std::option::Option::Some(v); - } - - // optional bytes commitment_data = 7; - - pub fn commitment_data(&self) -> &[u8] { - match self.commitment_data.as_ref() { - Some(v) => v, - None => b"", - } - } - - pub fn clear_commitment_data(&mut self) { - self.commitment_data = ::std::option::Option::None; - } - - pub fn has_commitment_data(&self) -> bool { - self.commitment_data.is_some() - } - - // Param is passed by value, moved - pub fn set_commitment_data(&mut self, v: ::std::vec::Vec) { - self.commitment_data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_commitment_data(&mut self) -> &mut ::std::vec::Vec { - if self.commitment_data.is_none() { - self.commitment_data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.commitment_data.as_mut().unwrap() - } - - // Take field - pub fn take_commitment_data(&mut self) -> ::std::vec::Vec { - self.commitment_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &GetOwnershipProof| { &m.address_n }, - |m: &mut GetOwnershipProof| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &GetOwnershipProof| { &m.coin_name }, - |m: &mut GetOwnershipProof| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &GetOwnershipProof| { &m.script_type }, - |m: &mut GetOwnershipProof| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MultisigRedeemScriptType>( - "multisig", - |m: &GetOwnershipProof| { &m.multisig }, - |m: &mut GetOwnershipProof| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "user_confirmation", - |m: &GetOwnershipProof| { &m.user_confirmation }, - |m: &mut GetOwnershipProof| { &mut m.user_confirmation }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "ownership_ids", - |m: &GetOwnershipProof| { &m.ownership_ids }, - |m: &mut GetOwnershipProof| { &mut m.ownership_ids }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "commitment_data", - |m: &GetOwnershipProof| { &m.commitment_data }, - |m: &mut GetOwnershipProof| { &mut m.commitment_data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetOwnershipProof", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetOwnershipProof { - const NAME: &'static str = "GetOwnershipProof"; - - fn is_initialized(&self) -> bool { - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 40 => { - self.user_confirmation = ::std::option::Option::Some(is.read_bool()?); - }, - 50 => { - self.ownership_ids.push(is.read_bytes()?); - }, - 58 => { - self.commitment_data = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(3, v.value()); - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.user_confirmation { - my_size += 1 + 1; - } - for value in &self.ownership_ids { - my_size += ::protobuf::rt::bytes_size(6, &value); - }; - if let Some(v) = self.commitment_data.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.coin_name.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.user_confirmation { - os.write_bool(5, v)?; - } - for v in &self.ownership_ids { - os.write_bytes(6, &v)?; - }; - if let Some(v) = self.commitment_data.as_ref() { - os.write_bytes(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetOwnershipProof { - GetOwnershipProof::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.coin_name = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.multisig.clear(); - self.user_confirmation = ::std::option::Option::None; - self.ownership_ids.clear(); - self.commitment_data = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetOwnershipProof { - static instance: GetOwnershipProof = GetOwnershipProof { - address_n: ::std::vec::Vec::new(), - coin_name: ::std::option::Option::None, - script_type: ::std::option::Option::None, - multisig: ::protobuf::MessageField::none(), - user_confirmation: ::std::option::Option::None, - ownership_ids: ::std::vec::Vec::new(), - commitment_data: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetOwnershipProof { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetOwnershipProof").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetOwnershipProof { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetOwnershipProof { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.OwnershipProof) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct OwnershipProof { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.OwnershipProof.ownership_proof) - pub ownership_proof: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.OwnershipProof.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.OwnershipProof.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a OwnershipProof { - fn default() -> &'a OwnershipProof { - ::default_instance() - } -} - -impl OwnershipProof { - pub fn new() -> OwnershipProof { - ::std::default::Default::default() - } - - // required bytes ownership_proof = 1; - - pub fn ownership_proof(&self) -> &[u8] { - match self.ownership_proof.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ownership_proof(&mut self) { - self.ownership_proof = ::std::option::Option::None; - } - - pub fn has_ownership_proof(&self) -> bool { - self.ownership_proof.is_some() - } - - // Param is passed by value, moved - pub fn set_ownership_proof(&mut self, v: ::std::vec::Vec) { - self.ownership_proof = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ownership_proof(&mut self) -> &mut ::std::vec::Vec { - if self.ownership_proof.is_none() { - self.ownership_proof = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ownership_proof.as_mut().unwrap() - } - - // Take field - pub fn take_ownership_proof(&mut self) -> ::std::vec::Vec { - self.ownership_proof.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ownership_proof", - |m: &OwnershipProof| { &m.ownership_proof }, - |m: &mut OwnershipProof| { &mut m.ownership_proof }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &OwnershipProof| { &m.signature }, - |m: &mut OwnershipProof| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "OwnershipProof", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for OwnershipProof { - const NAME: &'static str = "OwnershipProof"; - - fn is_initialized(&self) -> bool { - if self.ownership_proof.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.ownership_proof = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.ownership_proof.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.ownership_proof.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> OwnershipProof { - OwnershipProof::new() - } - - fn clear(&mut self) { - self.ownership_proof = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static OwnershipProof { - static instance: OwnershipProof = OwnershipProof { - ownership_proof: ::std::option::Option::None, - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for OwnershipProof { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("OwnershipProof").unwrap()).clone() - } -} - -impl ::std::fmt::Display for OwnershipProof { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for OwnershipProof { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.AuthorizeCoinJoin) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct AuthorizeCoinJoin { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.coordinator) - pub coordinator: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.max_rounds) - pub max_rounds: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.max_coordinator_fee_rate) - pub max_coordinator_fee_rate: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.max_fee_per_kvbyte) - pub max_fee_per_kvbyte: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.coin_name) - pub coin_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.script_type) - pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.amount_unit) - pub amount_unit: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.AuthorizeCoinJoin.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a AuthorizeCoinJoin { - fn default() -> &'a AuthorizeCoinJoin { - ::default_instance() - } -} - -impl AuthorizeCoinJoin { - pub fn new() -> AuthorizeCoinJoin { - ::std::default::Default::default() - } - - // required string coordinator = 1; - - pub fn coordinator(&self) -> &str { - match self.coordinator.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_coordinator(&mut self) { - self.coordinator = ::std::option::Option::None; - } - - pub fn has_coordinator(&self) -> bool { - self.coordinator.is_some() - } - - // Param is passed by value, moved - pub fn set_coordinator(&mut self, v: ::std::string::String) { - self.coordinator = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coordinator(&mut self) -> &mut ::std::string::String { - if self.coordinator.is_none() { - self.coordinator = ::std::option::Option::Some(::std::string::String::new()); - } - self.coordinator.as_mut().unwrap() - } - - // Take field - pub fn take_coordinator(&mut self) -> ::std::string::String { - self.coordinator.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 max_rounds = 2; - - pub fn max_rounds(&self) -> u64 { - self.max_rounds.unwrap_or(0) - } - - pub fn clear_max_rounds(&mut self) { - self.max_rounds = ::std::option::Option::None; - } - - pub fn has_max_rounds(&self) -> bool { - self.max_rounds.is_some() - } - - // Param is passed by value, moved - pub fn set_max_rounds(&mut self, v: u64) { - self.max_rounds = ::std::option::Option::Some(v); - } - - // required uint32 max_coordinator_fee_rate = 3; - - pub fn max_coordinator_fee_rate(&self) -> u32 { - self.max_coordinator_fee_rate.unwrap_or(0) - } - - pub fn clear_max_coordinator_fee_rate(&mut self) { - self.max_coordinator_fee_rate = ::std::option::Option::None; - } - - pub fn has_max_coordinator_fee_rate(&self) -> bool { - self.max_coordinator_fee_rate.is_some() - } - - // Param is passed by value, moved - pub fn set_max_coordinator_fee_rate(&mut self, v: u32) { - self.max_coordinator_fee_rate = ::std::option::Option::Some(v); - } - - // required uint32 max_fee_per_kvbyte = 4; - - pub fn max_fee_per_kvbyte(&self) -> u32 { - self.max_fee_per_kvbyte.unwrap_or(0) - } - - pub fn clear_max_fee_per_kvbyte(&mut self) { - self.max_fee_per_kvbyte = ::std::option::Option::None; - } - - pub fn has_max_fee_per_kvbyte(&self) -> bool { - self.max_fee_per_kvbyte.is_some() - } - - // Param is passed by value, moved - pub fn set_max_fee_per_kvbyte(&mut self, v: u32) { - self.max_fee_per_kvbyte = ::std::option::Option::Some(v); - } - - // optional string coin_name = 6; - - pub fn coin_name(&self) -> &str { - match self.coin_name.as_ref() { - Some(v) => v, - None => "Bitcoin", - } - } - - pub fn clear_coin_name(&mut self) { - self.coin_name = ::std::option::Option::None; - } - - pub fn has_coin_name(&self) -> bool { - self.coin_name.is_some() - } - - // Param is passed by value, moved - pub fn set_coin_name(&mut self, v: ::std::string::String) { - self.coin_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_coin_name(&mut self) -> &mut ::std::string::String { - if self.coin_name.is_none() { - self.coin_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.coin_name.as_mut().unwrap() - } - - // Take field - pub fn take_coin_name(&mut self) -> ::std::string::String { - self.coin_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional .hw.trezor.messages.bitcoin.InputScriptType script_type = 7; - - pub fn script_type(&self) -> InputScriptType { - match self.script_type { - Some(e) => e.enum_value_or(InputScriptType::SPENDADDRESS), - None => InputScriptType::SPENDADDRESS, - } - } - - pub fn clear_script_type(&mut self) { - self.script_type = ::std::option::Option::None; - } - - pub fn has_script_type(&self) -> bool { - self.script_type.is_some() - } - - // Param is passed by value, moved - pub fn set_script_type(&mut self, v: InputScriptType) { - self.script_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional .hw.trezor.messages.bitcoin.AmountUnit amount_unit = 8; - - pub fn amount_unit(&self) -> AmountUnit { - match self.amount_unit { - Some(e) => e.enum_value_or(AmountUnit::BITCOIN), - None => AmountUnit::BITCOIN, - } - } - - pub fn clear_amount_unit(&mut self) { - self.amount_unit = ::std::option::Option::None; - } - - pub fn has_amount_unit(&self) -> bool { - self.amount_unit.is_some() - } - - // Param is passed by value, moved - pub fn set_amount_unit(&mut self, v: AmountUnit) { - self.amount_unit = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coordinator", - |m: &AuthorizeCoinJoin| { &m.coordinator }, - |m: &mut AuthorizeCoinJoin| { &mut m.coordinator }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "max_rounds", - |m: &AuthorizeCoinJoin| { &m.max_rounds }, - |m: &mut AuthorizeCoinJoin| { &mut m.max_rounds }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "max_coordinator_fee_rate", - |m: &AuthorizeCoinJoin| { &m.max_coordinator_fee_rate }, - |m: &mut AuthorizeCoinJoin| { &mut m.max_coordinator_fee_rate }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "max_fee_per_kvbyte", - |m: &AuthorizeCoinJoin| { &m.max_fee_per_kvbyte }, - |m: &mut AuthorizeCoinJoin| { &mut m.max_fee_per_kvbyte }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &AuthorizeCoinJoin| { &m.address_n }, - |m: &mut AuthorizeCoinJoin| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "coin_name", - |m: &AuthorizeCoinJoin| { &m.coin_name }, - |m: &mut AuthorizeCoinJoin| { &mut m.coin_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_type", - |m: &AuthorizeCoinJoin| { &m.script_type }, - |m: &mut AuthorizeCoinJoin| { &mut m.script_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount_unit", - |m: &AuthorizeCoinJoin| { &m.amount_unit }, - |m: &mut AuthorizeCoinJoin| { &mut m.amount_unit }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "AuthorizeCoinJoin", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for AuthorizeCoinJoin { - const NAME: &'static str = "AuthorizeCoinJoin"; - - fn is_initialized(&self) -> bool { - if self.coordinator.is_none() { - return false; - } - if self.max_rounds.is_none() { - return false; - } - if self.max_coordinator_fee_rate.is_none() { - return false; - } - if self.max_fee_per_kvbyte.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.coordinator = ::std::option::Option::Some(is.read_string()?); - }, - 16 => { - self.max_rounds = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.max_coordinator_fee_rate = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.max_fee_per_kvbyte = ::std::option::Option::Some(is.read_uint32()?); - }, - 42 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 40 => { - self.address_n.push(is.read_uint32()?); - }, - 50 => { - self.coin_name = ::std::option::Option::Some(is.read_string()?); - }, - 56 => { - self.script_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 64 => { - self.amount_unit = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.coordinator.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.max_rounds { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.max_coordinator_fee_rate { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.max_fee_per_kvbyte { - my_size += ::protobuf::rt::uint32_size(4, v); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(5, *value); - }; - if let Some(v) = self.coin_name.as_ref() { - my_size += ::protobuf::rt::string_size(6, &v); - } - if let Some(v) = self.script_type { - my_size += ::protobuf::rt::int32_size(7, v.value()); - } - if let Some(v) = self.amount_unit { - my_size += ::protobuf::rt::int32_size(8, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.coordinator.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.max_rounds { - os.write_uint64(2, v)?; - } - if let Some(v) = self.max_coordinator_fee_rate { - os.write_uint32(3, v)?; - } - if let Some(v) = self.max_fee_per_kvbyte { - os.write_uint32(4, v)?; - } - for v in &self.address_n { - os.write_uint32(5, *v)?; - }; - if let Some(v) = self.coin_name.as_ref() { - os.write_string(6, v)?; - } - if let Some(v) = self.script_type { - os.write_enum(7, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.amount_unit { - os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> AuthorizeCoinJoin { - AuthorizeCoinJoin::new() - } - - fn clear(&mut self) { - self.coordinator = ::std::option::Option::None; - self.max_rounds = ::std::option::Option::None; - self.max_coordinator_fee_rate = ::std::option::Option::None; - self.max_fee_per_kvbyte = ::std::option::Option::None; - self.address_n.clear(); - self.coin_name = ::std::option::Option::None; - self.script_type = ::std::option::Option::None; - self.amount_unit = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static AuthorizeCoinJoin { - static instance: AuthorizeCoinJoin = AuthorizeCoinJoin { - coordinator: ::std::option::Option::None, - max_rounds: ::std::option::Option::None, - max_coordinator_fee_rate: ::std::option::Option::None, - max_fee_per_kvbyte: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - coin_name: ::std::option::Option::None, - script_type: ::std::option::Option::None, - amount_unit: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for AuthorizeCoinJoin { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("AuthorizeCoinJoin").unwrap()).clone() - } -} - -impl ::std::fmt::Display for AuthorizeCoinJoin { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AuthorizeCoinJoin { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.InputScriptType) -pub enum InputScriptType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDADDRESS) - SPENDADDRESS = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDMULTISIG) - SPENDMULTISIG = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.EXTERNAL) - EXTERNAL = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDWITNESS) - SPENDWITNESS = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDP2SHWITNESS) - SPENDP2SHWITNESS = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.InputScriptType.SPENDTAPROOT) - SPENDTAPROOT = 5, -} - -impl ::protobuf::Enum for InputScriptType { - const NAME: &'static str = "InputScriptType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(InputScriptType::SPENDADDRESS), - 1 => ::std::option::Option::Some(InputScriptType::SPENDMULTISIG), - 2 => ::std::option::Option::Some(InputScriptType::EXTERNAL), - 3 => ::std::option::Option::Some(InputScriptType::SPENDWITNESS), - 4 => ::std::option::Option::Some(InputScriptType::SPENDP2SHWITNESS), - 5 => ::std::option::Option::Some(InputScriptType::SPENDTAPROOT), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "SPENDADDRESS" => ::std::option::Option::Some(InputScriptType::SPENDADDRESS), - "SPENDMULTISIG" => ::std::option::Option::Some(InputScriptType::SPENDMULTISIG), - "EXTERNAL" => ::std::option::Option::Some(InputScriptType::EXTERNAL), - "SPENDWITNESS" => ::std::option::Option::Some(InputScriptType::SPENDWITNESS), - "SPENDP2SHWITNESS" => ::std::option::Option::Some(InputScriptType::SPENDP2SHWITNESS), - "SPENDTAPROOT" => ::std::option::Option::Some(InputScriptType::SPENDTAPROOT), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [InputScriptType] = &[ - InputScriptType::SPENDADDRESS, - InputScriptType::SPENDMULTISIG, - InputScriptType::EXTERNAL, - InputScriptType::SPENDWITNESS, - InputScriptType::SPENDP2SHWITNESS, - InputScriptType::SPENDTAPROOT, - ]; -} - -impl ::protobuf::EnumFull for InputScriptType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("InputScriptType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for InputScriptType { - fn default() -> Self { - InputScriptType::SPENDADDRESS - } -} - -impl InputScriptType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("InputScriptType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.OutputScriptType) -pub enum OutputScriptType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOADDRESS) - PAYTOADDRESS = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOSCRIPTHASH) - PAYTOSCRIPTHASH = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOMULTISIG) - PAYTOMULTISIG = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOOPRETURN) - PAYTOOPRETURN = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOWITNESS) - PAYTOWITNESS = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOP2SHWITNESS) - PAYTOP2SHWITNESS = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.OutputScriptType.PAYTOTAPROOT) - PAYTOTAPROOT = 6, -} - -impl ::protobuf::Enum for OutputScriptType { - const NAME: &'static str = "OutputScriptType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(OutputScriptType::PAYTOADDRESS), - 1 => ::std::option::Option::Some(OutputScriptType::PAYTOSCRIPTHASH), - 2 => ::std::option::Option::Some(OutputScriptType::PAYTOMULTISIG), - 3 => ::std::option::Option::Some(OutputScriptType::PAYTOOPRETURN), - 4 => ::std::option::Option::Some(OutputScriptType::PAYTOWITNESS), - 5 => ::std::option::Option::Some(OutputScriptType::PAYTOP2SHWITNESS), - 6 => ::std::option::Option::Some(OutputScriptType::PAYTOTAPROOT), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "PAYTOADDRESS" => ::std::option::Option::Some(OutputScriptType::PAYTOADDRESS), - "PAYTOSCRIPTHASH" => ::std::option::Option::Some(OutputScriptType::PAYTOSCRIPTHASH), - "PAYTOMULTISIG" => ::std::option::Option::Some(OutputScriptType::PAYTOMULTISIG), - "PAYTOOPRETURN" => ::std::option::Option::Some(OutputScriptType::PAYTOOPRETURN), - "PAYTOWITNESS" => ::std::option::Option::Some(OutputScriptType::PAYTOWITNESS), - "PAYTOP2SHWITNESS" => ::std::option::Option::Some(OutputScriptType::PAYTOP2SHWITNESS), - "PAYTOTAPROOT" => ::std::option::Option::Some(OutputScriptType::PAYTOTAPROOT), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [OutputScriptType] = &[ - OutputScriptType::PAYTOADDRESS, - OutputScriptType::PAYTOSCRIPTHASH, - OutputScriptType::PAYTOMULTISIG, - OutputScriptType::PAYTOOPRETURN, - OutputScriptType::PAYTOWITNESS, - OutputScriptType::PAYTOP2SHWITNESS, - OutputScriptType::PAYTOTAPROOT, - ]; -} - -impl ::protobuf::EnumFull for OutputScriptType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("OutputScriptType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for OutputScriptType { - fn default() -> Self { - OutputScriptType::PAYTOADDRESS - } -} - -impl OutputScriptType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("OutputScriptType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.DecredStakingSpendType) -pub enum DecredStakingSpendType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.DecredStakingSpendType.SSGen) - SSGen = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.DecredStakingSpendType.SSRTX) - SSRTX = 1, -} - -impl ::protobuf::Enum for DecredStakingSpendType { - const NAME: &'static str = "DecredStakingSpendType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(DecredStakingSpendType::SSGen), - 1 => ::std::option::Option::Some(DecredStakingSpendType::SSRTX), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "SSGen" => ::std::option::Option::Some(DecredStakingSpendType::SSGen), - "SSRTX" => ::std::option::Option::Some(DecredStakingSpendType::SSRTX), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [DecredStakingSpendType] = &[ - DecredStakingSpendType::SSGen, - DecredStakingSpendType::SSRTX, - ]; -} - -impl ::protobuf::EnumFull for DecredStakingSpendType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("DecredStakingSpendType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for DecredStakingSpendType { - fn default() -> Self { - DecredStakingSpendType::SSGen - } -} - -impl DecredStakingSpendType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DecredStakingSpendType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.bitcoin.AmountUnit) -pub enum AmountUnit { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.BITCOIN) - BITCOIN = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.MILLIBITCOIN) - MILLIBITCOIN = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.MICROBITCOIN) - MICROBITCOIN = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.bitcoin.AmountUnit.SATOSHI) - SATOSHI = 3, -} - -impl ::protobuf::Enum for AmountUnit { - const NAME: &'static str = "AmountUnit"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(AmountUnit::BITCOIN), - 1 => ::std::option::Option::Some(AmountUnit::MILLIBITCOIN), - 2 => ::std::option::Option::Some(AmountUnit::MICROBITCOIN), - 3 => ::std::option::Option::Some(AmountUnit::SATOSHI), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "BITCOIN" => ::std::option::Option::Some(AmountUnit::BITCOIN), - "MILLIBITCOIN" => ::std::option::Option::Some(AmountUnit::MILLIBITCOIN), - "MICROBITCOIN" => ::std::option::Option::Some(AmountUnit::MICROBITCOIN), - "SATOSHI" => ::std::option::Option::Some(AmountUnit::SATOSHI), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [AmountUnit] = &[ - AmountUnit::BITCOIN, - AmountUnit::MILLIBITCOIN, - AmountUnit::MICROBITCOIN, - AmountUnit::SATOSHI, - ]; -} - -impl ::protobuf::EnumFull for AmountUnit { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("AmountUnit").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for AmountUnit { - fn default() -> Self { - AmountUnit::BITCOIN - } -} - -impl AmountUnit { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("AmountUnit") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x16messages-bitcoin.proto\x12\x1ahw.trezor.messages.bitcoin\x1a\x0eme\ - ssages.proto\x1a\x15messages-common.proto\"\xeb\x02\n\x18MultisigRedeemS\ - criptType\x12]\n\x07pubkeys\x18\x01\x20\x03(\x0b2C.hw.trezor.messages.bi\ - tcoin.MultisigRedeemScriptType.HDNodePathTypeR\x07pubkeys\x12\x1e\n\nsig\ - natures\x18\x02\x20\x03(\x0cR\nsignatures\x12\x0c\n\x01m\x18\x03\x20\x02\ - (\rR\x01m\x12;\n\x05nodes\x18\x04\x20\x03(\x0b2%.hw.trezor.messages.comm\ - on.HDNodeTypeR\x05nodes\x12\x1b\n\taddress_n\x18\x05\x20\x03(\rR\x08addr\ - essN\x1ah\n\x0eHDNodePathType\x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.t\ - rezor.messages.common.HDNodeTypeR\x04node\x12\x1b\n\taddress_n\x18\x02\ - \x20\x03(\rR\x08addressN\"\xa6\x02\n\x0cGetPublicKey\x12\x1b\n\taddress_\ - n\x18\x01\x20\x03(\rR\x08addressN\x12(\n\x10ecdsa_curve_name\x18\x02\x20\ - \x01(\tR\x0eecdsaCurveName\x12!\n\x0cshow_display\x18\x03\x20\x01(\x08R\ - \x0bshowDisplay\x12$\n\tcoin_name\x18\x04\x20\x01(\t:\x07BitcoinR\x08coi\ - nName\x12Z\n\x0bscript_type\x18\x05\x20\x01(\x0e2+.hw.trezor.messages.bi\ - tcoin.InputScriptType:\x0cSPENDADDRESSR\nscriptType\x12*\n\x11ignore_xpu\ - b_magic\x18\x06\x20\x01(\x08R\x0fignoreXpubMagic\"\xa5\x01\n\tPublicKey\ - \x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trezor.messages.common.HDNodeT\ - ypeR\x04node\x12\x12\n\x04xpub\x18\x02\x20\x02(\tR\x04xpub\x12)\n\x10roo\ - t_fingerprint\x18\x03\x20\x01(\rR\x0frootFingerprint\x12\x1e\n\ndescript\ - or\x18\x04\x20\x01(\tR\ndescriptor\"\xe8\x02\n\nGetAddress\x12\x1b\n\tad\ - dress_n\x18\x01\x20\x03(\rR\x08addressN\x12$\n\tcoin_name\x18\x02\x20\ - \x01(\t:\x07BitcoinR\x08coinName\x12!\n\x0cshow_display\x18\x03\x20\x01(\ - \x08R\x0bshowDisplay\x12P\n\x08multisig\x18\x04\x20\x01(\x0b24.hw.trezor\ - .messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12Z\n\x0bscript\ - _type\x18\x05\x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputScriptType:\ - \x0cSPENDADDRESSR\nscriptType\x12*\n\x11ignore_xpub_magic\x18\x06\x20\ - \x01(\x08R\x0fignoreXpubMagic\x12\x1a\n\x08chunkify\x18\x07\x20\x01(\x08\ - R\x08chunkify\"5\n\x07Address\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ - \x07address\x12\x10\n\x03mac\x18\x02\x20\x01(\x0cR\x03mac\"\x81\x02\n\ - \x0eGetOwnershipId\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12$\n\tcoin_name\x18\x02\x20\x01(\t:\x07BitcoinR\x08coinName\x12P\n\ - \x08multisig\x18\x03\x20\x01(\x0b24.hw.trezor.messages.bitcoin.MultisigR\ - edeemScriptTypeR\x08multisig\x12Z\n\x0bscript_type\x18\x04\x20\x01(\x0e2\ - +.hw.trezor.messages.bitcoin.InputScriptType:\x0cSPENDADDRESSR\nscriptTy\ - pe\"0\n\x0bOwnershipId\x12!\n\x0cownership_id\x18\x01\x20\x02(\x0cR\x0bo\ - wnershipId\"\x88\x02\n\x0bSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\ - \x03(\rR\x08addressN\x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07messa\ - ge\x12$\n\tcoin_name\x18\x03\x20\x01(\t:\x07BitcoinR\x08coinName\x12Z\n\ - \x0bscript_type\x18\x04\x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputS\ - criptType:\x0cSPENDADDRESSR\nscriptType\x12$\n\x0eno_script_type\x18\x05\ - \x20\x01(\x08R\x0cnoScriptType\x12\x1a\n\x08chunkify\x18\x06\x20\x01(\ - \x08R\x08chunkify\"J\n\x10MessageSignature\x12\x18\n\x07address\x18\x01\ - \x20\x02(\tR\x07address\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsign\ - ature\"\xa3\x01\n\rVerifyMessage\x12\x18\n\x07address\x18\x01\x20\x02(\t\ - R\x07address\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\ - \x18\n\x07message\x18\x03\x20\x02(\x0cR\x07message\x12$\n\tcoin_name\x18\ - \x04\x20\x01(\t:\x07BitcoinR\x08coinName\x12\x1a\n\x08chunkify\x18\x05\ - \x20\x01(\x08R\x08chunkify\"\xd9\x06\n\x06SignTx\x12#\n\routputs_count\ - \x18\x01\x20\x02(\rR\x0coutputsCount\x12!\n\x0cinputs_count\x18\x02\x20\ - \x02(\rR\x0binputsCount\x12$\n\tcoin_name\x18\x03\x20\x01(\t:\x07Bitcoin\ - R\x08coinName\x12\x1b\n\x07version\x18\x04\x20\x01(\r:\x011R\x07version\ - \x12\x1e\n\tlock_time\x18\x05\x20\x01(\r:\x010R\x08lockTime\x12\x16\n\ - \x06expiry\x18\x06\x20\x01(\rR\x06expiry\x12&\n\x0coverwintered\x18\x07\ - \x20\x01(\x08R\x0coverwinteredB\x02\x18\x01\x12(\n\x10version_group_id\ - \x18\x08\x20\x01(\rR\x0eversionGroupId\x12\x1c\n\ttimestamp\x18\t\x20\ - \x01(\rR\ttimestamp\x12\x1b\n\tbranch_id\x18\n\x20\x01(\rR\x08branchId\ - \x12P\n\x0bamount_unit\x18\x0b\x20\x01(\x0e2&.hw.trezor.messages.bitcoin\ - .AmountUnit:\x07BITCOINR\namountUnit\x129\n\x15decred_staking_ticket\x18\ - \x0c\x20\x01(\x08:\x05falseR\x13decredStakingTicket\x12\"\n\tserialize\ - \x18\r\x20\x01(\x08:\x04trueR\tserialize\x12]\n\x10coinjoin_request\x18\ - \x0e\x20\x01(\x0b22.hw.trezor.messages.bitcoin.SignTx.CoinJoinRequestR\ - \x0fcoinjoinRequest\x12\x1a\n\x08chunkify\x18\x0f\x20\x01(\x08R\x08chunk\ - ify\x1a\xd2\x01\n\x0fCoinJoinRequest\x12\x19\n\x08fee_rate\x18\x01\x20\ - \x02(\rR\x07feeRate\x12(\n\x10no_fee_threshold\x18\x02\x20\x02(\x04R\x0e\ - noFeeThreshold\x124\n\x16min_registrable_amount\x18\x03\x20\x02(\x04R\ - \x14minRegistrableAmount\x12&\n\x0fmask_public_key\x18\x04\x20\x02(\x0cR\ - \rmaskPublicKey\x12\x1c\n\tsignature\x18\x05\x20\x02(\x0cR\tsignature\"\ - \xd4\x05\n\tTxRequest\x12T\n\x0crequest_type\x18\x01\x20\x01(\x0e21.hw.t\ - rezor.messages.bitcoin.TxRequest.RequestTypeR\x0brequestType\x12T\n\x07d\ - etails\x18\x02\x20\x01(\x0b2:.hw.trezor.messages.bitcoin.TxRequest.TxReq\ - uestDetailsTypeR\x07details\x12]\n\nserialized\x18\x03\x20\x01(\x0b2=.hw\ - .trezor.messages.bitcoin.TxRequest.TxRequestSerializedTypeR\nserialized\ - \x1a\xa6\x01\n\x14TxRequestDetailsType\x12#\n\rrequest_index\x18\x01\x20\ - \x01(\rR\x0crequestIndex\x12\x17\n\x07tx_hash\x18\x02\x20\x01(\x0cR\x06t\ - xHash\x12$\n\x0eextra_data_len\x18\x03\x20\x01(\rR\x0cextraDataLen\x12*\ - \n\x11extra_data_offset\x18\x04\x20\x01(\rR\x0fextraDataOffset\x1a\x85\ - \x01\n\x17TxRequestSerializedType\x12'\n\x0fsignature_index\x18\x01\x20\ - \x01(\rR\x0esignatureIndex\x12\x1c\n\tsignature\x18\x02\x20\x01(\x0cR\ts\ - ignature\x12#\n\rserialized_tx\x18\x03\x20\x01(\x0cR\x0cserializedTx\"\ - \x8a\x01\n\x0bRequestType\x12\x0b\n\x07TXINPUT\x10\0\x12\x0c\n\x08TXOUTP\ - UT\x10\x01\x12\n\n\x06TXMETA\x10\x02\x12\x0e\n\nTXFINISHED\x10\x03\x12\ - \x0f\n\x0bTXEXTRADATA\x10\x04\x12\x0f\n\x0bTXORIGINPUT\x10\x05\x12\x10\n\ - \x0cTXORIGOUTPUT\x10\x06\x12\x10\n\x0cTXPAYMENTREQ\x10\x07\"\xf4\x0f\n\ - \x05TxAck\x12A\n\x02tx\x18\x01\x20\x01(\x0b21.hw.trezor.messages.bitcoin\ - .TxAck.TransactionTypeR\x02tx\x1a\xa3\x0f\n\x0fTransactionType\x12\x18\n\ - \x07version\x18\x01\x20\x01(\rR\x07version\x12U\n\x06inputs\x18\x02\x20\ - \x03(\x0b2=.hw.trezor.messages.bitcoin.TxAck.TransactionType.TxInputType\ - R\x06inputs\x12b\n\x0bbin_outputs\x18\x03\x20\x03(\x0b2A.hw.trezor.messa\ - ges.bitcoin.TxAck.TransactionType.TxOutputBinTypeR\nbinOutputs\x12\x1b\n\ - \tlock_time\x18\x04\x20\x01(\rR\x08lockTime\x12X\n\x07outputs\x18\x05\ - \x20\x03(\x0b2>.hw.trezor.messages.bitcoin.TxAck.TransactionType.TxOutpu\ - tTypeR\x07outputs\x12\x1d\n\ninputs_cnt\x18\x06\x20\x01(\rR\tinputsCnt\ - \x12\x1f\n\x0boutputs_cnt\x18\x07\x20\x01(\rR\noutputsCnt\x12\x1d\n\next\ - ra_data\x18\x08\x20\x01(\x0cR\textraData\x12$\n\x0eextra_data_len\x18\t\ - \x20\x01(\rR\x0cextraDataLen\x12\x16\n\x06expiry\x18\n\x20\x01(\rR\x06ex\ - piry\x12&\n\x0coverwintered\x18\x0b\x20\x01(\x08R\x0coverwinteredB\x02\ - \x18\x01\x12(\n\x10version_group_id\x18\x0c\x20\x01(\rR\x0eversionGroupI\ - d\x12\x1c\n\ttimestamp\x18\r\x20\x01(\rR\ttimestamp\x12\x1b\n\tbranch_id\ - \x18\x0e\x20\x01(\rR\x08branchId\x1a\xf1\x05\n\x0bTxInputType\x12\x1b\n\ - \taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1b\n\tprev_hash\x18\x02\ - \x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tpr\ - evIndex\x12\x1d\n\nscript_sig\x18\x04\x20\x01(\x0cR\tscriptSig\x12&\n\ - \x08sequence\x18\x05\x20\x01(\r:\n4294967295R\x08sequence\x12Z\n\x0bscri\ - pt_type\x18\x06\x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputScriptTyp\ - e:\x0cSPENDADDRESSR\nscriptType\x12P\n\x08multisig\x18\x07\x20\x01(\x0b2\ - 4.hw.trezor.messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12\ - \x16\n\x06amount\x18\x08\x20\x01(\x04R\x06amount\x12\x1f\n\x0bdecred_tre\ - e\x18\t\x20\x01(\rR\ndecredTree\x12\x18\n\x07witness\x18\r\x20\x01(\x0cR\ - \x07witness\x12'\n\x0fownership_proof\x18\x0e\x20\x01(\x0cR\x0eownership\ - Proof\x12'\n\x0fcommitment_data\x18\x0f\x20\x01(\x0cR\x0ecommitmentData\ - \x12\x1b\n\torig_hash\x18\x10\x20\x01(\x0cR\x08origHash\x12\x1d\n\norig_\ - index\x18\x11\x20\x01(\rR\torigIndex\x12d\n\x14decred_staking_spend\x18\ - \x12\x20\x01(\x0e22.hw.trezor.messages.bitcoin.DecredStakingSpendTypeR\ - \x12decredStakingSpend\x12#\n\rscript_pubkey\x18\x13\x20\x01(\x0cR\x0csc\ - riptPubkey\x12(\n\x0ecoinjoin_flags\x18\x14\x20\x01(\r:\x010R\rcoinjoinF\ - lags\x1a\x82\x01\n\x0fTxOutputBinType\x12\x16\n\x06amount\x18\x01\x20\ - \x02(\x04R\x06amount\x12#\n\rscript_pubkey\x18\x02\x20\x02(\x0cR\x0cscri\ - ptPubkey\x122\n\x15decred_script_version\x18\x03\x20\x01(\rR\x13decredSc\ - riptVersion\x1a\xa0\x03\n\x0cTxOutputType\x12\x18\n\x07address\x18\x01\ - \x20\x01(\tR\x07address\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addr\ - essN\x12\x16\n\x06amount\x18\x03\x20\x02(\x04R\x06amount\x12[\n\x0bscrip\ - t_type\x18\x04\x20\x01(\x0e2,.hw.trezor.messages.bitcoin.OutputScriptTyp\ - e:\x0cPAYTOADDRESSR\nscriptType\x12P\n\x08multisig\x18\x05\x20\x01(\x0b2\ - 4.hw.trezor.messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12$\ - \n\x0eop_return_data\x18\x06\x20\x01(\x0cR\x0copReturnData\x12\x1b\n\tor\ - ig_hash\x18\n\x20\x01(\x0cR\x08origHash\x12\x1d\n\norig_index\x18\x0b\ - \x20\x01(\rR\torigIndex\x120\n\x11payment_req_index\x18\x0c\x20\x01(\rR\ - \x0fpaymentReqIndexB\x04\xc8\xf0\x19\x01:\x02\x18\x01\"\xff\x05\n\x07TxI\ - nput\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1b\n\tpre\ - v_hash\x18\x02\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\ - \x20\x02(\rR\tprevIndex\x12\x1d\n\nscript_sig\x18\x04\x20\x01(\x0cR\tscr\ - iptSig\x12&\n\x08sequence\x18\x05\x20\x01(\r:\n4294967295R\x08sequence\ - \x12Z\n\x0bscript_type\x18\x06\x20\x01(\x0e2+.hw.trezor.messages.bitcoin\ - .InputScriptType:\x0cSPENDADDRESSR\nscriptType\x12P\n\x08multisig\x18\ - \x07\x20\x01(\x0b24.hw.trezor.messages.bitcoin.MultisigRedeemScriptTypeR\ - \x08multisig\x12\x16\n\x06amount\x18\x08\x20\x02(\x04R\x06amount\x12\x1f\ - \n\x0bdecred_tree\x18\t\x20\x01(\rR\ndecredTree\x12\x18\n\x07witness\x18\ - \r\x20\x01(\x0cR\x07witness\x12'\n\x0fownership_proof\x18\x0e\x20\x01(\ - \x0cR\x0eownershipProof\x12'\n\x0fcommitment_data\x18\x0f\x20\x01(\x0cR\ - \x0ecommitmentData\x12\x1b\n\torig_hash\x18\x10\x20\x01(\x0cR\x08origHas\ - h\x12\x1d\n\norig_index\x18\x11\x20\x01(\rR\torigIndex\x12d\n\x14decred_\ - staking_spend\x18\x12\x20\x01(\x0e22.hw.trezor.messages.bitcoin.DecredSt\ - akingSpendTypeR\x12decredStakingSpend\x12#\n\rscript_pubkey\x18\x13\x20\ - \x01(\x0cR\x0cscriptPubkey\x12(\n\x0ecoinjoin_flags\x18\x14\x20\x01(\r:\ - \x010R\rcoinjoinFlagsJ\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\ - \x0c\x10\r\"\xae\x03\n\x08TxOutput\x12\x18\n\x07address\x18\x01\x20\x01(\ - \tR\x07address\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12\ - \x16\n\x06amount\x18\x03\x20\x02(\x04R\x06amount\x12[\n\x0bscript_type\ - \x18\x04\x20\x01(\x0e2,.hw.trezor.messages.bitcoin.OutputScriptType:\x0c\ - PAYTOADDRESSR\nscriptType\x12P\n\x08multisig\x18\x05\x20\x01(\x0b24.hw.t\ - rezor.messages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x12$\n\x0eo\ - p_return_data\x18\x06\x20\x01(\x0cR\x0copReturnData\x12\x1b\n\torig_hash\ - \x18\n\x20\x01(\x0cR\x08origHash\x12\x1d\n\norig_index\x18\x0b\x20\x01(\ - \rR\torigIndex\x120\n\x11payment_req_index\x18\x0c\x20\x01(\rR\x0fpaymen\ - tReqIndexB\x04\xc8\xf0\x19\x01J\x04\x08\x07\x10\x08J\x04\x08\x08\x10\tJ\ - \x04\x08\t\x10\n\"\xcb\x02\n\x06PrevTx\x12\x18\n\x07version\x18\x01\x20\ - \x02(\rR\x07version\x12\x1b\n\tlock_time\x18\x04\x20\x02(\rR\x08lockTime\ - \x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\x0binputsCount\x12#\n\routpu\ - ts_count\x18\x07\x20\x02(\rR\x0coutputsCount\x12'\n\x0eextra_data_len\ - \x18\t\x20\x01(\r:\x010R\x0cextraDataLen\x12\x16\n\x06expiry\x18\n\x20\ - \x01(\rR\x06expiry\x12(\n\x10version_group_id\x18\x0c\x20\x01(\rR\x0ever\ - sionGroupId\x12\x1c\n\ttimestamp\x18\r\x20\x01(\rR\ttimestamp\x12\x1b\n\ - \tbranch_id\x18\x0e\x20\x01(\rR\x08branchIdJ\x04\x08\x02\x10\x03J\x04\ - \x08\x03\x10\x04J\x04\x08\x05\x10\x06J\x04\x08\x08\x10\tJ\x04\x08\x0b\ - \x10\x0c\"\xf7\x01\n\tPrevInput\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\ - \x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndex\ - \x12\x1d\n\nscript_sig\x18\x04\x20\x02(\x0cR\tscriptSig\x12\x1a\n\x08seq\ - uence\x18\x05\x20\x02(\rR\x08sequence\x12\x1f\n\x0bdecred_tree\x18\t\x20\ - \x01(\rR\ndecredTreeJ\x04\x08\x01\x10\x02J\x04\x08\x06\x10\x07J\x04\x08\ - \x07\x10\x08J\x04\x08\x08\x10\tJ\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\ - \x04\x08\x0c\x10\rJ\x04\x08\r\x10\x0eJ\x04\x08\x0e\x10\x0fJ\x04\x08\x0f\ - \x10\x10J\x04\x08\x10\x10\x11J\x04\x08\x11\x10\x12J\x04\x08\x12\x10\x13J\ - \x04\x08\x13\x10\x14\"}\n\nPrevOutput\x12\x16\n\x06amount\x18\x01\x20\ - \x02(\x04R\x06amount\x12#\n\rscript_pubkey\x18\x02\x20\x02(\x0cR\x0cscri\ - ptPubkey\x122\n\x15decred_script_version\x18\x03\x20\x01(\rR\x13decredSc\ - riptVersion\"\xf2\x05\n\x13TxAckPaymentRequest\x12\x14\n\x05nonce\x18\ - \x01\x20\x01(\x0cR\x05nonce\x12%\n\x0erecipient_name\x18\x02\x20\x02(\tR\ - \rrecipientName\x12X\n\x05memos\x18\x03\x20\x03(\x0b2B.hw.trezor.message\ - s.bitcoin.TxAckPaymentRequest.PaymentRequestMemoR\x05memos\x12\x16\n\x06\ - amount\x18\x04\x20\x01(\x04R\x06amount\x12\x1c\n\tsignature\x18\x05\x20\ - \x02(\x0cR\tsignature\x1a\xb8\x02\n\x12PaymentRequestMemo\x12U\n\ttext_m\ - emo\x18\x01\x20\x01(\x0b28.hw.trezor.messages.bitcoin.TxAckPaymentReques\ - t.TextMemoR\x08textMemo\x12[\n\x0brefund_memo\x18\x02\x20\x01(\x0b2:.hw.\ - trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemoR\nrefundMemo\x12n\ - \n\x12coin_purchase_memo\x18\x03\x20\x01(\x0b2@.hw.trezor.messages.bitco\ - in.TxAckPaymentRequest.CoinPurchaseMemoR\x10coinPurchaseMemo\x1a\x1e\n\ - \x08TextMemo\x12\x12\n\x04text\x18\x01\x20\x02(\tR\x04text\x1a8\n\nRefun\ - dMemo\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\x12\x10\n\x03m\ - ac\x18\x02\x20\x02(\x0cR\x03mac\x1as\n\x10CoinPurchaseMemo\x12\x1b\n\tco\ - in_type\x18\x01\x20\x02(\rR\x08coinType\x12\x16\n\x06amount\x18\x02\x20\ - \x02(\tR\x06amount\x12\x18\n\x07address\x18\x03\x20\x02(\tR\x07address\ - \x12\x10\n\x03mac\x18\x04\x20\x02(\x0cR\x03mac:\x04\x88\xb2\x19\x01\"\ - \xac\x01\n\nTxAckInput\x12H\n\x02tx\x18\x01\x20\x02(\x0b28.hw.trezor.mes\ - sages.bitcoin.TxAckInput.TxAckInputWrapperR\x02tx\x1aN\n\x11TxAckInputWr\ - apper\x129\n\x05input\x18\x02\x20\x02(\x0b2#.hw.trezor.messages.bitcoin.\ - TxInputR\x05input:\x04\x90\xb2\x19\x16\"\xb3\x01\n\x0bTxAckOutput\x12J\n\ - \x02tx\x18\x01\x20\x02(\x0b2:.hw.trezor.messages.bitcoin.TxAckOutput.TxA\ - ckOutputWrapperR\x02tx\x1aR\n\x12TxAckOutputWrapper\x12<\n\x06output\x18\ - \x05\x20\x02(\x0b2$.hw.trezor.messages.bitcoin.TxOutputR\x06output:\x04\ - \x90\xb2\x19\x16\"I\n\rTxAckPrevMeta\x122\n\x02tx\x18\x01\x20\x02(\x0b2\ - \".hw.trezor.messages.bitcoin.PrevTxR\x02tx:\x04\x90\xb2\x19\x16\"\xbe\ - \x01\n\x0eTxAckPrevInput\x12P\n\x02tx\x18\x01\x20\x02(\x0b2@.hw.trezor.m\ - essages.bitcoin.TxAckPrevInput.TxAckPrevInputWrapperR\x02tx\x1aT\n\x15Tx\ - AckPrevInputWrapper\x12;\n\x05input\x18\x02\x20\x02(\x0b2%.hw.trezor.mes\ - sages.bitcoin.PrevInputR\x05input:\x04\x90\xb2\x19\x16\"\xc5\x01\n\x0fTx\ - AckPrevOutput\x12R\n\x02tx\x18\x01\x20\x02(\x0b2B.hw.trezor.messages.bit\ - coin.TxAckPrevOutput.TxAckPrevOutputWrapperR\x02tx\x1aX\n\x16TxAckPrevOu\ - tputWrapper\x12>\n\x06output\x18\x03\x20\x02(\x0b2&.hw.trezor.messages.b\ - itcoin.PrevOutputR\x06output:\x04\x90\xb2\x19\x16\"\xbb\x01\n\x12TxAckPr\ - evExtraData\x12X\n\x02tx\x18\x01\x20\x02(\x0b2H.hw.trezor.messages.bitco\ - in.TxAckPrevExtraData.TxAckPrevExtraDataWrapperR\x02tx\x1aE\n\x19TxAckPr\ - evExtraDataWrapper\x12(\n\x10extra_data_chunk\x18\x08\x20\x02(\x0cR\x0ee\ - xtraDataChunk:\x04\x90\xb2\x19\x16\"\x88\x03\n\x11GetOwnershipProof\x12\ - \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12$\n\tcoin_name\x18\ - \x02\x20\x01(\t:\x07BitcoinR\x08coinName\x12Z\n\x0bscript_type\x18\x03\ - \x20\x01(\x0e2+.hw.trezor.messages.bitcoin.InputScriptType:\x0cSPENDWITN\ - ESSR\nscriptType\x12P\n\x08multisig\x18\x04\x20\x01(\x0b24.hw.trezor.mes\ - sages.bitcoin.MultisigRedeemScriptTypeR\x08multisig\x122\n\x11user_confi\ - rmation\x18\x05\x20\x01(\x08:\x05falseR\x10userConfirmation\x12#\n\rowne\ - rship_ids\x18\x06\x20\x03(\x0cR\x0cownershipIds\x12)\n\x0fcommitment_dat\ - a\x18\x07\x20\x01(\x0c:\0R\x0ecommitmentData\"W\n\x0eOwnershipProof\x12'\ - \n\x0fownership_proof\x18\x01\x20\x02(\x0cR\x0eownershipProof\x12\x1c\n\ - \tsignature\x18\x02\x20\x02(\x0cR\tsignature\"\xab\x03\n\x11AuthorizeCoi\ - nJoin\x12\x20\n\x0bcoordinator\x18\x01\x20\x02(\tR\x0bcoordinator\x12\ - \x1d\n\nmax_rounds\x18\x02\x20\x02(\x04R\tmaxRounds\x127\n\x18max_coordi\ - nator_fee_rate\x18\x03\x20\x02(\rR\x15maxCoordinatorFeeRate\x12+\n\x12ma\ - x_fee_per_kvbyte\x18\x04\x20\x02(\rR\x0fmaxFeePerKvbyte\x12\x1b\n\taddre\ - ss_n\x18\x05\x20\x03(\rR\x08addressN\x12$\n\tcoin_name\x18\x06\x20\x01(\ - \t:\x07BitcoinR\x08coinName\x12Z\n\x0bscript_type\x18\x07\x20\x01(\x0e2+\ - .hw.trezor.messages.bitcoin.InputScriptType:\x0cSPENDADDRESSR\nscriptTyp\ - e\x12P\n\x0bamount_unit\x18\x08\x20\x01(\x0e2&.hw.trezor.messages.bitcoi\ - n.AmountUnit:\x07BITCOINR\namountUnit*~\n\x0fInputScriptType\x12\x10\n\ - \x0cSPENDADDRESS\x10\0\x12\x11\n\rSPENDMULTISIG\x10\x01\x12\x0c\n\x08EXT\ - ERNAL\x10\x02\x12\x10\n\x0cSPENDWITNESS\x10\x03\x12\x14\n\x10SPENDP2SHWI\ - TNESS\x10\x04\x12\x10\n\x0cSPENDTAPROOT\x10\x05*\x99\x01\n\x10OutputScri\ - ptType\x12\x10\n\x0cPAYTOADDRESS\x10\0\x12\x13\n\x0fPAYTOSCRIPTHASH\x10\ - \x01\x12\x11\n\rPAYTOMULTISIG\x10\x02\x12\x11\n\rPAYTOOPRETURN\x10\x03\ - \x12\x10\n\x0cPAYTOWITNESS\x10\x04\x12\x14\n\x10PAYTOP2SHWITNESS\x10\x05\ - \x12\x10\n\x0cPAYTOTAPROOT\x10\x06*.\n\x16DecredStakingSpendType\x12\t\n\ - \x05SSGen\x10\0\x12\t\n\x05SSRTX\x10\x01*J\n\nAmountUnit\x12\x0b\n\x07BI\ - TCOIN\x10\0\x12\x10\n\x0cMILLIBITCOIN\x10\x01\x12\x10\n\x0cMICROBITCOIN\ - \x10\x02\x12\x0b\n\x07SATOSHI\x10\x03B?\n#com.satoshilabs.trezor.lib.pro\ - tobufB\x14TrezorMessageBitcoin\x80\xa6\x1d\x01\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(2); - deps.push(super::messages::file_descriptor().clone()); - deps.push(super::messages_common::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(45); - messages.push(MultisigRedeemScriptType::generated_message_descriptor_data()); - messages.push(GetPublicKey::generated_message_descriptor_data()); - messages.push(PublicKey::generated_message_descriptor_data()); - messages.push(GetAddress::generated_message_descriptor_data()); - messages.push(Address::generated_message_descriptor_data()); - messages.push(GetOwnershipId::generated_message_descriptor_data()); - messages.push(OwnershipId::generated_message_descriptor_data()); - messages.push(SignMessage::generated_message_descriptor_data()); - messages.push(MessageSignature::generated_message_descriptor_data()); - messages.push(VerifyMessage::generated_message_descriptor_data()); - messages.push(SignTx::generated_message_descriptor_data()); - messages.push(TxRequest::generated_message_descriptor_data()); - messages.push(TxAck::generated_message_descriptor_data()); - messages.push(TxInput::generated_message_descriptor_data()); - messages.push(TxOutput::generated_message_descriptor_data()); - messages.push(PrevTx::generated_message_descriptor_data()); - messages.push(PrevInput::generated_message_descriptor_data()); - messages.push(PrevOutput::generated_message_descriptor_data()); - messages.push(TxAckPaymentRequest::generated_message_descriptor_data()); - messages.push(TxAckInput::generated_message_descriptor_data()); - messages.push(TxAckOutput::generated_message_descriptor_data()); - messages.push(TxAckPrevMeta::generated_message_descriptor_data()); - messages.push(TxAckPrevInput::generated_message_descriptor_data()); - messages.push(TxAckPrevOutput::generated_message_descriptor_data()); - messages.push(TxAckPrevExtraData::generated_message_descriptor_data()); - messages.push(GetOwnershipProof::generated_message_descriptor_data()); - messages.push(OwnershipProof::generated_message_descriptor_data()); - messages.push(AuthorizeCoinJoin::generated_message_descriptor_data()); - messages.push(multisig_redeem_script_type::HDNodePathType::generated_message_descriptor_data()); - messages.push(sign_tx::CoinJoinRequest::generated_message_descriptor_data()); - messages.push(tx_request::TxRequestDetailsType::generated_message_descriptor_data()); - messages.push(tx_request::TxRequestSerializedType::generated_message_descriptor_data()); - messages.push(tx_ack::TransactionType::generated_message_descriptor_data()); - messages.push(tx_ack::transaction_type::TxInputType::generated_message_descriptor_data()); - messages.push(tx_ack::transaction_type::TxOutputBinType::generated_message_descriptor_data()); - messages.push(tx_ack::transaction_type::TxOutputType::generated_message_descriptor_data()); - messages.push(tx_ack_payment_request::PaymentRequestMemo::generated_message_descriptor_data()); - messages.push(tx_ack_payment_request::TextMemo::generated_message_descriptor_data()); - messages.push(tx_ack_payment_request::RefundMemo::generated_message_descriptor_data()); - messages.push(tx_ack_payment_request::CoinPurchaseMemo::generated_message_descriptor_data()); - messages.push(tx_ack_input::TxAckInputWrapper::generated_message_descriptor_data()); - messages.push(tx_ack_output::TxAckOutputWrapper::generated_message_descriptor_data()); - messages.push(tx_ack_prev_input::TxAckPrevInputWrapper::generated_message_descriptor_data()); - messages.push(tx_ack_prev_output::TxAckPrevOutputWrapper::generated_message_descriptor_data()); - messages.push(tx_ack_prev_extra_data::TxAckPrevExtraDataWrapper::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(5); - enums.push(InputScriptType::generated_enum_descriptor_data()); - enums.push(OutputScriptType::generated_enum_descriptor_data()); - enums.push(DecredStakingSpendType::generated_enum_descriptor_data()); - enums.push(AmountUnit::generated_enum_descriptor_data()); - enums.push(tx_request::RequestType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_bootloader.rs b/wallet/trezor-client/src/protos/generated/messages_bootloader.rs deleted file mode 100644 index c8614be41a..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_bootloader.rs +++ /dev/null @@ -1,767 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-bootloader.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.FirmwareErase) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct FirmwareErase { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareErase.length) - pub length: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.FirmwareErase.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a FirmwareErase { - fn default() -> &'a FirmwareErase { - ::default_instance() - } -} - -impl FirmwareErase { - pub fn new() -> FirmwareErase { - ::std::default::Default::default() - } - - // optional uint32 length = 1; - - pub fn length(&self) -> u32 { - self.length.unwrap_or(0) - } - - pub fn clear_length(&mut self) { - self.length = ::std::option::Option::None; - } - - pub fn has_length(&self) -> bool { - self.length.is_some() - } - - // Param is passed by value, moved - pub fn set_length(&mut self, v: u32) { - self.length = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "length", - |m: &FirmwareErase| { &m.length }, - |m: &mut FirmwareErase| { &mut m.length }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "FirmwareErase", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for FirmwareErase { - const NAME: &'static str = "FirmwareErase"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.length = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.length { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.length { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> FirmwareErase { - FirmwareErase::new() - } - - fn clear(&mut self) { - self.length = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static FirmwareErase { - static instance: FirmwareErase = FirmwareErase { - length: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for FirmwareErase { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareErase").unwrap()).clone() - } -} - -impl ::std::fmt::Display for FirmwareErase { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FirmwareErase { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.FirmwareRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct FirmwareRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareRequest.offset) - pub offset: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareRequest.length) - pub length: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.FirmwareRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a FirmwareRequest { - fn default() -> &'a FirmwareRequest { - ::default_instance() - } -} - -impl FirmwareRequest { - pub fn new() -> FirmwareRequest { - ::std::default::Default::default() - } - - // required uint32 offset = 1; - - pub fn offset(&self) -> u32 { - self.offset.unwrap_or(0) - } - - pub fn clear_offset(&mut self) { - self.offset = ::std::option::Option::None; - } - - pub fn has_offset(&self) -> bool { - self.offset.is_some() - } - - // Param is passed by value, moved - pub fn set_offset(&mut self, v: u32) { - self.offset = ::std::option::Option::Some(v); - } - - // required uint32 length = 2; - - pub fn length(&self) -> u32 { - self.length.unwrap_or(0) - } - - pub fn clear_length(&mut self) { - self.length = ::std::option::Option::None; - } - - pub fn has_length(&self) -> bool { - self.length.is_some() - } - - // Param is passed by value, moved - pub fn set_length(&mut self, v: u32) { - self.length = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "offset", - |m: &FirmwareRequest| { &m.offset }, - |m: &mut FirmwareRequest| { &mut m.offset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "length", - |m: &FirmwareRequest| { &m.length }, - |m: &mut FirmwareRequest| { &mut m.length }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "FirmwareRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for FirmwareRequest { - const NAME: &'static str = "FirmwareRequest"; - - fn is_initialized(&self) -> bool { - if self.offset.is_none() { - return false; - } - if self.length.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.offset = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.length = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.offset { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.length { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.offset { - os.write_uint32(1, v)?; - } - if let Some(v) = self.length { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> FirmwareRequest { - FirmwareRequest::new() - } - - fn clear(&mut self) { - self.offset = ::std::option::Option::None; - self.length = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static FirmwareRequest { - static instance: FirmwareRequest = FirmwareRequest { - offset: ::std::option::Option::None, - length: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for FirmwareRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for FirmwareRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FirmwareRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.FirmwareUpload) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct FirmwareUpload { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareUpload.payload) - pub payload: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.FirmwareUpload.hash) - pub hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.FirmwareUpload.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a FirmwareUpload { - fn default() -> &'a FirmwareUpload { - ::default_instance() - } -} - -impl FirmwareUpload { - pub fn new() -> FirmwareUpload { - ::std::default::Default::default() - } - - // required bytes payload = 1; - - pub fn payload(&self) -> &[u8] { - match self.payload.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_payload(&mut self) { - self.payload = ::std::option::Option::None; - } - - pub fn has_payload(&self) -> bool { - self.payload.is_some() - } - - // Param is passed by value, moved - pub fn set_payload(&mut self, v: ::std::vec::Vec) { - self.payload = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { - if self.payload.is_none() { - self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.payload.as_mut().unwrap() - } - - // Take field - pub fn take_payload(&mut self) -> ::std::vec::Vec { - self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes hash = 2; - - pub fn hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payload", - |m: &FirmwareUpload| { &m.payload }, - |m: &mut FirmwareUpload| { &mut m.payload }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hash", - |m: &FirmwareUpload| { &m.hash }, - |m: &mut FirmwareUpload| { &mut m.hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "FirmwareUpload", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for FirmwareUpload { - const NAME: &'static str = "FirmwareUpload"; - - fn is_initialized(&self) -> bool { - if self.payload.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.payload = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.payload.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.payload.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.hash.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> FirmwareUpload { - FirmwareUpload::new() - } - - fn clear(&mut self) { - self.payload = ::std::option::Option::None; - self.hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static FirmwareUpload { - static instance: FirmwareUpload = FirmwareUpload { - payload: ::std::option::Option::None, - hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for FirmwareUpload { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareUpload").unwrap()).clone() - } -} - -impl ::std::fmt::Display for FirmwareUpload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FirmwareUpload { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.bootloader.ProdTestT1) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ProdTestT1 { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.bootloader.ProdTestT1.payload) - pub payload: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.bootloader.ProdTestT1.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ProdTestT1 { - fn default() -> &'a ProdTestT1 { - ::default_instance() - } -} - -impl ProdTestT1 { - pub fn new() -> ProdTestT1 { - ::std::default::Default::default() - } - - // optional bytes payload = 1; - - pub fn payload(&self) -> &[u8] { - match self.payload.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_payload(&mut self) { - self.payload = ::std::option::Option::None; - } - - pub fn has_payload(&self) -> bool { - self.payload.is_some() - } - - // Param is passed by value, moved - pub fn set_payload(&mut self, v: ::std::vec::Vec) { - self.payload = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { - if self.payload.is_none() { - self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.payload.as_mut().unwrap() - } - - // Take field - pub fn take_payload(&mut self) -> ::std::vec::Vec { - self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payload", - |m: &ProdTestT1| { &m.payload }, - |m: &mut ProdTestT1| { &mut m.payload }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ProdTestT1", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ProdTestT1 { - const NAME: &'static str = "ProdTestT1"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.payload = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.payload.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.payload.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ProdTestT1 { - ProdTestT1::new() - } - - fn clear(&mut self) { - self.payload = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ProdTestT1 { - static instance: ProdTestT1 = ProdTestT1 { - payload: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ProdTestT1 { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ProdTestT1").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ProdTestT1 { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ProdTestT1 { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x19messages-bootloader.proto\x12\x1dhw.trezor.messages.bootloader\"'\ - \n\rFirmwareErase\x12\x16\n\x06length\x18\x01\x20\x01(\rR\x06length\"A\n\ - \x0fFirmwareRequest\x12\x16\n\x06offset\x18\x01\x20\x02(\rR\x06offset\ - \x12\x16\n\x06length\x18\x02\x20\x02(\rR\x06length\">\n\x0eFirmwareUploa\ - d\x12\x18\n\x07payload\x18\x01\x20\x02(\x0cR\x07payload\x12\x12\n\x04has\ - h\x18\x02\x20\x01(\x0cR\x04hash\"&\n\nProdTestT1\x12\x18\n\x07payload\ - \x18\x01\x20\x01(\x0cR\x07payloadB>\n#com.satoshilabs.trezor.lib.protobu\ - fB\x17TrezorMessageBootloader\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(4); - messages.push(FirmwareErase::generated_message_descriptor_data()); - messages.push(FirmwareRequest::generated_message_descriptor_data()); - messages.push(FirmwareUpload::generated_message_descriptor_data()); - messages.push(ProdTestT1::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_cardano.rs b/wallet/trezor-client/src/protos/generated/messages_cardano.rs deleted file mode 100644 index eebc579b05..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_cardano.rs +++ /dev/null @@ -1,10240 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-cardano.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoBlockchainPointerType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoBlockchainPointerType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.block_index) - pub block_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.tx_index) - pub tx_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.certificate_index) - pub certificate_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoBlockchainPointerType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoBlockchainPointerType { - fn default() -> &'a CardanoBlockchainPointerType { - ::default_instance() - } -} - -impl CardanoBlockchainPointerType { - pub fn new() -> CardanoBlockchainPointerType { - ::std::default::Default::default() - } - - // required uint32 block_index = 1; - - pub fn block_index(&self) -> u32 { - self.block_index.unwrap_or(0) - } - - pub fn clear_block_index(&mut self) { - self.block_index = ::std::option::Option::None; - } - - pub fn has_block_index(&self) -> bool { - self.block_index.is_some() - } - - // Param is passed by value, moved - pub fn set_block_index(&mut self, v: u32) { - self.block_index = ::std::option::Option::Some(v); - } - - // required uint32 tx_index = 2; - - pub fn tx_index(&self) -> u32 { - self.tx_index.unwrap_or(0) - } - - pub fn clear_tx_index(&mut self) { - self.tx_index = ::std::option::Option::None; - } - - pub fn has_tx_index(&self) -> bool { - self.tx_index.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_index(&mut self, v: u32) { - self.tx_index = ::std::option::Option::Some(v); - } - - // required uint32 certificate_index = 3; - - pub fn certificate_index(&self) -> u32 { - self.certificate_index.unwrap_or(0) - } - - pub fn clear_certificate_index(&mut self) { - self.certificate_index = ::std::option::Option::None; - } - - pub fn has_certificate_index(&self) -> bool { - self.certificate_index.is_some() - } - - // Param is passed by value, moved - pub fn set_certificate_index(&mut self, v: u32) { - self.certificate_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "block_index", - |m: &CardanoBlockchainPointerType| { &m.block_index }, - |m: &mut CardanoBlockchainPointerType| { &mut m.block_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_index", - |m: &CardanoBlockchainPointerType| { &m.tx_index }, - |m: &mut CardanoBlockchainPointerType| { &mut m.tx_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "certificate_index", - |m: &CardanoBlockchainPointerType| { &m.certificate_index }, - |m: &mut CardanoBlockchainPointerType| { &mut m.certificate_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoBlockchainPointerType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoBlockchainPointerType { - const NAME: &'static str = "CardanoBlockchainPointerType"; - - fn is_initialized(&self) -> bool { - if self.block_index.is_none() { - return false; - } - if self.tx_index.is_none() { - return false; - } - if self.certificate_index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.block_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.tx_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.certificate_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.block_index { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.tx_index { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.certificate_index { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.block_index { - os.write_uint32(1, v)?; - } - if let Some(v) = self.tx_index { - os.write_uint32(2, v)?; - } - if let Some(v) = self.certificate_index { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoBlockchainPointerType { - CardanoBlockchainPointerType::new() - } - - fn clear(&mut self) { - self.block_index = ::std::option::Option::None; - self.tx_index = ::std::option::Option::None; - self.certificate_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoBlockchainPointerType { - static instance: CardanoBlockchainPointerType = CardanoBlockchainPointerType { - block_index: ::std::option::Option::None, - tx_index: ::std::option::Option::None, - certificate_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoBlockchainPointerType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoBlockchainPointerType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoBlockchainPointerType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoBlockchainPointerType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoNativeScript) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoNativeScript { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.scripts) - pub scripts: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.key_hash) - pub key_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.key_path) - pub key_path: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.required_signatures_count) - pub required_signatures_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.invalid_before) - pub invalid_before: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScript.invalid_hereafter) - pub invalid_hereafter: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoNativeScript.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoNativeScript { - fn default() -> &'a CardanoNativeScript { - ::default_instance() - } -} - -impl CardanoNativeScript { - pub fn new() -> CardanoNativeScript { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoNativeScriptType type = 1; - - pub fn type_(&self) -> CardanoNativeScriptType { - match self.type_ { - Some(e) => e.enum_value_or(CardanoNativeScriptType::PUB_KEY), - None => CardanoNativeScriptType::PUB_KEY, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: CardanoNativeScriptType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes key_hash = 3; - - pub fn key_hash(&self) -> &[u8] { - match self.key_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_key_hash(&mut self) { - self.key_hash = ::std::option::Option::None; - } - - pub fn has_key_hash(&self) -> bool { - self.key_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { - self.key_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { - if self.key_hash.is_none() { - self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.key_hash.as_mut().unwrap() - } - - // Take field - pub fn take_key_hash(&mut self) -> ::std::vec::Vec { - self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 required_signatures_count = 5; - - pub fn required_signatures_count(&self) -> u32 { - self.required_signatures_count.unwrap_or(0) - } - - pub fn clear_required_signatures_count(&mut self) { - self.required_signatures_count = ::std::option::Option::None; - } - - pub fn has_required_signatures_count(&self) -> bool { - self.required_signatures_count.is_some() - } - - // Param is passed by value, moved - pub fn set_required_signatures_count(&mut self, v: u32) { - self.required_signatures_count = ::std::option::Option::Some(v); - } - - // optional uint64 invalid_before = 6; - - pub fn invalid_before(&self) -> u64 { - self.invalid_before.unwrap_or(0) - } - - pub fn clear_invalid_before(&mut self) { - self.invalid_before = ::std::option::Option::None; - } - - pub fn has_invalid_before(&self) -> bool { - self.invalid_before.is_some() - } - - // Param is passed by value, moved - pub fn set_invalid_before(&mut self, v: u64) { - self.invalid_before = ::std::option::Option::Some(v); - } - - // optional uint64 invalid_hereafter = 7; - - pub fn invalid_hereafter(&self) -> u64 { - self.invalid_hereafter.unwrap_or(0) - } - - pub fn clear_invalid_hereafter(&mut self) { - self.invalid_hereafter = ::std::option::Option::None; - } - - pub fn has_invalid_hereafter(&self) -> bool { - self.invalid_hereafter.is_some() - } - - // Param is passed by value, moved - pub fn set_invalid_hereafter(&mut self, v: u64) { - self.invalid_hereafter = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &CardanoNativeScript| { &m.type_ }, - |m: &mut CardanoNativeScript| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "scripts", - |m: &CardanoNativeScript| { &m.scripts }, - |m: &mut CardanoNativeScript| { &mut m.scripts }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key_hash", - |m: &CardanoNativeScript| { &m.key_hash }, - |m: &mut CardanoNativeScript| { &mut m.key_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "key_path", - |m: &CardanoNativeScript| { &m.key_path }, - |m: &mut CardanoNativeScript| { &mut m.key_path }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "required_signatures_count", - |m: &CardanoNativeScript| { &m.required_signatures_count }, - |m: &mut CardanoNativeScript| { &mut m.required_signatures_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "invalid_before", - |m: &CardanoNativeScript| { &m.invalid_before }, - |m: &mut CardanoNativeScript| { &mut m.invalid_before }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "invalid_hereafter", - |m: &CardanoNativeScript| { &m.invalid_hereafter }, - |m: &mut CardanoNativeScript| { &mut m.invalid_hereafter }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoNativeScript", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoNativeScript { - const NAME: &'static str = "CardanoNativeScript"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - for v in &self.scripts { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.scripts.push(is.read_message()?); - }, - 26 => { - self.key_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - is.read_repeated_packed_uint32_into(&mut self.key_path)?; - }, - 32 => { - self.key_path.push(is.read_uint32()?); - }, - 40 => { - self.required_signatures_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.invalid_before = ::std::option::Option::Some(is.read_uint64()?); - }, - 56 => { - self.invalid_hereafter = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - for value in &self.scripts { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.key_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - for value in &self.key_path { - my_size += ::protobuf::rt::uint32_size(4, *value); - }; - if let Some(v) = self.required_signatures_count { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.invalid_before { - my_size += ::protobuf::rt::uint64_size(6, v); - } - if let Some(v) = self.invalid_hereafter { - my_size += ::protobuf::rt::uint64_size(7, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - for v in &self.scripts { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - if let Some(v) = self.key_hash.as_ref() { - os.write_bytes(3, v)?; - } - for v in &self.key_path { - os.write_uint32(4, *v)?; - }; - if let Some(v) = self.required_signatures_count { - os.write_uint32(5, v)?; - } - if let Some(v) = self.invalid_before { - os.write_uint64(6, v)?; - } - if let Some(v) = self.invalid_hereafter { - os.write_uint64(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoNativeScript { - CardanoNativeScript::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.scripts.clear(); - self.key_hash = ::std::option::Option::None; - self.key_path.clear(); - self.required_signatures_count = ::std::option::Option::None; - self.invalid_before = ::std::option::Option::None; - self.invalid_hereafter = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoNativeScript { - static instance: CardanoNativeScript = CardanoNativeScript { - type_: ::std::option::Option::None, - scripts: ::std::vec::Vec::new(), - key_hash: ::std::option::Option::None, - key_path: ::std::vec::Vec::new(), - required_signatures_count: ::std::option::Option::None, - invalid_before: ::std::option::Option::None, - invalid_hereafter: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoNativeScript { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoNativeScript").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoNativeScript { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoNativeScript { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoGetNativeScriptHash) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoGetNativeScriptHash { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.script) - pub script: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.display_format) - pub display_format: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.derivation_type) - pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoGetNativeScriptHash.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoGetNativeScriptHash { - fn default() -> &'a CardanoGetNativeScriptHash { - ::default_instance() - } -} - -impl CardanoGetNativeScriptHash { - pub fn new() -> CardanoGetNativeScriptHash { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat display_format = 2; - - pub fn display_format(&self) -> CardanoNativeScriptHashDisplayFormat { - match self.display_format { - Some(e) => e.enum_value_or(CardanoNativeScriptHashDisplayFormat::HIDE), - None => CardanoNativeScriptHashDisplayFormat::HIDE, - } - } - - pub fn clear_display_format(&mut self) { - self.display_format = ::std::option::Option::None; - } - - pub fn has_display_format(&self) -> bool { - self.display_format.is_some() - } - - // Param is passed by value, moved - pub fn set_display_format(&mut self, v: CardanoNativeScriptHashDisplayFormat) { - self.display_format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 3; - - pub fn derivation_type(&self) -> CardanoDerivationType { - match self.derivation_type { - Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), - None => CardanoDerivationType::LEDGER, - } - } - - pub fn clear_derivation_type(&mut self) { - self.derivation_type = ::std::option::Option::None; - } - - pub fn has_derivation_type(&self) -> bool { - self.derivation_type.is_some() - } - - // Param is passed by value, moved - pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { - self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoNativeScript>( - "script", - |m: &CardanoGetNativeScriptHash| { &m.script }, - |m: &mut CardanoGetNativeScriptHash| { &mut m.script }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "display_format", - |m: &CardanoGetNativeScriptHash| { &m.display_format }, - |m: &mut CardanoGetNativeScriptHash| { &mut m.display_format }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "derivation_type", - |m: &CardanoGetNativeScriptHash| { &m.derivation_type }, - |m: &mut CardanoGetNativeScriptHash| { &mut m.derivation_type }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoGetNativeScriptHash", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoGetNativeScriptHash { - const NAME: &'static str = "CardanoGetNativeScriptHash"; - - fn is_initialized(&self) -> bool { - if self.script.is_none() { - return false; - } - if self.display_format.is_none() { - return false; - } - if self.derivation_type.is_none() { - return false; - } - for v in &self.script { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.script)?; - }, - 16 => { - self.display_format = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 24 => { - self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.script.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.display_format { - my_size += ::protobuf::rt::int32_size(2, v.value()); - } - if let Some(v) = self.derivation_type { - my_size += ::protobuf::rt::int32_size(3, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.script.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.display_format { - os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.derivation_type { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoGetNativeScriptHash { - CardanoGetNativeScriptHash::new() - } - - fn clear(&mut self) { - self.script.clear(); - self.display_format = ::std::option::Option::None; - self.derivation_type = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoGetNativeScriptHash { - static instance: CardanoGetNativeScriptHash = CardanoGetNativeScriptHash { - script: ::protobuf::MessageField::none(), - display_format: ::std::option::Option::None, - derivation_type: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoGetNativeScriptHash { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoGetNativeScriptHash").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoGetNativeScriptHash { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoGetNativeScriptHash { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoNativeScriptHash) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoNativeScriptHash { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoNativeScriptHash.script_hash) - pub script_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoNativeScriptHash.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoNativeScriptHash { - fn default() -> &'a CardanoNativeScriptHash { - ::default_instance() - } -} - -impl CardanoNativeScriptHash { - pub fn new() -> CardanoNativeScriptHash { - ::std::default::Default::default() - } - - // required bytes script_hash = 1; - - pub fn script_hash(&self) -> &[u8] { - match self.script_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_hash(&mut self) { - self.script_hash = ::std::option::Option::None; - } - - pub fn has_script_hash(&self) -> bool { - self.script_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_script_hash(&mut self, v: ::std::vec::Vec) { - self.script_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_hash(&mut self) -> &mut ::std::vec::Vec { - if self.script_hash.is_none() { - self.script_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_hash.as_mut().unwrap() - } - - // Take field - pub fn take_script_hash(&mut self) -> ::std::vec::Vec { - self.script_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_hash", - |m: &CardanoNativeScriptHash| { &m.script_hash }, - |m: &mut CardanoNativeScriptHash| { &mut m.script_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoNativeScriptHash", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoNativeScriptHash { - const NAME: &'static str = "CardanoNativeScriptHash"; - - fn is_initialized(&self) -> bool { - if self.script_hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.script_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.script_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.script_hash.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoNativeScriptHash { - CardanoNativeScriptHash::new() - } - - fn clear(&mut self) { - self.script_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoNativeScriptHash { - static instance: CardanoNativeScriptHash = CardanoNativeScriptHash { - script_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoNativeScriptHash { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoNativeScriptHash").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoNativeScriptHash { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoNativeScriptHash { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoAddressParametersType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoAddressParametersType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.address_type) - pub address_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.address_n_staking) - pub address_n_staking: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.staking_key_hash) - pub staking_key_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.certificate_pointer) - pub certificate_pointer: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.script_payment_hash) - pub script_payment_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddressParametersType.script_staking_hash) - pub script_staking_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoAddressParametersType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoAddressParametersType { - fn default() -> &'a CardanoAddressParametersType { - ::default_instance() - } -} - -impl CardanoAddressParametersType { - pub fn new() -> CardanoAddressParametersType { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoAddressType address_type = 1; - - pub fn address_type(&self) -> CardanoAddressType { - match self.address_type { - Some(e) => e.enum_value_or(CardanoAddressType::BASE), - None => CardanoAddressType::BASE, - } - } - - pub fn clear_address_type(&mut self) { - self.address_type = ::std::option::Option::None; - } - - pub fn has_address_type(&self) -> bool { - self.address_type.is_some() - } - - // Param is passed by value, moved - pub fn set_address_type(&mut self, v: CardanoAddressType) { - self.address_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes staking_key_hash = 4; - - pub fn staking_key_hash(&self) -> &[u8] { - match self.staking_key_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_staking_key_hash(&mut self) { - self.staking_key_hash = ::std::option::Option::None; - } - - pub fn has_staking_key_hash(&self) -> bool { - self.staking_key_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_staking_key_hash(&mut self, v: ::std::vec::Vec) { - self.staking_key_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_staking_key_hash(&mut self) -> &mut ::std::vec::Vec { - if self.staking_key_hash.is_none() { - self.staking_key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.staking_key_hash.as_mut().unwrap() - } - - // Take field - pub fn take_staking_key_hash(&mut self) -> ::std::vec::Vec { - self.staking_key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes script_payment_hash = 6; - - pub fn script_payment_hash(&self) -> &[u8] { - match self.script_payment_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_payment_hash(&mut self) { - self.script_payment_hash = ::std::option::Option::None; - } - - pub fn has_script_payment_hash(&self) -> bool { - self.script_payment_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_script_payment_hash(&mut self, v: ::std::vec::Vec) { - self.script_payment_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_payment_hash(&mut self) -> &mut ::std::vec::Vec { - if self.script_payment_hash.is_none() { - self.script_payment_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_payment_hash.as_mut().unwrap() - } - - // Take field - pub fn take_script_payment_hash(&mut self) -> ::std::vec::Vec { - self.script_payment_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes script_staking_hash = 7; - - pub fn script_staking_hash(&self) -> &[u8] { - match self.script_staking_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_staking_hash(&mut self) { - self.script_staking_hash = ::std::option::Option::None; - } - - pub fn has_script_staking_hash(&self) -> bool { - self.script_staking_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_script_staking_hash(&mut self, v: ::std::vec::Vec) { - self.script_staking_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_staking_hash(&mut self) -> &mut ::std::vec::Vec { - if self.script_staking_hash.is_none() { - self.script_staking_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_staking_hash.as_mut().unwrap() - } - - // Take field - pub fn take_script_staking_hash(&mut self) -> ::std::vec::Vec { - self.script_staking_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address_type", - |m: &CardanoAddressParametersType| { &m.address_type }, - |m: &mut CardanoAddressParametersType| { &mut m.address_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &CardanoAddressParametersType| { &m.address_n }, - |m: &mut CardanoAddressParametersType| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n_staking", - |m: &CardanoAddressParametersType| { &m.address_n_staking }, - |m: &mut CardanoAddressParametersType| { &mut m.address_n_staking }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "staking_key_hash", - |m: &CardanoAddressParametersType| { &m.staking_key_hash }, - |m: &mut CardanoAddressParametersType| { &mut m.staking_key_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoBlockchainPointerType>( - "certificate_pointer", - |m: &CardanoAddressParametersType| { &m.certificate_pointer }, - |m: &mut CardanoAddressParametersType| { &mut m.certificate_pointer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_payment_hash", - |m: &CardanoAddressParametersType| { &m.script_payment_hash }, - |m: &mut CardanoAddressParametersType| { &mut m.script_payment_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_staking_hash", - |m: &CardanoAddressParametersType| { &m.script_staking_hash }, - |m: &mut CardanoAddressParametersType| { &mut m.script_staking_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoAddressParametersType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoAddressParametersType { - const NAME: &'static str = "CardanoAddressParametersType"; - - fn is_initialized(&self) -> bool { - if self.address_type.is_none() { - return false; - } - for v in &self.certificate_pointer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.address_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 26 => { - is.read_repeated_packed_uint32_into(&mut self.address_n_staking)?; - }, - 24 => { - self.address_n_staking.push(is.read_uint32()?); - }, - 34 => { - self.staking_key_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.certificate_pointer)?; - }, - 50 => { - self.script_payment_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 58 => { - self.script_staking_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address_type { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - for value in &self.address_n_staking { - my_size += ::protobuf::rt::uint32_size(3, *value); - }; - if let Some(v) = self.staking_key_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.certificate_pointer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.script_payment_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.script_staking_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address_type { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; - for v in &self.address_n_staking { - os.write_uint32(3, *v)?; - }; - if let Some(v) = self.staking_key_hash.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.certificate_pointer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.script_payment_hash.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.script_staking_hash.as_ref() { - os.write_bytes(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoAddressParametersType { - CardanoAddressParametersType::new() - } - - fn clear(&mut self) { - self.address_type = ::std::option::Option::None; - self.address_n.clear(); - self.address_n_staking.clear(); - self.staking_key_hash = ::std::option::Option::None; - self.certificate_pointer.clear(); - self.script_payment_hash = ::std::option::Option::None; - self.script_staking_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoAddressParametersType { - static instance: CardanoAddressParametersType = CardanoAddressParametersType { - address_type: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - address_n_staking: ::std::vec::Vec::new(), - staking_key_hash: ::std::option::Option::None, - certificate_pointer: ::protobuf::MessageField::none(), - script_payment_hash: ::std::option::Option::None, - script_staking_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoAddressParametersType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoAddressParametersType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoAddressParametersType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoAddressParametersType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.protocol_magic) - pub protocol_magic: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.network_id) - pub network_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.address_parameters) - pub address_parameters: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.derivation_type) - pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoGetAddress { - fn default() -> &'a CardanoGetAddress { - ::default_instance() - } -} - -impl CardanoGetAddress { - pub fn new() -> CardanoGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // required uint32 protocol_magic = 3; - - pub fn protocol_magic(&self) -> u32 { - self.protocol_magic.unwrap_or(0) - } - - pub fn clear_protocol_magic(&mut self) { - self.protocol_magic = ::std::option::Option::None; - } - - pub fn has_protocol_magic(&self) -> bool { - self.protocol_magic.is_some() - } - - // Param is passed by value, moved - pub fn set_protocol_magic(&mut self, v: u32) { - self.protocol_magic = ::std::option::Option::Some(v); - } - - // required uint32 network_id = 4; - - pub fn network_id(&self) -> u32 { - self.network_id.unwrap_or(0) - } - - pub fn clear_network_id(&mut self) { - self.network_id = ::std::option::Option::None; - } - - pub fn has_network_id(&self) -> bool { - self.network_id.is_some() - } - - // Param is passed by value, moved - pub fn set_network_id(&mut self, v: u32) { - self.network_id = ::std::option::Option::Some(v); - } - - // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 6; - - pub fn derivation_type(&self) -> CardanoDerivationType { - match self.derivation_type { - Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), - None => CardanoDerivationType::LEDGER, - } - } - - pub fn clear_derivation_type(&mut self) { - self.derivation_type = ::std::option::Option::None; - } - - pub fn has_derivation_type(&self) -> bool { - self.derivation_type.is_some() - } - - // Param is passed by value, moved - pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { - self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool chunkify = 7; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &CardanoGetAddress| { &m.show_display }, - |m: &mut CardanoGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "protocol_magic", - |m: &CardanoGetAddress| { &m.protocol_magic }, - |m: &mut CardanoGetAddress| { &mut m.protocol_magic }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_id", - |m: &CardanoGetAddress| { &m.network_id }, - |m: &mut CardanoGetAddress| { &mut m.network_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoAddressParametersType>( - "address_parameters", - |m: &CardanoGetAddress| { &m.address_parameters }, - |m: &mut CardanoGetAddress| { &mut m.address_parameters }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "derivation_type", - |m: &CardanoGetAddress| { &m.derivation_type }, - |m: &mut CardanoGetAddress| { &mut m.derivation_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &CardanoGetAddress| { &m.chunkify }, - |m: &mut CardanoGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoGetAddress { - const NAME: &'static str = "CardanoGetAddress"; - - fn is_initialized(&self) -> bool { - if self.protocol_magic.is_none() { - return false; - } - if self.network_id.is_none() { - return false; - } - if self.address_parameters.is_none() { - return false; - } - if self.derivation_type.is_none() { - return false; - } - for v in &self.address_parameters { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.protocol_magic = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.network_id = ::std::option::Option::Some(is.read_uint32()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.address_parameters)?; - }, - 48 => { - self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 56 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.protocol_magic { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.network_id { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.address_parameters.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.derivation_type { - my_size += ::protobuf::rt::int32_size(6, v.value()); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.protocol_magic { - os.write_uint32(3, v)?; - } - if let Some(v) = self.network_id { - os.write_uint32(4, v)?; - } - if let Some(v) = self.address_parameters.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.derivation_type { - os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.chunkify { - os.write_bool(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoGetAddress { - CardanoGetAddress::new() - } - - fn clear(&mut self) { - self.show_display = ::std::option::Option::None; - self.protocol_magic = ::std::option::Option::None; - self.network_id = ::std::option::Option::None; - self.address_parameters.clear(); - self.derivation_type = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoGetAddress { - static instance: CardanoGetAddress = CardanoGetAddress { - show_display: ::std::option::Option::None, - protocol_magic: ::std::option::Option::None, - network_id: ::std::option::Option::None, - address_parameters: ::protobuf::MessageField::none(), - derivation_type: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoAddress { - fn default() -> &'a CardanoAddress { - ::default_instance() - } -} - -impl CardanoAddress { - pub fn new() -> CardanoAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &CardanoAddress| { &m.address }, - |m: &mut CardanoAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoAddress { - const NAME: &'static str = "CardanoAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoAddress { - CardanoAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoAddress { - static instance: CardanoAddress = CardanoAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoGetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoGetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetPublicKey.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoGetPublicKey.derivation_type) - pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoGetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoGetPublicKey { - fn default() -> &'a CardanoGetPublicKey { - ::default_instance() - } -} - -impl CardanoGetPublicKey { - pub fn new() -> CardanoGetPublicKey { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 3; - - pub fn derivation_type(&self) -> CardanoDerivationType { - match self.derivation_type { - Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), - None => CardanoDerivationType::LEDGER, - } - } - - pub fn clear_derivation_type(&mut self) { - self.derivation_type = ::std::option::Option::None; - } - - pub fn has_derivation_type(&self) -> bool { - self.derivation_type.is_some() - } - - // Param is passed by value, moved - pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { - self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &CardanoGetPublicKey| { &m.address_n }, - |m: &mut CardanoGetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &CardanoGetPublicKey| { &m.show_display }, - |m: &mut CardanoGetPublicKey| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "derivation_type", - |m: &CardanoGetPublicKey| { &m.derivation_type }, - |m: &mut CardanoGetPublicKey| { &mut m.derivation_type }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoGetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoGetPublicKey { - const NAME: &'static str = "CardanoGetPublicKey"; - - fn is_initialized(&self) -> bool { - if self.derivation_type.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.derivation_type { - my_size += ::protobuf::rt::int32_size(3, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.derivation_type { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoGetPublicKey { - CardanoGetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.derivation_type = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoGetPublicKey { - static instance: CardanoGetPublicKey = CardanoGetPublicKey { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - derivation_type: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoGetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoGetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoGetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoGetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPublicKey.xpub) - pub xpub: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPublicKey.node) - pub node: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoPublicKey { - fn default() -> &'a CardanoPublicKey { - ::default_instance() - } -} - -impl CardanoPublicKey { - pub fn new() -> CardanoPublicKey { - ::std::default::Default::default() - } - - // required string xpub = 1; - - pub fn xpub(&self) -> &str { - match self.xpub.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_xpub(&mut self) { - self.xpub = ::std::option::Option::None; - } - - pub fn has_xpub(&self) -> bool { - self.xpub.is_some() - } - - // Param is passed by value, moved - pub fn set_xpub(&mut self, v: ::std::string::String) { - self.xpub = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_xpub(&mut self) -> &mut ::std::string::String { - if self.xpub.is_none() { - self.xpub = ::std::option::Option::Some(::std::string::String::new()); - } - self.xpub.as_mut().unwrap() - } - - // Take field - pub fn take_xpub(&mut self) -> ::std::string::String { - self.xpub.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "xpub", - |m: &CardanoPublicKey| { &m.xpub }, - |m: &mut CardanoPublicKey| { &mut m.xpub }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( - "node", - |m: &CardanoPublicKey| { &m.node }, - |m: &mut CardanoPublicKey| { &mut m.node }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoPublicKey { - const NAME: &'static str = "CardanoPublicKey"; - - fn is_initialized(&self) -> bool { - if self.xpub.is_none() { - return false; - } - if self.node.is_none() { - return false; - } - for v in &self.node { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.xpub = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.xpub.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.node.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.xpub.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.node.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoPublicKey { - CardanoPublicKey::new() - } - - fn clear(&mut self) { - self.xpub = ::std::option::Option::None; - self.node.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoPublicKey { - static instance: CardanoPublicKey = CardanoPublicKey { - xpub: ::std::option::Option::None, - node: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoSignTxInit) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoSignTxInit { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.signing_mode) - pub signing_mode: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.protocol_magic) - pub protocol_magic: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.network_id) - pub network_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.inputs_count) - pub inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.outputs_count) - pub outputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.ttl) - pub ttl: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.certificates_count) - pub certificates_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.withdrawals_count) - pub withdrawals_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.has_auxiliary_data) - pub has_auxiliary_data: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.validity_interval_start) - pub validity_interval_start: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.witness_requests_count) - pub witness_requests_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.minting_asset_groups_count) - pub minting_asset_groups_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.derivation_type) - pub derivation_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.include_network_id) - pub include_network_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.script_data_hash) - pub script_data_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.collateral_inputs_count) - pub collateral_inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.required_signers_count) - pub required_signers_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.has_collateral_return) - pub has_collateral_return: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.total_collateral) - pub total_collateral: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.reference_inputs_count) - pub reference_inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoSignTxInit.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoSignTxInit.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoSignTxInit { - fn default() -> &'a CardanoSignTxInit { - ::default_instance() - } -} - -impl CardanoSignTxInit { - pub fn new() -> CardanoSignTxInit { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoTxSigningMode signing_mode = 1; - - pub fn signing_mode(&self) -> CardanoTxSigningMode { - match self.signing_mode { - Some(e) => e.enum_value_or(CardanoTxSigningMode::ORDINARY_TRANSACTION), - None => CardanoTxSigningMode::ORDINARY_TRANSACTION, - } - } - - pub fn clear_signing_mode(&mut self) { - self.signing_mode = ::std::option::Option::None; - } - - pub fn has_signing_mode(&self) -> bool { - self.signing_mode.is_some() - } - - // Param is passed by value, moved - pub fn set_signing_mode(&mut self, v: CardanoTxSigningMode) { - self.signing_mode = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required uint32 protocol_magic = 2; - - pub fn protocol_magic(&self) -> u32 { - self.protocol_magic.unwrap_or(0) - } - - pub fn clear_protocol_magic(&mut self) { - self.protocol_magic = ::std::option::Option::None; - } - - pub fn has_protocol_magic(&self) -> bool { - self.protocol_magic.is_some() - } - - // Param is passed by value, moved - pub fn set_protocol_magic(&mut self, v: u32) { - self.protocol_magic = ::std::option::Option::Some(v); - } - - // required uint32 network_id = 3; - - pub fn network_id(&self) -> u32 { - self.network_id.unwrap_or(0) - } - - pub fn clear_network_id(&mut self) { - self.network_id = ::std::option::Option::None; - } - - pub fn has_network_id(&self) -> bool { - self.network_id.is_some() - } - - // Param is passed by value, moved - pub fn set_network_id(&mut self, v: u32) { - self.network_id = ::std::option::Option::Some(v); - } - - // required uint32 inputs_count = 4; - - pub fn inputs_count(&self) -> u32 { - self.inputs_count.unwrap_or(0) - } - - pub fn clear_inputs_count(&mut self) { - self.inputs_count = ::std::option::Option::None; - } - - pub fn has_inputs_count(&self) -> bool { - self.inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_inputs_count(&mut self, v: u32) { - self.inputs_count = ::std::option::Option::Some(v); - } - - // required uint32 outputs_count = 5; - - pub fn outputs_count(&self) -> u32 { - self.outputs_count.unwrap_or(0) - } - - pub fn clear_outputs_count(&mut self) { - self.outputs_count = ::std::option::Option::None; - } - - pub fn has_outputs_count(&self) -> bool { - self.outputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_outputs_count(&mut self, v: u32) { - self.outputs_count = ::std::option::Option::Some(v); - } - - // required uint64 fee = 6; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // optional uint64 ttl = 7; - - pub fn ttl(&self) -> u64 { - self.ttl.unwrap_or(0) - } - - pub fn clear_ttl(&mut self) { - self.ttl = ::std::option::Option::None; - } - - pub fn has_ttl(&self) -> bool { - self.ttl.is_some() - } - - // Param is passed by value, moved - pub fn set_ttl(&mut self, v: u64) { - self.ttl = ::std::option::Option::Some(v); - } - - // required uint32 certificates_count = 8; - - pub fn certificates_count(&self) -> u32 { - self.certificates_count.unwrap_or(0) - } - - pub fn clear_certificates_count(&mut self) { - self.certificates_count = ::std::option::Option::None; - } - - pub fn has_certificates_count(&self) -> bool { - self.certificates_count.is_some() - } - - // Param is passed by value, moved - pub fn set_certificates_count(&mut self, v: u32) { - self.certificates_count = ::std::option::Option::Some(v); - } - - // required uint32 withdrawals_count = 9; - - pub fn withdrawals_count(&self) -> u32 { - self.withdrawals_count.unwrap_or(0) - } - - pub fn clear_withdrawals_count(&mut self) { - self.withdrawals_count = ::std::option::Option::None; - } - - pub fn has_withdrawals_count(&self) -> bool { - self.withdrawals_count.is_some() - } - - // Param is passed by value, moved - pub fn set_withdrawals_count(&mut self, v: u32) { - self.withdrawals_count = ::std::option::Option::Some(v); - } - - // required bool has_auxiliary_data = 10; - - pub fn has_auxiliary_data(&self) -> bool { - self.has_auxiliary_data.unwrap_or(false) - } - - pub fn clear_has_auxiliary_data(&mut self) { - self.has_auxiliary_data = ::std::option::Option::None; - } - - pub fn has_has_auxiliary_data(&self) -> bool { - self.has_auxiliary_data.is_some() - } - - // Param is passed by value, moved - pub fn set_has_auxiliary_data(&mut self, v: bool) { - self.has_auxiliary_data = ::std::option::Option::Some(v); - } - - // optional uint64 validity_interval_start = 11; - - pub fn validity_interval_start(&self) -> u64 { - self.validity_interval_start.unwrap_or(0) - } - - pub fn clear_validity_interval_start(&mut self) { - self.validity_interval_start = ::std::option::Option::None; - } - - pub fn has_validity_interval_start(&self) -> bool { - self.validity_interval_start.is_some() - } - - // Param is passed by value, moved - pub fn set_validity_interval_start(&mut self, v: u64) { - self.validity_interval_start = ::std::option::Option::Some(v); - } - - // required uint32 witness_requests_count = 12; - - pub fn witness_requests_count(&self) -> u32 { - self.witness_requests_count.unwrap_or(0) - } - - pub fn clear_witness_requests_count(&mut self) { - self.witness_requests_count = ::std::option::Option::None; - } - - pub fn has_witness_requests_count(&self) -> bool { - self.witness_requests_count.is_some() - } - - // Param is passed by value, moved - pub fn set_witness_requests_count(&mut self, v: u32) { - self.witness_requests_count = ::std::option::Option::Some(v); - } - - // required uint32 minting_asset_groups_count = 13; - - pub fn minting_asset_groups_count(&self) -> u32 { - self.minting_asset_groups_count.unwrap_or(0) - } - - pub fn clear_minting_asset_groups_count(&mut self) { - self.minting_asset_groups_count = ::std::option::Option::None; - } - - pub fn has_minting_asset_groups_count(&self) -> bool { - self.minting_asset_groups_count.is_some() - } - - // Param is passed by value, moved - pub fn set_minting_asset_groups_count(&mut self, v: u32) { - self.minting_asset_groups_count = ::std::option::Option::Some(v); - } - - // required .hw.trezor.messages.cardano.CardanoDerivationType derivation_type = 14; - - pub fn derivation_type(&self) -> CardanoDerivationType { - match self.derivation_type { - Some(e) => e.enum_value_or(CardanoDerivationType::LEDGER), - None => CardanoDerivationType::LEDGER, - } - } - - pub fn clear_derivation_type(&mut self) { - self.derivation_type = ::std::option::Option::None; - } - - pub fn has_derivation_type(&self) -> bool { - self.derivation_type.is_some() - } - - // Param is passed by value, moved - pub fn set_derivation_type(&mut self, v: CardanoDerivationType) { - self.derivation_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool include_network_id = 15; - - pub fn include_network_id(&self) -> bool { - self.include_network_id.unwrap_or(false) - } - - pub fn clear_include_network_id(&mut self) { - self.include_network_id = ::std::option::Option::None; - } - - pub fn has_include_network_id(&self) -> bool { - self.include_network_id.is_some() - } - - // Param is passed by value, moved - pub fn set_include_network_id(&mut self, v: bool) { - self.include_network_id = ::std::option::Option::Some(v); - } - - // optional bytes script_data_hash = 16; - - pub fn script_data_hash(&self) -> &[u8] { - match self.script_data_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_data_hash(&mut self) { - self.script_data_hash = ::std::option::Option::None; - } - - pub fn has_script_data_hash(&self) -> bool { - self.script_data_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_script_data_hash(&mut self, v: ::std::vec::Vec) { - self.script_data_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_data_hash(&mut self) -> &mut ::std::vec::Vec { - if self.script_data_hash.is_none() { - self.script_data_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_data_hash.as_mut().unwrap() - } - - // Take field - pub fn take_script_data_hash(&mut self) -> ::std::vec::Vec { - self.script_data_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 collateral_inputs_count = 17; - - pub fn collateral_inputs_count(&self) -> u32 { - self.collateral_inputs_count.unwrap_or(0) - } - - pub fn clear_collateral_inputs_count(&mut self) { - self.collateral_inputs_count = ::std::option::Option::None; - } - - pub fn has_collateral_inputs_count(&self) -> bool { - self.collateral_inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_collateral_inputs_count(&mut self, v: u32) { - self.collateral_inputs_count = ::std::option::Option::Some(v); - } - - // required uint32 required_signers_count = 18; - - pub fn required_signers_count(&self) -> u32 { - self.required_signers_count.unwrap_or(0) - } - - pub fn clear_required_signers_count(&mut self) { - self.required_signers_count = ::std::option::Option::None; - } - - pub fn has_required_signers_count(&self) -> bool { - self.required_signers_count.is_some() - } - - // Param is passed by value, moved - pub fn set_required_signers_count(&mut self, v: u32) { - self.required_signers_count = ::std::option::Option::Some(v); - } - - // optional bool has_collateral_return = 19; - - pub fn has_collateral_return(&self) -> bool { - self.has_collateral_return.unwrap_or(false) - } - - pub fn clear_has_collateral_return(&mut self) { - self.has_collateral_return = ::std::option::Option::None; - } - - pub fn has_has_collateral_return(&self) -> bool { - self.has_collateral_return.is_some() - } - - // Param is passed by value, moved - pub fn set_has_collateral_return(&mut self, v: bool) { - self.has_collateral_return = ::std::option::Option::Some(v); - } - - // optional uint64 total_collateral = 20; - - pub fn total_collateral(&self) -> u64 { - self.total_collateral.unwrap_or(0) - } - - pub fn clear_total_collateral(&mut self) { - self.total_collateral = ::std::option::Option::None; - } - - pub fn has_total_collateral(&self) -> bool { - self.total_collateral.is_some() - } - - // Param is passed by value, moved - pub fn set_total_collateral(&mut self, v: u64) { - self.total_collateral = ::std::option::Option::Some(v); - } - - // optional uint32 reference_inputs_count = 21; - - pub fn reference_inputs_count(&self) -> u32 { - self.reference_inputs_count.unwrap_or(0u32) - } - - pub fn clear_reference_inputs_count(&mut self) { - self.reference_inputs_count = ::std::option::Option::None; - } - - pub fn has_reference_inputs_count(&self) -> bool { - self.reference_inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_reference_inputs_count(&mut self, v: u32) { - self.reference_inputs_count = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 22; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(22); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signing_mode", - |m: &CardanoSignTxInit| { &m.signing_mode }, - |m: &mut CardanoSignTxInit| { &mut m.signing_mode }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "protocol_magic", - |m: &CardanoSignTxInit| { &m.protocol_magic }, - |m: &mut CardanoSignTxInit| { &mut m.protocol_magic }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_id", - |m: &CardanoSignTxInit| { &m.network_id }, - |m: &mut CardanoSignTxInit| { &mut m.network_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inputs_count", - |m: &CardanoSignTxInit| { &m.inputs_count }, - |m: &mut CardanoSignTxInit| { &mut m.inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "outputs_count", - |m: &CardanoSignTxInit| { &m.outputs_count }, - |m: &mut CardanoSignTxInit| { &mut m.outputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &CardanoSignTxInit| { &m.fee }, - |m: &mut CardanoSignTxInit| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ttl", - |m: &CardanoSignTxInit| { &m.ttl }, - |m: &mut CardanoSignTxInit| { &mut m.ttl }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "certificates_count", - |m: &CardanoSignTxInit| { &m.certificates_count }, - |m: &mut CardanoSignTxInit| { &mut m.certificates_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "withdrawals_count", - |m: &CardanoSignTxInit| { &m.withdrawals_count }, - |m: &mut CardanoSignTxInit| { &mut m.withdrawals_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "has_auxiliary_data", - |m: &CardanoSignTxInit| { &m.has_auxiliary_data }, - |m: &mut CardanoSignTxInit| { &mut m.has_auxiliary_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "validity_interval_start", - |m: &CardanoSignTxInit| { &m.validity_interval_start }, - |m: &mut CardanoSignTxInit| { &mut m.validity_interval_start }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "witness_requests_count", - |m: &CardanoSignTxInit| { &m.witness_requests_count }, - |m: &mut CardanoSignTxInit| { &mut m.witness_requests_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "minting_asset_groups_count", - |m: &CardanoSignTxInit| { &m.minting_asset_groups_count }, - |m: &mut CardanoSignTxInit| { &mut m.minting_asset_groups_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "derivation_type", - |m: &CardanoSignTxInit| { &m.derivation_type }, - |m: &mut CardanoSignTxInit| { &mut m.derivation_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "include_network_id", - |m: &CardanoSignTxInit| { &m.include_network_id }, - |m: &mut CardanoSignTxInit| { &mut m.include_network_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_data_hash", - |m: &CardanoSignTxInit| { &m.script_data_hash }, - |m: &mut CardanoSignTxInit| { &mut m.script_data_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "collateral_inputs_count", - |m: &CardanoSignTxInit| { &m.collateral_inputs_count }, - |m: &mut CardanoSignTxInit| { &mut m.collateral_inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "required_signers_count", - |m: &CardanoSignTxInit| { &m.required_signers_count }, - |m: &mut CardanoSignTxInit| { &mut m.required_signers_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "has_collateral_return", - |m: &CardanoSignTxInit| { &m.has_collateral_return }, - |m: &mut CardanoSignTxInit| { &mut m.has_collateral_return }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "total_collateral", - |m: &CardanoSignTxInit| { &m.total_collateral }, - |m: &mut CardanoSignTxInit| { &mut m.total_collateral }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "reference_inputs_count", - |m: &CardanoSignTxInit| { &m.reference_inputs_count }, - |m: &mut CardanoSignTxInit| { &mut m.reference_inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &CardanoSignTxInit| { &m.chunkify }, - |m: &mut CardanoSignTxInit| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoSignTxInit", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoSignTxInit { - const NAME: &'static str = "CardanoSignTxInit"; - - fn is_initialized(&self) -> bool { - if self.signing_mode.is_none() { - return false; - } - if self.protocol_magic.is_none() { - return false; - } - if self.network_id.is_none() { - return false; - } - if self.inputs_count.is_none() { - return false; - } - if self.outputs_count.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - if self.certificates_count.is_none() { - return false; - } - if self.withdrawals_count.is_none() { - return false; - } - if self.has_auxiliary_data.is_none() { - return false; - } - if self.witness_requests_count.is_none() { - return false; - } - if self.minting_asset_groups_count.is_none() { - return false; - } - if self.derivation_type.is_none() { - return false; - } - if self.collateral_inputs_count.is_none() { - return false; - } - if self.required_signers_count.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.signing_mode = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 16 => { - self.protocol_magic = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.network_id = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 56 => { - self.ttl = ::std::option::Option::Some(is.read_uint64()?); - }, - 64 => { - self.certificates_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.withdrawals_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 80 => { - self.has_auxiliary_data = ::std::option::Option::Some(is.read_bool()?); - }, - 88 => { - self.validity_interval_start = ::std::option::Option::Some(is.read_uint64()?); - }, - 96 => { - self.witness_requests_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 104 => { - self.minting_asset_groups_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 112 => { - self.derivation_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 120 => { - self.include_network_id = ::std::option::Option::Some(is.read_bool()?); - }, - 130 => { - self.script_data_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 136 => { - self.collateral_inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 144 => { - self.required_signers_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 152 => { - self.has_collateral_return = ::std::option::Option::Some(is.read_bool()?); - }, - 160 => { - self.total_collateral = ::std::option::Option::Some(is.read_uint64()?); - }, - 168 => { - self.reference_inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 176 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signing_mode { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.protocol_magic { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.network_id { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.inputs_count { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.outputs_count { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(6, v); - } - if let Some(v) = self.ttl { - my_size += ::protobuf::rt::uint64_size(7, v); - } - if let Some(v) = self.certificates_count { - my_size += ::protobuf::rt::uint32_size(8, v); - } - if let Some(v) = self.withdrawals_count { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.has_auxiliary_data { - my_size += 1 + 1; - } - if let Some(v) = self.validity_interval_start { - my_size += ::protobuf::rt::uint64_size(11, v); - } - if let Some(v) = self.witness_requests_count { - my_size += ::protobuf::rt::uint32_size(12, v); - } - if let Some(v) = self.minting_asset_groups_count { - my_size += ::protobuf::rt::uint32_size(13, v); - } - if let Some(v) = self.derivation_type { - my_size += ::protobuf::rt::int32_size(14, v.value()); - } - if let Some(v) = self.include_network_id { - my_size += 1 + 1; - } - if let Some(v) = self.script_data_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(16, &v); - } - if let Some(v) = self.collateral_inputs_count { - my_size += ::protobuf::rt::uint32_size(17, v); - } - if let Some(v) = self.required_signers_count { - my_size += ::protobuf::rt::uint32_size(18, v); - } - if let Some(v) = self.has_collateral_return { - my_size += 2 + 1; - } - if let Some(v) = self.total_collateral { - my_size += ::protobuf::rt::uint64_size(20, v); - } - if let Some(v) = self.reference_inputs_count { - my_size += ::protobuf::rt::uint32_size(21, v); - } - if let Some(v) = self.chunkify { - my_size += 2 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signing_mode { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.protocol_magic { - os.write_uint32(2, v)?; - } - if let Some(v) = self.network_id { - os.write_uint32(3, v)?; - } - if let Some(v) = self.inputs_count { - os.write_uint32(4, v)?; - } - if let Some(v) = self.outputs_count { - os.write_uint32(5, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(6, v)?; - } - if let Some(v) = self.ttl { - os.write_uint64(7, v)?; - } - if let Some(v) = self.certificates_count { - os.write_uint32(8, v)?; - } - if let Some(v) = self.withdrawals_count { - os.write_uint32(9, v)?; - } - if let Some(v) = self.has_auxiliary_data { - os.write_bool(10, v)?; - } - if let Some(v) = self.validity_interval_start { - os.write_uint64(11, v)?; - } - if let Some(v) = self.witness_requests_count { - os.write_uint32(12, v)?; - } - if let Some(v) = self.minting_asset_groups_count { - os.write_uint32(13, v)?; - } - if let Some(v) = self.derivation_type { - os.write_enum(14, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.include_network_id { - os.write_bool(15, v)?; - } - if let Some(v) = self.script_data_hash.as_ref() { - os.write_bytes(16, v)?; - } - if let Some(v) = self.collateral_inputs_count { - os.write_uint32(17, v)?; - } - if let Some(v) = self.required_signers_count { - os.write_uint32(18, v)?; - } - if let Some(v) = self.has_collateral_return { - os.write_bool(19, v)?; - } - if let Some(v) = self.total_collateral { - os.write_uint64(20, v)?; - } - if let Some(v) = self.reference_inputs_count { - os.write_uint32(21, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(22, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoSignTxInit { - CardanoSignTxInit::new() - } - - fn clear(&mut self) { - self.signing_mode = ::std::option::Option::None; - self.protocol_magic = ::std::option::Option::None; - self.network_id = ::std::option::Option::None; - self.inputs_count = ::std::option::Option::None; - self.outputs_count = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.ttl = ::std::option::Option::None; - self.certificates_count = ::std::option::Option::None; - self.withdrawals_count = ::std::option::Option::None; - self.has_auxiliary_data = ::std::option::Option::None; - self.validity_interval_start = ::std::option::Option::None; - self.witness_requests_count = ::std::option::Option::None; - self.minting_asset_groups_count = ::std::option::Option::None; - self.derivation_type = ::std::option::Option::None; - self.include_network_id = ::std::option::Option::None; - self.script_data_hash = ::std::option::Option::None; - self.collateral_inputs_count = ::std::option::Option::None; - self.required_signers_count = ::std::option::Option::None; - self.has_collateral_return = ::std::option::Option::None; - self.total_collateral = ::std::option::Option::None; - self.reference_inputs_count = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoSignTxInit { - static instance: CardanoSignTxInit = CardanoSignTxInit { - signing_mode: ::std::option::Option::None, - protocol_magic: ::std::option::Option::None, - network_id: ::std::option::Option::None, - inputs_count: ::std::option::Option::None, - outputs_count: ::std::option::Option::None, - fee: ::std::option::Option::None, - ttl: ::std::option::Option::None, - certificates_count: ::std::option::Option::None, - withdrawals_count: ::std::option::Option::None, - has_auxiliary_data: ::std::option::Option::None, - validity_interval_start: ::std::option::Option::None, - witness_requests_count: ::std::option::Option::None, - minting_asset_groups_count: ::std::option::Option::None, - derivation_type: ::std::option::Option::None, - include_network_id: ::std::option::Option::None, - script_data_hash: ::std::option::Option::None, - collateral_inputs_count: ::std::option::Option::None, - required_signers_count: ::std::option::Option::None, - has_collateral_return: ::std::option::Option::None, - total_collateral: ::std::option::Option::None, - reference_inputs_count: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoSignTxInit { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoSignTxInit").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoSignTxInit { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoSignTxInit { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxInput.prev_index) - pub prev_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxInput { - fn default() -> &'a CardanoTxInput { - ::default_instance() - } -} - -impl CardanoTxInput { - pub fn new() -> CardanoTxInput { - ::std::default::Default::default() - } - - // required bytes prev_hash = 1; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 2; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &CardanoTxInput| { &m.prev_hash }, - |m: &mut CardanoTxInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &CardanoTxInput| { &m.prev_index }, - |m: &mut CardanoTxInput| { &mut m.prev_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxInput { - const NAME: &'static str = "CardanoTxInput"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxInput { - CardanoTxInput::new() - } - - fn clear(&mut self) { - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxInput { - static instance: CardanoTxInput = CardanoTxInput { - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.address_parameters) - pub address_parameters: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.asset_groups_count) - pub asset_groups_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.datum_hash) - pub datum_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.format) - pub format: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.inline_datum_size) - pub inline_datum_size: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxOutput.reference_script_size) - pub reference_script_size: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxOutput { - fn default() -> &'a CardanoTxOutput { - ::default_instance() - } -} - -impl CardanoTxOutput { - pub fn new() -> CardanoTxOutput { - ::std::default::Default::default() - } - - // optional string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 amount = 3; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // required uint32 asset_groups_count = 4; - - pub fn asset_groups_count(&self) -> u32 { - self.asset_groups_count.unwrap_or(0) - } - - pub fn clear_asset_groups_count(&mut self) { - self.asset_groups_count = ::std::option::Option::None; - } - - pub fn has_asset_groups_count(&self) -> bool { - self.asset_groups_count.is_some() - } - - // Param is passed by value, moved - pub fn set_asset_groups_count(&mut self, v: u32) { - self.asset_groups_count = ::std::option::Option::Some(v); - } - - // optional bytes datum_hash = 5; - - pub fn datum_hash(&self) -> &[u8] { - match self.datum_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_datum_hash(&mut self) { - self.datum_hash = ::std::option::Option::None; - } - - pub fn has_datum_hash(&self) -> bool { - self.datum_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_datum_hash(&mut self, v: ::std::vec::Vec) { - self.datum_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_datum_hash(&mut self) -> &mut ::std::vec::Vec { - if self.datum_hash.is_none() { - self.datum_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.datum_hash.as_mut().unwrap() - } - - // Take field - pub fn take_datum_hash(&mut self) -> ::std::vec::Vec { - self.datum_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional .hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat format = 6; - - pub fn format(&self) -> CardanoTxOutputSerializationFormat { - match self.format { - Some(e) => e.enum_value_or(CardanoTxOutputSerializationFormat::ARRAY_LEGACY), - None => CardanoTxOutputSerializationFormat::ARRAY_LEGACY, - } - } - - pub fn clear_format(&mut self) { - self.format = ::std::option::Option::None; - } - - pub fn has_format(&self) -> bool { - self.format.is_some() - } - - // Param is passed by value, moved - pub fn set_format(&mut self, v: CardanoTxOutputSerializationFormat) { - self.format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint32 inline_datum_size = 7; - - pub fn inline_datum_size(&self) -> u32 { - self.inline_datum_size.unwrap_or(0u32) - } - - pub fn clear_inline_datum_size(&mut self) { - self.inline_datum_size = ::std::option::Option::None; - } - - pub fn has_inline_datum_size(&self) -> bool { - self.inline_datum_size.is_some() - } - - // Param is passed by value, moved - pub fn set_inline_datum_size(&mut self, v: u32) { - self.inline_datum_size = ::std::option::Option::Some(v); - } - - // optional uint32 reference_script_size = 8; - - pub fn reference_script_size(&self) -> u32 { - self.reference_script_size.unwrap_or(0u32) - } - - pub fn clear_reference_script_size(&mut self) { - self.reference_script_size = ::std::option::Option::None; - } - - pub fn has_reference_script_size(&self) -> bool { - self.reference_script_size.is_some() - } - - // Param is passed by value, moved - pub fn set_reference_script_size(&mut self, v: u32) { - self.reference_script_size = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &CardanoTxOutput| { &m.address }, - |m: &mut CardanoTxOutput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoAddressParametersType>( - "address_parameters", - |m: &CardanoTxOutput| { &m.address_parameters }, - |m: &mut CardanoTxOutput| { &mut m.address_parameters }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &CardanoTxOutput| { &m.amount }, - |m: &mut CardanoTxOutput| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "asset_groups_count", - |m: &CardanoTxOutput| { &m.asset_groups_count }, - |m: &mut CardanoTxOutput| { &mut m.asset_groups_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "datum_hash", - |m: &CardanoTxOutput| { &m.datum_hash }, - |m: &mut CardanoTxOutput| { &mut m.datum_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "format", - |m: &CardanoTxOutput| { &m.format }, - |m: &mut CardanoTxOutput| { &mut m.format }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inline_datum_size", - |m: &CardanoTxOutput| { &m.inline_datum_size }, - |m: &mut CardanoTxOutput| { &mut m.inline_datum_size }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "reference_script_size", - |m: &CardanoTxOutput| { &m.reference_script_size }, - |m: &mut CardanoTxOutput| { &mut m.reference_script_size }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxOutput { - const NAME: &'static str = "CardanoTxOutput"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - if self.asset_groups_count.is_none() { - return false; - } - for v in &self.address_parameters { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.address_parameters)?; - }, - 24 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.asset_groups_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 42 => { - self.datum_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 48 => { - self.format = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 56 => { - self.inline_datum_size = ::std::option::Option::Some(is.read_uint32()?); - }, - 64 => { - self.reference_script_size = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.address_parameters.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.asset_groups_count { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.datum_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.format { - my_size += ::protobuf::rt::int32_size(6, v.value()); - } - if let Some(v) = self.inline_datum_size { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.reference_script_size { - my_size += ::protobuf::rt::uint32_size(8, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.address_parameters.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.amount { - os.write_uint64(3, v)?; - } - if let Some(v) = self.asset_groups_count { - os.write_uint32(4, v)?; - } - if let Some(v) = self.datum_hash.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.format { - os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.inline_datum_size { - os.write_uint32(7, v)?; - } - if let Some(v) = self.reference_script_size { - os.write_uint32(8, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxOutput { - CardanoTxOutput::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.address_parameters.clear(); - self.amount = ::std::option::Option::None; - self.asset_groups_count = ::std::option::Option::None; - self.datum_hash = ::std::option::Option::None; - self.format = ::std::option::Option::None; - self.inline_datum_size = ::std::option::Option::None; - self.reference_script_size = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxOutput { - static instance: CardanoTxOutput = CardanoTxOutput { - address: ::std::option::Option::None, - address_parameters: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - asset_groups_count: ::std::option::Option::None, - datum_hash: ::std::option::Option::None, - format: ::std::option::Option::None, - inline_datum_size: ::std::option::Option::None, - reference_script_size: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoAssetGroup) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoAssetGroup { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAssetGroup.policy_id) - pub policy_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoAssetGroup.tokens_count) - pub tokens_count: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoAssetGroup.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoAssetGroup { - fn default() -> &'a CardanoAssetGroup { - ::default_instance() - } -} - -impl CardanoAssetGroup { - pub fn new() -> CardanoAssetGroup { - ::std::default::Default::default() - } - - // required bytes policy_id = 1; - - pub fn policy_id(&self) -> &[u8] { - match self.policy_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_policy_id(&mut self) { - self.policy_id = ::std::option::Option::None; - } - - pub fn has_policy_id(&self) -> bool { - self.policy_id.is_some() - } - - // Param is passed by value, moved - pub fn set_policy_id(&mut self, v: ::std::vec::Vec) { - self.policy_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_policy_id(&mut self) -> &mut ::std::vec::Vec { - if self.policy_id.is_none() { - self.policy_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.policy_id.as_mut().unwrap() - } - - // Take field - pub fn take_policy_id(&mut self) -> ::std::vec::Vec { - self.policy_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 tokens_count = 2; - - pub fn tokens_count(&self) -> u32 { - self.tokens_count.unwrap_or(0) - } - - pub fn clear_tokens_count(&mut self) { - self.tokens_count = ::std::option::Option::None; - } - - pub fn has_tokens_count(&self) -> bool { - self.tokens_count.is_some() - } - - // Param is passed by value, moved - pub fn set_tokens_count(&mut self, v: u32) { - self.tokens_count = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "policy_id", - |m: &CardanoAssetGroup| { &m.policy_id }, - |m: &mut CardanoAssetGroup| { &mut m.policy_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tokens_count", - |m: &CardanoAssetGroup| { &m.tokens_count }, - |m: &mut CardanoAssetGroup| { &mut m.tokens_count }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoAssetGroup", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoAssetGroup { - const NAME: &'static str = "CardanoAssetGroup"; - - fn is_initialized(&self) -> bool { - if self.policy_id.is_none() { - return false; - } - if self.tokens_count.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.policy_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.tokens_count = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.policy_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.tokens_count { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.policy_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.tokens_count { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoAssetGroup { - CardanoAssetGroup::new() - } - - fn clear(&mut self) { - self.policy_id = ::std::option::Option::None; - self.tokens_count = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoAssetGroup { - static instance: CardanoAssetGroup = CardanoAssetGroup { - policy_id: ::std::option::Option::None, - tokens_count: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoAssetGroup { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoAssetGroup").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoAssetGroup { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoAssetGroup { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoToken) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoToken { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoToken.asset_name_bytes) - pub asset_name_bytes: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoToken.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoToken.mint_amount) - pub mint_amount: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoToken.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoToken { - fn default() -> &'a CardanoToken { - ::default_instance() - } -} - -impl CardanoToken { - pub fn new() -> CardanoToken { - ::std::default::Default::default() - } - - // required bytes asset_name_bytes = 1; - - pub fn asset_name_bytes(&self) -> &[u8] { - match self.asset_name_bytes.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_asset_name_bytes(&mut self) { - self.asset_name_bytes = ::std::option::Option::None; - } - - pub fn has_asset_name_bytes(&self) -> bool { - self.asset_name_bytes.is_some() - } - - // Param is passed by value, moved - pub fn set_asset_name_bytes(&mut self, v: ::std::vec::Vec) { - self.asset_name_bytes = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_asset_name_bytes(&mut self) -> &mut ::std::vec::Vec { - if self.asset_name_bytes.is_none() { - self.asset_name_bytes = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.asset_name_bytes.as_mut().unwrap() - } - - // Take field - pub fn take_asset_name_bytes(&mut self) -> ::std::vec::Vec { - self.asset_name_bytes.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint64 amount = 2; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional sint64 mint_amount = 3; - - pub fn mint_amount(&self) -> i64 { - self.mint_amount.unwrap_or(0) - } - - pub fn clear_mint_amount(&mut self) { - self.mint_amount = ::std::option::Option::None; - } - - pub fn has_mint_amount(&self) -> bool { - self.mint_amount.is_some() - } - - // Param is passed by value, moved - pub fn set_mint_amount(&mut self, v: i64) { - self.mint_amount = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "asset_name_bytes", - |m: &CardanoToken| { &m.asset_name_bytes }, - |m: &mut CardanoToken| { &mut m.asset_name_bytes }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &CardanoToken| { &m.amount }, - |m: &mut CardanoToken| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mint_amount", - |m: &CardanoToken| { &m.mint_amount }, - |m: &mut CardanoToken| { &mut m.mint_amount }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoToken", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoToken { - const NAME: &'static str = "CardanoToken"; - - fn is_initialized(&self) -> bool { - if self.asset_name_bytes.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.asset_name_bytes = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.mint_amount = ::std::option::Option::Some(is.read_sint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.asset_name_bytes.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.mint_amount { - my_size += ::protobuf::rt::sint64_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.asset_name_bytes.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.amount { - os.write_uint64(2, v)?; - } - if let Some(v) = self.mint_amount { - os.write_sint64(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoToken { - CardanoToken::new() - } - - fn clear(&mut self) { - self.asset_name_bytes = ::std::option::Option::None; - self.amount = ::std::option::Option::None; - self.mint_amount = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoToken { - static instance: CardanoToken = CardanoToken { - asset_name_bytes: ::std::option::Option::None, - amount: ::std::option::Option::None, - mint_amount: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoToken { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoToken").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoToken { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoToken { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxInlineDatumChunk) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxInlineDatumChunk { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxInlineDatumChunk.data) - pub data: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxInlineDatumChunk.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxInlineDatumChunk { - fn default() -> &'a CardanoTxInlineDatumChunk { - ::default_instance() - } -} - -impl CardanoTxInlineDatumChunk { - pub fn new() -> CardanoTxInlineDatumChunk { - ::std::default::Default::default() - } - - // required bytes data = 1; - - pub fn data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data", - |m: &CardanoTxInlineDatumChunk| { &m.data }, - |m: &mut CardanoTxInlineDatumChunk| { &mut m.data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxInlineDatumChunk", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxInlineDatumChunk { - const NAME: &'static str = "CardanoTxInlineDatumChunk"; - - fn is_initialized(&self) -> bool { - if self.data.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.data = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxInlineDatumChunk { - CardanoTxInlineDatumChunk::new() - } - - fn clear(&mut self) { - self.data = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxInlineDatumChunk { - static instance: CardanoTxInlineDatumChunk = CardanoTxInlineDatumChunk { - data: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxInlineDatumChunk { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxInlineDatumChunk").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxInlineDatumChunk { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxInlineDatumChunk { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxReferenceScriptChunk) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxReferenceScriptChunk { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxReferenceScriptChunk.data) - pub data: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxReferenceScriptChunk.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxReferenceScriptChunk { - fn default() -> &'a CardanoTxReferenceScriptChunk { - ::default_instance() - } -} - -impl CardanoTxReferenceScriptChunk { - pub fn new() -> CardanoTxReferenceScriptChunk { - ::std::default::Default::default() - } - - // required bytes data = 1; - - pub fn data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data", - |m: &CardanoTxReferenceScriptChunk| { &m.data }, - |m: &mut CardanoTxReferenceScriptChunk| { &mut m.data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxReferenceScriptChunk", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxReferenceScriptChunk { - const NAME: &'static str = "CardanoTxReferenceScriptChunk"; - - fn is_initialized(&self) -> bool { - if self.data.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.data = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxReferenceScriptChunk { - CardanoTxReferenceScriptChunk::new() - } - - fn clear(&mut self) { - self.data = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxReferenceScriptChunk { - static instance: CardanoTxReferenceScriptChunk = CardanoTxReferenceScriptChunk { - data: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxReferenceScriptChunk { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxReferenceScriptChunk").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxReferenceScriptChunk { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxReferenceScriptChunk { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolOwner) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoPoolOwner { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolOwner.staking_key_path) - pub staking_key_path: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolOwner.staking_key_hash) - pub staking_key_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolOwner.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoPoolOwner { - fn default() -> &'a CardanoPoolOwner { - ::default_instance() - } -} - -impl CardanoPoolOwner { - pub fn new() -> CardanoPoolOwner { - ::std::default::Default::default() - } - - // optional bytes staking_key_hash = 2; - - pub fn staking_key_hash(&self) -> &[u8] { - match self.staking_key_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_staking_key_hash(&mut self) { - self.staking_key_hash = ::std::option::Option::None; - } - - pub fn has_staking_key_hash(&self) -> bool { - self.staking_key_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_staking_key_hash(&mut self, v: ::std::vec::Vec) { - self.staking_key_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_staking_key_hash(&mut self) -> &mut ::std::vec::Vec { - if self.staking_key_hash.is_none() { - self.staking_key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.staking_key_hash.as_mut().unwrap() - } - - // Take field - pub fn take_staking_key_hash(&mut self) -> ::std::vec::Vec { - self.staking_key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "staking_key_path", - |m: &CardanoPoolOwner| { &m.staking_key_path }, - |m: &mut CardanoPoolOwner| { &mut m.staking_key_path }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "staking_key_hash", - |m: &CardanoPoolOwner| { &m.staking_key_hash }, - |m: &mut CardanoPoolOwner| { &mut m.staking_key_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoPoolOwner", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoPoolOwner { - const NAME: &'static str = "CardanoPoolOwner"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.staking_key_path)?; - }, - 8 => { - self.staking_key_path.push(is.read_uint32()?); - }, - 18 => { - self.staking_key_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.staking_key_path { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.staking_key_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.staking_key_path { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.staking_key_hash.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoPoolOwner { - CardanoPoolOwner::new() - } - - fn clear(&mut self) { - self.staking_key_path.clear(); - self.staking_key_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoPoolOwner { - static instance: CardanoPoolOwner = CardanoPoolOwner { - staking_key_path: ::std::vec::Vec::new(), - staking_key_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoPoolOwner { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolOwner").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoPoolOwner { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoPoolOwner { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolRelayParameters) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoPoolRelayParameters { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.ipv4_address) - pub ipv4_address: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.ipv6_address) - pub ipv6_address: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.host_name) - pub host_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.port) - pub port: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolRelayParameters.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoPoolRelayParameters { - fn default() -> &'a CardanoPoolRelayParameters { - ::default_instance() - } -} - -impl CardanoPoolRelayParameters { - pub fn new() -> CardanoPoolRelayParameters { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoPoolRelayType type = 1; - - pub fn type_(&self) -> CardanoPoolRelayType { - match self.type_ { - Some(e) => e.enum_value_or(CardanoPoolRelayType::SINGLE_HOST_IP), - None => CardanoPoolRelayType::SINGLE_HOST_IP, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: CardanoPoolRelayType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes ipv4_address = 2; - - pub fn ipv4_address(&self) -> &[u8] { - match self.ipv4_address.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ipv4_address(&mut self) { - self.ipv4_address = ::std::option::Option::None; - } - - pub fn has_ipv4_address(&self) -> bool { - self.ipv4_address.is_some() - } - - // Param is passed by value, moved - pub fn set_ipv4_address(&mut self, v: ::std::vec::Vec) { - self.ipv4_address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ipv4_address(&mut self) -> &mut ::std::vec::Vec { - if self.ipv4_address.is_none() { - self.ipv4_address = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ipv4_address.as_mut().unwrap() - } - - // Take field - pub fn take_ipv4_address(&mut self) -> ::std::vec::Vec { - self.ipv4_address.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes ipv6_address = 3; - - pub fn ipv6_address(&self) -> &[u8] { - match self.ipv6_address.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ipv6_address(&mut self) { - self.ipv6_address = ::std::option::Option::None; - } - - pub fn has_ipv6_address(&self) -> bool { - self.ipv6_address.is_some() - } - - // Param is passed by value, moved - pub fn set_ipv6_address(&mut self, v: ::std::vec::Vec) { - self.ipv6_address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ipv6_address(&mut self) -> &mut ::std::vec::Vec { - if self.ipv6_address.is_none() { - self.ipv6_address = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ipv6_address.as_mut().unwrap() - } - - // Take field - pub fn take_ipv6_address(&mut self) -> ::std::vec::Vec { - self.ipv6_address.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string host_name = 4; - - pub fn host_name(&self) -> &str { - match self.host_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_host_name(&mut self) { - self.host_name = ::std::option::Option::None; - } - - pub fn has_host_name(&self) -> bool { - self.host_name.is_some() - } - - // Param is passed by value, moved - pub fn set_host_name(&mut self, v: ::std::string::String) { - self.host_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_host_name(&mut self) -> &mut ::std::string::String { - if self.host_name.is_none() { - self.host_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.host_name.as_mut().unwrap() - } - - // Take field - pub fn take_host_name(&mut self) -> ::std::string::String { - self.host_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 port = 5; - - pub fn port(&self) -> u32 { - self.port.unwrap_or(0) - } - - pub fn clear_port(&mut self) { - self.port = ::std::option::Option::None; - } - - pub fn has_port(&self) -> bool { - self.port.is_some() - } - - // Param is passed by value, moved - pub fn set_port(&mut self, v: u32) { - self.port = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &CardanoPoolRelayParameters| { &m.type_ }, - |m: &mut CardanoPoolRelayParameters| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ipv4_address", - |m: &CardanoPoolRelayParameters| { &m.ipv4_address }, - |m: &mut CardanoPoolRelayParameters| { &mut m.ipv4_address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ipv6_address", - |m: &CardanoPoolRelayParameters| { &m.ipv6_address }, - |m: &mut CardanoPoolRelayParameters| { &mut m.ipv6_address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "host_name", - |m: &CardanoPoolRelayParameters| { &m.host_name }, - |m: &mut CardanoPoolRelayParameters| { &mut m.host_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "port", - |m: &CardanoPoolRelayParameters| { &m.port }, - |m: &mut CardanoPoolRelayParameters| { &mut m.port }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoPoolRelayParameters", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoPoolRelayParameters { - const NAME: &'static str = "CardanoPoolRelayParameters"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.ipv4_address = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.ipv6_address = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.host_name = ::std::option::Option::Some(is.read_string()?); - }, - 40 => { - self.port = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.ipv4_address.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.ipv6_address.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.host_name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.port { - my_size += ::protobuf::rt::uint32_size(5, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.ipv4_address.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.ipv6_address.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.host_name.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.port { - os.write_uint32(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoPoolRelayParameters { - CardanoPoolRelayParameters::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.ipv4_address = ::std::option::Option::None; - self.ipv6_address = ::std::option::Option::None; - self.host_name = ::std::option::Option::None; - self.port = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoPoolRelayParameters { - static instance: CardanoPoolRelayParameters = CardanoPoolRelayParameters { - type_: ::std::option::Option::None, - ipv4_address: ::std::option::Option::None, - ipv6_address: ::std::option::Option::None, - host_name: ::std::option::Option::None, - port: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoPoolRelayParameters { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolRelayParameters").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoPoolRelayParameters { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoPoolRelayParameters { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolMetadataType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoPoolMetadataType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolMetadataType.url) - pub url: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolMetadataType.hash) - pub hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolMetadataType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoPoolMetadataType { - fn default() -> &'a CardanoPoolMetadataType { - ::default_instance() - } -} - -impl CardanoPoolMetadataType { - pub fn new() -> CardanoPoolMetadataType { - ::std::default::Default::default() - } - - // required string url = 1; - - pub fn url(&self) -> &str { - match self.url.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_url(&mut self) { - self.url = ::std::option::Option::None; - } - - pub fn has_url(&self) -> bool { - self.url.is_some() - } - - // Param is passed by value, moved - pub fn set_url(&mut self, v: ::std::string::String) { - self.url = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_url(&mut self) -> &mut ::std::string::String { - if self.url.is_none() { - self.url = ::std::option::Option::Some(::std::string::String::new()); - } - self.url.as_mut().unwrap() - } - - // Take field - pub fn take_url(&mut self) -> ::std::string::String { - self.url.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes hash = 2; - - pub fn hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "url", - |m: &CardanoPoolMetadataType| { &m.url }, - |m: &mut CardanoPoolMetadataType| { &mut m.url }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hash", - |m: &CardanoPoolMetadataType| { &m.hash }, - |m: &mut CardanoPoolMetadataType| { &mut m.hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoPoolMetadataType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoPoolMetadataType { - const NAME: &'static str = "CardanoPoolMetadataType"; - - fn is_initialized(&self) -> bool { - if self.url.is_none() { - return false; - } - if self.hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.url = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.url.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.url.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.hash.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoPoolMetadataType { - CardanoPoolMetadataType::new() - } - - fn clear(&mut self) { - self.url = ::std::option::Option::None; - self.hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoPoolMetadataType { - static instance: CardanoPoolMetadataType = CardanoPoolMetadataType { - url: ::std::option::Option::None, - hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoPoolMetadataType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolMetadataType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoPoolMetadataType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoPoolMetadataType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoPoolParametersType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoPoolParametersType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.pool_id) - pub pool_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.vrf_key_hash) - pub vrf_key_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.pledge) - pub pledge: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.cost) - pub cost: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.margin_numerator) - pub margin_numerator: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.margin_denominator) - pub margin_denominator: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.reward_account) - pub reward_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.metadata) - pub metadata: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.owners_count) - pub owners_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoPoolParametersType.relays_count) - pub relays_count: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoPoolParametersType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoPoolParametersType { - fn default() -> &'a CardanoPoolParametersType { - ::default_instance() - } -} - -impl CardanoPoolParametersType { - pub fn new() -> CardanoPoolParametersType { - ::std::default::Default::default() - } - - // required bytes pool_id = 1; - - pub fn pool_id(&self) -> &[u8] { - match self.pool_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pool_id(&mut self) { - self.pool_id = ::std::option::Option::None; - } - - pub fn has_pool_id(&self) -> bool { - self.pool_id.is_some() - } - - // Param is passed by value, moved - pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { - self.pool_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { - if self.pool_id.is_none() { - self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pool_id.as_mut().unwrap() - } - - // Take field - pub fn take_pool_id(&mut self) -> ::std::vec::Vec { - self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes vrf_key_hash = 2; - - pub fn vrf_key_hash(&self) -> &[u8] { - match self.vrf_key_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vrf_key_hash(&mut self) { - self.vrf_key_hash = ::std::option::Option::None; - } - - pub fn has_vrf_key_hash(&self) -> bool { - self.vrf_key_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_vrf_key_hash(&mut self, v: ::std::vec::Vec) { - self.vrf_key_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vrf_key_hash(&mut self) -> &mut ::std::vec::Vec { - if self.vrf_key_hash.is_none() { - self.vrf_key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vrf_key_hash.as_mut().unwrap() - } - - // Take field - pub fn take_vrf_key_hash(&mut self) -> ::std::vec::Vec { - self.vrf_key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 pledge = 3; - - pub fn pledge(&self) -> u64 { - self.pledge.unwrap_or(0) - } - - pub fn clear_pledge(&mut self) { - self.pledge = ::std::option::Option::None; - } - - pub fn has_pledge(&self) -> bool { - self.pledge.is_some() - } - - // Param is passed by value, moved - pub fn set_pledge(&mut self, v: u64) { - self.pledge = ::std::option::Option::Some(v); - } - - // required uint64 cost = 4; - - pub fn cost(&self) -> u64 { - self.cost.unwrap_or(0) - } - - pub fn clear_cost(&mut self) { - self.cost = ::std::option::Option::None; - } - - pub fn has_cost(&self) -> bool { - self.cost.is_some() - } - - // Param is passed by value, moved - pub fn set_cost(&mut self, v: u64) { - self.cost = ::std::option::Option::Some(v); - } - - // required uint64 margin_numerator = 5; - - pub fn margin_numerator(&self) -> u64 { - self.margin_numerator.unwrap_or(0) - } - - pub fn clear_margin_numerator(&mut self) { - self.margin_numerator = ::std::option::Option::None; - } - - pub fn has_margin_numerator(&self) -> bool { - self.margin_numerator.is_some() - } - - // Param is passed by value, moved - pub fn set_margin_numerator(&mut self, v: u64) { - self.margin_numerator = ::std::option::Option::Some(v); - } - - // required uint64 margin_denominator = 6; - - pub fn margin_denominator(&self) -> u64 { - self.margin_denominator.unwrap_or(0) - } - - pub fn clear_margin_denominator(&mut self) { - self.margin_denominator = ::std::option::Option::None; - } - - pub fn has_margin_denominator(&self) -> bool { - self.margin_denominator.is_some() - } - - // Param is passed by value, moved - pub fn set_margin_denominator(&mut self, v: u64) { - self.margin_denominator = ::std::option::Option::Some(v); - } - - // required string reward_account = 7; - - pub fn reward_account(&self) -> &str { - match self.reward_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_reward_account(&mut self) { - self.reward_account = ::std::option::Option::None; - } - - pub fn has_reward_account(&self) -> bool { - self.reward_account.is_some() - } - - // Param is passed by value, moved - pub fn set_reward_account(&mut self, v: ::std::string::String) { - self.reward_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_reward_account(&mut self) -> &mut ::std::string::String { - if self.reward_account.is_none() { - self.reward_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.reward_account.as_mut().unwrap() - } - - // Take field - pub fn take_reward_account(&mut self) -> ::std::string::String { - self.reward_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint32 owners_count = 11; - - pub fn owners_count(&self) -> u32 { - self.owners_count.unwrap_or(0) - } - - pub fn clear_owners_count(&mut self) { - self.owners_count = ::std::option::Option::None; - } - - pub fn has_owners_count(&self) -> bool { - self.owners_count.is_some() - } - - // Param is passed by value, moved - pub fn set_owners_count(&mut self, v: u32) { - self.owners_count = ::std::option::Option::Some(v); - } - - // required uint32 relays_count = 12; - - pub fn relays_count(&self) -> u32 { - self.relays_count.unwrap_or(0) - } - - pub fn clear_relays_count(&mut self) { - self.relays_count = ::std::option::Option::None; - } - - pub fn has_relays_count(&self) -> bool { - self.relays_count.is_some() - } - - // Param is passed by value, moved - pub fn set_relays_count(&mut self, v: u32) { - self.relays_count = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(10); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pool_id", - |m: &CardanoPoolParametersType| { &m.pool_id }, - |m: &mut CardanoPoolParametersType| { &mut m.pool_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vrf_key_hash", - |m: &CardanoPoolParametersType| { &m.vrf_key_hash }, - |m: &mut CardanoPoolParametersType| { &mut m.vrf_key_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pledge", - |m: &CardanoPoolParametersType| { &m.pledge }, - |m: &mut CardanoPoolParametersType| { &mut m.pledge }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "cost", - |m: &CardanoPoolParametersType| { &m.cost }, - |m: &mut CardanoPoolParametersType| { &mut m.cost }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "margin_numerator", - |m: &CardanoPoolParametersType| { &m.margin_numerator }, - |m: &mut CardanoPoolParametersType| { &mut m.margin_numerator }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "margin_denominator", - |m: &CardanoPoolParametersType| { &m.margin_denominator }, - |m: &mut CardanoPoolParametersType| { &mut m.margin_denominator }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "reward_account", - |m: &CardanoPoolParametersType| { &m.reward_account }, - |m: &mut CardanoPoolParametersType| { &mut m.reward_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoPoolMetadataType>( - "metadata", - |m: &CardanoPoolParametersType| { &m.metadata }, - |m: &mut CardanoPoolParametersType| { &mut m.metadata }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "owners_count", - |m: &CardanoPoolParametersType| { &m.owners_count }, - |m: &mut CardanoPoolParametersType| { &mut m.owners_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "relays_count", - |m: &CardanoPoolParametersType| { &m.relays_count }, - |m: &mut CardanoPoolParametersType| { &mut m.relays_count }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoPoolParametersType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoPoolParametersType { - const NAME: &'static str = "CardanoPoolParametersType"; - - fn is_initialized(&self) -> bool { - if self.pool_id.is_none() { - return false; - } - if self.vrf_key_hash.is_none() { - return false; - } - if self.pledge.is_none() { - return false; - } - if self.cost.is_none() { - return false; - } - if self.margin_numerator.is_none() { - return false; - } - if self.margin_denominator.is_none() { - return false; - } - if self.reward_account.is_none() { - return false; - } - if self.owners_count.is_none() { - return false; - } - if self.relays_count.is_none() { - return false; - } - for v in &self.metadata { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.pool_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.vrf_key_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.pledge = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.cost = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.margin_numerator = ::std::option::Option::Some(is.read_uint64()?); - }, - 48 => { - self.margin_denominator = ::std::option::Option::Some(is.read_uint64()?); - }, - 58 => { - self.reward_account = ::std::option::Option::Some(is.read_string()?); - }, - 82 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.metadata)?; - }, - 88 => { - self.owners_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 96 => { - self.relays_count = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.pool_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.vrf_key_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.pledge { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.cost { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.margin_numerator { - my_size += ::protobuf::rt::uint64_size(5, v); - } - if let Some(v) = self.margin_denominator { - my_size += ::protobuf::rt::uint64_size(6, v); - } - if let Some(v) = self.reward_account.as_ref() { - my_size += ::protobuf::rt::string_size(7, &v); - } - if let Some(v) = self.metadata.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.owners_count { - my_size += ::protobuf::rt::uint32_size(11, v); - } - if let Some(v) = self.relays_count { - my_size += ::protobuf::rt::uint32_size(12, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.pool_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.vrf_key_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.pledge { - os.write_uint64(3, v)?; - } - if let Some(v) = self.cost { - os.write_uint64(4, v)?; - } - if let Some(v) = self.margin_numerator { - os.write_uint64(5, v)?; - } - if let Some(v) = self.margin_denominator { - os.write_uint64(6, v)?; - } - if let Some(v) = self.reward_account.as_ref() { - os.write_string(7, v)?; - } - if let Some(v) = self.metadata.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; - } - if let Some(v) = self.owners_count { - os.write_uint32(11, v)?; - } - if let Some(v) = self.relays_count { - os.write_uint32(12, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoPoolParametersType { - CardanoPoolParametersType::new() - } - - fn clear(&mut self) { - self.pool_id = ::std::option::Option::None; - self.vrf_key_hash = ::std::option::Option::None; - self.pledge = ::std::option::Option::None; - self.cost = ::std::option::Option::None; - self.margin_numerator = ::std::option::Option::None; - self.margin_denominator = ::std::option::Option::None; - self.reward_account = ::std::option::Option::None; - self.metadata.clear(); - self.owners_count = ::std::option::Option::None; - self.relays_count = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoPoolParametersType { - static instance: CardanoPoolParametersType = CardanoPoolParametersType { - pool_id: ::std::option::Option::None, - vrf_key_hash: ::std::option::Option::None, - pledge: ::std::option::Option::None, - cost: ::std::option::Option::None, - margin_numerator: ::std::option::Option::None, - margin_denominator: ::std::option::Option::None, - reward_account: ::std::option::Option::None, - metadata: ::protobuf::MessageField::none(), - owners_count: ::std::option::Option::None, - relays_count: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoPoolParametersType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoPoolParametersType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoPoolParametersType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoPoolParametersType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxCertificate) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxCertificate { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.path) - pub path: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.pool) - pub pool: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.pool_parameters) - pub pool_parameters: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.script_hash) - pub script_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.key_hash) - pub key_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxCertificate.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxCertificate { - fn default() -> &'a CardanoTxCertificate { - ::default_instance() - } -} - -impl CardanoTxCertificate { - pub fn new() -> CardanoTxCertificate { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoCertificateType type = 1; - - pub fn type_(&self) -> CardanoCertificateType { - match self.type_ { - Some(e) => e.enum_value_or(CardanoCertificateType::STAKE_REGISTRATION), - None => CardanoCertificateType::STAKE_REGISTRATION, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: CardanoCertificateType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes pool = 3; - - pub fn pool(&self) -> &[u8] { - match self.pool.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pool(&mut self) { - self.pool = ::std::option::Option::None; - } - - pub fn has_pool(&self) -> bool { - self.pool.is_some() - } - - // Param is passed by value, moved - pub fn set_pool(&mut self, v: ::std::vec::Vec) { - self.pool = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pool(&mut self) -> &mut ::std::vec::Vec { - if self.pool.is_none() { - self.pool = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pool.as_mut().unwrap() - } - - // Take field - pub fn take_pool(&mut self) -> ::std::vec::Vec { - self.pool.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes script_hash = 5; - - pub fn script_hash(&self) -> &[u8] { - match self.script_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_hash(&mut self) { - self.script_hash = ::std::option::Option::None; - } - - pub fn has_script_hash(&self) -> bool { - self.script_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_script_hash(&mut self, v: ::std::vec::Vec) { - self.script_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_hash(&mut self) -> &mut ::std::vec::Vec { - if self.script_hash.is_none() { - self.script_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_hash.as_mut().unwrap() - } - - // Take field - pub fn take_script_hash(&mut self) -> ::std::vec::Vec { - self.script_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes key_hash = 6; - - pub fn key_hash(&self) -> &[u8] { - match self.key_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_key_hash(&mut self) { - self.key_hash = ::std::option::Option::None; - } - - pub fn has_key_hash(&self) -> bool { - self.key_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { - self.key_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { - if self.key_hash.is_none() { - self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.key_hash.as_mut().unwrap() - } - - // Take field - pub fn take_key_hash(&mut self) -> ::std::vec::Vec { - self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &CardanoTxCertificate| { &m.type_ }, - |m: &mut CardanoTxCertificate| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "path", - |m: &CardanoTxCertificate| { &m.path }, - |m: &mut CardanoTxCertificate| { &mut m.path }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pool", - |m: &CardanoTxCertificate| { &m.pool }, - |m: &mut CardanoTxCertificate| { &mut m.pool }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoPoolParametersType>( - "pool_parameters", - |m: &CardanoTxCertificate| { &m.pool_parameters }, - |m: &mut CardanoTxCertificate| { &mut m.pool_parameters }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_hash", - |m: &CardanoTxCertificate| { &m.script_hash }, - |m: &mut CardanoTxCertificate| { &mut m.script_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key_hash", - |m: &CardanoTxCertificate| { &m.key_hash }, - |m: &mut CardanoTxCertificate| { &mut m.key_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxCertificate", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxCertificate { - const NAME: &'static str = "CardanoTxCertificate"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - for v in &self.pool_parameters { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.path)?; - }, - 16 => { - self.path.push(is.read_uint32()?); - }, - 26 => { - self.pool = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.pool_parameters)?; - }, - 42 => { - self.script_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.key_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - for value in &self.path { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - if let Some(v) = self.pool.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.pool_parameters.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.script_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.key_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - for v in &self.path { - os.write_uint32(2, *v)?; - }; - if let Some(v) = self.pool.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.pool_parameters.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.script_hash.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.key_hash.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxCertificate { - CardanoTxCertificate::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.path.clear(); - self.pool = ::std::option::Option::None; - self.pool_parameters.clear(); - self.script_hash = ::std::option::Option::None; - self.key_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxCertificate { - static instance: CardanoTxCertificate = CardanoTxCertificate { - type_: ::std::option::Option::None, - path: ::std::vec::Vec::new(), - pool: ::std::option::Option::None, - pool_parameters: ::protobuf::MessageField::none(), - script_hash: ::std::option::Option::None, - key_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxCertificate { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxCertificate").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxCertificate { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxCertificate { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxWithdrawal) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxWithdrawal { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.path) - pub path: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.script_hash) - pub script_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWithdrawal.key_hash) - pub key_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxWithdrawal.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxWithdrawal { - fn default() -> &'a CardanoTxWithdrawal { - ::default_instance() - } -} - -impl CardanoTxWithdrawal { - pub fn new() -> CardanoTxWithdrawal { - ::std::default::Default::default() - } - - // required uint64 amount = 2; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional bytes script_hash = 3; - - pub fn script_hash(&self) -> &[u8] { - match self.script_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script_hash(&mut self) { - self.script_hash = ::std::option::Option::None; - } - - pub fn has_script_hash(&self) -> bool { - self.script_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_script_hash(&mut self, v: ::std::vec::Vec) { - self.script_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_hash(&mut self) -> &mut ::std::vec::Vec { - if self.script_hash.is_none() { - self.script_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script_hash.as_mut().unwrap() - } - - // Take field - pub fn take_script_hash(&mut self) -> ::std::vec::Vec { - self.script_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes key_hash = 4; - - pub fn key_hash(&self) -> &[u8] { - match self.key_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_key_hash(&mut self) { - self.key_hash = ::std::option::Option::None; - } - - pub fn has_key_hash(&self) -> bool { - self.key_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { - self.key_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { - if self.key_hash.is_none() { - self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.key_hash.as_mut().unwrap() - } - - // Take field - pub fn take_key_hash(&mut self) -> ::std::vec::Vec { - self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "path", - |m: &CardanoTxWithdrawal| { &m.path }, - |m: &mut CardanoTxWithdrawal| { &mut m.path }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &CardanoTxWithdrawal| { &m.amount }, - |m: &mut CardanoTxWithdrawal| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script_hash", - |m: &CardanoTxWithdrawal| { &m.script_hash }, - |m: &mut CardanoTxWithdrawal| { &mut m.script_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key_hash", - |m: &CardanoTxWithdrawal| { &m.key_hash }, - |m: &mut CardanoTxWithdrawal| { &mut m.key_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxWithdrawal", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxWithdrawal { - const NAME: &'static str = "CardanoTxWithdrawal"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.path)?; - }, - 8 => { - self.path.push(is.read_uint32()?); - }, - 16 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - self.script_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.key_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.path { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.script_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.key_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.path { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.amount { - os.write_uint64(2, v)?; - } - if let Some(v) = self.script_hash.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.key_hash.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxWithdrawal { - CardanoTxWithdrawal::new() - } - - fn clear(&mut self) { - self.path.clear(); - self.amount = ::std::option::Option::None; - self.script_hash = ::std::option::Option::None; - self.key_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxWithdrawal { - static instance: CardanoTxWithdrawal = CardanoTxWithdrawal { - path: ::std::vec::Vec::new(), - amount: ::std::option::Option::None, - script_hash: ::std::option::Option::None, - key_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxWithdrawal { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxWithdrawal").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxWithdrawal { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxWithdrawal { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoCVoteRegistrationDelegation { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation.vote_public_key) - pub vote_public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation.weight) - pub weight: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegation.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoCVoteRegistrationDelegation { - fn default() -> &'a CardanoCVoteRegistrationDelegation { - ::default_instance() - } -} - -impl CardanoCVoteRegistrationDelegation { - pub fn new() -> CardanoCVoteRegistrationDelegation { - ::std::default::Default::default() - } - - // required bytes vote_public_key = 1; - - pub fn vote_public_key(&self) -> &[u8] { - match self.vote_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vote_public_key(&mut self) { - self.vote_public_key = ::std::option::Option::None; - } - - pub fn has_vote_public_key(&self) -> bool { - self.vote_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_vote_public_key(&mut self, v: ::std::vec::Vec) { - self.vote_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vote_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.vote_public_key.is_none() { - self.vote_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vote_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_vote_public_key(&mut self) -> ::std::vec::Vec { - self.vote_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 weight = 2; - - pub fn weight(&self) -> u32 { - self.weight.unwrap_or(0) - } - - pub fn clear_weight(&mut self) { - self.weight = ::std::option::Option::None; - } - - pub fn has_weight(&self) -> bool { - self.weight.is_some() - } - - // Param is passed by value, moved - pub fn set_weight(&mut self, v: u32) { - self.weight = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vote_public_key", - |m: &CardanoCVoteRegistrationDelegation| { &m.vote_public_key }, - |m: &mut CardanoCVoteRegistrationDelegation| { &mut m.vote_public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "weight", - |m: &CardanoCVoteRegistrationDelegation| { &m.weight }, - |m: &mut CardanoCVoteRegistrationDelegation| { &mut m.weight }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoCVoteRegistrationDelegation", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoCVoteRegistrationDelegation { - const NAME: &'static str = "CardanoCVoteRegistrationDelegation"; - - fn is_initialized(&self) -> bool { - if self.vote_public_key.is_none() { - return false; - } - if self.weight.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.vote_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.weight = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.vote_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.weight { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.vote_public_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.weight { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoCVoteRegistrationDelegation { - CardanoCVoteRegistrationDelegation::new() - } - - fn clear(&mut self) { - self.vote_public_key = ::std::option::Option::None; - self.weight = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoCVoteRegistrationDelegation { - static instance: CardanoCVoteRegistrationDelegation = CardanoCVoteRegistrationDelegation { - vote_public_key: ::std::option::Option::None, - weight: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoCVoteRegistrationDelegation { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoCVoteRegistrationDelegation").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoCVoteRegistrationDelegation { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoCVoteRegistrationDelegation { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoCVoteRegistrationParametersType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.vote_public_key) - pub vote_public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.staking_path) - pub staking_path: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.payment_address_parameters) - pub payment_address_parameters: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.nonce) - pub nonce: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.format) - pub format: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.delegations) - pub delegations: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.voting_purpose) - pub voting_purpose: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.payment_address) - pub payment_address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoCVoteRegistrationParametersType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoCVoteRegistrationParametersType { - fn default() -> &'a CardanoCVoteRegistrationParametersType { - ::default_instance() - } -} - -impl CardanoCVoteRegistrationParametersType { - pub fn new() -> CardanoCVoteRegistrationParametersType { - ::std::default::Default::default() - } - - // optional bytes vote_public_key = 1; - - pub fn vote_public_key(&self) -> &[u8] { - match self.vote_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vote_public_key(&mut self) { - self.vote_public_key = ::std::option::Option::None; - } - - pub fn has_vote_public_key(&self) -> bool { - self.vote_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_vote_public_key(&mut self, v: ::std::vec::Vec) { - self.vote_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vote_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.vote_public_key.is_none() { - self.vote_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vote_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_vote_public_key(&mut self) -> ::std::vec::Vec { - self.vote_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 nonce = 4; - - pub fn nonce(&self) -> u64 { - self.nonce.unwrap_or(0) - } - - pub fn clear_nonce(&mut self) { - self.nonce = ::std::option::Option::None; - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: u64) { - self.nonce = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat format = 5; - - pub fn format(&self) -> CardanoCVoteRegistrationFormat { - match self.format { - Some(e) => e.enum_value_or(CardanoCVoteRegistrationFormat::CIP15), - None => CardanoCVoteRegistrationFormat::CIP15, - } - } - - pub fn clear_format(&mut self) { - self.format = ::std::option::Option::None; - } - - pub fn has_format(&self) -> bool { - self.format.is_some() - } - - // Param is passed by value, moved - pub fn set_format(&mut self, v: CardanoCVoteRegistrationFormat) { - self.format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint64 voting_purpose = 7; - - pub fn voting_purpose(&self) -> u64 { - self.voting_purpose.unwrap_or(0) - } - - pub fn clear_voting_purpose(&mut self) { - self.voting_purpose = ::std::option::Option::None; - } - - pub fn has_voting_purpose(&self) -> bool { - self.voting_purpose.is_some() - } - - // Param is passed by value, moved - pub fn set_voting_purpose(&mut self, v: u64) { - self.voting_purpose = ::std::option::Option::Some(v); - } - - // optional string payment_address = 8; - - pub fn payment_address(&self) -> &str { - match self.payment_address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_payment_address(&mut self) { - self.payment_address = ::std::option::Option::None; - } - - pub fn has_payment_address(&self) -> bool { - self.payment_address.is_some() - } - - // Param is passed by value, moved - pub fn set_payment_address(&mut self, v: ::std::string::String) { - self.payment_address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payment_address(&mut self) -> &mut ::std::string::String { - if self.payment_address.is_none() { - self.payment_address = ::std::option::Option::Some(::std::string::String::new()); - } - self.payment_address.as_mut().unwrap() - } - - // Take field - pub fn take_payment_address(&mut self) -> ::std::string::String { - self.payment_address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vote_public_key", - |m: &CardanoCVoteRegistrationParametersType| { &m.vote_public_key }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.vote_public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "staking_path", - |m: &CardanoCVoteRegistrationParametersType| { &m.staking_path }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.staking_path }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoAddressParametersType>( - "payment_address_parameters", - |m: &CardanoCVoteRegistrationParametersType| { &m.payment_address_parameters }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.payment_address_parameters }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "nonce", - |m: &CardanoCVoteRegistrationParametersType| { &m.nonce }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.nonce }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "format", - |m: &CardanoCVoteRegistrationParametersType| { &m.format }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.format }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "delegations", - |m: &CardanoCVoteRegistrationParametersType| { &m.delegations }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.delegations }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "voting_purpose", - |m: &CardanoCVoteRegistrationParametersType| { &m.voting_purpose }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.voting_purpose }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payment_address", - |m: &CardanoCVoteRegistrationParametersType| { &m.payment_address }, - |m: &mut CardanoCVoteRegistrationParametersType| { &mut m.payment_address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoCVoteRegistrationParametersType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoCVoteRegistrationParametersType { - const NAME: &'static str = "CardanoCVoteRegistrationParametersType"; - - fn is_initialized(&self) -> bool { - if self.nonce.is_none() { - return false; - } - for v in &self.payment_address_parameters { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delegations { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.vote_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.staking_path)?; - }, - 16 => { - self.staking_path.push(is.read_uint32()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.payment_address_parameters)?; - }, - 32 => { - self.nonce = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.format = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 50 => { - self.delegations.push(is.read_message()?); - }, - 56 => { - self.voting_purpose = ::std::option::Option::Some(is.read_uint64()?); - }, - 66 => { - self.payment_address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.vote_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - for value in &self.staking_path { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - if let Some(v) = self.payment_address_parameters.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.nonce { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.format { - my_size += ::protobuf::rt::int32_size(5, v.value()); - } - for value in &self.delegations { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.voting_purpose { - my_size += ::protobuf::rt::uint64_size(7, v); - } - if let Some(v) = self.payment_address.as_ref() { - my_size += ::protobuf::rt::string_size(8, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.vote_public_key.as_ref() { - os.write_bytes(1, v)?; - } - for v in &self.staking_path { - os.write_uint32(2, *v)?; - }; - if let Some(v) = self.payment_address_parameters.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.nonce { - os.write_uint64(4, v)?; - } - if let Some(v) = self.format { - os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; - } - for v in &self.delegations { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - }; - if let Some(v) = self.voting_purpose { - os.write_uint64(7, v)?; - } - if let Some(v) = self.payment_address.as_ref() { - os.write_string(8, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoCVoteRegistrationParametersType { - CardanoCVoteRegistrationParametersType::new() - } - - fn clear(&mut self) { - self.vote_public_key = ::std::option::Option::None; - self.staking_path.clear(); - self.payment_address_parameters.clear(); - self.nonce = ::std::option::Option::None; - self.format = ::std::option::Option::None; - self.delegations.clear(); - self.voting_purpose = ::std::option::Option::None; - self.payment_address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoCVoteRegistrationParametersType { - static instance: CardanoCVoteRegistrationParametersType = CardanoCVoteRegistrationParametersType { - vote_public_key: ::std::option::Option::None, - staking_path: ::std::vec::Vec::new(), - payment_address_parameters: ::protobuf::MessageField::none(), - nonce: ::std::option::Option::None, - format: ::std::option::Option::None, - delegations: ::std::vec::Vec::new(), - voting_purpose: ::std::option::Option::None, - payment_address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoCVoteRegistrationParametersType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoCVoteRegistrationParametersType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoCVoteRegistrationParametersType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoCVoteRegistrationParametersType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxAuxiliaryData) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxAuxiliaryData { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryData.cvote_registration_parameters) - pub cvote_registration_parameters: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryData.hash) - pub hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxAuxiliaryData.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxAuxiliaryData { - fn default() -> &'a CardanoTxAuxiliaryData { - ::default_instance() - } -} - -impl CardanoTxAuxiliaryData { - pub fn new() -> CardanoTxAuxiliaryData { - ::std::default::Default::default() - } - - // optional bytes hash = 2; - - pub fn hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoCVoteRegistrationParametersType>( - "cvote_registration_parameters", - |m: &CardanoTxAuxiliaryData| { &m.cvote_registration_parameters }, - |m: &mut CardanoTxAuxiliaryData| { &mut m.cvote_registration_parameters }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hash", - |m: &CardanoTxAuxiliaryData| { &m.hash }, - |m: &mut CardanoTxAuxiliaryData| { &mut m.hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxAuxiliaryData", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxAuxiliaryData { - const NAME: &'static str = "CardanoTxAuxiliaryData"; - - fn is_initialized(&self) -> bool { - for v in &self.cvote_registration_parameters { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.cvote_registration_parameters)?; - }, - 18 => { - self.hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.cvote_registration_parameters.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.cvote_registration_parameters.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.hash.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxAuxiliaryData { - CardanoTxAuxiliaryData::new() - } - - fn clear(&mut self) { - self.cvote_registration_parameters.clear(); - self.hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxAuxiliaryData { - static instance: CardanoTxAuxiliaryData = CardanoTxAuxiliaryData { - cvote_registration_parameters: ::protobuf::MessageField::none(), - hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxAuxiliaryData { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxAuxiliaryData").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxAuxiliaryData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxAuxiliaryData { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxMint) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxMint { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxMint.asset_groups_count) - pub asset_groups_count: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxMint.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxMint { - fn default() -> &'a CardanoTxMint { - ::default_instance() - } -} - -impl CardanoTxMint { - pub fn new() -> CardanoTxMint { - ::std::default::Default::default() - } - - // required uint32 asset_groups_count = 1; - - pub fn asset_groups_count(&self) -> u32 { - self.asset_groups_count.unwrap_or(0) - } - - pub fn clear_asset_groups_count(&mut self) { - self.asset_groups_count = ::std::option::Option::None; - } - - pub fn has_asset_groups_count(&self) -> bool { - self.asset_groups_count.is_some() - } - - // Param is passed by value, moved - pub fn set_asset_groups_count(&mut self, v: u32) { - self.asset_groups_count = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "asset_groups_count", - |m: &CardanoTxMint| { &m.asset_groups_count }, - |m: &mut CardanoTxMint| { &mut m.asset_groups_count }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxMint", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxMint { - const NAME: &'static str = "CardanoTxMint"; - - fn is_initialized(&self) -> bool { - if self.asset_groups_count.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.asset_groups_count = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.asset_groups_count { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.asset_groups_count { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxMint { - CardanoTxMint::new() - } - - fn clear(&mut self) { - self.asset_groups_count = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxMint { - static instance: CardanoTxMint = CardanoTxMint { - asset_groups_count: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxMint { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxMint").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxMint { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxMint { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxCollateralInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxCollateralInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCollateralInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCollateralInput.prev_index) - pub prev_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxCollateralInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxCollateralInput { - fn default() -> &'a CardanoTxCollateralInput { - ::default_instance() - } -} - -impl CardanoTxCollateralInput { - pub fn new() -> CardanoTxCollateralInput { - ::std::default::Default::default() - } - - // required bytes prev_hash = 1; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 2; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &CardanoTxCollateralInput| { &m.prev_hash }, - |m: &mut CardanoTxCollateralInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &CardanoTxCollateralInput| { &m.prev_index }, - |m: &mut CardanoTxCollateralInput| { &mut m.prev_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxCollateralInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxCollateralInput { - const NAME: &'static str = "CardanoTxCollateralInput"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxCollateralInput { - CardanoTxCollateralInput::new() - } - - fn clear(&mut self) { - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxCollateralInput { - static instance: CardanoTxCollateralInput = CardanoTxCollateralInput { - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxCollateralInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxCollateralInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxCollateralInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxCollateralInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxRequiredSigner) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxRequiredSigner { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxRequiredSigner.key_hash) - pub key_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxRequiredSigner.key_path) - pub key_path: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxRequiredSigner.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxRequiredSigner { - fn default() -> &'a CardanoTxRequiredSigner { - ::default_instance() - } -} - -impl CardanoTxRequiredSigner { - pub fn new() -> CardanoTxRequiredSigner { - ::std::default::Default::default() - } - - // optional bytes key_hash = 1; - - pub fn key_hash(&self) -> &[u8] { - match self.key_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_key_hash(&mut self) { - self.key_hash = ::std::option::Option::None; - } - - pub fn has_key_hash(&self) -> bool { - self.key_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_key_hash(&mut self, v: ::std::vec::Vec) { - self.key_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec { - if self.key_hash.is_none() { - self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.key_hash.as_mut().unwrap() - } - - // Take field - pub fn take_key_hash(&mut self) -> ::std::vec::Vec { - self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key_hash", - |m: &CardanoTxRequiredSigner| { &m.key_hash }, - |m: &mut CardanoTxRequiredSigner| { &mut m.key_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "key_path", - |m: &CardanoTxRequiredSigner| { &m.key_path }, - |m: &mut CardanoTxRequiredSigner| { &mut m.key_path }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxRequiredSigner", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxRequiredSigner { - const NAME: &'static str = "CardanoTxRequiredSigner"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.key_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.key_path)?; - }, - 16 => { - self.key_path.push(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.key_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - for value in &self.key_path { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.key_hash.as_ref() { - os.write_bytes(1, v)?; - } - for v in &self.key_path { - os.write_uint32(2, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxRequiredSigner { - CardanoTxRequiredSigner::new() - } - - fn clear(&mut self) { - self.key_hash = ::std::option::Option::None; - self.key_path.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxRequiredSigner { - static instance: CardanoTxRequiredSigner = CardanoTxRequiredSigner { - key_hash: ::std::option::Option::None, - key_path: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxRequiredSigner { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxRequiredSigner").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxRequiredSigner { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxRequiredSigner { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxReferenceInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxReferenceInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxReferenceInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxReferenceInput.prev_index) - pub prev_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxReferenceInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxReferenceInput { - fn default() -> &'a CardanoTxReferenceInput { - ::default_instance() - } -} - -impl CardanoTxReferenceInput { - pub fn new() -> CardanoTxReferenceInput { - ::std::default::Default::default() - } - - // required bytes prev_hash = 1; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 2; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &CardanoTxReferenceInput| { &m.prev_hash }, - |m: &mut CardanoTxReferenceInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &CardanoTxReferenceInput| { &m.prev_index }, - |m: &mut CardanoTxReferenceInput| { &mut m.prev_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxReferenceInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxReferenceInput { - const NAME: &'static str = "CardanoTxReferenceInput"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxReferenceInput { - CardanoTxReferenceInput::new() - } - - fn clear(&mut self) { - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxReferenceInput { - static instance: CardanoTxReferenceInput = CardanoTxReferenceInput { - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxReferenceInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxReferenceInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxReferenceInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxReferenceInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxItemAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxItemAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxItemAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxItemAck { - fn default() -> &'a CardanoTxItemAck { - ::default_instance() - } -} - -impl CardanoTxItemAck { - pub fn new() -> CardanoTxItemAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxItemAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxItemAck { - const NAME: &'static str = "CardanoTxItemAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxItemAck { - CardanoTxItemAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxItemAck { - static instance: CardanoTxItemAck = CardanoTxItemAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxItemAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxItemAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxItemAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxItemAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxAuxiliaryDataSupplement { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.auxiliary_data_hash) - pub auxiliary_data_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.cvote_registration_signature) - pub cvote_registration_signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplement.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxAuxiliaryDataSupplement { - fn default() -> &'a CardanoTxAuxiliaryDataSupplement { - ::default_instance() - } -} - -impl CardanoTxAuxiliaryDataSupplement { - pub fn new() -> CardanoTxAuxiliaryDataSupplement { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType type = 1; - - pub fn type_(&self) -> CardanoTxAuxiliaryDataSupplementType { - match self.type_ { - Some(e) => e.enum_value_or(CardanoTxAuxiliaryDataSupplementType::NONE), - None => CardanoTxAuxiliaryDataSupplementType::NONE, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: CardanoTxAuxiliaryDataSupplementType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes auxiliary_data_hash = 2; - - pub fn auxiliary_data_hash(&self) -> &[u8] { - match self.auxiliary_data_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_auxiliary_data_hash(&mut self) { - self.auxiliary_data_hash = ::std::option::Option::None; - } - - pub fn has_auxiliary_data_hash(&self) -> bool { - self.auxiliary_data_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_auxiliary_data_hash(&mut self, v: ::std::vec::Vec) { - self.auxiliary_data_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_auxiliary_data_hash(&mut self) -> &mut ::std::vec::Vec { - if self.auxiliary_data_hash.is_none() { - self.auxiliary_data_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.auxiliary_data_hash.as_mut().unwrap() - } - - // Take field - pub fn take_auxiliary_data_hash(&mut self) -> ::std::vec::Vec { - self.auxiliary_data_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes cvote_registration_signature = 3; - - pub fn cvote_registration_signature(&self) -> &[u8] { - match self.cvote_registration_signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_cvote_registration_signature(&mut self) { - self.cvote_registration_signature = ::std::option::Option::None; - } - - pub fn has_cvote_registration_signature(&self) -> bool { - self.cvote_registration_signature.is_some() - } - - // Param is passed by value, moved - pub fn set_cvote_registration_signature(&mut self, v: ::std::vec::Vec) { - self.cvote_registration_signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cvote_registration_signature(&mut self) -> &mut ::std::vec::Vec { - if self.cvote_registration_signature.is_none() { - self.cvote_registration_signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.cvote_registration_signature.as_mut().unwrap() - } - - // Take field - pub fn take_cvote_registration_signature(&mut self) -> ::std::vec::Vec { - self.cvote_registration_signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &CardanoTxAuxiliaryDataSupplement| { &m.type_ }, - |m: &mut CardanoTxAuxiliaryDataSupplement| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "auxiliary_data_hash", - |m: &CardanoTxAuxiliaryDataSupplement| { &m.auxiliary_data_hash }, - |m: &mut CardanoTxAuxiliaryDataSupplement| { &mut m.auxiliary_data_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "cvote_registration_signature", - |m: &CardanoTxAuxiliaryDataSupplement| { &m.cvote_registration_signature }, - |m: &mut CardanoTxAuxiliaryDataSupplement| { &mut m.cvote_registration_signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxAuxiliaryDataSupplement", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxAuxiliaryDataSupplement { - const NAME: &'static str = "CardanoTxAuxiliaryDataSupplement"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.auxiliary_data_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.cvote_registration_signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.auxiliary_data_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.cvote_registration_signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.auxiliary_data_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.cvote_registration_signature.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxAuxiliaryDataSupplement { - CardanoTxAuxiliaryDataSupplement::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.auxiliary_data_hash = ::std::option::Option::None; - self.cvote_registration_signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxAuxiliaryDataSupplement { - static instance: CardanoTxAuxiliaryDataSupplement = CardanoTxAuxiliaryDataSupplement { - type_: ::std::option::Option::None, - auxiliary_data_hash: ::std::option::Option::None, - cvote_registration_signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxAuxiliaryDataSupplement { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxAuxiliaryDataSupplement").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxAuxiliaryDataSupplement { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxAuxiliaryDataSupplement { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxWitnessRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxWitnessRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessRequest.path) - pub path: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxWitnessRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxWitnessRequest { - fn default() -> &'a CardanoTxWitnessRequest { - ::default_instance() - } -} - -impl CardanoTxWitnessRequest { - pub fn new() -> CardanoTxWitnessRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "path", - |m: &CardanoTxWitnessRequest| { &m.path }, - |m: &mut CardanoTxWitnessRequest| { &mut m.path }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxWitnessRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxWitnessRequest { - const NAME: &'static str = "CardanoTxWitnessRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.path)?; - }, - 8 => { - self.path.push(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.path { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.path { - os.write_uint32(1, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxWitnessRequest { - CardanoTxWitnessRequest::new() - } - - fn clear(&mut self) { - self.path.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxWitnessRequest { - static instance: CardanoTxWitnessRequest = CardanoTxWitnessRequest { - path: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxWitnessRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxWitnessRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxWitnessRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxWitnessRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxWitnessResponse) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxWitnessResponse { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.pub_key) - pub pub_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.chain_code) - pub chain_code: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxWitnessResponse.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxWitnessResponse { - fn default() -> &'a CardanoTxWitnessResponse { - ::default_instance() - } -} - -impl CardanoTxWitnessResponse { - pub fn new() -> CardanoTxWitnessResponse { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.cardano.CardanoTxWitnessType type = 1; - - pub fn type_(&self) -> CardanoTxWitnessType { - match self.type_ { - Some(e) => e.enum_value_or(CardanoTxWitnessType::BYRON_WITNESS), - None => CardanoTxWitnessType::BYRON_WITNESS, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: CardanoTxWitnessType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required bytes pub_key = 2; - - pub fn pub_key(&self) -> &[u8] { - match self.pub_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pub_key(&mut self) { - self.pub_key = ::std::option::Option::None; - } - - pub fn has_pub_key(&self) -> bool { - self.pub_key.is_some() - } - - // Param is passed by value, moved - pub fn set_pub_key(&mut self, v: ::std::vec::Vec) { - self.pub_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pub_key(&mut self) -> &mut ::std::vec::Vec { - if self.pub_key.is_none() { - self.pub_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pub_key.as_mut().unwrap() - } - - // Take field - pub fn take_pub_key(&mut self) -> ::std::vec::Vec { - self.pub_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes signature = 3; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes chain_code = 4; - - pub fn chain_code(&self) -> &[u8] { - match self.chain_code.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_chain_code(&mut self) { - self.chain_code = ::std::option::Option::None; - } - - pub fn has_chain_code(&self) -> bool { - self.chain_code.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_code(&mut self, v: ::std::vec::Vec) { - self.chain_code = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_chain_code(&mut self) -> &mut ::std::vec::Vec { - if self.chain_code.is_none() { - self.chain_code = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.chain_code.as_mut().unwrap() - } - - // Take field - pub fn take_chain_code(&mut self) -> ::std::vec::Vec { - self.chain_code.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &CardanoTxWitnessResponse| { &m.type_ }, - |m: &mut CardanoTxWitnessResponse| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pub_key", - |m: &CardanoTxWitnessResponse| { &m.pub_key }, - |m: &mut CardanoTxWitnessResponse| { &mut m.pub_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &CardanoTxWitnessResponse| { &m.signature }, - |m: &mut CardanoTxWitnessResponse| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_code", - |m: &CardanoTxWitnessResponse| { &m.chain_code }, - |m: &mut CardanoTxWitnessResponse| { &mut m.chain_code }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxWitnessResponse", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxWitnessResponse { - const NAME: &'static str = "CardanoTxWitnessResponse"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - if self.pub_key.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.pub_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.chain_code = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.pub_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.chain_code.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.pub_key.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.chain_code.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxWitnessResponse { - CardanoTxWitnessResponse::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.pub_key = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.chain_code = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxWitnessResponse { - static instance: CardanoTxWitnessResponse = CardanoTxWitnessResponse { - type_: ::std::option::Option::None, - pub_key: ::std::option::Option::None, - signature: ::std::option::Option::None, - chain_code: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxWitnessResponse { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxWitnessResponse").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxWitnessResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxWitnessResponse { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxHostAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxHostAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxHostAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxHostAck { - fn default() -> &'a CardanoTxHostAck { - ::default_instance() - } -} - -impl CardanoTxHostAck { - pub fn new() -> CardanoTxHostAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxHostAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxHostAck { - const NAME: &'static str = "CardanoTxHostAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxHostAck { - CardanoTxHostAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxHostAck { - static instance: CardanoTxHostAck = CardanoTxHostAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxHostAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxHostAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxHostAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxHostAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxBodyHash) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoTxBodyHash { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxBodyHash.tx_hash) - pub tx_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxBodyHash.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoTxBodyHash { - fn default() -> &'a CardanoTxBodyHash { - ::default_instance() - } -} - -impl CardanoTxBodyHash { - pub fn new() -> CardanoTxBodyHash { - ::std::default::Default::default() - } - - // required bytes tx_hash = 1; - - pub fn tx_hash(&self) -> &[u8] { - match self.tx_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_hash(&mut self) { - self.tx_hash = ::std::option::Option::None; - } - - pub fn has_tx_hash(&self) -> bool { - self.tx_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_hash(&mut self, v: ::std::vec::Vec) { - self.tx_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_hash(&mut self) -> &mut ::std::vec::Vec { - if self.tx_hash.is_none() { - self.tx_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_hash.as_mut().unwrap() - } - - // Take field - pub fn take_tx_hash(&mut self) -> ::std::vec::Vec { - self.tx_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_hash", - |m: &CardanoTxBodyHash| { &m.tx_hash }, - |m: &mut CardanoTxBodyHash| { &mut m.tx_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoTxBodyHash", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoTxBodyHash { - const NAME: &'static str = "CardanoTxBodyHash"; - - fn is_initialized(&self) -> bool { - if self.tx_hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.tx_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx_hash.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoTxBodyHash { - CardanoTxBodyHash::new() - } - - fn clear(&mut self) { - self.tx_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoTxBodyHash { - static instance: CardanoTxBodyHash = CardanoTxBodyHash { - tx_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoTxBodyHash { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoTxBodyHash").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoTxBodyHash { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoTxBodyHash { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoSignTxFinished) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CardanoSignTxFinished { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoSignTxFinished.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CardanoSignTxFinished { - fn default() -> &'a CardanoSignTxFinished { - ::default_instance() - } -} - -impl CardanoSignTxFinished { - pub fn new() -> CardanoSignTxFinished { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CardanoSignTxFinished", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CardanoSignTxFinished { - const NAME: &'static str = "CardanoSignTxFinished"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CardanoSignTxFinished { - CardanoSignTxFinished::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static CardanoSignTxFinished { - static instance: CardanoSignTxFinished = CardanoSignTxFinished { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CardanoSignTxFinished { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoSignTxFinished").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CardanoSignTxFinished { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CardanoSignTxFinished { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoDerivationType) -pub enum CardanoDerivationType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDerivationType.LEDGER) - LEDGER = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDerivationType.ICARUS) - ICARUS = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDerivationType.ICARUS_TREZOR) - ICARUS_TREZOR = 2, -} - -impl ::protobuf::Enum for CardanoDerivationType { - const NAME: &'static str = "CardanoDerivationType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoDerivationType::LEDGER), - 1 => ::std::option::Option::Some(CardanoDerivationType::ICARUS), - 2 => ::std::option::Option::Some(CardanoDerivationType::ICARUS_TREZOR), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "LEDGER" => ::std::option::Option::Some(CardanoDerivationType::LEDGER), - "ICARUS" => ::std::option::Option::Some(CardanoDerivationType::ICARUS), - "ICARUS_TREZOR" => ::std::option::Option::Some(CardanoDerivationType::ICARUS_TREZOR), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoDerivationType] = &[ - CardanoDerivationType::LEDGER, - CardanoDerivationType::ICARUS, - CardanoDerivationType::ICARUS_TREZOR, - ]; -} - -impl ::protobuf::EnumFull for CardanoDerivationType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoDerivationType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoDerivationType { - fn default() -> Self { - CardanoDerivationType::LEDGER - } -} - -impl CardanoDerivationType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoDerivationType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoAddressType) -pub enum CardanoAddressType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE) - BASE = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE_SCRIPT_KEY) - BASE_SCRIPT_KEY = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE_KEY_SCRIPT) - BASE_KEY_SCRIPT = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BASE_SCRIPT_SCRIPT) - BASE_SCRIPT_SCRIPT = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.POINTER) - POINTER = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.POINTER_SCRIPT) - POINTER_SCRIPT = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.ENTERPRISE) - ENTERPRISE = 6, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.ENTERPRISE_SCRIPT) - ENTERPRISE_SCRIPT = 7, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.BYRON) - BYRON = 8, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.REWARD) - REWARD = 14, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoAddressType.REWARD_SCRIPT) - REWARD_SCRIPT = 15, -} - -impl ::protobuf::Enum for CardanoAddressType { - const NAME: &'static str = "CardanoAddressType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoAddressType::BASE), - 1 => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_KEY), - 2 => ::std::option::Option::Some(CardanoAddressType::BASE_KEY_SCRIPT), - 3 => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_SCRIPT), - 4 => ::std::option::Option::Some(CardanoAddressType::POINTER), - 5 => ::std::option::Option::Some(CardanoAddressType::POINTER_SCRIPT), - 6 => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE), - 7 => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE_SCRIPT), - 8 => ::std::option::Option::Some(CardanoAddressType::BYRON), - 14 => ::std::option::Option::Some(CardanoAddressType::REWARD), - 15 => ::std::option::Option::Some(CardanoAddressType::REWARD_SCRIPT), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "BASE" => ::std::option::Option::Some(CardanoAddressType::BASE), - "BASE_SCRIPT_KEY" => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_KEY), - "BASE_KEY_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::BASE_KEY_SCRIPT), - "BASE_SCRIPT_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::BASE_SCRIPT_SCRIPT), - "POINTER" => ::std::option::Option::Some(CardanoAddressType::POINTER), - "POINTER_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::POINTER_SCRIPT), - "ENTERPRISE" => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE), - "ENTERPRISE_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::ENTERPRISE_SCRIPT), - "BYRON" => ::std::option::Option::Some(CardanoAddressType::BYRON), - "REWARD" => ::std::option::Option::Some(CardanoAddressType::REWARD), - "REWARD_SCRIPT" => ::std::option::Option::Some(CardanoAddressType::REWARD_SCRIPT), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoAddressType] = &[ - CardanoAddressType::BASE, - CardanoAddressType::BASE_SCRIPT_KEY, - CardanoAddressType::BASE_KEY_SCRIPT, - CardanoAddressType::BASE_SCRIPT_SCRIPT, - CardanoAddressType::POINTER, - CardanoAddressType::POINTER_SCRIPT, - CardanoAddressType::ENTERPRISE, - CardanoAddressType::ENTERPRISE_SCRIPT, - CardanoAddressType::BYRON, - CardanoAddressType::REWARD, - CardanoAddressType::REWARD_SCRIPT, - ]; -} - -impl ::protobuf::EnumFull for CardanoAddressType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoAddressType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - CardanoAddressType::BASE => 0, - CardanoAddressType::BASE_SCRIPT_KEY => 1, - CardanoAddressType::BASE_KEY_SCRIPT => 2, - CardanoAddressType::BASE_SCRIPT_SCRIPT => 3, - CardanoAddressType::POINTER => 4, - CardanoAddressType::POINTER_SCRIPT => 5, - CardanoAddressType::ENTERPRISE => 6, - CardanoAddressType::ENTERPRISE_SCRIPT => 7, - CardanoAddressType::BYRON => 8, - CardanoAddressType::REWARD => 9, - CardanoAddressType::REWARD_SCRIPT => 10, - }; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoAddressType { - fn default() -> Self { - CardanoAddressType::BASE - } -} - -impl CardanoAddressType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoAddressType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoNativeScriptType) -pub enum CardanoNativeScriptType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.PUB_KEY) - PUB_KEY = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.ALL) - ALL = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.ANY) - ANY = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.N_OF_K) - N_OF_K = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.INVALID_BEFORE) - INVALID_BEFORE = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptType.INVALID_HEREAFTER) - INVALID_HEREAFTER = 5, -} - -impl ::protobuf::Enum for CardanoNativeScriptType { - const NAME: &'static str = "CardanoNativeScriptType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoNativeScriptType::PUB_KEY), - 1 => ::std::option::Option::Some(CardanoNativeScriptType::ALL), - 2 => ::std::option::Option::Some(CardanoNativeScriptType::ANY), - 3 => ::std::option::Option::Some(CardanoNativeScriptType::N_OF_K), - 4 => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_BEFORE), - 5 => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_HEREAFTER), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "PUB_KEY" => ::std::option::Option::Some(CardanoNativeScriptType::PUB_KEY), - "ALL" => ::std::option::Option::Some(CardanoNativeScriptType::ALL), - "ANY" => ::std::option::Option::Some(CardanoNativeScriptType::ANY), - "N_OF_K" => ::std::option::Option::Some(CardanoNativeScriptType::N_OF_K), - "INVALID_BEFORE" => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_BEFORE), - "INVALID_HEREAFTER" => ::std::option::Option::Some(CardanoNativeScriptType::INVALID_HEREAFTER), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoNativeScriptType] = &[ - CardanoNativeScriptType::PUB_KEY, - CardanoNativeScriptType::ALL, - CardanoNativeScriptType::ANY, - CardanoNativeScriptType::N_OF_K, - CardanoNativeScriptType::INVALID_BEFORE, - CardanoNativeScriptType::INVALID_HEREAFTER, - ]; -} - -impl ::protobuf::EnumFull for CardanoNativeScriptType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoNativeScriptType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoNativeScriptType { - fn default() -> Self { - CardanoNativeScriptType::PUB_KEY - } -} - -impl CardanoNativeScriptType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoNativeScriptType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat) -pub enum CardanoNativeScriptHashDisplayFormat { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat.HIDE) - HIDE = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat.BECH32) - BECH32 = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoNativeScriptHashDisplayFormat.POLICY_ID) - POLICY_ID = 2, -} - -impl ::protobuf::Enum for CardanoNativeScriptHashDisplayFormat { - const NAME: &'static str = "CardanoNativeScriptHashDisplayFormat"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::HIDE), - 1 => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::BECH32), - 2 => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::POLICY_ID), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "HIDE" => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::HIDE), - "BECH32" => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::BECH32), - "POLICY_ID" => ::std::option::Option::Some(CardanoNativeScriptHashDisplayFormat::POLICY_ID), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoNativeScriptHashDisplayFormat] = &[ - CardanoNativeScriptHashDisplayFormat::HIDE, - CardanoNativeScriptHashDisplayFormat::BECH32, - CardanoNativeScriptHashDisplayFormat::POLICY_ID, - ]; -} - -impl ::protobuf::EnumFull for CardanoNativeScriptHashDisplayFormat { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoNativeScriptHashDisplayFormat").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoNativeScriptHashDisplayFormat { - fn default() -> Self { - CardanoNativeScriptHashDisplayFormat::HIDE - } -} - -impl CardanoNativeScriptHashDisplayFormat { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoNativeScriptHashDisplayFormat") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat) -pub enum CardanoTxOutputSerializationFormat { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat.ARRAY_LEGACY) - ARRAY_LEGACY = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxOutputSerializationFormat.MAP_BABBAGE) - MAP_BABBAGE = 1, -} - -impl ::protobuf::Enum for CardanoTxOutputSerializationFormat { - const NAME: &'static str = "CardanoTxOutputSerializationFormat"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::ARRAY_LEGACY), - 1 => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::MAP_BABBAGE), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "ARRAY_LEGACY" => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::ARRAY_LEGACY), - "MAP_BABBAGE" => ::std::option::Option::Some(CardanoTxOutputSerializationFormat::MAP_BABBAGE), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoTxOutputSerializationFormat] = &[ - CardanoTxOutputSerializationFormat::ARRAY_LEGACY, - CardanoTxOutputSerializationFormat::MAP_BABBAGE, - ]; -} - -impl ::protobuf::EnumFull for CardanoTxOutputSerializationFormat { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxOutputSerializationFormat").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoTxOutputSerializationFormat { - fn default() -> Self { - CardanoTxOutputSerializationFormat::ARRAY_LEGACY - } -} - -impl CardanoTxOutputSerializationFormat { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxOutputSerializationFormat") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoCertificateType) -pub enum CardanoCertificateType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_REGISTRATION) - STAKE_REGISTRATION = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_DEREGISTRATION) - STAKE_DEREGISTRATION = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_DELEGATION) - STAKE_DELEGATION = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_POOL_REGISTRATION) - STAKE_POOL_REGISTRATION = 3, -} - -impl ::protobuf::Enum for CardanoCertificateType { - const NAME: &'static str = "CardanoCertificateType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoCertificateType::STAKE_REGISTRATION), - 1 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION), - 2 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION), - 3 => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "STAKE_REGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_REGISTRATION), - "STAKE_DEREGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION), - "STAKE_DELEGATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION), - "STAKE_POOL_REGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoCertificateType] = &[ - CardanoCertificateType::STAKE_REGISTRATION, - CardanoCertificateType::STAKE_DEREGISTRATION, - CardanoCertificateType::STAKE_DELEGATION, - CardanoCertificateType::STAKE_POOL_REGISTRATION, - ]; -} - -impl ::protobuf::EnumFull for CardanoCertificateType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoCertificateType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoCertificateType { - fn default() -> Self { - CardanoCertificateType::STAKE_REGISTRATION - } -} - -impl CardanoCertificateType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoCertificateType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoPoolRelayType) -pub enum CardanoPoolRelayType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoPoolRelayType.SINGLE_HOST_IP) - SINGLE_HOST_IP = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoPoolRelayType.SINGLE_HOST_NAME) - SINGLE_HOST_NAME = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoPoolRelayType.MULTIPLE_HOST_NAME) - MULTIPLE_HOST_NAME = 2, -} - -impl ::protobuf::Enum for CardanoPoolRelayType { - const NAME: &'static str = "CardanoPoolRelayType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_IP), - 1 => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_NAME), - 2 => ::std::option::Option::Some(CardanoPoolRelayType::MULTIPLE_HOST_NAME), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "SINGLE_HOST_IP" => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_IP), - "SINGLE_HOST_NAME" => ::std::option::Option::Some(CardanoPoolRelayType::SINGLE_HOST_NAME), - "MULTIPLE_HOST_NAME" => ::std::option::Option::Some(CardanoPoolRelayType::MULTIPLE_HOST_NAME), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoPoolRelayType] = &[ - CardanoPoolRelayType::SINGLE_HOST_IP, - CardanoPoolRelayType::SINGLE_HOST_NAME, - CardanoPoolRelayType::MULTIPLE_HOST_NAME, - ]; -} - -impl ::protobuf::EnumFull for CardanoPoolRelayType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoPoolRelayType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoPoolRelayType { - fn default() -> Self { - CardanoPoolRelayType::SINGLE_HOST_IP - } -} - -impl CardanoPoolRelayType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoPoolRelayType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType) -pub enum CardanoTxAuxiliaryDataSupplementType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType.NONE) - NONE = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplementType.CVOTE_REGISTRATION_SIGNATURE) - CVOTE_REGISTRATION_SIGNATURE = 1, -} - -impl ::protobuf::Enum for CardanoTxAuxiliaryDataSupplementType { - const NAME: &'static str = "CardanoTxAuxiliaryDataSupplementType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::NONE), - 1 => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::CVOTE_REGISTRATION_SIGNATURE), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "NONE" => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::NONE), - "CVOTE_REGISTRATION_SIGNATURE" => ::std::option::Option::Some(CardanoTxAuxiliaryDataSupplementType::CVOTE_REGISTRATION_SIGNATURE), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoTxAuxiliaryDataSupplementType] = &[ - CardanoTxAuxiliaryDataSupplementType::NONE, - CardanoTxAuxiliaryDataSupplementType::CVOTE_REGISTRATION_SIGNATURE, - ]; -} - -impl ::protobuf::EnumFull for CardanoTxAuxiliaryDataSupplementType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxAuxiliaryDataSupplementType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoTxAuxiliaryDataSupplementType { - fn default() -> Self { - CardanoTxAuxiliaryDataSupplementType::NONE - } -} - -impl CardanoTxAuxiliaryDataSupplementType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxAuxiliaryDataSupplementType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat) -pub enum CardanoCVoteRegistrationFormat { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat.CIP15) - CIP15 = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCVoteRegistrationFormat.CIP36) - CIP36 = 1, -} - -impl ::protobuf::Enum for CardanoCVoteRegistrationFormat { - const NAME: &'static str = "CardanoCVoteRegistrationFormat"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP15), - 1 => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP36), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "CIP15" => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP15), - "CIP36" => ::std::option::Option::Some(CardanoCVoteRegistrationFormat::CIP36), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoCVoteRegistrationFormat] = &[ - CardanoCVoteRegistrationFormat::CIP15, - CardanoCVoteRegistrationFormat::CIP36, - ]; -} - -impl ::protobuf::EnumFull for CardanoCVoteRegistrationFormat { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoCVoteRegistrationFormat").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoCVoteRegistrationFormat { - fn default() -> Self { - CardanoCVoteRegistrationFormat::CIP15 - } -} - -impl CardanoCVoteRegistrationFormat { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoCVoteRegistrationFormat") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxSigningMode) -pub enum CardanoTxSigningMode { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.ORDINARY_TRANSACTION) - ORDINARY_TRANSACTION = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.POOL_REGISTRATION_AS_OWNER) - POOL_REGISTRATION_AS_OWNER = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.MULTISIG_TRANSACTION) - MULTISIG_TRANSACTION = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxSigningMode.PLUTUS_TRANSACTION) - PLUTUS_TRANSACTION = 3, -} - -impl ::protobuf::Enum for CardanoTxSigningMode { - const NAME: &'static str = "CardanoTxSigningMode"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoTxSigningMode::ORDINARY_TRANSACTION), - 1 => ::std::option::Option::Some(CardanoTxSigningMode::POOL_REGISTRATION_AS_OWNER), - 2 => ::std::option::Option::Some(CardanoTxSigningMode::MULTISIG_TRANSACTION), - 3 => ::std::option::Option::Some(CardanoTxSigningMode::PLUTUS_TRANSACTION), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "ORDINARY_TRANSACTION" => ::std::option::Option::Some(CardanoTxSigningMode::ORDINARY_TRANSACTION), - "POOL_REGISTRATION_AS_OWNER" => ::std::option::Option::Some(CardanoTxSigningMode::POOL_REGISTRATION_AS_OWNER), - "MULTISIG_TRANSACTION" => ::std::option::Option::Some(CardanoTxSigningMode::MULTISIG_TRANSACTION), - "PLUTUS_TRANSACTION" => ::std::option::Option::Some(CardanoTxSigningMode::PLUTUS_TRANSACTION), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoTxSigningMode] = &[ - CardanoTxSigningMode::ORDINARY_TRANSACTION, - CardanoTxSigningMode::POOL_REGISTRATION_AS_OWNER, - CardanoTxSigningMode::MULTISIG_TRANSACTION, - CardanoTxSigningMode::PLUTUS_TRANSACTION, - ]; -} - -impl ::protobuf::EnumFull for CardanoTxSigningMode { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxSigningMode").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoTxSigningMode { - fn default() -> Self { - CardanoTxSigningMode::ORDINARY_TRANSACTION - } -} - -impl CardanoTxSigningMode { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxSigningMode") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoTxWitnessType) -pub enum CardanoTxWitnessType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxWitnessType.BYRON_WITNESS) - BYRON_WITNESS = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoTxWitnessType.SHELLEY_WITNESS) - SHELLEY_WITNESS = 1, -} - -impl ::protobuf::Enum for CardanoTxWitnessType { - const NAME: &'static str = "CardanoTxWitnessType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CardanoTxWitnessType::BYRON_WITNESS), - 1 => ::std::option::Option::Some(CardanoTxWitnessType::SHELLEY_WITNESS), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "BYRON_WITNESS" => ::std::option::Option::Some(CardanoTxWitnessType::BYRON_WITNESS), - "SHELLEY_WITNESS" => ::std::option::Option::Some(CardanoTxWitnessType::SHELLEY_WITNESS), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [CardanoTxWitnessType] = &[ - CardanoTxWitnessType::BYRON_WITNESS, - CardanoTxWitnessType::SHELLEY_WITNESS, - ]; -} - -impl ::protobuf::EnumFull for CardanoTxWitnessType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoTxWitnessType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for CardanoTxWitnessType { - fn default() -> Self { - CardanoTxWitnessType::BYRON_WITNESS - } -} - -impl CardanoTxWitnessType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("CardanoTxWitnessType") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x16messages-cardano.proto\x12\x1ahw.trezor.messages.cardano\x1a\x15me\ - ssages-common.proto\"\x87\x01\n\x1cCardanoBlockchainPointerType\x12\x1f\ - \n\x0bblock_index\x18\x01\x20\x02(\rR\nblockIndex\x12\x19\n\x08tx_index\ - \x18\x02\x20\x02(\rR\x07txIndex\x12+\n\x11certificate_index\x18\x03\x20\ - \x02(\rR\x10certificateIndex\"\xef\x02\n\x13CardanoNativeScript\x12G\n\ - \x04type\x18\x01\x20\x02(\x0e23.hw.trezor.messages.cardano.CardanoNative\ - ScriptTypeR\x04type\x12I\n\x07scripts\x18\x02\x20\x03(\x0b2/.hw.trezor.m\ - essages.cardano.CardanoNativeScriptR\x07scripts\x12\x19\n\x08key_hash\ - \x18\x03\x20\x01(\x0cR\x07keyHash\x12\x19\n\x08key_path\x18\x04\x20\x03(\ - \rR\x07keyPath\x12:\n\x19required_signatures_count\x18\x05\x20\x01(\rR\ - \x17requiredSignaturesCount\x12%\n\x0einvalid_before\x18\x06\x20\x01(\ - \x04R\rinvalidBefore\x12+\n\x11invalid_hereafter\x18\x07\x20\x01(\x04R\ - \x10invalidHereafter\"\xaa\x02\n\x1aCardanoGetNativeScriptHash\x12G\n\ - \x06script\x18\x01\x20\x02(\x0b2/.hw.trezor.messages.cardano.CardanoNati\ - veScriptR\x06script\x12g\n\x0edisplay_format\x18\x02\x20\x02(\x0e2@.hw.t\ - rezor.messages.cardano.CardanoNativeScriptHashDisplayFormatR\rdisplayFor\ - mat\x12Z\n\x0fderivation_type\x18\x03\x20\x02(\x0e21.hw.trezor.messages.\ - cardano.CardanoDerivationTypeR\x0ederivationType\":\n\x17CardanoNativeSc\ - riptHash\x12\x1f\n\x0bscript_hash\x18\x01\x20\x02(\x0cR\nscriptHash\"\ - \xaf\x03\n\x1cCardanoAddressParametersType\x12Q\n\x0caddress_type\x18\ - \x01\x20\x02(\x0e2..hw.trezor.messages.cardano.CardanoAddressTypeR\x0bad\ - dressType\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12*\n\ - \x11address_n_staking\x18\x03\x20\x03(\rR\x0faddressNStaking\x12(\n\x10s\ - taking_key_hash\x18\x04\x20\x01(\x0cR\x0estakingKeyHash\x12i\n\x13certif\ - icate_pointer\x18\x05\x20\x01(\x0b28.hw.trezor.messages.cardano.CardanoB\ - lockchainPointerTypeR\x12certificatePointer\x12.\n\x13script_payment_has\ - h\x18\x06\x20\x01(\x0cR\x11scriptPaymentHash\x12.\n\x13script_staking_ha\ - sh\x18\x07\x20\x01(\x0cR\x11scriptStakingHash\"\xe4\x02\n\x11CardanoGetA\ - ddress\x12(\n\x0cshow_display\x18\x02\x20\x01(\x08:\x05falseR\x0bshowDis\ - play\x12%\n\x0eprotocol_magic\x18\x03\x20\x02(\rR\rprotocolMagic\x12\x1d\ - \n\nnetwork_id\x18\x04\x20\x02(\rR\tnetworkId\x12g\n\x12address_paramete\ - rs\x18\x05\x20\x02(\x0b28.hw.trezor.messages.cardano.CardanoAddressParam\ - etersTypeR\x11addressParameters\x12Z\n\x0fderivation_type\x18\x06\x20\ - \x02(\x0e21.hw.trezor.messages.cardano.CardanoDerivationTypeR\x0ederivat\ - ionType\x12\x1a\n\x08chunkify\x18\x07\x20\x01(\x08R\x08chunkify\"*\n\x0e\ - CardanoAddress\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"\xb1\ - \x01\n\x13CardanoGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\ - \x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\ - \x12Z\n\x0fderivation_type\x18\x03\x20\x02(\x0e21.hw.trezor.messages.car\ - dano.CardanoDerivationTypeR\x0ederivationType\"a\n\x10CardanoPublicKey\ - \x12\x12\n\x04xpub\x18\x01\x20\x02(\tR\x04xpub\x129\n\x04node\x18\x02\ - \x20\x02(\x0b2%.hw.trezor.messages.common.HDNodeTypeR\x04node\"\xb3\x08\ - \n\x11CardanoSignTxInit\x12S\n\x0csigning_mode\x18\x01\x20\x02(\x0e20.hw\ - .trezor.messages.cardano.CardanoTxSigningModeR\x0bsigningMode\x12%\n\x0e\ - protocol_magic\x18\x02\x20\x02(\rR\rprotocolMagic\x12\x1d\n\nnetwork_id\ - \x18\x03\x20\x02(\rR\tnetworkId\x12!\n\x0cinputs_count\x18\x04\x20\x02(\ - \rR\x0binputsCount\x12#\n\routputs_count\x18\x05\x20\x02(\rR\x0coutputsC\ - ount\x12\x10\n\x03fee\x18\x06\x20\x02(\x04R\x03fee\x12\x10\n\x03ttl\x18\ - \x07\x20\x01(\x04R\x03ttl\x12-\n\x12certificates_count\x18\x08\x20\x02(\ - \rR\x11certificatesCount\x12+\n\x11withdrawals_count\x18\t\x20\x02(\rR\ - \x10withdrawalsCount\x12,\n\x12has_auxiliary_data\x18\n\x20\x02(\x08R\ - \x10hasAuxiliaryData\x126\n\x17validity_interval_start\x18\x0b\x20\x01(\ - \x04R\x15validityIntervalStart\x124\n\x16witness_requests_count\x18\x0c\ - \x20\x02(\rR\x14witnessRequestsCount\x12;\n\x1aminting_asset_groups_coun\ - t\x18\r\x20\x02(\rR\x17mintingAssetGroupsCount\x12Z\n\x0fderivation_type\ - \x18\x0e\x20\x02(\x0e21.hw.trezor.messages.cardano.CardanoDerivationType\ - R\x0ederivationType\x123\n\x12include_network_id\x18\x0f\x20\x01(\x08:\ - \x05falseR\x10includeNetworkId\x12(\n\x10script_data_hash\x18\x10\x20\ - \x01(\x0cR\x0escriptDataHash\x126\n\x17collateral_inputs_count\x18\x11\ - \x20\x02(\rR\x15collateralInputsCount\x124\n\x16required_signers_count\ - \x18\x12\x20\x02(\rR\x14requiredSignersCount\x129\n\x15has_collateral_re\ - turn\x18\x13\x20\x01(\x08:\x05falseR\x13hasCollateralReturn\x12)\n\x10to\ - tal_collateral\x18\x14\x20\x01(\x04R\x0ftotalCollateral\x127\n\x16refere\ - nce_inputs_count\x18\x15\x20\x01(\r:\x010R\x14referenceInputsCount\x12\ - \x1a\n\x08chunkify\x18\x16\x20\x01(\x08R\x08chunkify\"L\n\x0eCardanoTxIn\ - put\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\x12\x1d\n\npr\ - ev_index\x18\x02\x20\x02(\rR\tprevIndex\"\xc5\x03\n\x0fCardanoTxOutput\ - \x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12g\n\x12address_p\ - arameters\x18\x02\x20\x01(\x0b28.hw.trezor.messages.cardano.CardanoAddre\ - ssParametersTypeR\x11addressParameters\x12\x16\n\x06amount\x18\x03\x20\ - \x02(\x04R\x06amount\x12,\n\x12asset_groups_count\x18\x04\x20\x02(\rR\ - \x10assetGroupsCount\x12\x1d\n\ndatum_hash\x18\x05\x20\x01(\x0cR\tdatumH\ - ash\x12d\n\x06format\x18\x06\x20\x01(\x0e2>.hw.trezor.messages.cardano.C\ - ardanoTxOutputSerializationFormat:\x0cARRAY_LEGACYR\x06format\x12-\n\x11\ - inline_datum_size\x18\x07\x20\x01(\r:\x010R\x0finlineDatumSize\x125\n\ - \x15reference_script_size\x18\x08\x20\x01(\r:\x010R\x13referenceScriptSi\ - ze\"S\n\x11CardanoAssetGroup\x12\x1b\n\tpolicy_id\x18\x01\x20\x02(\x0cR\ - \x08policyId\x12!\n\x0ctokens_count\x18\x02\x20\x02(\rR\x0btokensCount\"\ - q\n\x0cCardanoToken\x12(\n\x10asset_name_bytes\x18\x01\x20\x02(\x0cR\x0e\ - assetNameBytes\x12\x16\n\x06amount\x18\x02\x20\x01(\x04R\x06amount\x12\ - \x1f\n\x0bmint_amount\x18\x03\x20\x01(\x12R\nmintAmount\"/\n\x19CardanoT\ - xInlineDatumChunk\x12\x12\n\x04data\x18\x01\x20\x02(\x0cR\x04data\"3\n\ - \x1dCardanoTxReferenceScriptChunk\x12\x12\n\x04data\x18\x01\x20\x02(\x0c\ - R\x04data\"f\n\x10CardanoPoolOwner\x12(\n\x10staking_key_path\x18\x01\ - \x20\x03(\rR\x0estakingKeyPath\x12(\n\x10staking_key_hash\x18\x02\x20\ - \x01(\x0cR\x0estakingKeyHash\"\xd9\x01\n\x1aCardanoPoolRelayParameters\ - \x12D\n\x04type\x18\x01\x20\x02(\x0e20.hw.trezor.messages.cardano.Cardan\ - oPoolRelayTypeR\x04type\x12!\n\x0cipv4_address\x18\x02\x20\x01(\x0cR\x0b\ - ipv4Address\x12!\n\x0cipv6_address\x18\x03\x20\x01(\x0cR\x0bipv6Address\ - \x12\x1b\n\thost_name\x18\x04\x20\x01(\tR\x08hostName\x12\x12\n\x04port\ - \x18\x05\x20\x01(\rR\x04port\"?\n\x17CardanoPoolMetadataType\x12\x10\n\ - \x03url\x18\x01\x20\x02(\tR\x03url\x12\x12\n\x04hash\x18\x02\x20\x02(\ - \x0cR\x04hash\"\x9a\x03\n\x19CardanoPoolParametersType\x12\x17\n\x07pool\ - _id\x18\x01\x20\x02(\x0cR\x06poolId\x12\x20\n\x0cvrf_key_hash\x18\x02\ - \x20\x02(\x0cR\nvrfKeyHash\x12\x16\n\x06pledge\x18\x03\x20\x02(\x04R\x06\ - pledge\x12\x12\n\x04cost\x18\x04\x20\x02(\x04R\x04cost\x12)\n\x10margin_\ - numerator\x18\x05\x20\x02(\x04R\x0fmarginNumerator\x12-\n\x12margin_deno\ - minator\x18\x06\x20\x02(\x04R\x11marginDenominator\x12%\n\x0ereward_acco\ - unt\x18\x07\x20\x02(\tR\rrewardAccount\x12O\n\x08metadata\x18\n\x20\x01(\ - \x0b23.hw.trezor.messages.cardano.CardanoPoolMetadataTypeR\x08metadata\ - \x12!\n\x0cowners_count\x18\x0b\x20\x02(\rR\x0bownersCount\x12!\n\x0crel\ - ays_count\x18\x0c\x20\x02(\rR\x0brelaysCount\"\xa2\x02\n\x14CardanoTxCer\ - tificate\x12F\n\x04type\x18\x01\x20\x02(\x0e22.hw.trezor.messages.cardan\ - o.CardanoCertificateTypeR\x04type\x12\x12\n\x04path\x18\x02\x20\x03(\rR\ - \x04path\x12\x12\n\x04pool\x18\x03\x20\x01(\x0cR\x04pool\x12^\n\x0fpool_\ - parameters\x18\x04\x20\x01(\x0b25.hw.trezor.messages.cardano.CardanoPool\ - ParametersTypeR\x0epoolParameters\x12\x1f\n\x0bscript_hash\x18\x05\x20\ - \x01(\x0cR\nscriptHash\x12\x19\n\x08key_hash\x18\x06\x20\x01(\x0cR\x07ke\ - yHash\"}\n\x13CardanoTxWithdrawal\x12\x12\n\x04path\x18\x01\x20\x03(\rR\ - \x04path\x12\x16\n\x06amount\x18\x02\x20\x02(\x04R\x06amount\x12\x1f\n\ - \x0bscript_hash\x18\x03\x20\x01(\x0cR\nscriptHash\x12\x19\n\x08key_hash\ - \x18\x04\x20\x01(\x0cR\x07keyHash\"d\n\"CardanoCVoteRegistrationDelegati\ - on\x12&\n\x0fvote_public_key\x18\x01\x20\x02(\x0cR\rvotePublicKey\x12\ - \x16\n\x06weight\x18\x02\x20\x02(\rR\x06weight\"\x8e\x04\n&CardanoCVoteR\ - egistrationParametersType\x12&\n\x0fvote_public_key\x18\x01\x20\x01(\x0c\ - R\rvotePublicKey\x12!\n\x0cstaking_path\x18\x02\x20\x03(\rR\x0bstakingPa\ - th\x12v\n\x1apayment_address_parameters\x18\x03\x20\x01(\x0b28.hw.trezor\ - .messages.cardano.CardanoAddressParametersTypeR\x18paymentAddressParamet\ - ers\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\x12Y\n\x06format\ - \x18\x05\x20\x01(\x0e2:.hw.trezor.messages.cardano.CardanoCVoteRegistrat\ - ionFormat:\x05CIP15R\x06format\x12`\n\x0bdelegations\x18\x06\x20\x03(\ - \x0b2>.hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegationR\ - \x0bdelegations\x12%\n\x0evoting_purpose\x18\x07\x20\x01(\x04R\rvotingPu\ - rpose\x12'\n\x0fpayment_address\x18\x08\x20\x01(\tR\x0epaymentAddress\"\ - \xb5\x01\n\x16CardanoTxAuxiliaryData\x12\x86\x01\n\x1dcvote_registration\ - _parameters\x18\x01\x20\x01(\x0b2B.hw.trezor.messages.cardano.CardanoCVo\ - teRegistrationParametersTypeR\x1bcvoteRegistrationParameters\x12\x12\n\ - \x04hash\x18\x02\x20\x01(\x0cR\x04hash\"=\n\rCardanoTxMint\x12,\n\x12ass\ - et_groups_count\x18\x01\x20\x02(\rR\x10assetGroupsCount\"V\n\x18CardanoT\ - xCollateralInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\ - \x12\x1d\n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"O\n\x17CardanoTxR\ - equiredSigner\x12\x19\n\x08key_hash\x18\x01\x20\x01(\x0cR\x07keyHash\x12\ - \x19\n\x08key_path\x18\x02\x20\x03(\rR\x07keyPath\"U\n\x17CardanoTxRefer\ - enceInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\x12\x1d\ - \n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"\x12\n\x10CardanoTxItemAc\ - k\"\xea\x01\n\x20CardanoTxAuxiliaryDataSupplement\x12T\n\x04type\x18\x01\ - \x20\x02(\x0e2@.hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplem\ - entTypeR\x04type\x12.\n\x13auxiliary_data_hash\x18\x02\x20\x01(\x0cR\x11\ - auxiliaryDataHash\x12@\n\x1ccvote_registration_signature\x18\x03\x20\x01\ - (\x0cR\x1acvoteRegistrationSignature\"-\n\x17CardanoTxWitnessRequest\x12\ - \x12\n\x04path\x18\x01\x20\x03(\rR\x04path\"\xb6\x01\n\x18CardanoTxWitne\ - ssResponse\x12D\n\x04type\x18\x01\x20\x02(\x0e20.hw.trezor.messages.card\ - ano.CardanoTxWitnessTypeR\x04type\x12\x17\n\x07pub_key\x18\x02\x20\x02(\ - \x0cR\x06pubKey\x12\x1c\n\tsignature\x18\x03\x20\x02(\x0cR\tsignature\ - \x12\x1d\n\nchain_code\x18\x04\x20\x01(\x0cR\tchainCode\"\x12\n\x10Carda\ - noTxHostAck\",\n\x11CardanoTxBodyHash\x12\x17\n\x07tx_hash\x18\x01\x20\ - \x02(\x0cR\x06txHash\"\x17\n\x15CardanoSignTxFinished*B\n\x15CardanoDeri\ - vationType\x12\n\n\x06LEDGER\x10\0\x12\n\n\x06ICARUS\x10\x01\x12\x11\n\r\ - ICARUS_TREZOR\x10\x02*\xd2\x01\n\x12CardanoAddressType\x12\x08\n\x04BASE\ - \x10\0\x12\x13\n\x0fBASE_SCRIPT_KEY\x10\x01\x12\x13\n\x0fBASE_KEY_SCRIPT\ - \x10\x02\x12\x16\n\x12BASE_SCRIPT_SCRIPT\x10\x03\x12\x0b\n\x07POINTER\ - \x10\x04\x12\x12\n\x0ePOINTER_SCRIPT\x10\x05\x12\x0e\n\nENTERPRISE\x10\ - \x06\x12\x15\n\x11ENTERPRISE_SCRIPT\x10\x07\x12\t\n\x05BYRON\x10\x08\x12\ - \n\n\x06REWARD\x10\x0e\x12\x11\n\rREWARD_SCRIPT\x10\x0f*o\n\x17CardanoNa\ - tiveScriptType\x12\x0b\n\x07PUB_KEY\x10\0\x12\x07\n\x03ALL\x10\x01\x12\ - \x07\n\x03ANY\x10\x02\x12\n\n\x06N_OF_K\x10\x03\x12\x12\n\x0eINVALID_BEF\ - ORE\x10\x04\x12\x15\n\x11INVALID_HEREAFTER\x10\x05*K\n$CardanoNativeScri\ - ptHashDisplayFormat\x12\x08\n\x04HIDE\x10\0\x12\n\n\x06BECH32\x10\x01\ - \x12\r\n\tPOLICY_ID\x10\x02*G\n\"CardanoTxOutputSerializationFormat\x12\ - \x10\n\x0cARRAY_LEGACY\x10\0\x12\x0f\n\x0bMAP_BABBAGE\x10\x01*}\n\x16Car\ - danoCertificateType\x12\x16\n\x12STAKE_REGISTRATION\x10\0\x12\x18\n\x14S\ - TAKE_DEREGISTRATION\x10\x01\x12\x14\n\x10STAKE_DELEGATION\x10\x02\x12\ - \x1b\n\x17STAKE_POOL_REGISTRATION\x10\x03*X\n\x14CardanoPoolRelayType\ - \x12\x12\n\x0eSINGLE_HOST_IP\x10\0\x12\x14\n\x10SINGLE_HOST_NAME\x10\x01\ - \x12\x16\n\x12MULTIPLE_HOST_NAME\x10\x02*R\n$CardanoTxAuxiliaryDataSuppl\ - ementType\x12\x08\n\x04NONE\x10\0\x12\x20\n\x1cCVOTE_REGISTRATION_SIGNAT\ - URE\x10\x01*6\n\x1eCardanoCVoteRegistrationFormat\x12\t\n\x05CIP15\x10\0\ - \x12\t\n\x05CIP36\x10\x01*\x82\x01\n\x14CardanoTxSigningMode\x12\x18\n\ - \x14ORDINARY_TRANSACTION\x10\0\x12\x1e\n\x1aPOOL_REGISTRATION_AS_OWNER\ - \x10\x01\x12\x18\n\x14MULTISIG_TRANSACTION\x10\x02\x12\x16\n\x12PLUTUS_T\ - RANSACTION\x10\x03*>\n\x14CardanoTxWitnessType\x12\x11\n\rBYRON_WITNESS\ - \x10\0\x12\x13\n\x0fSHELLEY_WITNESS\x10\x01B;\n#com.satoshilabs.trezor.l\ - ib.protobufB\x14TrezorMessageCardano\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(1); - deps.push(super::messages_common::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(36); - messages.push(CardanoBlockchainPointerType::generated_message_descriptor_data()); - messages.push(CardanoNativeScript::generated_message_descriptor_data()); - messages.push(CardanoGetNativeScriptHash::generated_message_descriptor_data()); - messages.push(CardanoNativeScriptHash::generated_message_descriptor_data()); - messages.push(CardanoAddressParametersType::generated_message_descriptor_data()); - messages.push(CardanoGetAddress::generated_message_descriptor_data()); - messages.push(CardanoAddress::generated_message_descriptor_data()); - messages.push(CardanoGetPublicKey::generated_message_descriptor_data()); - messages.push(CardanoPublicKey::generated_message_descriptor_data()); - messages.push(CardanoSignTxInit::generated_message_descriptor_data()); - messages.push(CardanoTxInput::generated_message_descriptor_data()); - messages.push(CardanoTxOutput::generated_message_descriptor_data()); - messages.push(CardanoAssetGroup::generated_message_descriptor_data()); - messages.push(CardanoToken::generated_message_descriptor_data()); - messages.push(CardanoTxInlineDatumChunk::generated_message_descriptor_data()); - messages.push(CardanoTxReferenceScriptChunk::generated_message_descriptor_data()); - messages.push(CardanoPoolOwner::generated_message_descriptor_data()); - messages.push(CardanoPoolRelayParameters::generated_message_descriptor_data()); - messages.push(CardanoPoolMetadataType::generated_message_descriptor_data()); - messages.push(CardanoPoolParametersType::generated_message_descriptor_data()); - messages.push(CardanoTxCertificate::generated_message_descriptor_data()); - messages.push(CardanoTxWithdrawal::generated_message_descriptor_data()); - messages.push(CardanoCVoteRegistrationDelegation::generated_message_descriptor_data()); - messages.push(CardanoCVoteRegistrationParametersType::generated_message_descriptor_data()); - messages.push(CardanoTxAuxiliaryData::generated_message_descriptor_data()); - messages.push(CardanoTxMint::generated_message_descriptor_data()); - messages.push(CardanoTxCollateralInput::generated_message_descriptor_data()); - messages.push(CardanoTxRequiredSigner::generated_message_descriptor_data()); - messages.push(CardanoTxReferenceInput::generated_message_descriptor_data()); - messages.push(CardanoTxItemAck::generated_message_descriptor_data()); - messages.push(CardanoTxAuxiliaryDataSupplement::generated_message_descriptor_data()); - messages.push(CardanoTxWitnessRequest::generated_message_descriptor_data()); - messages.push(CardanoTxWitnessResponse::generated_message_descriptor_data()); - messages.push(CardanoTxHostAck::generated_message_descriptor_data()); - messages.push(CardanoTxBodyHash::generated_message_descriptor_data()); - messages.push(CardanoSignTxFinished::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(11); - enums.push(CardanoDerivationType::generated_enum_descriptor_data()); - enums.push(CardanoAddressType::generated_enum_descriptor_data()); - enums.push(CardanoNativeScriptType::generated_enum_descriptor_data()); - enums.push(CardanoNativeScriptHashDisplayFormat::generated_enum_descriptor_data()); - enums.push(CardanoTxOutputSerializationFormat::generated_enum_descriptor_data()); - enums.push(CardanoCertificateType::generated_enum_descriptor_data()); - enums.push(CardanoPoolRelayType::generated_enum_descriptor_data()); - enums.push(CardanoTxAuxiliaryDataSupplementType::generated_enum_descriptor_data()); - enums.push(CardanoCVoteRegistrationFormat::generated_enum_descriptor_data()); - enums.push(CardanoTxSigningMode::generated_enum_descriptor_data()); - enums.push(CardanoTxWitnessType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_common.rs b/wallet/trezor-client/src/protos/generated/messages_common.rs deleted file mode 100644 index 49e0f1dfd2..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_common.rs +++ /dev/null @@ -1,2521 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-common.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.common.Success) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Success { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.Success.message) - pub message: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Success.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Success { - fn default() -> &'a Success { - ::default_instance() - } -} - -impl Success { - pub fn new() -> Success { - ::std::default::Default::default() - } - - // optional string message = 1; - - pub fn message(&self) -> &str { - match self.message.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::string::String) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::string::String { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::string::String::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::string::String { - self.message.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &Success| { &m.message }, - |m: &mut Success| { &mut m.message }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Success", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Success { - const NAME: &'static str = "Success"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.message = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.message.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Success { - Success::new() - } - - fn clear(&mut self) { - self.message = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Success { - static instance: Success = Success { - message: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Success { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Success").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Success { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Success { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.Failure) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Failure { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.Failure.code) - pub code: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.common.Failure.message) - pub message: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Failure.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Failure { - fn default() -> &'a Failure { - ::default_instance() - } -} - -impl Failure { - pub fn new() -> Failure { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.common.Failure.FailureType code = 1; - - pub fn code(&self) -> failure::FailureType { - match self.code { - Some(e) => e.enum_value_or(failure::FailureType::Failure_UnexpectedMessage), - None => failure::FailureType::Failure_UnexpectedMessage, - } - } - - pub fn clear_code(&mut self) { - self.code = ::std::option::Option::None; - } - - pub fn has_code(&self) -> bool { - self.code.is_some() - } - - // Param is passed by value, moved - pub fn set_code(&mut self, v: failure::FailureType) { - self.code = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional string message = 2; - - pub fn message(&self) -> &str { - match self.message.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::string::String) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::string::String { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::string::String::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::string::String { - self.message.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "code", - |m: &Failure| { &m.code }, - |m: &mut Failure| { &mut m.code }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &Failure| { &m.message }, - |m: &mut Failure| { &mut m.message }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Failure", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Failure { - const NAME: &'static str = "Failure"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.code = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.message = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.code { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.code { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.message.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Failure { - Failure::new() - } - - fn clear(&mut self) { - self.code = ::std::option::Option::None; - self.message = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Failure { - static instance: Failure = Failure { - code: ::std::option::Option::None, - message: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Failure { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Failure").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Failure { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Failure { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `Failure` -pub mod failure { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.common.Failure.FailureType) - pub enum FailureType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_UnexpectedMessage) - Failure_UnexpectedMessage = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_ButtonExpected) - Failure_ButtonExpected = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_DataError) - Failure_DataError = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_ActionCancelled) - Failure_ActionCancelled = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinExpected) - Failure_PinExpected = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinCancelled) - Failure_PinCancelled = 6, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinInvalid) - Failure_PinInvalid = 7, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_InvalidSignature) - Failure_InvalidSignature = 8, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_ProcessError) - Failure_ProcessError = 9, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_NotEnoughFunds) - Failure_NotEnoughFunds = 10, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_NotInitialized) - Failure_NotInitialized = 11, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_PinMismatch) - Failure_PinMismatch = 12, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_WipeCodeMismatch) - Failure_WipeCodeMismatch = 13, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_InvalidSession) - Failure_InvalidSession = 14, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.Failure.FailureType.Failure_FirmwareError) - Failure_FirmwareError = 99, - } - - impl ::protobuf::Enum for FailureType { - const NAME: &'static str = "FailureType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(FailureType::Failure_UnexpectedMessage), - 2 => ::std::option::Option::Some(FailureType::Failure_ButtonExpected), - 3 => ::std::option::Option::Some(FailureType::Failure_DataError), - 4 => ::std::option::Option::Some(FailureType::Failure_ActionCancelled), - 5 => ::std::option::Option::Some(FailureType::Failure_PinExpected), - 6 => ::std::option::Option::Some(FailureType::Failure_PinCancelled), - 7 => ::std::option::Option::Some(FailureType::Failure_PinInvalid), - 8 => ::std::option::Option::Some(FailureType::Failure_InvalidSignature), - 9 => ::std::option::Option::Some(FailureType::Failure_ProcessError), - 10 => ::std::option::Option::Some(FailureType::Failure_NotEnoughFunds), - 11 => ::std::option::Option::Some(FailureType::Failure_NotInitialized), - 12 => ::std::option::Option::Some(FailureType::Failure_PinMismatch), - 13 => ::std::option::Option::Some(FailureType::Failure_WipeCodeMismatch), - 14 => ::std::option::Option::Some(FailureType::Failure_InvalidSession), - 99 => ::std::option::Option::Some(FailureType::Failure_FirmwareError), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "Failure_UnexpectedMessage" => ::std::option::Option::Some(FailureType::Failure_UnexpectedMessage), - "Failure_ButtonExpected" => ::std::option::Option::Some(FailureType::Failure_ButtonExpected), - "Failure_DataError" => ::std::option::Option::Some(FailureType::Failure_DataError), - "Failure_ActionCancelled" => ::std::option::Option::Some(FailureType::Failure_ActionCancelled), - "Failure_PinExpected" => ::std::option::Option::Some(FailureType::Failure_PinExpected), - "Failure_PinCancelled" => ::std::option::Option::Some(FailureType::Failure_PinCancelled), - "Failure_PinInvalid" => ::std::option::Option::Some(FailureType::Failure_PinInvalid), - "Failure_InvalidSignature" => ::std::option::Option::Some(FailureType::Failure_InvalidSignature), - "Failure_ProcessError" => ::std::option::Option::Some(FailureType::Failure_ProcessError), - "Failure_NotEnoughFunds" => ::std::option::Option::Some(FailureType::Failure_NotEnoughFunds), - "Failure_NotInitialized" => ::std::option::Option::Some(FailureType::Failure_NotInitialized), - "Failure_PinMismatch" => ::std::option::Option::Some(FailureType::Failure_PinMismatch), - "Failure_WipeCodeMismatch" => ::std::option::Option::Some(FailureType::Failure_WipeCodeMismatch), - "Failure_InvalidSession" => ::std::option::Option::Some(FailureType::Failure_InvalidSession), - "Failure_FirmwareError" => ::std::option::Option::Some(FailureType::Failure_FirmwareError), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [FailureType] = &[ - FailureType::Failure_UnexpectedMessage, - FailureType::Failure_ButtonExpected, - FailureType::Failure_DataError, - FailureType::Failure_ActionCancelled, - FailureType::Failure_PinExpected, - FailureType::Failure_PinCancelled, - FailureType::Failure_PinInvalid, - FailureType::Failure_InvalidSignature, - FailureType::Failure_ProcessError, - FailureType::Failure_NotEnoughFunds, - FailureType::Failure_NotInitialized, - FailureType::Failure_PinMismatch, - FailureType::Failure_WipeCodeMismatch, - FailureType::Failure_InvalidSession, - FailureType::Failure_FirmwareError, - ]; - } - - impl ::protobuf::EnumFull for FailureType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Failure.FailureType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - FailureType::Failure_UnexpectedMessage => 0, - FailureType::Failure_ButtonExpected => 1, - FailureType::Failure_DataError => 2, - FailureType::Failure_ActionCancelled => 3, - FailureType::Failure_PinExpected => 4, - FailureType::Failure_PinCancelled => 5, - FailureType::Failure_PinInvalid => 6, - FailureType::Failure_InvalidSignature => 7, - FailureType::Failure_ProcessError => 8, - FailureType::Failure_NotEnoughFunds => 9, - FailureType::Failure_NotInitialized => 10, - FailureType::Failure_PinMismatch => 11, - FailureType::Failure_WipeCodeMismatch => 12, - FailureType::Failure_InvalidSession => 13, - FailureType::Failure_FirmwareError => 14, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for FailureType { - fn default() -> Self { - FailureType::Failure_UnexpectedMessage - } - } - - impl FailureType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Failure.FailureType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.ButtonRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ButtonRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.ButtonRequest.code) - pub code: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.common.ButtonRequest.pages) - pub pages: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.ButtonRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ButtonRequest { - fn default() -> &'a ButtonRequest { - ::default_instance() - } -} - -impl ButtonRequest { - pub fn new() -> ButtonRequest { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.common.ButtonRequest.ButtonRequestType code = 1; - - pub fn code(&self) -> button_request::ButtonRequestType { - match self.code { - Some(e) => e.enum_value_or(button_request::ButtonRequestType::ButtonRequest_Other), - None => button_request::ButtonRequestType::ButtonRequest_Other, - } - } - - pub fn clear_code(&mut self) { - self.code = ::std::option::Option::None; - } - - pub fn has_code(&self) -> bool { - self.code.is_some() - } - - // Param is passed by value, moved - pub fn set_code(&mut self, v: button_request::ButtonRequestType) { - self.code = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint32 pages = 2; - - pub fn pages(&self) -> u32 { - self.pages.unwrap_or(0) - } - - pub fn clear_pages(&mut self) { - self.pages = ::std::option::Option::None; - } - - pub fn has_pages(&self) -> bool { - self.pages.is_some() - } - - // Param is passed by value, moved - pub fn set_pages(&mut self, v: u32) { - self.pages = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "code", - |m: &ButtonRequest| { &m.code }, - |m: &mut ButtonRequest| { &mut m.code }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pages", - |m: &ButtonRequest| { &m.pages }, - |m: &mut ButtonRequest| { &mut m.pages }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ButtonRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ButtonRequest { - const NAME: &'static str = "ButtonRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.code = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 16 => { - self.pages = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.code { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.pages { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.code { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.pages { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ButtonRequest { - ButtonRequest::new() - } - - fn clear(&mut self) { - self.code = ::std::option::Option::None; - self.pages = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ButtonRequest { - static instance: ButtonRequest = ButtonRequest { - code: ::std::option::Option::None, - pages: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ButtonRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ButtonRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ButtonRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ButtonRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `ButtonRequest` -pub mod button_request { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.common.ButtonRequest.ButtonRequestType) - pub enum ButtonRequestType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Other) - ButtonRequest_Other = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_FeeOverThreshold) - ButtonRequest_FeeOverThreshold = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ConfirmOutput) - ButtonRequest_ConfirmOutput = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ResetDevice) - ButtonRequest_ResetDevice = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ConfirmWord) - ButtonRequest_ConfirmWord = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_WipeDevice) - ButtonRequest_WipeDevice = 6, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_ProtectCall) - ButtonRequest_ProtectCall = 7, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_SignTx) - ButtonRequest_SignTx = 8, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_FirmwareCheck) - ButtonRequest_FirmwareCheck = 9, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Address) - ButtonRequest_Address = 10, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_PublicKey) - ButtonRequest_PublicKey = 11, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_MnemonicWordCount) - ButtonRequest_MnemonicWordCount = 12, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_MnemonicInput) - ButtonRequest_MnemonicInput = 13, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType._Deprecated_ButtonRequest_PassphraseType) - _Deprecated_ButtonRequest_PassphraseType = 14, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_UnknownDerivationPath) - ButtonRequest_UnknownDerivationPath = 15, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_RecoveryHomepage) - ButtonRequest_RecoveryHomepage = 16, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Success) - ButtonRequest_Success = 17, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_Warning) - ButtonRequest_Warning = 18, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_PassphraseEntry) - ButtonRequest_PassphraseEntry = 19, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.ButtonRequest.ButtonRequestType.ButtonRequest_PinEntry) - ButtonRequest_PinEntry = 20, - } - - impl ::protobuf::Enum for ButtonRequestType { - const NAME: &'static str = "ButtonRequestType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Other), - 2 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FeeOverThreshold), - 3 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmOutput), - 4 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ResetDevice), - 5 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmWord), - 6 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_WipeDevice), - 7 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ProtectCall), - 8 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_SignTx), - 9 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FirmwareCheck), - 10 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Address), - 11 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PublicKey), - 12 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicWordCount), - 13 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicInput), - 14 => ::std::option::Option::Some(ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType), - 15 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_UnknownDerivationPath), - 16 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_RecoveryHomepage), - 17 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Success), - 18 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Warning), - 19 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PassphraseEntry), - 20 => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PinEntry), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "ButtonRequest_Other" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Other), - "ButtonRequest_FeeOverThreshold" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FeeOverThreshold), - "ButtonRequest_ConfirmOutput" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmOutput), - "ButtonRequest_ResetDevice" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ResetDevice), - "ButtonRequest_ConfirmWord" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ConfirmWord), - "ButtonRequest_WipeDevice" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_WipeDevice), - "ButtonRequest_ProtectCall" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_ProtectCall), - "ButtonRequest_SignTx" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_SignTx), - "ButtonRequest_FirmwareCheck" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_FirmwareCheck), - "ButtonRequest_Address" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Address), - "ButtonRequest_PublicKey" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PublicKey), - "ButtonRequest_MnemonicWordCount" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicWordCount), - "ButtonRequest_MnemonicInput" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_MnemonicInput), - "_Deprecated_ButtonRequest_PassphraseType" => ::std::option::Option::Some(ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType), - "ButtonRequest_UnknownDerivationPath" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_UnknownDerivationPath), - "ButtonRequest_RecoveryHomepage" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_RecoveryHomepage), - "ButtonRequest_Success" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Success), - "ButtonRequest_Warning" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_Warning), - "ButtonRequest_PassphraseEntry" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PassphraseEntry), - "ButtonRequest_PinEntry" => ::std::option::Option::Some(ButtonRequestType::ButtonRequest_PinEntry), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [ButtonRequestType] = &[ - ButtonRequestType::ButtonRequest_Other, - ButtonRequestType::ButtonRequest_FeeOverThreshold, - ButtonRequestType::ButtonRequest_ConfirmOutput, - ButtonRequestType::ButtonRequest_ResetDevice, - ButtonRequestType::ButtonRequest_ConfirmWord, - ButtonRequestType::ButtonRequest_WipeDevice, - ButtonRequestType::ButtonRequest_ProtectCall, - ButtonRequestType::ButtonRequest_SignTx, - ButtonRequestType::ButtonRequest_FirmwareCheck, - ButtonRequestType::ButtonRequest_Address, - ButtonRequestType::ButtonRequest_PublicKey, - ButtonRequestType::ButtonRequest_MnemonicWordCount, - ButtonRequestType::ButtonRequest_MnemonicInput, - ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType, - ButtonRequestType::ButtonRequest_UnknownDerivationPath, - ButtonRequestType::ButtonRequest_RecoveryHomepage, - ButtonRequestType::ButtonRequest_Success, - ButtonRequestType::ButtonRequest_Warning, - ButtonRequestType::ButtonRequest_PassphraseEntry, - ButtonRequestType::ButtonRequest_PinEntry, - ]; - } - - impl ::protobuf::EnumFull for ButtonRequestType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("ButtonRequest.ButtonRequestType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - ButtonRequestType::ButtonRequest_Other => 0, - ButtonRequestType::ButtonRequest_FeeOverThreshold => 1, - ButtonRequestType::ButtonRequest_ConfirmOutput => 2, - ButtonRequestType::ButtonRequest_ResetDevice => 3, - ButtonRequestType::ButtonRequest_ConfirmWord => 4, - ButtonRequestType::ButtonRequest_WipeDevice => 5, - ButtonRequestType::ButtonRequest_ProtectCall => 6, - ButtonRequestType::ButtonRequest_SignTx => 7, - ButtonRequestType::ButtonRequest_FirmwareCheck => 8, - ButtonRequestType::ButtonRequest_Address => 9, - ButtonRequestType::ButtonRequest_PublicKey => 10, - ButtonRequestType::ButtonRequest_MnemonicWordCount => 11, - ButtonRequestType::ButtonRequest_MnemonicInput => 12, - ButtonRequestType::_Deprecated_ButtonRequest_PassphraseType => 13, - ButtonRequestType::ButtonRequest_UnknownDerivationPath => 14, - ButtonRequestType::ButtonRequest_RecoveryHomepage => 15, - ButtonRequestType::ButtonRequest_Success => 16, - ButtonRequestType::ButtonRequest_Warning => 17, - ButtonRequestType::ButtonRequest_PassphraseEntry => 18, - ButtonRequestType::ButtonRequest_PinEntry => 19, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for ButtonRequestType { - fn default() -> Self { - ButtonRequestType::ButtonRequest_Other - } - } - - impl ButtonRequestType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("ButtonRequest.ButtonRequestType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.ButtonAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ButtonAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.ButtonAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ButtonAck { - fn default() -> &'a ButtonAck { - ::default_instance() - } -} - -impl ButtonAck { - pub fn new() -> ButtonAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ButtonAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ButtonAck { - const NAME: &'static str = "ButtonAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ButtonAck { - ButtonAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static ButtonAck { - static instance: ButtonAck = ButtonAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ButtonAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ButtonAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ButtonAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ButtonAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.PinMatrixRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PinMatrixRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.PinMatrixRequest.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PinMatrixRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PinMatrixRequest { - fn default() -> &'a PinMatrixRequest { - ::default_instance() - } -} - -impl PinMatrixRequest { - pub fn new() -> PinMatrixRequest { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType type = 1; - - pub fn type_(&self) -> pin_matrix_request::PinMatrixRequestType { - match self.type_ { - Some(e) => e.enum_value_or(pin_matrix_request::PinMatrixRequestType::PinMatrixRequestType_Current), - None => pin_matrix_request::PinMatrixRequestType::PinMatrixRequestType_Current, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: pin_matrix_request::PinMatrixRequestType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &PinMatrixRequest| { &m.type_ }, - |m: &mut PinMatrixRequest| { &mut m.type_ }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PinMatrixRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PinMatrixRequest { - const NAME: &'static str = "PinMatrixRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PinMatrixRequest { - PinMatrixRequest::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PinMatrixRequest { - static instance: PinMatrixRequest = PinMatrixRequest { - type_: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PinMatrixRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PinMatrixRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PinMatrixRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PinMatrixRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `PinMatrixRequest` -pub mod pin_matrix_request { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType) - pub enum PinMatrixRequestType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_Current) - PinMatrixRequestType_Current = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_NewFirst) - PinMatrixRequestType_NewFirst = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_NewSecond) - PinMatrixRequestType_NewSecond = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_WipeCodeFirst) - PinMatrixRequestType_WipeCodeFirst = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.common.PinMatrixRequest.PinMatrixRequestType.PinMatrixRequestType_WipeCodeSecond) - PinMatrixRequestType_WipeCodeSecond = 5, - } - - impl ::protobuf::Enum for PinMatrixRequestType { - const NAME: &'static str = "PinMatrixRequestType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_Current), - 2 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewFirst), - 3 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewSecond), - 4 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst), - 5 => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "PinMatrixRequestType_Current" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_Current), - "PinMatrixRequestType_NewFirst" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewFirst), - "PinMatrixRequestType_NewSecond" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_NewSecond), - "PinMatrixRequestType_WipeCodeFirst" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst), - "PinMatrixRequestType_WipeCodeSecond" => ::std::option::Option::Some(PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [PinMatrixRequestType] = &[ - PinMatrixRequestType::PinMatrixRequestType_Current, - PinMatrixRequestType::PinMatrixRequestType_NewFirst, - PinMatrixRequestType::PinMatrixRequestType_NewSecond, - PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst, - PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond, - ]; - } - - impl ::protobuf::EnumFull for PinMatrixRequestType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("PinMatrixRequest.PinMatrixRequestType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - PinMatrixRequestType::PinMatrixRequestType_Current => 0, - PinMatrixRequestType::PinMatrixRequestType_NewFirst => 1, - PinMatrixRequestType::PinMatrixRequestType_NewSecond => 2, - PinMatrixRequestType::PinMatrixRequestType_WipeCodeFirst => 3, - PinMatrixRequestType::PinMatrixRequestType_WipeCodeSecond => 4, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for PinMatrixRequestType { - fn default() -> Self { - PinMatrixRequestType::PinMatrixRequestType_Current - } - } - - impl PinMatrixRequestType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("PinMatrixRequest.PinMatrixRequestType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.PinMatrixAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PinMatrixAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.PinMatrixAck.pin) - pub pin: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PinMatrixAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PinMatrixAck { - fn default() -> &'a PinMatrixAck { - ::default_instance() - } -} - -impl PinMatrixAck { - pub fn new() -> PinMatrixAck { - ::std::default::Default::default() - } - - // required string pin = 1; - - pub fn pin(&self) -> &str { - match self.pin.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_pin(&mut self) { - self.pin = ::std::option::Option::None; - } - - pub fn has_pin(&self) -> bool { - self.pin.is_some() - } - - // Param is passed by value, moved - pub fn set_pin(&mut self, v: ::std::string::String) { - self.pin = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pin(&mut self) -> &mut ::std::string::String { - if self.pin.is_none() { - self.pin = ::std::option::Option::Some(::std::string::String::new()); - } - self.pin.as_mut().unwrap() - } - - // Take field - pub fn take_pin(&mut self) -> ::std::string::String { - self.pin.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pin", - |m: &PinMatrixAck| { &m.pin }, - |m: &mut PinMatrixAck| { &mut m.pin }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PinMatrixAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PinMatrixAck { - const NAME: &'static str = "PinMatrixAck"; - - fn is_initialized(&self) -> bool { - if self.pin.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.pin = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.pin.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.pin.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PinMatrixAck { - PinMatrixAck::new() - } - - fn clear(&mut self) { - self.pin = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PinMatrixAck { - static instance: PinMatrixAck = PinMatrixAck { - pin: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PinMatrixAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PinMatrixAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PinMatrixAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PinMatrixAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.PassphraseRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PassphraseRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseRequest._on_device) - pub _on_device: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PassphraseRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PassphraseRequest { - fn default() -> &'a PassphraseRequest { - ::default_instance() - } -} - -impl PassphraseRequest { - pub fn new() -> PassphraseRequest { - ::std::default::Default::default() - } - - // optional bool _on_device = 1; - - pub fn _on_device(&self) -> bool { - self._on_device.unwrap_or(false) - } - - pub fn clear__on_device(&mut self) { - self._on_device = ::std::option::Option::None; - } - - pub fn has__on_device(&self) -> bool { - self._on_device.is_some() - } - - // Param is passed by value, moved - pub fn set__on_device(&mut self, v: bool) { - self._on_device = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "_on_device", - |m: &PassphraseRequest| { &m._on_device }, - |m: &mut PassphraseRequest| { &mut m._on_device }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PassphraseRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PassphraseRequest { - const NAME: &'static str = "PassphraseRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self._on_device = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self._on_device { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self._on_device { - os.write_bool(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PassphraseRequest { - PassphraseRequest::new() - } - - fn clear(&mut self) { - self._on_device = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PassphraseRequest { - static instance: PassphraseRequest = PassphraseRequest { - _on_device: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PassphraseRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PassphraseRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PassphraseRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PassphraseRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.PassphraseAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PassphraseAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseAck.passphrase) - pub passphrase: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseAck._state) - pub _state: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.common.PassphraseAck.on_device) - pub on_device: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.PassphraseAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PassphraseAck { - fn default() -> &'a PassphraseAck { - ::default_instance() - } -} - -impl PassphraseAck { - pub fn new() -> PassphraseAck { - ::std::default::Default::default() - } - - // optional string passphrase = 1; - - pub fn passphrase(&self) -> &str { - match self.passphrase.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_passphrase(&mut self) { - self.passphrase = ::std::option::Option::None; - } - - pub fn has_passphrase(&self) -> bool { - self.passphrase.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase(&mut self, v: ::std::string::String) { - self.passphrase = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_passphrase(&mut self) -> &mut ::std::string::String { - if self.passphrase.is_none() { - self.passphrase = ::std::option::Option::Some(::std::string::String::new()); - } - self.passphrase.as_mut().unwrap() - } - - // Take field - pub fn take_passphrase(&mut self) -> ::std::string::String { - self.passphrase.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bytes _state = 2; - - pub fn _state(&self) -> &[u8] { - match self._state.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear__state(&mut self) { - self._state = ::std::option::Option::None; - } - - pub fn has__state(&self) -> bool { - self._state.is_some() - } - - // Param is passed by value, moved - pub fn set__state(&mut self, v: ::std::vec::Vec) { - self._state = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut__state(&mut self) -> &mut ::std::vec::Vec { - if self._state.is_none() { - self._state = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self._state.as_mut().unwrap() - } - - // Take field - pub fn take__state(&mut self) -> ::std::vec::Vec { - self._state.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool on_device = 3; - - pub fn on_device(&self) -> bool { - self.on_device.unwrap_or(false) - } - - pub fn clear_on_device(&mut self) { - self.on_device = ::std::option::Option::None; - } - - pub fn has_on_device(&self) -> bool { - self.on_device.is_some() - } - - // Param is passed by value, moved - pub fn set_on_device(&mut self, v: bool) { - self.on_device = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase", - |m: &PassphraseAck| { &m.passphrase }, - |m: &mut PassphraseAck| { &mut m.passphrase }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "_state", - |m: &PassphraseAck| { &m._state }, - |m: &mut PassphraseAck| { &mut m._state }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "on_device", - |m: &PassphraseAck| { &m.on_device }, - |m: &mut PassphraseAck| { &mut m.on_device }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PassphraseAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PassphraseAck { - const NAME: &'static str = "PassphraseAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.passphrase = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self._state = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.on_device = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.passphrase.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self._state.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.on_device { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.passphrase.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self._state.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.on_device { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PassphraseAck { - PassphraseAck::new() - } - - fn clear(&mut self) { - self.passphrase = ::std::option::Option::None; - self._state = ::std::option::Option::None; - self.on_device = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static PassphraseAck { - static instance: PassphraseAck = PassphraseAck { - passphrase: ::std::option::Option::None, - _state: ::std::option::Option::None, - on_device: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PassphraseAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PassphraseAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PassphraseAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PassphraseAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.Deprecated_PassphraseStateRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Deprecated_PassphraseStateRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.Deprecated_PassphraseStateRequest.state) - pub state: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Deprecated_PassphraseStateRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Deprecated_PassphraseStateRequest { - fn default() -> &'a Deprecated_PassphraseStateRequest { - ::default_instance() - } -} - -impl Deprecated_PassphraseStateRequest { - pub fn new() -> Deprecated_PassphraseStateRequest { - ::std::default::Default::default() - } - - // optional bytes state = 1; - - pub fn state(&self) -> &[u8] { - match self.state.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_state(&mut self) { - self.state = ::std::option::Option::None; - } - - pub fn has_state(&self) -> bool { - self.state.is_some() - } - - // Param is passed by value, moved - pub fn set_state(&mut self, v: ::std::vec::Vec) { - self.state = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_state(&mut self) -> &mut ::std::vec::Vec { - if self.state.is_none() { - self.state = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.state.as_mut().unwrap() - } - - // Take field - pub fn take_state(&mut self) -> ::std::vec::Vec { - self.state.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "state", - |m: &Deprecated_PassphraseStateRequest| { &m.state }, - |m: &mut Deprecated_PassphraseStateRequest| { &mut m.state }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Deprecated_PassphraseStateRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Deprecated_PassphraseStateRequest { - const NAME: &'static str = "Deprecated_PassphraseStateRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.state = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.state.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.state.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Deprecated_PassphraseStateRequest { - Deprecated_PassphraseStateRequest::new() - } - - fn clear(&mut self) { - self.state = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Deprecated_PassphraseStateRequest { - static instance: Deprecated_PassphraseStateRequest = Deprecated_PassphraseStateRequest { - state: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Deprecated_PassphraseStateRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Deprecated_PassphraseStateRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Deprecated_PassphraseStateRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Deprecated_PassphraseStateRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.Deprecated_PassphraseStateAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Deprecated_PassphraseStateAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.Deprecated_PassphraseStateAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Deprecated_PassphraseStateAck { - fn default() -> &'a Deprecated_PassphraseStateAck { - ::default_instance() - } -} - -impl Deprecated_PassphraseStateAck { - pub fn new() -> Deprecated_PassphraseStateAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Deprecated_PassphraseStateAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Deprecated_PassphraseStateAck { - const NAME: &'static str = "Deprecated_PassphraseStateAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Deprecated_PassphraseStateAck { - Deprecated_PassphraseStateAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static Deprecated_PassphraseStateAck { - static instance: Deprecated_PassphraseStateAck = Deprecated_PassphraseStateAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Deprecated_PassphraseStateAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Deprecated_PassphraseStateAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Deprecated_PassphraseStateAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Deprecated_PassphraseStateAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.common.HDNodeType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct HDNodeType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.depth) - pub depth: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.fingerprint) - pub fingerprint: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.child_num) - pub child_num: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.chain_code) - pub chain_code: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.private_key) - pub private_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.common.HDNodeType.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.common.HDNodeType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a HDNodeType { - fn default() -> &'a HDNodeType { - ::default_instance() - } -} - -impl HDNodeType { - pub fn new() -> HDNodeType { - ::std::default::Default::default() - } - - // required uint32 depth = 1; - - pub fn depth(&self) -> u32 { - self.depth.unwrap_or(0) - } - - pub fn clear_depth(&mut self) { - self.depth = ::std::option::Option::None; - } - - pub fn has_depth(&self) -> bool { - self.depth.is_some() - } - - // Param is passed by value, moved - pub fn set_depth(&mut self, v: u32) { - self.depth = ::std::option::Option::Some(v); - } - - // required uint32 fingerprint = 2; - - pub fn fingerprint(&self) -> u32 { - self.fingerprint.unwrap_or(0) - } - - pub fn clear_fingerprint(&mut self) { - self.fingerprint = ::std::option::Option::None; - } - - pub fn has_fingerprint(&self) -> bool { - self.fingerprint.is_some() - } - - // Param is passed by value, moved - pub fn set_fingerprint(&mut self, v: u32) { - self.fingerprint = ::std::option::Option::Some(v); - } - - // required uint32 child_num = 3; - - pub fn child_num(&self) -> u32 { - self.child_num.unwrap_or(0) - } - - pub fn clear_child_num(&mut self) { - self.child_num = ::std::option::Option::None; - } - - pub fn has_child_num(&self) -> bool { - self.child_num.is_some() - } - - // Param is passed by value, moved - pub fn set_child_num(&mut self, v: u32) { - self.child_num = ::std::option::Option::Some(v); - } - - // required bytes chain_code = 4; - - pub fn chain_code(&self) -> &[u8] { - match self.chain_code.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_chain_code(&mut self) { - self.chain_code = ::std::option::Option::None; - } - - pub fn has_chain_code(&self) -> bool { - self.chain_code.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_code(&mut self, v: ::std::vec::Vec) { - self.chain_code = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_chain_code(&mut self) -> &mut ::std::vec::Vec { - if self.chain_code.is_none() { - self.chain_code = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.chain_code.as_mut().unwrap() - } - - // Take field - pub fn take_chain_code(&mut self) -> ::std::vec::Vec { - self.chain_code.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes private_key = 5; - - pub fn private_key(&self) -> &[u8] { - match self.private_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_private_key(&mut self) { - self.private_key = ::std::option::Option::None; - } - - pub fn has_private_key(&self) -> bool { - self.private_key.is_some() - } - - // Param is passed by value, moved - pub fn set_private_key(&mut self, v: ::std::vec::Vec) { - self.private_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_private_key(&mut self) -> &mut ::std::vec::Vec { - if self.private_key.is_none() { - self.private_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.private_key.as_mut().unwrap() - } - - // Take field - pub fn take_private_key(&mut self) -> ::std::vec::Vec { - self.private_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes public_key = 6; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "depth", - |m: &HDNodeType| { &m.depth }, - |m: &mut HDNodeType| { &mut m.depth }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fingerprint", - |m: &HDNodeType| { &m.fingerprint }, - |m: &mut HDNodeType| { &mut m.fingerprint }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "child_num", - |m: &HDNodeType| { &m.child_num }, - |m: &mut HDNodeType| { &mut m.child_num }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_code", - |m: &HDNodeType| { &m.chain_code }, - |m: &mut HDNodeType| { &mut m.chain_code }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "private_key", - |m: &HDNodeType| { &m.private_key }, - |m: &mut HDNodeType| { &mut m.private_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &HDNodeType| { &m.public_key }, - |m: &mut HDNodeType| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "HDNodeType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for HDNodeType { - const NAME: &'static str = "HDNodeType"; - - fn is_initialized(&self) -> bool { - if self.depth.is_none() { - return false; - } - if self.fingerprint.is_none() { - return false; - } - if self.child_num.is_none() { - return false; - } - if self.chain_code.is_none() { - return false; - } - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.depth = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.fingerprint = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.child_num = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - self.chain_code = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.private_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.depth { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.fingerprint { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.child_num { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.chain_code.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.private_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.depth { - os.write_uint32(1, v)?; - } - if let Some(v) = self.fingerprint { - os.write_uint32(2, v)?; - } - if let Some(v) = self.child_num { - os.write_uint32(3, v)?; - } - if let Some(v) = self.chain_code.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.private_key.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> HDNodeType { - HDNodeType::new() - } - - fn clear(&mut self) { - self.depth = ::std::option::Option::None; - self.fingerprint = ::std::option::Option::None; - self.child_num = ::std::option::Option::None; - self.chain_code = ::std::option::Option::None; - self.private_key = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static HDNodeType { - static instance: HDNodeType = HDNodeType { - depth: ::std::option::Option::None, - fingerprint: ::std::option::Option::None, - child_num: ::std::option::Option::None, - chain_code: ::std::option::Option::None, - private_key: ::std::option::Option::None, - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for HDNodeType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("HDNodeType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for HDNodeType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for HDNodeType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x15messages-common.proto\x12\x19hw.trezor.messages.common\x1a\x0emess\ - ages.proto\"%\n\x07Success\x12\x1a\n\x07message\x18\x01\x20\x01(\t:\0R\ - \x07message\"\x8f\x04\n\x07Failure\x12B\n\x04code\x18\x01\x20\x01(\x0e2.\ - .hw.trezor.messages.common.Failure.FailureTypeR\x04code\x12\x18\n\x07mes\ - sage\x18\x02\x20\x01(\tR\x07message\"\xa5\x03\n\x0bFailureType\x12\x1d\n\ - \x19Failure_UnexpectedMessage\x10\x01\x12\x1a\n\x16Failure_ButtonExpecte\ - d\x10\x02\x12\x15\n\x11Failure_DataError\x10\x03\x12\x1b\n\x17Failure_Ac\ - tionCancelled\x10\x04\x12\x17\n\x13Failure_PinExpected\x10\x05\x12\x18\n\ - \x14Failure_PinCancelled\x10\x06\x12\x16\n\x12Failure_PinInvalid\x10\x07\ - \x12\x1c\n\x18Failure_InvalidSignature\x10\x08\x12\x18\n\x14Failure_Proc\ - essError\x10\t\x12\x1a\n\x16Failure_NotEnoughFunds\x10\n\x12\x1a\n\x16Fa\ - ilure_NotInitialized\x10\x0b\x12\x17\n\x13Failure_PinMismatch\x10\x0c\ - \x12\x1c\n\x18Failure_WipeCodeMismatch\x10\r\x12\x1a\n\x16Failure_Invali\ - dSession\x10\x0e\x12\x19\n\x15Failure_FirmwareError\x10c\"\x91\x06\n\rBu\ - ttonRequest\x12N\n\x04code\x18\x01\x20\x01(\x0e2:.hw.trezor.messages.com\ - mon.ButtonRequest.ButtonRequestTypeR\x04code\x12\x14\n\x05pages\x18\x02\ - \x20\x01(\rR\x05pages\"\x99\x05\n\x11ButtonRequestType\x12\x17\n\x13Butt\ - onRequest_Other\x10\x01\x12\"\n\x1eButtonRequest_FeeOverThreshold\x10\ - \x02\x12\x1f\n\x1bButtonRequest_ConfirmOutput\x10\x03\x12\x1d\n\x19Butto\ - nRequest_ResetDevice\x10\x04\x12\x1d\n\x19ButtonRequest_ConfirmWord\x10\ - \x05\x12\x1c\n\x18ButtonRequest_WipeDevice\x10\x06\x12\x1d\n\x19ButtonRe\ - quest_ProtectCall\x10\x07\x12\x18\n\x14ButtonRequest_SignTx\x10\x08\x12\ - \x1f\n\x1bButtonRequest_FirmwareCheck\x10\t\x12\x19\n\x15ButtonRequest_A\ - ddress\x10\n\x12\x1b\n\x17ButtonRequest_PublicKey\x10\x0b\x12#\n\x1fButt\ - onRequest_MnemonicWordCount\x10\x0c\x12\x1f\n\x1bButtonRequest_MnemonicI\ - nput\x10\r\x120\n(_Deprecated_ButtonRequest_PassphraseType\x10\x0e\x1a\ - \x02\x08\x01\x12'\n#ButtonRequest_UnknownDerivationPath\x10\x0f\x12\"\n\ - \x1eButtonRequest_RecoveryHomepage\x10\x10\x12\x19\n\x15ButtonRequest_Su\ - ccess\x10\x11\x12\x19\n\x15ButtonRequest_Warning\x10\x12\x12!\n\x1dButto\ - nRequest_PassphraseEntry\x10\x13\x12\x1a\n\x16ButtonRequest_PinEntry\x10\ - \x14\"\x0b\n\tButtonAck\"\xbb\x02\n\x10PinMatrixRequest\x12T\n\x04type\ - \x18\x01\x20\x01(\x0e2@.hw.trezor.messages.common.PinMatrixRequest.PinMa\ - trixRequestTypeR\x04type\"\xd0\x01\n\x14PinMatrixRequestType\x12\x20\n\ - \x1cPinMatrixRequestType_Current\x10\x01\x12!\n\x1dPinMatrixRequestType_\ - NewFirst\x10\x02\x12\"\n\x1ePinMatrixRequestType_NewSecond\x10\x03\x12&\ - \n\"PinMatrixRequestType_WipeCodeFirst\x10\x04\x12'\n#PinMatrixRequestTy\ - pe_WipeCodeSecond\x10\x05\"\x20\n\x0cPinMatrixAck\x12\x10\n\x03pin\x18\ - \x01\x20\x02(\tR\x03pin\"5\n\x11PassphraseRequest\x12\x20\n\n_on_device\ - \x18\x01\x20\x01(\x08R\x08OnDeviceB\x02\x18\x01\"g\n\rPassphraseAck\x12\ - \x1e\n\npassphrase\x18\x01\x20\x01(\tR\npassphrase\x12\x19\n\x06_state\ - \x18\x02\x20\x01(\x0cR\x05StateB\x02\x18\x01\x12\x1b\n\ton_device\x18\ - \x03\x20\x01(\x08R\x08onDevice\"=\n!Deprecated_PassphraseStateRequest\ - \x12\x14\n\x05state\x18\x01\x20\x01(\x0cR\x05state:\x02\x18\x01\"#\n\x1d\ - Deprecated_PassphraseStateAck:\x02\x18\x01\"\xc0\x01\n\nHDNodeType\x12\ - \x14\n\x05depth\x18\x01\x20\x02(\rR\x05depth\x12\x20\n\x0bfingerprint\ - \x18\x02\x20\x02(\rR\x0bfingerprint\x12\x1b\n\tchild_num\x18\x03\x20\x02\ - (\rR\x08childNum\x12\x1d\n\nchain_code\x18\x04\x20\x02(\x0cR\tchainCode\ - \x12\x1f\n\x0bprivate_key\x18\x05\x20\x01(\x0cR\nprivateKey\x12\x1d\n\np\ - ublic_key\x18\x06\x20\x02(\x0cR\tpublicKeyB>\n#com.satoshilabs.trezor.li\ - b.protobufB\x13TrezorMessageCommon\x80\xa6\x1d\x01\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(1); - deps.push(super::messages::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(11); - messages.push(Success::generated_message_descriptor_data()); - messages.push(Failure::generated_message_descriptor_data()); - messages.push(ButtonRequest::generated_message_descriptor_data()); - messages.push(ButtonAck::generated_message_descriptor_data()); - messages.push(PinMatrixRequest::generated_message_descriptor_data()); - messages.push(PinMatrixAck::generated_message_descriptor_data()); - messages.push(PassphraseRequest::generated_message_descriptor_data()); - messages.push(PassphraseAck::generated_message_descriptor_data()); - messages.push(Deprecated_PassphraseStateRequest::generated_message_descriptor_data()); - messages.push(Deprecated_PassphraseStateAck::generated_message_descriptor_data()); - messages.push(HDNodeType::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(3); - enums.push(failure::FailureType::generated_enum_descriptor_data()); - enums.push(button_request::ButtonRequestType::generated_enum_descriptor_data()); - enums.push(pin_matrix_request::PinMatrixRequestType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_crypto.rs b/wallet/trezor-client/src/protos/generated/messages_crypto.rs deleted file mode 100644 index 5fec7d5f8f..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_crypto.rs +++ /dev/null @@ -1,2956 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-crypto.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CipherKeyValue) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CipherKeyValue { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.key) - pub key: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.value) - pub value: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.encrypt) - pub encrypt: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.ask_on_encrypt) - pub ask_on_encrypt: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.ask_on_decrypt) - pub ask_on_decrypt: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipherKeyValue.iv) - pub iv: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CipherKeyValue.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CipherKeyValue { - fn default() -> &'a CipherKeyValue { - ::default_instance() - } -} - -impl CipherKeyValue { - pub fn new() -> CipherKeyValue { - ::std::default::Default::default() - } - - // required string key = 2; - - pub fn key(&self) -> &str { - match self.key.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_key(&mut self) { - self.key = ::std::option::Option::None; - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::string::String) { - self.key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::string::String { - if self.key.is_none() { - self.key = ::std::option::Option::Some(::std::string::String::new()); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::string::String { - self.key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes value = 3; - - pub fn value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool encrypt = 4; - - pub fn encrypt(&self) -> bool { - self.encrypt.unwrap_or(false) - } - - pub fn clear_encrypt(&mut self) { - self.encrypt = ::std::option::Option::None; - } - - pub fn has_encrypt(&self) -> bool { - self.encrypt.is_some() - } - - // Param is passed by value, moved - pub fn set_encrypt(&mut self, v: bool) { - self.encrypt = ::std::option::Option::Some(v); - } - - // optional bool ask_on_encrypt = 5; - - pub fn ask_on_encrypt(&self) -> bool { - self.ask_on_encrypt.unwrap_or(false) - } - - pub fn clear_ask_on_encrypt(&mut self) { - self.ask_on_encrypt = ::std::option::Option::None; - } - - pub fn has_ask_on_encrypt(&self) -> bool { - self.ask_on_encrypt.is_some() - } - - // Param is passed by value, moved - pub fn set_ask_on_encrypt(&mut self, v: bool) { - self.ask_on_encrypt = ::std::option::Option::Some(v); - } - - // optional bool ask_on_decrypt = 6; - - pub fn ask_on_decrypt(&self) -> bool { - self.ask_on_decrypt.unwrap_or(false) - } - - pub fn clear_ask_on_decrypt(&mut self) { - self.ask_on_decrypt = ::std::option::Option::None; - } - - pub fn has_ask_on_decrypt(&self) -> bool { - self.ask_on_decrypt.is_some() - } - - // Param is passed by value, moved - pub fn set_ask_on_decrypt(&mut self, v: bool) { - self.ask_on_decrypt = ::std::option::Option::Some(v); - } - - // optional bytes iv = 7; - - pub fn iv(&self) -> &[u8] { - match self.iv.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_iv(&mut self) { - self.iv = ::std::option::Option::None; - } - - pub fn has_iv(&self) -> bool { - self.iv.is_some() - } - - // Param is passed by value, moved - pub fn set_iv(&mut self, v: ::std::vec::Vec) { - self.iv = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_iv(&mut self) -> &mut ::std::vec::Vec { - if self.iv.is_none() { - self.iv = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.iv.as_mut().unwrap() - } - - // Take field - pub fn take_iv(&mut self) -> ::std::vec::Vec { - self.iv.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &CipherKeyValue| { &m.address_n }, - |m: &mut CipherKeyValue| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key", - |m: &CipherKeyValue| { &m.key }, - |m: &mut CipherKeyValue| { &mut m.key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "value", - |m: &CipherKeyValue| { &m.value }, - |m: &mut CipherKeyValue| { &mut m.value }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "encrypt", - |m: &CipherKeyValue| { &m.encrypt }, - |m: &mut CipherKeyValue| { &mut m.encrypt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ask_on_encrypt", - |m: &CipherKeyValue| { &m.ask_on_encrypt }, - |m: &mut CipherKeyValue| { &mut m.ask_on_encrypt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ask_on_decrypt", - |m: &CipherKeyValue| { &m.ask_on_decrypt }, - |m: &mut CipherKeyValue| { &mut m.ask_on_decrypt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "iv", - |m: &CipherKeyValue| { &m.iv }, - |m: &mut CipherKeyValue| { &mut m.iv }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CipherKeyValue", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CipherKeyValue { - const NAME: &'static str = "CipherKeyValue"; - - fn is_initialized(&self) -> bool { - if self.key.is_none() { - return false; - } - if self.value.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.key = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.value = ::std::option::Option::Some(is.read_bytes()?); - }, - 32 => { - self.encrypt = ::std::option::Option::Some(is.read_bool()?); - }, - 40 => { - self.ask_on_encrypt = ::std::option::Option::Some(is.read_bool()?); - }, - 48 => { - self.ask_on_decrypt = ::std::option::Option::Some(is.read_bool()?); - }, - 58 => { - self.iv = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.key.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.encrypt { - my_size += 1 + 1; - } - if let Some(v) = self.ask_on_encrypt { - my_size += 1 + 1; - } - if let Some(v) = self.ask_on_decrypt { - my_size += 1 + 1; - } - if let Some(v) = self.iv.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.key.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.value.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.encrypt { - os.write_bool(4, v)?; - } - if let Some(v) = self.ask_on_encrypt { - os.write_bool(5, v)?; - } - if let Some(v) = self.ask_on_decrypt { - os.write_bool(6, v)?; - } - if let Some(v) = self.iv.as_ref() { - os.write_bytes(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CipherKeyValue { - CipherKeyValue::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.key = ::std::option::Option::None; - self.value = ::std::option::Option::None; - self.encrypt = ::std::option::Option::None; - self.ask_on_encrypt = ::std::option::Option::None; - self.ask_on_decrypt = ::std::option::Option::None; - self.iv = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CipherKeyValue { - static instance: CipherKeyValue = CipherKeyValue { - address_n: ::std::vec::Vec::new(), - key: ::std::option::Option::None, - value: ::std::option::Option::None, - encrypt: ::std::option::Option::None, - ask_on_encrypt: ::std::option::Option::None, - ask_on_decrypt: ::std::option::Option::None, - iv: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CipherKeyValue { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CipherKeyValue").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CipherKeyValue { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CipherKeyValue { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CipheredKeyValue) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CipheredKeyValue { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CipheredKeyValue.value) - pub value: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CipheredKeyValue.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CipheredKeyValue { - fn default() -> &'a CipheredKeyValue { - ::default_instance() - } -} - -impl CipheredKeyValue { - pub fn new() -> CipheredKeyValue { - ::std::default::Default::default() - } - - // required bytes value = 1; - - pub fn value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "value", - |m: &CipheredKeyValue| { &m.value }, - |m: &mut CipheredKeyValue| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CipheredKeyValue", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CipheredKeyValue { - const NAME: &'static str = "CipheredKeyValue"; - - fn is_initialized(&self) -> bool { - if self.value.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.value = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.value.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CipheredKeyValue { - CipheredKeyValue::new() - } - - fn clear(&mut self) { - self.value = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CipheredKeyValue { - static instance: CipheredKeyValue = CipheredKeyValue { - value: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CipheredKeyValue { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CipheredKeyValue").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CipheredKeyValue { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CipheredKeyValue { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.IdentityType) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct IdentityType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.proto) - pub proto: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.user) - pub user: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.host) - pub host: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.port) - pub port: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.path) - pub path: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.IdentityType.index) - pub index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.IdentityType.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a IdentityType { - fn default() -> &'a IdentityType { - ::default_instance() - } -} - -impl IdentityType { - pub fn new() -> IdentityType { - ::std::default::Default::default() - } - - // optional string proto = 1; - - pub fn proto(&self) -> &str { - match self.proto.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_proto(&mut self) { - self.proto = ::std::option::Option::None; - } - - pub fn has_proto(&self) -> bool { - self.proto.is_some() - } - - // Param is passed by value, moved - pub fn set_proto(&mut self, v: ::std::string::String) { - self.proto = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_proto(&mut self) -> &mut ::std::string::String { - if self.proto.is_none() { - self.proto = ::std::option::Option::Some(::std::string::String::new()); - } - self.proto.as_mut().unwrap() - } - - // Take field - pub fn take_proto(&mut self) -> ::std::string::String { - self.proto.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string user = 2; - - pub fn user(&self) -> &str { - match self.user.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_user(&mut self) { - self.user = ::std::option::Option::None; - } - - pub fn has_user(&self) -> bool { - self.user.is_some() - } - - // Param is passed by value, moved - pub fn set_user(&mut self, v: ::std::string::String) { - self.user = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_user(&mut self) -> &mut ::std::string::String { - if self.user.is_none() { - self.user = ::std::option::Option::Some(::std::string::String::new()); - } - self.user.as_mut().unwrap() - } - - // Take field - pub fn take_user(&mut self) -> ::std::string::String { - self.user.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string host = 3; - - pub fn host(&self) -> &str { - match self.host.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_host(&mut self) { - self.host = ::std::option::Option::None; - } - - pub fn has_host(&self) -> bool { - self.host.is_some() - } - - // Param is passed by value, moved - pub fn set_host(&mut self, v: ::std::string::String) { - self.host = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_host(&mut self) -> &mut ::std::string::String { - if self.host.is_none() { - self.host = ::std::option::Option::Some(::std::string::String::new()); - } - self.host.as_mut().unwrap() - } - - // Take field - pub fn take_host(&mut self) -> ::std::string::String { - self.host.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string port = 4; - - pub fn port(&self) -> &str { - match self.port.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_port(&mut self) { - self.port = ::std::option::Option::None; - } - - pub fn has_port(&self) -> bool { - self.port.is_some() - } - - // Param is passed by value, moved - pub fn set_port(&mut self, v: ::std::string::String) { - self.port = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_port(&mut self) -> &mut ::std::string::String { - if self.port.is_none() { - self.port = ::std::option::Option::Some(::std::string::String::new()); - } - self.port.as_mut().unwrap() - } - - // Take field - pub fn take_port(&mut self) -> ::std::string::String { - self.port.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string path = 5; - - pub fn path(&self) -> &str { - match self.path.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_path(&mut self) { - self.path = ::std::option::Option::None; - } - - pub fn has_path(&self) -> bool { - self.path.is_some() - } - - // Param is passed by value, moved - pub fn set_path(&mut self, v: ::std::string::String) { - self.path = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_path(&mut self) -> &mut ::std::string::String { - if self.path.is_none() { - self.path = ::std::option::Option::Some(::std::string::String::new()); - } - self.path.as_mut().unwrap() - } - - // Take field - pub fn take_path(&mut self) -> ::std::string::String { - self.path.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 index = 6; - - pub fn index(&self) -> u32 { - self.index.unwrap_or(0u32) - } - - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u32) { - self.index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "proto", - |m: &IdentityType| { &m.proto }, - |m: &mut IdentityType| { &mut m.proto }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "user", - |m: &IdentityType| { &m.user }, - |m: &mut IdentityType| { &mut m.user }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "host", - |m: &IdentityType| { &m.host }, - |m: &mut IdentityType| { &mut m.host }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "port", - |m: &IdentityType| { &m.port }, - |m: &mut IdentityType| { &mut m.port }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "path", - |m: &IdentityType| { &m.path }, - |m: &mut IdentityType| { &mut m.path }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "index", - |m: &IdentityType| { &m.index }, - |m: &mut IdentityType| { &mut m.index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "IdentityType", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for IdentityType { - const NAME: &'static str = "IdentityType"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.proto = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.user = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.host = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.port = ::std::option::Option::Some(is.read_string()?); - }, - 42 => { - self.path = ::std::option::Option::Some(is.read_string()?); - }, - 48 => { - self.index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.proto.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.user.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.host.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.port.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.path.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.index { - my_size += ::protobuf::rt::uint32_size(6, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.proto.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.user.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.host.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.port.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.path.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.index { - os.write_uint32(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> IdentityType { - IdentityType::new() - } - - fn clear(&mut self) { - self.proto = ::std::option::Option::None; - self.user = ::std::option::Option::None; - self.host = ::std::option::Option::None; - self.port = ::std::option::Option::None; - self.path = ::std::option::Option::None; - self.index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static IdentityType { - static instance: IdentityType = IdentityType { - proto: ::std::option::Option::None, - user: ::std::option::Option::None, - host: ::std::option::Option::None, - port: ::std::option::Option::None, - path: ::std::option::Option::None, - index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for IdentityType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("IdentityType").unwrap()).clone() - } -} - -impl ::std::fmt::Display for IdentityType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for IdentityType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.SignIdentity) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SignIdentity { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.identity) - pub identity: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.challenge_hidden) - pub challenge_hidden: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.challenge_visual) - pub challenge_visual: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignIdentity.ecdsa_curve_name) - pub ecdsa_curve_name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.SignIdentity.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SignIdentity { - fn default() -> &'a SignIdentity { - ::default_instance() - } -} - -impl SignIdentity { - pub fn new() -> SignIdentity { - ::std::default::Default::default() - } - - // optional bytes challenge_hidden = 2; - - pub fn challenge_hidden(&self) -> &[u8] { - match self.challenge_hidden.as_ref() { - Some(v) => v, - None => b"", - } - } - - pub fn clear_challenge_hidden(&mut self) { - self.challenge_hidden = ::std::option::Option::None; - } - - pub fn has_challenge_hidden(&self) -> bool { - self.challenge_hidden.is_some() - } - - // Param is passed by value, moved - pub fn set_challenge_hidden(&mut self, v: ::std::vec::Vec) { - self.challenge_hidden = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_challenge_hidden(&mut self) -> &mut ::std::vec::Vec { - if self.challenge_hidden.is_none() { - self.challenge_hidden = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.challenge_hidden.as_mut().unwrap() - } - - // Take field - pub fn take_challenge_hidden(&mut self) -> ::std::vec::Vec { - self.challenge_hidden.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string challenge_visual = 3; - - pub fn challenge_visual(&self) -> &str { - match self.challenge_visual.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_challenge_visual(&mut self) { - self.challenge_visual = ::std::option::Option::None; - } - - pub fn has_challenge_visual(&self) -> bool { - self.challenge_visual.is_some() - } - - // Param is passed by value, moved - pub fn set_challenge_visual(&mut self, v: ::std::string::String) { - self.challenge_visual = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_challenge_visual(&mut self) -> &mut ::std::string::String { - if self.challenge_visual.is_none() { - self.challenge_visual = ::std::option::Option::Some(::std::string::String::new()); - } - self.challenge_visual.as_mut().unwrap() - } - - // Take field - pub fn take_challenge_visual(&mut self) -> ::std::string::String { - self.challenge_visual.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string ecdsa_curve_name = 4; - - pub fn ecdsa_curve_name(&self) -> &str { - match self.ecdsa_curve_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_ecdsa_curve_name(&mut self) { - self.ecdsa_curve_name = ::std::option::Option::None; - } - - pub fn has_ecdsa_curve_name(&self) -> bool { - self.ecdsa_curve_name.is_some() - } - - // Param is passed by value, moved - pub fn set_ecdsa_curve_name(&mut self, v: ::std::string::String) { - self.ecdsa_curve_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ecdsa_curve_name(&mut self) -> &mut ::std::string::String { - if self.ecdsa_curve_name.is_none() { - self.ecdsa_curve_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.ecdsa_curve_name.as_mut().unwrap() - } - - // Take field - pub fn take_ecdsa_curve_name(&mut self) -> ::std::string::String { - self.ecdsa_curve_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, IdentityType>( - "identity", - |m: &SignIdentity| { &m.identity }, - |m: &mut SignIdentity| { &mut m.identity }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "challenge_hidden", - |m: &SignIdentity| { &m.challenge_hidden }, - |m: &mut SignIdentity| { &mut m.challenge_hidden }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "challenge_visual", - |m: &SignIdentity| { &m.challenge_visual }, - |m: &mut SignIdentity| { &mut m.challenge_visual }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ecdsa_curve_name", - |m: &SignIdentity| { &m.ecdsa_curve_name }, - |m: &mut SignIdentity| { &mut m.ecdsa_curve_name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SignIdentity", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SignIdentity { - const NAME: &'static str = "SignIdentity"; - - fn is_initialized(&self) -> bool { - if self.identity.is_none() { - return false; - } - for v in &self.identity { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.identity)?; - }, - 18 => { - self.challenge_hidden = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.challenge_visual = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.ecdsa_curve_name = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.identity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.challenge_hidden.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.challenge_visual.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.ecdsa_curve_name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.identity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.challenge_hidden.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.challenge_visual.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.ecdsa_curve_name.as_ref() { - os.write_string(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SignIdentity { - SignIdentity::new() - } - - fn clear(&mut self) { - self.identity.clear(); - self.challenge_hidden = ::std::option::Option::None; - self.challenge_visual = ::std::option::Option::None; - self.ecdsa_curve_name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SignIdentity { - static instance: SignIdentity = SignIdentity { - identity: ::protobuf::MessageField::none(), - challenge_hidden: ::std::option::Option::None, - challenge_visual: ::std::option::Option::None, - ecdsa_curve_name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SignIdentity { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SignIdentity").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SignIdentity { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SignIdentity { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.SignedIdentity) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SignedIdentity { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignedIdentity.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignedIdentity.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.SignedIdentity.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.SignedIdentity.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SignedIdentity { - fn default() -> &'a SignedIdentity { - ::default_instance() - } -} - -impl SignedIdentity { - pub fn new() -> SignedIdentity { - ::std::default::Default::default() - } - - // optional string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes public_key = 2; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes signature = 3; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &SignedIdentity| { &m.address }, - |m: &mut SignedIdentity| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &SignedIdentity| { &m.public_key }, - |m: &mut SignedIdentity| { &mut m.public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &SignedIdentity| { &m.signature }, - |m: &mut SignedIdentity| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SignedIdentity", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SignedIdentity { - const NAME: &'static str = "SignedIdentity"; - - fn is_initialized(&self) -> bool { - if self.public_key.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SignedIdentity { - SignedIdentity::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SignedIdentity { - static instance: SignedIdentity = SignedIdentity { - address: ::std::option::Option::None, - public_key: ::std::option::Option::None, - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SignedIdentity { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SignedIdentity").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SignedIdentity { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SignedIdentity { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.GetECDHSessionKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetECDHSessionKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.GetECDHSessionKey.identity) - pub identity: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.GetECDHSessionKey.peer_public_key) - pub peer_public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.GetECDHSessionKey.ecdsa_curve_name) - pub ecdsa_curve_name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.GetECDHSessionKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetECDHSessionKey { - fn default() -> &'a GetECDHSessionKey { - ::default_instance() - } -} - -impl GetECDHSessionKey { - pub fn new() -> GetECDHSessionKey { - ::std::default::Default::default() - } - - // required bytes peer_public_key = 2; - - pub fn peer_public_key(&self) -> &[u8] { - match self.peer_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_peer_public_key(&mut self) { - self.peer_public_key = ::std::option::Option::None; - } - - pub fn has_peer_public_key(&self) -> bool { - self.peer_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_peer_public_key(&mut self, v: ::std::vec::Vec) { - self.peer_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.peer_public_key.is_none() { - self.peer_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.peer_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_peer_public_key(&mut self) -> ::std::vec::Vec { - self.peer_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string ecdsa_curve_name = 3; - - pub fn ecdsa_curve_name(&self) -> &str { - match self.ecdsa_curve_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_ecdsa_curve_name(&mut self) { - self.ecdsa_curve_name = ::std::option::Option::None; - } - - pub fn has_ecdsa_curve_name(&self) -> bool { - self.ecdsa_curve_name.is_some() - } - - // Param is passed by value, moved - pub fn set_ecdsa_curve_name(&mut self, v: ::std::string::String) { - self.ecdsa_curve_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ecdsa_curve_name(&mut self) -> &mut ::std::string::String { - if self.ecdsa_curve_name.is_none() { - self.ecdsa_curve_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.ecdsa_curve_name.as_mut().unwrap() - } - - // Take field - pub fn take_ecdsa_curve_name(&mut self) -> ::std::string::String { - self.ecdsa_curve_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, IdentityType>( - "identity", - |m: &GetECDHSessionKey| { &m.identity }, - |m: &mut GetECDHSessionKey| { &mut m.identity }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "peer_public_key", - |m: &GetECDHSessionKey| { &m.peer_public_key }, - |m: &mut GetECDHSessionKey| { &mut m.peer_public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ecdsa_curve_name", - |m: &GetECDHSessionKey| { &m.ecdsa_curve_name }, - |m: &mut GetECDHSessionKey| { &mut m.ecdsa_curve_name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetECDHSessionKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetECDHSessionKey { - const NAME: &'static str = "GetECDHSessionKey"; - - fn is_initialized(&self) -> bool { - if self.identity.is_none() { - return false; - } - if self.peer_public_key.is_none() { - return false; - } - for v in &self.identity { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.identity)?; - }, - 18 => { - self.peer_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.ecdsa_curve_name = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.identity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.peer_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.ecdsa_curve_name.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.identity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.peer_public_key.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.ecdsa_curve_name.as_ref() { - os.write_string(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetECDHSessionKey { - GetECDHSessionKey::new() - } - - fn clear(&mut self) { - self.identity.clear(); - self.peer_public_key = ::std::option::Option::None; - self.ecdsa_curve_name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetECDHSessionKey { - static instance: GetECDHSessionKey = GetECDHSessionKey { - identity: ::protobuf::MessageField::none(), - peer_public_key: ::std::option::Option::None, - ecdsa_curve_name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetECDHSessionKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetECDHSessionKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetECDHSessionKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetECDHSessionKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.ECDHSessionKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ECDHSessionKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.ECDHSessionKey.session_key) - pub session_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.ECDHSessionKey.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.ECDHSessionKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ECDHSessionKey { - fn default() -> &'a ECDHSessionKey { - ::default_instance() - } -} - -impl ECDHSessionKey { - pub fn new() -> ECDHSessionKey { - ::std::default::Default::default() - } - - // required bytes session_key = 1; - - pub fn session_key(&self) -> &[u8] { - match self.session_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_session_key(&mut self) { - self.session_key = ::std::option::Option::None; - } - - pub fn has_session_key(&self) -> bool { - self.session_key.is_some() - } - - // Param is passed by value, moved - pub fn set_session_key(&mut self, v: ::std::vec::Vec) { - self.session_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_session_key(&mut self) -> &mut ::std::vec::Vec { - if self.session_key.is_none() { - self.session_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.session_key.as_mut().unwrap() - } - - // Take field - pub fn take_session_key(&mut self) -> ::std::vec::Vec { - self.session_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes public_key = 2; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "session_key", - |m: &ECDHSessionKey| { &m.session_key }, - |m: &mut ECDHSessionKey| { &mut m.session_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &ECDHSessionKey| { &m.public_key }, - |m: &mut ECDHSessionKey| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ECDHSessionKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ECDHSessionKey { - const NAME: &'static str = "ECDHSessionKey"; - - fn is_initialized(&self) -> bool { - if self.session_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.session_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.session_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.session_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ECDHSessionKey { - ECDHSessionKey::new() - } - - fn clear(&mut self) { - self.session_key = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ECDHSessionKey { - static instance: ECDHSessionKey = ECDHSessionKey { - session_key: ::std::option::Option::None, - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ECDHSessionKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ECDHSessionKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ECDHSessionKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ECDHSessionKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiCommit) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CosiCommit { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommit.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommit.data) - pub data: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiCommit.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CosiCommit { - fn default() -> &'a CosiCommit { - ::default_instance() - } -} - -impl CosiCommit { - pub fn new() -> CosiCommit { - ::std::default::Default::default() - } - - // optional bytes data = 2; - - pub fn data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &CosiCommit| { &m.address_n }, - |m: &mut CosiCommit| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data", - |m: &CosiCommit| { &m.data }, - |m: &mut CosiCommit| { &mut m.data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CosiCommit", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CosiCommit { - const NAME: &'static str = "CosiCommit"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.data = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.data.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CosiCommit { - CosiCommit::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.data = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CosiCommit { - static instance: CosiCommit = CosiCommit { - address_n: ::std::vec::Vec::new(), - data: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CosiCommit { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiCommit").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CosiCommit { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CosiCommit { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiCommitment) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CosiCommitment { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommitment.commitment) - pub commitment: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiCommitment.pubkey) - pub pubkey: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiCommitment.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CosiCommitment { - fn default() -> &'a CosiCommitment { - ::default_instance() - } -} - -impl CosiCommitment { - pub fn new() -> CosiCommitment { - ::std::default::Default::default() - } - - // required bytes commitment = 1; - - pub fn commitment(&self) -> &[u8] { - match self.commitment.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_commitment(&mut self) { - self.commitment = ::std::option::Option::None; - } - - pub fn has_commitment(&self) -> bool { - self.commitment.is_some() - } - - // Param is passed by value, moved - pub fn set_commitment(&mut self, v: ::std::vec::Vec) { - self.commitment = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_commitment(&mut self) -> &mut ::std::vec::Vec { - if self.commitment.is_none() { - self.commitment = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.commitment.as_mut().unwrap() - } - - // Take field - pub fn take_commitment(&mut self) -> ::std::vec::Vec { - self.commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes pubkey = 2; - - pub fn pubkey(&self) -> &[u8] { - match self.pubkey.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pubkey(&mut self) { - self.pubkey = ::std::option::Option::None; - } - - pub fn has_pubkey(&self) -> bool { - self.pubkey.is_some() - } - - // Param is passed by value, moved - pub fn set_pubkey(&mut self, v: ::std::vec::Vec) { - self.pubkey = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pubkey(&mut self) -> &mut ::std::vec::Vec { - if self.pubkey.is_none() { - self.pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pubkey.as_mut().unwrap() - } - - // Take field - pub fn take_pubkey(&mut self) -> ::std::vec::Vec { - self.pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "commitment", - |m: &CosiCommitment| { &m.commitment }, - |m: &mut CosiCommitment| { &mut m.commitment }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pubkey", - |m: &CosiCommitment| { &m.pubkey }, - |m: &mut CosiCommitment| { &mut m.pubkey }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CosiCommitment", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CosiCommitment { - const NAME: &'static str = "CosiCommitment"; - - fn is_initialized(&self) -> bool { - if self.commitment.is_none() { - return false; - } - if self.pubkey.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.commitment = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.pubkey = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.commitment.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.pubkey.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.commitment.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.pubkey.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CosiCommitment { - CosiCommitment::new() - } - - fn clear(&mut self) { - self.commitment = ::std::option::Option::None; - self.pubkey = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CosiCommitment { - static instance: CosiCommitment = CosiCommitment { - commitment: ::std::option::Option::None, - pubkey: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CosiCommitment { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiCommitment").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CosiCommitment { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CosiCommitment { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiSign) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CosiSign { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.data) - pub data: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.global_commitment) - pub global_commitment: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSign.global_pubkey) - pub global_pubkey: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiSign.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CosiSign { - fn default() -> &'a CosiSign { - ::default_instance() - } -} - -impl CosiSign { - pub fn new() -> CosiSign { - ::std::default::Default::default() - } - - // required bytes data = 2; - - pub fn data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes global_commitment = 3; - - pub fn global_commitment(&self) -> &[u8] { - match self.global_commitment.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_global_commitment(&mut self) { - self.global_commitment = ::std::option::Option::None; - } - - pub fn has_global_commitment(&self) -> bool { - self.global_commitment.is_some() - } - - // Param is passed by value, moved - pub fn set_global_commitment(&mut self, v: ::std::vec::Vec) { - self.global_commitment = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_global_commitment(&mut self) -> &mut ::std::vec::Vec { - if self.global_commitment.is_none() { - self.global_commitment = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.global_commitment.as_mut().unwrap() - } - - // Take field - pub fn take_global_commitment(&mut self) -> ::std::vec::Vec { - self.global_commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes global_pubkey = 4; - - pub fn global_pubkey(&self) -> &[u8] { - match self.global_pubkey.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_global_pubkey(&mut self) { - self.global_pubkey = ::std::option::Option::None; - } - - pub fn has_global_pubkey(&self) -> bool { - self.global_pubkey.is_some() - } - - // Param is passed by value, moved - pub fn set_global_pubkey(&mut self, v: ::std::vec::Vec) { - self.global_pubkey = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_global_pubkey(&mut self) -> &mut ::std::vec::Vec { - if self.global_pubkey.is_none() { - self.global_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.global_pubkey.as_mut().unwrap() - } - - // Take field - pub fn take_global_pubkey(&mut self) -> ::std::vec::Vec { - self.global_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &CosiSign| { &m.address_n }, - |m: &mut CosiSign| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data", - |m: &CosiSign| { &m.data }, - |m: &mut CosiSign| { &mut m.data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "global_commitment", - |m: &CosiSign| { &m.global_commitment }, - |m: &mut CosiSign| { &mut m.global_commitment }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "global_pubkey", - |m: &CosiSign| { &m.global_pubkey }, - |m: &mut CosiSign| { &mut m.global_pubkey }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CosiSign", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CosiSign { - const NAME: &'static str = "CosiSign"; - - fn is_initialized(&self) -> bool { - if self.data.is_none() { - return false; - } - if self.global_commitment.is_none() { - return false; - } - if self.global_pubkey.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.data = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.global_commitment = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.global_pubkey = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.global_commitment.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.global_pubkey.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.data.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.global_commitment.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.global_pubkey.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CosiSign { - CosiSign::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.data = ::std::option::Option::None; - self.global_commitment = ::std::option::Option::None; - self.global_pubkey = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CosiSign { - static instance: CosiSign = CosiSign { - address_n: ::std::vec::Vec::new(), - data: ::std::option::Option::None, - global_commitment: ::std::option::Option::None, - global_pubkey: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CosiSign { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiSign").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CosiSign { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CosiSign { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.crypto.CosiSignature) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CosiSignature { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.crypto.CosiSignature.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.crypto.CosiSignature.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CosiSignature { - fn default() -> &'a CosiSignature { - ::default_instance() - } -} - -impl CosiSignature { - pub fn new() -> CosiSignature { - ::std::default::Default::default() - } - - // required bytes signature = 1; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &CosiSignature| { &m.signature }, - |m: &mut CosiSignature| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CosiSignature", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CosiSignature { - const NAME: &'static str = "CosiSignature"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CosiSignature { - CosiSignature::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static CosiSignature { - static instance: CosiSignature = CosiSignature { - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CosiSignature { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CosiSignature").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CosiSignature { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CosiSignature { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x15messages-crypto.proto\x12\x19hw.trezor.messages.crypto\x1a\x0emess\ - ages.proto\"\xcb\x01\n\x0eCipherKeyValue\x12\x1b\n\taddress_n\x18\x01\ - \x20\x03(\rR\x08addressN\x12\x10\n\x03key\x18\x02\x20\x02(\tR\x03key\x12\ - \x14\n\x05value\x18\x03\x20\x02(\x0cR\x05value\x12\x18\n\x07encrypt\x18\ - \x04\x20\x01(\x08R\x07encrypt\x12$\n\x0eask_on_encrypt\x18\x05\x20\x01(\ - \x08R\x0caskOnEncrypt\x12$\n\x0eask_on_decrypt\x18\x06\x20\x01(\x08R\x0c\ - askOnDecrypt\x12\x0e\n\x02iv\x18\x07\x20\x01(\x0cR\x02iv\"(\n\x10Ciphere\ - dKeyValue\x12\x14\n\x05value\x18\x01\x20\x02(\x0cR\x05value\"\x8d\x01\n\ - \x0cIdentityType\x12\x14\n\x05proto\x18\x01\x20\x01(\tR\x05proto\x12\x12\ - \n\x04user\x18\x02\x20\x01(\tR\x04user\x12\x12\n\x04host\x18\x03\x20\x01\ - (\tR\x04host\x12\x12\n\x04port\x18\x04\x20\x01(\tR\x04port\x12\x12\n\x04\ - path\x18\x05\x20\x01(\tR\x04path\x12\x17\n\x05index\x18\x06\x20\x01(\r:\ - \x010R\x05index\"\xd7\x01\n\x0cSignIdentity\x12C\n\x08identity\x18\x01\ - \x20\x02(\x0b2'.hw.trezor.messages.crypto.IdentityTypeR\x08identity\x12+\ - \n\x10challenge_hidden\x18\x02\x20\x01(\x0c:\0R\x0fchallengeHidden\x12+\ - \n\x10challenge_visual\x18\x03\x20\x01(\t:\0R\x0fchallengeVisual\x12(\n\ - \x10ecdsa_curve_name\x18\x04\x20\x01(\tR\x0eecdsaCurveName\"g\n\x0eSigne\ - dIdentity\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12\x1d\n\ - \npublic_key\x18\x02\x20\x02(\x0cR\tpublicKey\x12\x1c\n\tsignature\x18\ - \x03\x20\x02(\x0cR\tsignature\"\xaa\x01\n\x11GetECDHSessionKey\x12C\n\ - \x08identity\x18\x01\x20\x02(\x0b2'.hw.trezor.messages.crypto.IdentityTy\ - peR\x08identity\x12&\n\x0fpeer_public_key\x18\x02\x20\x02(\x0cR\rpeerPub\ - licKey\x12(\n\x10ecdsa_curve_name\x18\x03\x20\x01(\tR\x0eecdsaCurveName\ - \"P\n\x0eECDHSessionKey\x12\x1f\n\x0bsession_key\x18\x01\x20\x02(\x0cR\n\ - sessionKey\x12\x1d\n\npublic_key\x18\x02\x20\x01(\x0cR\tpublicKey\"A\n\n\ - CosiCommit\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x16\ - \n\x04data\x18\x02\x20\x01(\x0cR\x04dataB\x02\x18\x01\"H\n\x0eCosiCommit\ - ment\x12\x1e\n\ncommitment\x18\x01\x20\x02(\x0cR\ncommitment\x12\x16\n\ - \x06pubkey\x18\x02\x20\x02(\x0cR\x06pubkey\"\x8d\x01\n\x08CosiSign\x12\ - \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x12\n\x04data\x18\ - \x02\x20\x02(\x0cR\x04data\x12+\n\x11global_commitment\x18\x03\x20\x02(\ - \x0cR\x10globalCommitment\x12#\n\rglobal_pubkey\x18\x04\x20\x02(\x0cR\ - \x0cglobalPubkey\"-\n\rCosiSignature\x12\x1c\n\tsignature\x18\x01\x20\ - \x02(\x0cR\tsignatureB>\n#com.satoshilabs.trezor.lib.protobufB\x13Trezor\ - MessageCrypto\x80\xa6\x1d\x01\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(1); - deps.push(super::messages::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(11); - messages.push(CipherKeyValue::generated_message_descriptor_data()); - messages.push(CipheredKeyValue::generated_message_descriptor_data()); - messages.push(IdentityType::generated_message_descriptor_data()); - messages.push(SignIdentity::generated_message_descriptor_data()); - messages.push(SignedIdentity::generated_message_descriptor_data()); - messages.push(GetECDHSessionKey::generated_message_descriptor_data()); - messages.push(ECDHSessionKey::generated_message_descriptor_data()); - messages.push(CosiCommit::generated_message_descriptor_data()); - messages.push(CosiCommitment::generated_message_descriptor_data()); - messages.push(CosiSign::generated_message_descriptor_data()); - messages.push(CosiSignature::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_debug.rs b/wallet/trezor-client/src/protos/generated/messages_debug.rs deleted file mode 100644 index 7bf28d1bf9..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_debug.rs +++ /dev/null @@ -1,3555 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-debug.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkDecision) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkDecision { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.button) - pub button: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.swipe) - pub swipe: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.input) - pub input: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.x) - pub x: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.y) - pub y: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.wait) - pub wait: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.hold_ms) - pub hold_ms: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkDecision.physical_button) - pub physical_button: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkDecision.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkDecision { - fn default() -> &'a DebugLinkDecision { - ::default_instance() - } -} - -impl DebugLinkDecision { - pub fn new() -> DebugLinkDecision { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.debug.DebugLinkDecision.DebugButton button = 1; - - pub fn button(&self) -> debug_link_decision::DebugButton { - match self.button { - Some(e) => e.enum_value_or(debug_link_decision::DebugButton::NO), - None => debug_link_decision::DebugButton::NO, - } - } - - pub fn clear_button(&mut self) { - self.button = ::std::option::Option::None; - } - - pub fn has_button(&self) -> bool { - self.button.is_some() - } - - // Param is passed by value, moved - pub fn set_button(&mut self, v: debug_link_decision::DebugButton) { - self.button = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional .hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection swipe = 2; - - pub fn swipe(&self) -> debug_link_decision::DebugSwipeDirection { - match self.swipe { - Some(e) => e.enum_value_or(debug_link_decision::DebugSwipeDirection::UP), - None => debug_link_decision::DebugSwipeDirection::UP, - } - } - - pub fn clear_swipe(&mut self) { - self.swipe = ::std::option::Option::None; - } - - pub fn has_swipe(&self) -> bool { - self.swipe.is_some() - } - - // Param is passed by value, moved - pub fn set_swipe(&mut self, v: debug_link_decision::DebugSwipeDirection) { - self.swipe = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional string input = 3; - - pub fn input(&self) -> &str { - match self.input.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_input(&mut self) { - self.input = ::std::option::Option::None; - } - - pub fn has_input(&self) -> bool { - self.input.is_some() - } - - // Param is passed by value, moved - pub fn set_input(&mut self, v: ::std::string::String) { - self.input = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_input(&mut self) -> &mut ::std::string::String { - if self.input.is_none() { - self.input = ::std::option::Option::Some(::std::string::String::new()); - } - self.input.as_mut().unwrap() - } - - // Take field - pub fn take_input(&mut self) -> ::std::string::String { - self.input.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 x = 4; - - pub fn x(&self) -> u32 { - self.x.unwrap_or(0) - } - - pub fn clear_x(&mut self) { - self.x = ::std::option::Option::None; - } - - pub fn has_x(&self) -> bool { - self.x.is_some() - } - - // Param is passed by value, moved - pub fn set_x(&mut self, v: u32) { - self.x = ::std::option::Option::Some(v); - } - - // optional uint32 y = 5; - - pub fn y(&self) -> u32 { - self.y.unwrap_or(0) - } - - pub fn clear_y(&mut self) { - self.y = ::std::option::Option::None; - } - - pub fn has_y(&self) -> bool { - self.y.is_some() - } - - // Param is passed by value, moved - pub fn set_y(&mut self, v: u32) { - self.y = ::std::option::Option::Some(v); - } - - // optional bool wait = 6; - - pub fn wait(&self) -> bool { - self.wait.unwrap_or(false) - } - - pub fn clear_wait(&mut self) { - self.wait = ::std::option::Option::None; - } - - pub fn has_wait(&self) -> bool { - self.wait.is_some() - } - - // Param is passed by value, moved - pub fn set_wait(&mut self, v: bool) { - self.wait = ::std::option::Option::Some(v); - } - - // optional uint32 hold_ms = 7; - - pub fn hold_ms(&self) -> u32 { - self.hold_ms.unwrap_or(0) - } - - pub fn clear_hold_ms(&mut self) { - self.hold_ms = ::std::option::Option::None; - } - - pub fn has_hold_ms(&self) -> bool { - self.hold_ms.is_some() - } - - // Param is passed by value, moved - pub fn set_hold_ms(&mut self, v: u32) { - self.hold_ms = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton physical_button = 8; - - pub fn physical_button(&self) -> debug_link_decision::DebugPhysicalButton { - match self.physical_button { - Some(e) => e.enum_value_or(debug_link_decision::DebugPhysicalButton::LEFT_BTN), - None => debug_link_decision::DebugPhysicalButton::LEFT_BTN, - } - } - - pub fn clear_physical_button(&mut self) { - self.physical_button = ::std::option::Option::None; - } - - pub fn has_physical_button(&self) -> bool { - self.physical_button.is_some() - } - - // Param is passed by value, moved - pub fn set_physical_button(&mut self, v: debug_link_decision::DebugPhysicalButton) { - self.physical_button = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "button", - |m: &DebugLinkDecision| { &m.button }, - |m: &mut DebugLinkDecision| { &mut m.button }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "swipe", - |m: &DebugLinkDecision| { &m.swipe }, - |m: &mut DebugLinkDecision| { &mut m.swipe }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "input", - |m: &DebugLinkDecision| { &m.input }, - |m: &mut DebugLinkDecision| { &mut m.input }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "x", - |m: &DebugLinkDecision| { &m.x }, - |m: &mut DebugLinkDecision| { &mut m.x }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "y", - |m: &DebugLinkDecision| { &m.y }, - |m: &mut DebugLinkDecision| { &mut m.y }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "wait", - |m: &DebugLinkDecision| { &m.wait }, - |m: &mut DebugLinkDecision| { &mut m.wait }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hold_ms", - |m: &DebugLinkDecision| { &m.hold_ms }, - |m: &mut DebugLinkDecision| { &mut m.hold_ms }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "physical_button", - |m: &DebugLinkDecision| { &m.physical_button }, - |m: &mut DebugLinkDecision| { &mut m.physical_button }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkDecision", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkDecision { - const NAME: &'static str = "DebugLinkDecision"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.button = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 16 => { - self.swipe = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 26 => { - self.input = ::std::option::Option::Some(is.read_string()?); - }, - 32 => { - self.x = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.y = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.wait = ::std::option::Option::Some(is.read_bool()?); - }, - 56 => { - self.hold_ms = ::std::option::Option::Some(is.read_uint32()?); - }, - 64 => { - self.physical_button = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.button { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.swipe { - my_size += ::protobuf::rt::int32_size(2, v.value()); - } - if let Some(v) = self.input.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.x { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.y { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.wait { - my_size += 1 + 1; - } - if let Some(v) = self.hold_ms { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.physical_button { - my_size += ::protobuf::rt::int32_size(8, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.button { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.swipe { - os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.input.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.x { - os.write_uint32(4, v)?; - } - if let Some(v) = self.y { - os.write_uint32(5, v)?; - } - if let Some(v) = self.wait { - os.write_bool(6, v)?; - } - if let Some(v) = self.hold_ms { - os.write_uint32(7, v)?; - } - if let Some(v) = self.physical_button { - os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkDecision { - DebugLinkDecision::new() - } - - fn clear(&mut self) { - self.button = ::std::option::Option::None; - self.swipe = ::std::option::Option::None; - self.input = ::std::option::Option::None; - self.x = ::std::option::Option::None; - self.y = ::std::option::Option::None; - self.wait = ::std::option::Option::None; - self.hold_ms = ::std::option::Option::None; - self.physical_button = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkDecision { - static instance: DebugLinkDecision = DebugLinkDecision { - button: ::std::option::Option::None, - swipe: ::std::option::Option::None, - input: ::std::option::Option::None, - x: ::std::option::Option::None, - y: ::std::option::Option::None, - wait: ::std::option::Option::None, - hold_ms: ::std::option::Option::None, - physical_button: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkDecision { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkDecision").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkDecision { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkDecision { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `DebugLinkDecision` -pub mod debug_link_decision { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection) - pub enum DebugSwipeDirection { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.UP) - UP = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.DOWN) - DOWN = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.LEFT) - LEFT = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugSwipeDirection.RIGHT) - RIGHT = 3, - } - - impl ::protobuf::Enum for DebugSwipeDirection { - const NAME: &'static str = "DebugSwipeDirection"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(DebugSwipeDirection::UP), - 1 => ::std::option::Option::Some(DebugSwipeDirection::DOWN), - 2 => ::std::option::Option::Some(DebugSwipeDirection::LEFT), - 3 => ::std::option::Option::Some(DebugSwipeDirection::RIGHT), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "UP" => ::std::option::Option::Some(DebugSwipeDirection::UP), - "DOWN" => ::std::option::Option::Some(DebugSwipeDirection::DOWN), - "LEFT" => ::std::option::Option::Some(DebugSwipeDirection::LEFT), - "RIGHT" => ::std::option::Option::Some(DebugSwipeDirection::RIGHT), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [DebugSwipeDirection] = &[ - DebugSwipeDirection::UP, - DebugSwipeDirection::DOWN, - DebugSwipeDirection::LEFT, - DebugSwipeDirection::RIGHT, - ]; - } - - impl ::protobuf::EnumFull for DebugSwipeDirection { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("DebugLinkDecision.DebugSwipeDirection").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for DebugSwipeDirection { - fn default() -> Self { - DebugSwipeDirection::UP - } - } - - impl DebugSwipeDirection { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DebugLinkDecision.DebugSwipeDirection") - } - } - - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.debug.DebugLinkDecision.DebugButton) - pub enum DebugButton { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugButton.NO) - NO = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugButton.YES) - YES = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugButton.INFO) - INFO = 2, - } - - impl ::protobuf::Enum for DebugButton { - const NAME: &'static str = "DebugButton"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(DebugButton::NO), - 1 => ::std::option::Option::Some(DebugButton::YES), - 2 => ::std::option::Option::Some(DebugButton::INFO), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "NO" => ::std::option::Option::Some(DebugButton::NO), - "YES" => ::std::option::Option::Some(DebugButton::YES), - "INFO" => ::std::option::Option::Some(DebugButton::INFO), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [DebugButton] = &[ - DebugButton::NO, - DebugButton::YES, - DebugButton::INFO, - ]; - } - - impl ::protobuf::EnumFull for DebugButton { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("DebugLinkDecision.DebugButton").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for DebugButton { - fn default() -> Self { - DebugButton::NO - } - } - - impl DebugButton { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DebugLinkDecision.DebugButton") - } - } - - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton) - pub enum DebugPhysicalButton { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton.LEFT_BTN) - LEFT_BTN = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton.MIDDLE_BTN) - MIDDLE_BTN = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugLinkDecision.DebugPhysicalButton.RIGHT_BTN) - RIGHT_BTN = 2, - } - - impl ::protobuf::Enum for DebugPhysicalButton { - const NAME: &'static str = "DebugPhysicalButton"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(DebugPhysicalButton::LEFT_BTN), - 1 => ::std::option::Option::Some(DebugPhysicalButton::MIDDLE_BTN), - 2 => ::std::option::Option::Some(DebugPhysicalButton::RIGHT_BTN), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "LEFT_BTN" => ::std::option::Option::Some(DebugPhysicalButton::LEFT_BTN), - "MIDDLE_BTN" => ::std::option::Option::Some(DebugPhysicalButton::MIDDLE_BTN), - "RIGHT_BTN" => ::std::option::Option::Some(DebugPhysicalButton::RIGHT_BTN), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [DebugPhysicalButton] = &[ - DebugPhysicalButton::LEFT_BTN, - DebugPhysicalButton::MIDDLE_BTN, - DebugPhysicalButton::RIGHT_BTN, - ]; - } - - impl ::protobuf::EnumFull for DebugPhysicalButton { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("DebugLinkDecision.DebugPhysicalButton").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for DebugPhysicalButton { - fn default() -> Self { - DebugPhysicalButton::LEFT_BTN - } - } - - impl DebugPhysicalButton { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("DebugLinkDecision.DebugPhysicalButton") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkLayout) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkLayout { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLayout.tokens) - pub tokens: ::std::vec::Vec<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkLayout.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkLayout { - fn default() -> &'a DebugLinkLayout { - ::default_instance() - } -} - -impl DebugLinkLayout { - pub fn new() -> DebugLinkLayout { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "tokens", - |m: &DebugLinkLayout| { &m.tokens }, - |m: &mut DebugLinkLayout| { &mut m.tokens }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkLayout", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkLayout { - const NAME: &'static str = "DebugLinkLayout"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.tokens.push(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.tokens { - my_size += ::protobuf::rt::string_size(1, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.tokens { - os.write_string(1, &v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkLayout { - DebugLinkLayout::new() - } - - fn clear(&mut self) { - self.tokens.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkLayout { - static instance: DebugLinkLayout = DebugLinkLayout { - tokens: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkLayout { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkLayout").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkLayout { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkLayout { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkReseedRandom) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkReseedRandom { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkReseedRandom.value) - pub value: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkReseedRandom.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkReseedRandom { - fn default() -> &'a DebugLinkReseedRandom { - ::default_instance() - } -} - -impl DebugLinkReseedRandom { - pub fn new() -> DebugLinkReseedRandom { - ::std::default::Default::default() - } - - // optional uint32 value = 1; - - pub fn value(&self) -> u32 { - self.value.unwrap_or(0) - } - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: u32) { - self.value = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "value", - |m: &DebugLinkReseedRandom| { &m.value }, - |m: &mut DebugLinkReseedRandom| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkReseedRandom", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkReseedRandom { - const NAME: &'static str = "DebugLinkReseedRandom"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.value = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.value { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.value { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkReseedRandom { - DebugLinkReseedRandom::new() - } - - fn clear(&mut self) { - self.value = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkReseedRandom { - static instance: DebugLinkReseedRandom = DebugLinkReseedRandom { - value: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkReseedRandom { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkReseedRandom").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkReseedRandom { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkReseedRandom { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkRecordScreen) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkRecordScreen { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkRecordScreen.target_directory) - pub target_directory: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkRecordScreen.refresh_index) - pub refresh_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkRecordScreen.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkRecordScreen { - fn default() -> &'a DebugLinkRecordScreen { - ::default_instance() - } -} - -impl DebugLinkRecordScreen { - pub fn new() -> DebugLinkRecordScreen { - ::std::default::Default::default() - } - - // optional string target_directory = 1; - - pub fn target_directory(&self) -> &str { - match self.target_directory.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_target_directory(&mut self) { - self.target_directory = ::std::option::Option::None; - } - - pub fn has_target_directory(&self) -> bool { - self.target_directory.is_some() - } - - // Param is passed by value, moved - pub fn set_target_directory(&mut self, v: ::std::string::String) { - self.target_directory = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_target_directory(&mut self) -> &mut ::std::string::String { - if self.target_directory.is_none() { - self.target_directory = ::std::option::Option::Some(::std::string::String::new()); - } - self.target_directory.as_mut().unwrap() - } - - // Take field - pub fn take_target_directory(&mut self) -> ::std::string::String { - self.target_directory.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 refresh_index = 2; - - pub fn refresh_index(&self) -> u32 { - self.refresh_index.unwrap_or(0u32) - } - - pub fn clear_refresh_index(&mut self) { - self.refresh_index = ::std::option::Option::None; - } - - pub fn has_refresh_index(&self) -> bool { - self.refresh_index.is_some() - } - - // Param is passed by value, moved - pub fn set_refresh_index(&mut self, v: u32) { - self.refresh_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "target_directory", - |m: &DebugLinkRecordScreen| { &m.target_directory }, - |m: &mut DebugLinkRecordScreen| { &mut m.target_directory }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "refresh_index", - |m: &DebugLinkRecordScreen| { &m.refresh_index }, - |m: &mut DebugLinkRecordScreen| { &mut m.refresh_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkRecordScreen", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkRecordScreen { - const NAME: &'static str = "DebugLinkRecordScreen"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.target_directory = ::std::option::Option::Some(is.read_string()?); - }, - 16 => { - self.refresh_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.target_directory.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.refresh_index { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.target_directory.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.refresh_index { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkRecordScreen { - DebugLinkRecordScreen::new() - } - - fn clear(&mut self) { - self.target_directory = ::std::option::Option::None; - self.refresh_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkRecordScreen { - static instance: DebugLinkRecordScreen = DebugLinkRecordScreen { - target_directory: ::std::option::Option::None, - refresh_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkRecordScreen { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkRecordScreen").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkRecordScreen { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkRecordScreen { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkGetState) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkGetState { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkGetState.wait_word_list) - pub wait_word_list: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkGetState.wait_word_pos) - pub wait_word_pos: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkGetState.wait_layout) - pub wait_layout: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkGetState.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkGetState { - fn default() -> &'a DebugLinkGetState { - ::default_instance() - } -} - -impl DebugLinkGetState { - pub fn new() -> DebugLinkGetState { - ::std::default::Default::default() - } - - // optional bool wait_word_list = 1; - - pub fn wait_word_list(&self) -> bool { - self.wait_word_list.unwrap_or(false) - } - - pub fn clear_wait_word_list(&mut self) { - self.wait_word_list = ::std::option::Option::None; - } - - pub fn has_wait_word_list(&self) -> bool { - self.wait_word_list.is_some() - } - - // Param is passed by value, moved - pub fn set_wait_word_list(&mut self, v: bool) { - self.wait_word_list = ::std::option::Option::Some(v); - } - - // optional bool wait_word_pos = 2; - - pub fn wait_word_pos(&self) -> bool { - self.wait_word_pos.unwrap_or(false) - } - - pub fn clear_wait_word_pos(&mut self) { - self.wait_word_pos = ::std::option::Option::None; - } - - pub fn has_wait_word_pos(&self) -> bool { - self.wait_word_pos.is_some() - } - - // Param is passed by value, moved - pub fn set_wait_word_pos(&mut self, v: bool) { - self.wait_word_pos = ::std::option::Option::Some(v); - } - - // optional bool wait_layout = 3; - - pub fn wait_layout(&self) -> bool { - self.wait_layout.unwrap_or(false) - } - - pub fn clear_wait_layout(&mut self) { - self.wait_layout = ::std::option::Option::None; - } - - pub fn has_wait_layout(&self) -> bool { - self.wait_layout.is_some() - } - - // Param is passed by value, moved - pub fn set_wait_layout(&mut self, v: bool) { - self.wait_layout = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "wait_word_list", - |m: &DebugLinkGetState| { &m.wait_word_list }, - |m: &mut DebugLinkGetState| { &mut m.wait_word_list }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "wait_word_pos", - |m: &DebugLinkGetState| { &m.wait_word_pos }, - |m: &mut DebugLinkGetState| { &mut m.wait_word_pos }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "wait_layout", - |m: &DebugLinkGetState| { &m.wait_layout }, - |m: &mut DebugLinkGetState| { &mut m.wait_layout }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkGetState", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkGetState { - const NAME: &'static str = "DebugLinkGetState"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.wait_word_list = ::std::option::Option::Some(is.read_bool()?); - }, - 16 => { - self.wait_word_pos = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.wait_layout = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.wait_word_list { - my_size += 1 + 1; - } - if let Some(v) = self.wait_word_pos { - my_size += 1 + 1; - } - if let Some(v) = self.wait_layout { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.wait_word_list { - os.write_bool(1, v)?; - } - if let Some(v) = self.wait_word_pos { - os.write_bool(2, v)?; - } - if let Some(v) = self.wait_layout { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkGetState { - DebugLinkGetState::new() - } - - fn clear(&mut self) { - self.wait_word_list = ::std::option::Option::None; - self.wait_word_pos = ::std::option::Option::None; - self.wait_layout = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkGetState { - static instance: DebugLinkGetState = DebugLinkGetState { - wait_word_list: ::std::option::Option::None, - wait_word_pos: ::std::option::Option::None, - wait_layout: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkGetState { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkGetState").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkGetState { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkGetState { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkState) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkState { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.layout) - pub layout: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.pin) - pub pin: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.matrix) - pub matrix: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.mnemonic_secret) - pub mnemonic_secret: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.node) - pub node: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.passphrase_protection) - pub passphrase_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.reset_word) - pub reset_word: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.reset_entropy) - pub reset_entropy: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.recovery_fake_word) - pub recovery_fake_word: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.recovery_word_pos) - pub recovery_word_pos: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.reset_word_pos) - pub reset_word_pos: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.mnemonic_type) - pub mnemonic_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkState.tokens) - pub tokens: ::std::vec::Vec<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkState.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkState { - fn default() -> &'a DebugLinkState { - ::default_instance() - } -} - -impl DebugLinkState { - pub fn new() -> DebugLinkState { - ::std::default::Default::default() - } - - // optional bytes layout = 1; - - pub fn layout(&self) -> &[u8] { - match self.layout.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_layout(&mut self) { - self.layout = ::std::option::Option::None; - } - - pub fn has_layout(&self) -> bool { - self.layout.is_some() - } - - // Param is passed by value, moved - pub fn set_layout(&mut self, v: ::std::vec::Vec) { - self.layout = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_layout(&mut self) -> &mut ::std::vec::Vec { - if self.layout.is_none() { - self.layout = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.layout.as_mut().unwrap() - } - - // Take field - pub fn take_layout(&mut self) -> ::std::vec::Vec { - self.layout.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string pin = 2; - - pub fn pin(&self) -> &str { - match self.pin.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_pin(&mut self) { - self.pin = ::std::option::Option::None; - } - - pub fn has_pin(&self) -> bool { - self.pin.is_some() - } - - // Param is passed by value, moved - pub fn set_pin(&mut self, v: ::std::string::String) { - self.pin = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pin(&mut self) -> &mut ::std::string::String { - if self.pin.is_none() { - self.pin = ::std::option::Option::Some(::std::string::String::new()); - } - self.pin.as_mut().unwrap() - } - - // Take field - pub fn take_pin(&mut self) -> ::std::string::String { - self.pin.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string matrix = 3; - - pub fn matrix(&self) -> &str { - match self.matrix.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_matrix(&mut self) { - self.matrix = ::std::option::Option::None; - } - - pub fn has_matrix(&self) -> bool { - self.matrix.is_some() - } - - // Param is passed by value, moved - pub fn set_matrix(&mut self, v: ::std::string::String) { - self.matrix = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_matrix(&mut self) -> &mut ::std::string::String { - if self.matrix.is_none() { - self.matrix = ::std::option::Option::Some(::std::string::String::new()); - } - self.matrix.as_mut().unwrap() - } - - // Take field - pub fn take_matrix(&mut self) -> ::std::string::String { - self.matrix.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bytes mnemonic_secret = 4; - - pub fn mnemonic_secret(&self) -> &[u8] { - match self.mnemonic_secret.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mnemonic_secret(&mut self) { - self.mnemonic_secret = ::std::option::Option::None; - } - - pub fn has_mnemonic_secret(&self) -> bool { - self.mnemonic_secret.is_some() - } - - // Param is passed by value, moved - pub fn set_mnemonic_secret(&mut self, v: ::std::vec::Vec) { - self.mnemonic_secret = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mnemonic_secret(&mut self) -> &mut ::std::vec::Vec { - if self.mnemonic_secret.is_none() { - self.mnemonic_secret = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mnemonic_secret.as_mut().unwrap() - } - - // Take field - pub fn take_mnemonic_secret(&mut self) -> ::std::vec::Vec { - self.mnemonic_secret.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool passphrase_protection = 6; - - pub fn passphrase_protection(&self) -> bool { - self.passphrase_protection.unwrap_or(false) - } - - pub fn clear_passphrase_protection(&mut self) { - self.passphrase_protection = ::std::option::Option::None; - } - - pub fn has_passphrase_protection(&self) -> bool { - self.passphrase_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase_protection(&mut self, v: bool) { - self.passphrase_protection = ::std::option::Option::Some(v); - } - - // optional string reset_word = 7; - - pub fn reset_word(&self) -> &str { - match self.reset_word.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_reset_word(&mut self) { - self.reset_word = ::std::option::Option::None; - } - - pub fn has_reset_word(&self) -> bool { - self.reset_word.is_some() - } - - // Param is passed by value, moved - pub fn set_reset_word(&mut self, v: ::std::string::String) { - self.reset_word = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_reset_word(&mut self) -> &mut ::std::string::String { - if self.reset_word.is_none() { - self.reset_word = ::std::option::Option::Some(::std::string::String::new()); - } - self.reset_word.as_mut().unwrap() - } - - // Take field - pub fn take_reset_word(&mut self) -> ::std::string::String { - self.reset_word.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bytes reset_entropy = 8; - - pub fn reset_entropy(&self) -> &[u8] { - match self.reset_entropy.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_reset_entropy(&mut self) { - self.reset_entropy = ::std::option::Option::None; - } - - pub fn has_reset_entropy(&self) -> bool { - self.reset_entropy.is_some() - } - - // Param is passed by value, moved - pub fn set_reset_entropy(&mut self, v: ::std::vec::Vec) { - self.reset_entropy = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_reset_entropy(&mut self) -> &mut ::std::vec::Vec { - if self.reset_entropy.is_none() { - self.reset_entropy = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.reset_entropy.as_mut().unwrap() - } - - // Take field - pub fn take_reset_entropy(&mut self) -> ::std::vec::Vec { - self.reset_entropy.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string recovery_fake_word = 9; - - pub fn recovery_fake_word(&self) -> &str { - match self.recovery_fake_word.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_recovery_fake_word(&mut self) { - self.recovery_fake_word = ::std::option::Option::None; - } - - pub fn has_recovery_fake_word(&self) -> bool { - self.recovery_fake_word.is_some() - } - - // Param is passed by value, moved - pub fn set_recovery_fake_word(&mut self, v: ::std::string::String) { - self.recovery_fake_word = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_recovery_fake_word(&mut self) -> &mut ::std::string::String { - if self.recovery_fake_word.is_none() { - self.recovery_fake_word = ::std::option::Option::Some(::std::string::String::new()); - } - self.recovery_fake_word.as_mut().unwrap() - } - - // Take field - pub fn take_recovery_fake_word(&mut self) -> ::std::string::String { - self.recovery_fake_word.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 recovery_word_pos = 10; - - pub fn recovery_word_pos(&self) -> u32 { - self.recovery_word_pos.unwrap_or(0) - } - - pub fn clear_recovery_word_pos(&mut self) { - self.recovery_word_pos = ::std::option::Option::None; - } - - pub fn has_recovery_word_pos(&self) -> bool { - self.recovery_word_pos.is_some() - } - - // Param is passed by value, moved - pub fn set_recovery_word_pos(&mut self, v: u32) { - self.recovery_word_pos = ::std::option::Option::Some(v); - } - - // optional uint32 reset_word_pos = 11; - - pub fn reset_word_pos(&self) -> u32 { - self.reset_word_pos.unwrap_or(0) - } - - pub fn clear_reset_word_pos(&mut self) { - self.reset_word_pos = ::std::option::Option::None; - } - - pub fn has_reset_word_pos(&self) -> bool { - self.reset_word_pos.is_some() - } - - // Param is passed by value, moved - pub fn set_reset_word_pos(&mut self, v: u32) { - self.reset_word_pos = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.management.BackupType mnemonic_type = 12; - - pub fn mnemonic_type(&self) -> super::messages_management::BackupType { - match self.mnemonic_type { - Some(e) => e.enum_value_or(super::messages_management::BackupType::Bip39), - None => super::messages_management::BackupType::Bip39, - } - } - - pub fn clear_mnemonic_type(&mut self) { - self.mnemonic_type = ::std::option::Option::None; - } - - pub fn has_mnemonic_type(&self) -> bool { - self.mnemonic_type.is_some() - } - - // Param is passed by value, moved - pub fn set_mnemonic_type(&mut self, v: super::messages_management::BackupType) { - self.mnemonic_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(13); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "layout", - |m: &DebugLinkState| { &m.layout }, - |m: &mut DebugLinkState| { &mut m.layout }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pin", - |m: &DebugLinkState| { &m.pin }, - |m: &mut DebugLinkState| { &mut m.pin }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "matrix", - |m: &DebugLinkState| { &m.matrix }, - |m: &mut DebugLinkState| { &mut m.matrix }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mnemonic_secret", - |m: &DebugLinkState| { &m.mnemonic_secret }, - |m: &mut DebugLinkState| { &mut m.mnemonic_secret }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( - "node", - |m: &DebugLinkState| { &m.node }, - |m: &mut DebugLinkState| { &mut m.node }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase_protection", - |m: &DebugLinkState| { &m.passphrase_protection }, - |m: &mut DebugLinkState| { &mut m.passphrase_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "reset_word", - |m: &DebugLinkState| { &m.reset_word }, - |m: &mut DebugLinkState| { &mut m.reset_word }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "reset_entropy", - |m: &DebugLinkState| { &m.reset_entropy }, - |m: &mut DebugLinkState| { &mut m.reset_entropy }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "recovery_fake_word", - |m: &DebugLinkState| { &m.recovery_fake_word }, - |m: &mut DebugLinkState| { &mut m.recovery_fake_word }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "recovery_word_pos", - |m: &DebugLinkState| { &m.recovery_word_pos }, - |m: &mut DebugLinkState| { &mut m.recovery_word_pos }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "reset_word_pos", - |m: &DebugLinkState| { &m.reset_word_pos }, - |m: &mut DebugLinkState| { &mut m.reset_word_pos }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mnemonic_type", - |m: &DebugLinkState| { &m.mnemonic_type }, - |m: &mut DebugLinkState| { &mut m.mnemonic_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "tokens", - |m: &DebugLinkState| { &m.tokens }, - |m: &mut DebugLinkState| { &mut m.tokens }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkState", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkState { - const NAME: &'static str = "DebugLinkState"; - - fn is_initialized(&self) -> bool { - for v in &self.node { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.layout = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.pin = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.matrix = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.mnemonic_secret = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; - }, - 48 => { - self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 58 => { - self.reset_word = ::std::option::Option::Some(is.read_string()?); - }, - 66 => { - self.reset_entropy = ::std::option::Option::Some(is.read_bytes()?); - }, - 74 => { - self.recovery_fake_word = ::std::option::Option::Some(is.read_string()?); - }, - 80 => { - self.recovery_word_pos = ::std::option::Option::Some(is.read_uint32()?); - }, - 88 => { - self.reset_word_pos = ::std::option::Option::Some(is.read_uint32()?); - }, - 96 => { - self.mnemonic_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 106 => { - self.tokens.push(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.layout.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.pin.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.matrix.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.mnemonic_secret.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.node.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.passphrase_protection { - my_size += 1 + 1; - } - if let Some(v) = self.reset_word.as_ref() { - my_size += ::protobuf::rt::string_size(7, &v); - } - if let Some(v) = self.reset_entropy.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - if let Some(v) = self.recovery_fake_word.as_ref() { - my_size += ::protobuf::rt::string_size(9, &v); - } - if let Some(v) = self.recovery_word_pos { - my_size += ::protobuf::rt::uint32_size(10, v); - } - if let Some(v) = self.reset_word_pos { - my_size += ::protobuf::rt::uint32_size(11, v); - } - if let Some(v) = self.mnemonic_type { - my_size += ::protobuf::rt::int32_size(12, v.value()); - } - for value in &self.tokens { - my_size += ::protobuf::rt::string_size(13, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.layout.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.pin.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.matrix.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.mnemonic_secret.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.node.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.passphrase_protection { - os.write_bool(6, v)?; - } - if let Some(v) = self.reset_word.as_ref() { - os.write_string(7, v)?; - } - if let Some(v) = self.reset_entropy.as_ref() { - os.write_bytes(8, v)?; - } - if let Some(v) = self.recovery_fake_word.as_ref() { - os.write_string(9, v)?; - } - if let Some(v) = self.recovery_word_pos { - os.write_uint32(10, v)?; - } - if let Some(v) = self.reset_word_pos { - os.write_uint32(11, v)?; - } - if let Some(v) = self.mnemonic_type { - os.write_enum(12, ::protobuf::EnumOrUnknown::value(&v))?; - } - for v in &self.tokens { - os.write_string(13, &v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkState { - DebugLinkState::new() - } - - fn clear(&mut self) { - self.layout = ::std::option::Option::None; - self.pin = ::std::option::Option::None; - self.matrix = ::std::option::Option::None; - self.mnemonic_secret = ::std::option::Option::None; - self.node.clear(); - self.passphrase_protection = ::std::option::Option::None; - self.reset_word = ::std::option::Option::None; - self.reset_entropy = ::std::option::Option::None; - self.recovery_fake_word = ::std::option::Option::None; - self.recovery_word_pos = ::std::option::Option::None; - self.reset_word_pos = ::std::option::Option::None; - self.mnemonic_type = ::std::option::Option::None; - self.tokens.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkState { - static instance: DebugLinkState = DebugLinkState { - layout: ::std::option::Option::None, - pin: ::std::option::Option::None, - matrix: ::std::option::Option::None, - mnemonic_secret: ::std::option::Option::None, - node: ::protobuf::MessageField::none(), - passphrase_protection: ::std::option::Option::None, - reset_word: ::std::option::Option::None, - reset_entropy: ::std::option::Option::None, - recovery_fake_word: ::std::option::Option::None, - recovery_word_pos: ::std::option::Option::None, - reset_word_pos: ::std::option::Option::None, - mnemonic_type: ::std::option::Option::None, - tokens: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkState { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkState").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkState { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkState { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkStop) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkStop { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkStop.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkStop { - fn default() -> &'a DebugLinkStop { - ::default_instance() - } -} - -impl DebugLinkStop { - pub fn new() -> DebugLinkStop { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkStop", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkStop { - const NAME: &'static str = "DebugLinkStop"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkStop { - DebugLinkStop::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkStop { - static instance: DebugLinkStop = DebugLinkStop { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkStop { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkStop").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkStop { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkStop { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkLog) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkLog { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLog.level) - pub level: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLog.bucket) - pub bucket: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkLog.text) - pub text: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkLog.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkLog { - fn default() -> &'a DebugLinkLog { - ::default_instance() - } -} - -impl DebugLinkLog { - pub fn new() -> DebugLinkLog { - ::std::default::Default::default() - } - - // optional uint32 level = 1; - - pub fn level(&self) -> u32 { - self.level.unwrap_or(0) - } - - pub fn clear_level(&mut self) { - self.level = ::std::option::Option::None; - } - - pub fn has_level(&self) -> bool { - self.level.is_some() - } - - // Param is passed by value, moved - pub fn set_level(&mut self, v: u32) { - self.level = ::std::option::Option::Some(v); - } - - // optional string bucket = 2; - - pub fn bucket(&self) -> &str { - match self.bucket.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_bucket(&mut self) { - self.bucket = ::std::option::Option::None; - } - - pub fn has_bucket(&self) -> bool { - self.bucket.is_some() - } - - // Param is passed by value, moved - pub fn set_bucket(&mut self, v: ::std::string::String) { - self.bucket = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_bucket(&mut self) -> &mut ::std::string::String { - if self.bucket.is_none() { - self.bucket = ::std::option::Option::Some(::std::string::String::new()); - } - self.bucket.as_mut().unwrap() - } - - // Take field - pub fn take_bucket(&mut self) -> ::std::string::String { - self.bucket.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string text = 3; - - pub fn text(&self) -> &str { - match self.text.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_text(&mut self) { - self.text = ::std::option::Option::None; - } - - pub fn has_text(&self) -> bool { - self.text.is_some() - } - - // Param is passed by value, moved - pub fn set_text(&mut self, v: ::std::string::String) { - self.text = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_text(&mut self) -> &mut ::std::string::String { - if self.text.is_none() { - self.text = ::std::option::Option::Some(::std::string::String::new()); - } - self.text.as_mut().unwrap() - } - - // Take field - pub fn take_text(&mut self) -> ::std::string::String { - self.text.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "level", - |m: &DebugLinkLog| { &m.level }, - |m: &mut DebugLinkLog| { &mut m.level }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bucket", - |m: &DebugLinkLog| { &m.bucket }, - |m: &mut DebugLinkLog| { &mut m.bucket }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "text", - |m: &DebugLinkLog| { &m.text }, - |m: &mut DebugLinkLog| { &mut m.text }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkLog", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkLog { - const NAME: &'static str = "DebugLinkLog"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.level = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.bucket = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.text = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.level { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.bucket.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.text.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.level { - os.write_uint32(1, v)?; - } - if let Some(v) = self.bucket.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.text.as_ref() { - os.write_string(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkLog { - DebugLinkLog::new() - } - - fn clear(&mut self) { - self.level = ::std::option::Option::None; - self.bucket = ::std::option::Option::None; - self.text = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkLog { - static instance: DebugLinkLog = DebugLinkLog { - level: ::std::option::Option::None, - bucket: ::std::option::Option::None, - text: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkLog { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkLog").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkLog { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkLog { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkMemoryRead) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkMemoryRead { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryRead.address) - pub address: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryRead.length) - pub length: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkMemoryRead.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkMemoryRead { - fn default() -> &'a DebugLinkMemoryRead { - ::default_instance() - } -} - -impl DebugLinkMemoryRead { - pub fn new() -> DebugLinkMemoryRead { - ::std::default::Default::default() - } - - // optional uint32 address = 1; - - pub fn address(&self) -> u32 { - self.address.unwrap_or(0) - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: u32) { - self.address = ::std::option::Option::Some(v); - } - - // optional uint32 length = 2; - - pub fn length(&self) -> u32 { - self.length.unwrap_or(0) - } - - pub fn clear_length(&mut self) { - self.length = ::std::option::Option::None; - } - - pub fn has_length(&self) -> bool { - self.length.is_some() - } - - // Param is passed by value, moved - pub fn set_length(&mut self, v: u32) { - self.length = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &DebugLinkMemoryRead| { &m.address }, - |m: &mut DebugLinkMemoryRead| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "length", - |m: &DebugLinkMemoryRead| { &m.length }, - |m: &mut DebugLinkMemoryRead| { &mut m.length }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkMemoryRead", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkMemoryRead { - const NAME: &'static str = "DebugLinkMemoryRead"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.address = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.length = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.length { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address { - os.write_uint32(1, v)?; - } - if let Some(v) = self.length { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkMemoryRead { - DebugLinkMemoryRead::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.length = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkMemoryRead { - static instance: DebugLinkMemoryRead = DebugLinkMemoryRead { - address: ::std::option::Option::None, - length: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkMemoryRead { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkMemoryRead").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkMemoryRead { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkMemoryRead { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkMemory) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkMemory { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemory.memory) - pub memory: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkMemory.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkMemory { - fn default() -> &'a DebugLinkMemory { - ::default_instance() - } -} - -impl DebugLinkMemory { - pub fn new() -> DebugLinkMemory { - ::std::default::Default::default() - } - - // optional bytes memory = 1; - - pub fn memory(&self) -> &[u8] { - match self.memory.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_memory(&mut self) { - self.memory = ::std::option::Option::None; - } - - pub fn has_memory(&self) -> bool { - self.memory.is_some() - } - - // Param is passed by value, moved - pub fn set_memory(&mut self, v: ::std::vec::Vec) { - self.memory = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_memory(&mut self) -> &mut ::std::vec::Vec { - if self.memory.is_none() { - self.memory = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.memory.as_mut().unwrap() - } - - // Take field - pub fn take_memory(&mut self) -> ::std::vec::Vec { - self.memory.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memory", - |m: &DebugLinkMemory| { &m.memory }, - |m: &mut DebugLinkMemory| { &mut m.memory }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkMemory", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkMemory { - const NAME: &'static str = "DebugLinkMemory"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.memory = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.memory.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.memory.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkMemory { - DebugLinkMemory::new() - } - - fn clear(&mut self) { - self.memory = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkMemory { - static instance: DebugLinkMemory = DebugLinkMemory { - memory: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkMemory { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkMemory").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkMemory { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkMemory { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkMemoryWrite) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkMemoryWrite { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryWrite.address) - pub address: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryWrite.memory) - pub memory: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkMemoryWrite.flash) - pub flash: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkMemoryWrite.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkMemoryWrite { - fn default() -> &'a DebugLinkMemoryWrite { - ::default_instance() - } -} - -impl DebugLinkMemoryWrite { - pub fn new() -> DebugLinkMemoryWrite { - ::std::default::Default::default() - } - - // optional uint32 address = 1; - - pub fn address(&self) -> u32 { - self.address.unwrap_or(0) - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: u32) { - self.address = ::std::option::Option::Some(v); - } - - // optional bytes memory = 2; - - pub fn memory(&self) -> &[u8] { - match self.memory.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_memory(&mut self) { - self.memory = ::std::option::Option::None; - } - - pub fn has_memory(&self) -> bool { - self.memory.is_some() - } - - // Param is passed by value, moved - pub fn set_memory(&mut self, v: ::std::vec::Vec) { - self.memory = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_memory(&mut self) -> &mut ::std::vec::Vec { - if self.memory.is_none() { - self.memory = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.memory.as_mut().unwrap() - } - - // Take field - pub fn take_memory(&mut self) -> ::std::vec::Vec { - self.memory.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool flash = 3; - - pub fn flash(&self) -> bool { - self.flash.unwrap_or(false) - } - - pub fn clear_flash(&mut self) { - self.flash = ::std::option::Option::None; - } - - pub fn has_flash(&self) -> bool { - self.flash.is_some() - } - - // Param is passed by value, moved - pub fn set_flash(&mut self, v: bool) { - self.flash = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &DebugLinkMemoryWrite| { &m.address }, - |m: &mut DebugLinkMemoryWrite| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memory", - |m: &DebugLinkMemoryWrite| { &m.memory }, - |m: &mut DebugLinkMemoryWrite| { &mut m.memory }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "flash", - |m: &DebugLinkMemoryWrite| { &m.flash }, - |m: &mut DebugLinkMemoryWrite| { &mut m.flash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkMemoryWrite", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkMemoryWrite { - const NAME: &'static str = "DebugLinkMemoryWrite"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.address = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.memory = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.flash = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.memory.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.flash { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address { - os.write_uint32(1, v)?; - } - if let Some(v) = self.memory.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.flash { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkMemoryWrite { - DebugLinkMemoryWrite::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.memory = ::std::option::Option::None; - self.flash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkMemoryWrite { - static instance: DebugLinkMemoryWrite = DebugLinkMemoryWrite { - address: ::std::option::Option::None, - memory: ::std::option::Option::None, - flash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkMemoryWrite { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkMemoryWrite").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkMemoryWrite { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkMemoryWrite { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkFlashErase) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkFlashErase { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashErase.sector) - pub sector: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkFlashErase.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkFlashErase { - fn default() -> &'a DebugLinkFlashErase { - ::default_instance() - } -} - -impl DebugLinkFlashErase { - pub fn new() -> DebugLinkFlashErase { - ::std::default::Default::default() - } - - // optional uint32 sector = 1; - - pub fn sector(&self) -> u32 { - self.sector.unwrap_or(0) - } - - pub fn clear_sector(&mut self) { - self.sector = ::std::option::Option::None; - } - - pub fn has_sector(&self) -> bool { - self.sector.is_some() - } - - // Param is passed by value, moved - pub fn set_sector(&mut self, v: u32) { - self.sector = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sector", - |m: &DebugLinkFlashErase| { &m.sector }, - |m: &mut DebugLinkFlashErase| { &mut m.sector }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkFlashErase", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkFlashErase { - const NAME: &'static str = "DebugLinkFlashErase"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.sector = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.sector { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.sector { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkFlashErase { - DebugLinkFlashErase::new() - } - - fn clear(&mut self) { - self.sector = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkFlashErase { - static instance: DebugLinkFlashErase = DebugLinkFlashErase { - sector: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkFlashErase { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkFlashErase").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkFlashErase { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkFlashErase { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkEraseSdCard) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkEraseSdCard { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkEraseSdCard.format) - pub format: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkEraseSdCard.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkEraseSdCard { - fn default() -> &'a DebugLinkEraseSdCard { - ::default_instance() - } -} - -impl DebugLinkEraseSdCard { - pub fn new() -> DebugLinkEraseSdCard { - ::std::default::Default::default() - } - - // optional bool format = 1; - - pub fn format(&self) -> bool { - self.format.unwrap_or(false) - } - - pub fn clear_format(&mut self) { - self.format = ::std::option::Option::None; - } - - pub fn has_format(&self) -> bool { - self.format.is_some() - } - - // Param is passed by value, moved - pub fn set_format(&mut self, v: bool) { - self.format = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "format", - |m: &DebugLinkEraseSdCard| { &m.format }, - |m: &mut DebugLinkEraseSdCard| { &mut m.format }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkEraseSdCard", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkEraseSdCard { - const NAME: &'static str = "DebugLinkEraseSdCard"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.format = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.format { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.format { - os.write_bool(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkEraseSdCard { - DebugLinkEraseSdCard::new() - } - - fn clear(&mut self) { - self.format = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkEraseSdCard { - static instance: DebugLinkEraseSdCard = DebugLinkEraseSdCard { - format: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkEraseSdCard { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkEraseSdCard").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkEraseSdCard { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkEraseSdCard { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkWatchLayout) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkWatchLayout { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkWatchLayout.watch) - pub watch: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkWatchLayout.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkWatchLayout { - fn default() -> &'a DebugLinkWatchLayout { - ::default_instance() - } -} - -impl DebugLinkWatchLayout { - pub fn new() -> DebugLinkWatchLayout { - ::std::default::Default::default() - } - - // optional bool watch = 1; - - pub fn watch(&self) -> bool { - self.watch.unwrap_or(false) - } - - pub fn clear_watch(&mut self) { - self.watch = ::std::option::Option::None; - } - - pub fn has_watch(&self) -> bool { - self.watch.is_some() - } - - // Param is passed by value, moved - pub fn set_watch(&mut self, v: bool) { - self.watch = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "watch", - |m: &DebugLinkWatchLayout| { &m.watch }, - |m: &mut DebugLinkWatchLayout| { &mut m.watch }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkWatchLayout", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkWatchLayout { - const NAME: &'static str = "DebugLinkWatchLayout"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.watch = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.watch { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.watch { - os.write_bool(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkWatchLayout { - DebugLinkWatchLayout::new() - } - - fn clear(&mut self) { - self.watch = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkWatchLayout { - static instance: DebugLinkWatchLayout = DebugLinkWatchLayout { - watch: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkWatchLayout { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkWatchLayout").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkWatchLayout { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkWatchLayout { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugLinkResetDebugEvents) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugLinkResetDebugEvents { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugLinkResetDebugEvents.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugLinkResetDebugEvents { - fn default() -> &'a DebugLinkResetDebugEvents { - ::default_instance() - } -} - -impl DebugLinkResetDebugEvents { - pub fn new() -> DebugLinkResetDebugEvents { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugLinkResetDebugEvents", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugLinkResetDebugEvents { - const NAME: &'static str = "DebugLinkResetDebugEvents"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugLinkResetDebugEvents { - DebugLinkResetDebugEvents::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugLinkResetDebugEvents { - static instance: DebugLinkResetDebugEvents = DebugLinkResetDebugEvents { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugLinkResetDebugEvents { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugLinkResetDebugEvents").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugLinkResetDebugEvents { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugLinkResetDebugEvents { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x14messages-debug.proto\x12\x18hw.trezor.messages.debug\x1a\x0emessag\ - es.proto\x1a\x15messages-common.proto\x1a\x19messages-management.proto\"\ - \xb0\x04\n\x11DebugLinkDecision\x12O\n\x06button\x18\x01\x20\x01(\x0e27.\ - hw.trezor.messages.debug.DebugLinkDecision.DebugButtonR\x06button\x12U\n\ - \x05swipe\x18\x02\x20\x01(\x0e2?.hw.trezor.messages.debug.DebugLinkDecis\ - ion.DebugSwipeDirectionR\x05swipe\x12\x14\n\x05input\x18\x03\x20\x01(\tR\ - \x05input\x12\x0c\n\x01x\x18\x04\x20\x01(\rR\x01x\x12\x0c\n\x01y\x18\x05\ - \x20\x01(\rR\x01y\x12\x12\n\x04wait\x18\x06\x20\x01(\x08R\x04wait\x12\ - \x17\n\x07hold_ms\x18\x07\x20\x01(\rR\x06holdMs\x12h\n\x0fphysical_butto\ - n\x18\x08\x20\x01(\x0e2?.hw.trezor.messages.debug.DebugLinkDecision.Debu\ - gPhysicalButtonR\x0ephysicalButton\"<\n\x13DebugSwipeDirection\x12\x06\n\ - \x02UP\x10\0\x12\x08\n\x04DOWN\x10\x01\x12\x08\n\x04LEFT\x10\x02\x12\t\n\ - \x05RIGHT\x10\x03\"(\n\x0bDebugButton\x12\x06\n\x02NO\x10\0\x12\x07\n\ - \x03YES\x10\x01\x12\x08\n\x04INFO\x10\x02\"B\n\x13DebugPhysicalButton\ - \x12\x0c\n\x08LEFT_BTN\x10\0\x12\x0e\n\nMIDDLE_BTN\x10\x01\x12\r\n\tRIGH\ - T_BTN\x10\x02\")\n\x0fDebugLinkLayout\x12\x16\n\x06tokens\x18\x01\x20\ - \x03(\tR\x06tokens\"-\n\x15DebugLinkReseedRandom\x12\x14\n\x05value\x18\ - \x01\x20\x01(\rR\x05value\"j\n\x15DebugLinkRecordScreen\x12)\n\x10target\ - _directory\x18\x01\x20\x01(\tR\x0ftargetDirectory\x12&\n\rrefresh_index\ - \x18\x02\x20\x01(\r:\x010R\x0crefreshIndex\"~\n\x11DebugLinkGetState\x12\ - $\n\x0ewait_word_list\x18\x01\x20\x01(\x08R\x0cwaitWordList\x12\"\n\rwai\ - t_word_pos\x18\x02\x20\x01(\x08R\x0bwaitWordPos\x12\x1f\n\x0bwait_layout\ - \x18\x03\x20\x01(\x08R\nwaitLayout\"\x97\x04\n\x0eDebugLinkState\x12\x16\ - \n\x06layout\x18\x01\x20\x01(\x0cR\x06layout\x12\x10\n\x03pin\x18\x02\ - \x20\x01(\tR\x03pin\x12\x16\n\x06matrix\x18\x03\x20\x01(\tR\x06matrix\ - \x12'\n\x0fmnemonic_secret\x18\x04\x20\x01(\x0cR\x0emnemonicSecret\x129\ - \n\x04node\x18\x05\x20\x01(\x0b2%.hw.trezor.messages.common.HDNodeTypeR\ - \x04node\x123\n\x15passphrase_protection\x18\x06\x20\x01(\x08R\x14passph\ - raseProtection\x12\x1d\n\nreset_word\x18\x07\x20\x01(\tR\tresetWord\x12#\ - \n\rreset_entropy\x18\x08\x20\x01(\x0cR\x0cresetEntropy\x12,\n\x12recove\ - ry_fake_word\x18\t\x20\x01(\tR\x10recoveryFakeWord\x12*\n\x11recovery_wo\ - rd_pos\x18\n\x20\x01(\rR\x0frecoveryWordPos\x12$\n\x0ereset_word_pos\x18\ - \x0b\x20\x01(\rR\x0cresetWordPos\x12N\n\rmnemonic_type\x18\x0c\x20\x01(\ - \x0e2).hw.trezor.messages.management.BackupTypeR\x0cmnemonicType\x12\x16\ - \n\x06tokens\x18\r\x20\x03(\tR\x06tokens\"\x0f\n\rDebugLinkStop\"P\n\x0c\ - DebugLinkLog\x12\x14\n\x05level\x18\x01\x20\x01(\rR\x05level\x12\x16\n\ - \x06bucket\x18\x02\x20\x01(\tR\x06bucket\x12\x12\n\x04text\x18\x03\x20\ - \x01(\tR\x04text\"G\n\x13DebugLinkMemoryRead\x12\x18\n\x07address\x18\ - \x01\x20\x01(\rR\x07address\x12\x16\n\x06length\x18\x02\x20\x01(\rR\x06l\ - ength\")\n\x0fDebugLinkMemory\x12\x16\n\x06memory\x18\x01\x20\x01(\x0cR\ - \x06memory\"^\n\x14DebugLinkMemoryWrite\x12\x18\n\x07address\x18\x01\x20\ - \x01(\rR\x07address\x12\x16\n\x06memory\x18\x02\x20\x01(\x0cR\x06memory\ - \x12\x14\n\x05flash\x18\x03\x20\x01(\x08R\x05flash\"-\n\x13DebugLinkFlas\ - hErase\x12\x16\n\x06sector\x18\x01\x20\x01(\rR\x06sector\".\n\x14DebugLi\ - nkEraseSdCard\x12\x16\n\x06format\x18\x01\x20\x01(\x08R\x06format\",\n\ - \x14DebugLinkWatchLayout\x12\x14\n\x05watch\x18\x01\x20\x01(\x08R\x05wat\ - ch\"\x1b\n\x19DebugLinkResetDebugEventsB=\n#com.satoshilabs.trezor.lib.p\ - rotobufB\x12TrezorMessageDebug\x80\xa6\x1d\x01\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(3); - deps.push(super::messages::file_descriptor().clone()); - deps.push(super::messages_common::file_descriptor().clone()); - deps.push(super::messages_management::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(15); - messages.push(DebugLinkDecision::generated_message_descriptor_data()); - messages.push(DebugLinkLayout::generated_message_descriptor_data()); - messages.push(DebugLinkReseedRandom::generated_message_descriptor_data()); - messages.push(DebugLinkRecordScreen::generated_message_descriptor_data()); - messages.push(DebugLinkGetState::generated_message_descriptor_data()); - messages.push(DebugLinkState::generated_message_descriptor_data()); - messages.push(DebugLinkStop::generated_message_descriptor_data()); - messages.push(DebugLinkLog::generated_message_descriptor_data()); - messages.push(DebugLinkMemoryRead::generated_message_descriptor_data()); - messages.push(DebugLinkMemory::generated_message_descriptor_data()); - messages.push(DebugLinkMemoryWrite::generated_message_descriptor_data()); - messages.push(DebugLinkFlashErase::generated_message_descriptor_data()); - messages.push(DebugLinkEraseSdCard::generated_message_descriptor_data()); - messages.push(DebugLinkWatchLayout::generated_message_descriptor_data()); - messages.push(DebugLinkResetDebugEvents::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(3); - enums.push(debug_link_decision::DebugSwipeDirection::generated_enum_descriptor_data()); - enums.push(debug_link_decision::DebugButton::generated_enum_descriptor_data()); - enums.push(debug_link_decision::DebugPhysicalButton::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_eos.rs b/wallet/trezor-client/src/protos/generated/messages_eos.rs deleted file mode 100644 index 15a989f143..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_eos.rs +++ /dev/null @@ -1,6536 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-eos.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosGetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EosGetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosGetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosGetPublicKey.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosGetPublicKey.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosGetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EosGetPublicKey { - fn default() -> &'a EosGetPublicKey { - ::default_instance() - } -} - -impl EosGetPublicKey { - pub fn new() -> EosGetPublicKey { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EosGetPublicKey| { &m.address_n }, - |m: &mut EosGetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &EosGetPublicKey| { &m.show_display }, - |m: &mut EosGetPublicKey| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &EosGetPublicKey| { &m.chunkify }, - |m: &mut EosGetPublicKey| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosGetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EosGetPublicKey { - const NAME: &'static str = "EosGetPublicKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosGetPublicKey { - EosGetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosGetPublicKey { - static instance: EosGetPublicKey = EosGetPublicKey { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EosGetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EosGetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EosGetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EosGetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EosPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosPublicKey.wif_public_key) - pub wif_public_key: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosPublicKey.raw_public_key) - pub raw_public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EosPublicKey { - fn default() -> &'a EosPublicKey { - ::default_instance() - } -} - -impl EosPublicKey { - pub fn new() -> EosPublicKey { - ::std::default::Default::default() - } - - // required string wif_public_key = 1; - - pub fn wif_public_key(&self) -> &str { - match self.wif_public_key.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_wif_public_key(&mut self) { - self.wif_public_key = ::std::option::Option::None; - } - - pub fn has_wif_public_key(&self) -> bool { - self.wif_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_wif_public_key(&mut self, v: ::std::string::String) { - self.wif_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_wif_public_key(&mut self) -> &mut ::std::string::String { - if self.wif_public_key.is_none() { - self.wif_public_key = ::std::option::Option::Some(::std::string::String::new()); - } - self.wif_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_wif_public_key(&mut self) -> ::std::string::String { - self.wif_public_key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes raw_public_key = 2; - - pub fn raw_public_key(&self) -> &[u8] { - match self.raw_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_raw_public_key(&mut self) { - self.raw_public_key = ::std::option::Option::None; - } - - pub fn has_raw_public_key(&self) -> bool { - self.raw_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_raw_public_key(&mut self, v: ::std::vec::Vec) { - self.raw_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_raw_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.raw_public_key.is_none() { - self.raw_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.raw_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_raw_public_key(&mut self) -> ::std::vec::Vec { - self.raw_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "wif_public_key", - |m: &EosPublicKey| { &m.wif_public_key }, - |m: &mut EosPublicKey| { &mut m.wif_public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "raw_public_key", - |m: &EosPublicKey| { &m.raw_public_key }, - |m: &mut EosPublicKey| { &mut m.raw_public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EosPublicKey { - const NAME: &'static str = "EosPublicKey"; - - fn is_initialized(&self) -> bool { - if self.wif_public_key.is_none() { - return false; - } - if self.raw_public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.wif_public_key = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.raw_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.wif_public_key.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.raw_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.wif_public_key.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.raw_public_key.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosPublicKey { - EosPublicKey::new() - } - - fn clear(&mut self) { - self.wif_public_key = ::std::option::Option::None; - self.raw_public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosPublicKey { - static instance: EosPublicKey = EosPublicKey { - wif_public_key: ::std::option::Option::None, - raw_public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EosPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EosPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EosPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EosPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EosSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.chain_id) - pub chain_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.header) - pub header: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.num_actions) - pub num_actions: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EosSignTx { - fn default() -> &'a EosSignTx { - ::default_instance() - } -} - -impl EosSignTx { - pub fn new() -> EosSignTx { - ::std::default::Default::default() - } - - // required bytes chain_id = 2; - - pub fn chain_id(&self) -> &[u8] { - match self.chain_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_chain_id(&mut self) { - self.chain_id = ::std::option::Option::None; - } - - pub fn has_chain_id(&self) -> bool { - self.chain_id.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_id(&mut self, v: ::std::vec::Vec) { - self.chain_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_chain_id(&mut self) -> &mut ::std::vec::Vec { - if self.chain_id.is_none() { - self.chain_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.chain_id.as_mut().unwrap() - } - - // Take field - pub fn take_chain_id(&mut self) -> ::std::vec::Vec { - self.chain_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 num_actions = 4; - - pub fn num_actions(&self) -> u32 { - self.num_actions.unwrap_or(0) - } - - pub fn clear_num_actions(&mut self) { - self.num_actions = ::std::option::Option::None; - } - - pub fn has_num_actions(&self) -> bool { - self.num_actions.is_some() - } - - // Param is passed by value, moved - pub fn set_num_actions(&mut self, v: u32) { - self.num_actions = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 5; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EosSignTx| { &m.address_n }, - |m: &mut EosSignTx| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_id", - |m: &EosSignTx| { &m.chain_id }, - |m: &mut EosSignTx| { &mut m.chain_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_sign_tx::EosTxHeader>( - "header", - |m: &EosSignTx| { &m.header }, - |m: &mut EosSignTx| { &mut m.header }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "num_actions", - |m: &EosSignTx| { &m.num_actions }, - |m: &mut EosSignTx| { &mut m.num_actions }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &EosSignTx| { &m.chunkify }, - |m: &mut EosSignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EosSignTx { - const NAME: &'static str = "EosSignTx"; - - fn is_initialized(&self) -> bool { - if self.chain_id.is_none() { - return false; - } - if self.header.is_none() { - return false; - } - if self.num_actions.is_none() { - return false; - } - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.chain_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.header)?; - }, - 32 => { - self.num_actions = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.chain_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.num_actions { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.chain_id.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.header.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.num_actions { - os.write_uint32(4, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosSignTx { - EosSignTx::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.chain_id = ::std::option::Option::None; - self.header.clear(); - self.num_actions = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosSignTx { - static instance: EosSignTx = EosSignTx { - address_n: ::std::vec::Vec::new(), - chain_id: ::std::option::Option::None, - header: ::protobuf::MessageField::none(), - num_actions: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EosSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EosSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EosSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EosSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `EosSignTx` -pub mod eos_sign_tx { - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosSignTx.EosTxHeader) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosTxHeader { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.expiration) - pub expiration: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.ref_block_num) - pub ref_block_num: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.ref_block_prefix) - pub ref_block_prefix: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.max_net_usage_words) - pub max_net_usage_words: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.max_cpu_usage_ms) - pub max_cpu_usage_ms: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.delay_sec) - pub delay_sec: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosSignTx.EosTxHeader.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosTxHeader { - fn default() -> &'a EosTxHeader { - ::default_instance() - } - } - - impl EosTxHeader { - pub fn new() -> EosTxHeader { - ::std::default::Default::default() - } - - // required uint32 expiration = 1; - - pub fn expiration(&self) -> u32 { - self.expiration.unwrap_or(0) - } - - pub fn clear_expiration(&mut self) { - self.expiration = ::std::option::Option::None; - } - - pub fn has_expiration(&self) -> bool { - self.expiration.is_some() - } - - // Param is passed by value, moved - pub fn set_expiration(&mut self, v: u32) { - self.expiration = ::std::option::Option::Some(v); - } - - // required uint32 ref_block_num = 2; - - pub fn ref_block_num(&self) -> u32 { - self.ref_block_num.unwrap_or(0) - } - - pub fn clear_ref_block_num(&mut self) { - self.ref_block_num = ::std::option::Option::None; - } - - pub fn has_ref_block_num(&self) -> bool { - self.ref_block_num.is_some() - } - - // Param is passed by value, moved - pub fn set_ref_block_num(&mut self, v: u32) { - self.ref_block_num = ::std::option::Option::Some(v); - } - - // required uint32 ref_block_prefix = 3; - - pub fn ref_block_prefix(&self) -> u32 { - self.ref_block_prefix.unwrap_or(0) - } - - pub fn clear_ref_block_prefix(&mut self) { - self.ref_block_prefix = ::std::option::Option::None; - } - - pub fn has_ref_block_prefix(&self) -> bool { - self.ref_block_prefix.is_some() - } - - // Param is passed by value, moved - pub fn set_ref_block_prefix(&mut self, v: u32) { - self.ref_block_prefix = ::std::option::Option::Some(v); - } - - // required uint32 max_net_usage_words = 4; - - pub fn max_net_usage_words(&self) -> u32 { - self.max_net_usage_words.unwrap_or(0) - } - - pub fn clear_max_net_usage_words(&mut self) { - self.max_net_usage_words = ::std::option::Option::None; - } - - pub fn has_max_net_usage_words(&self) -> bool { - self.max_net_usage_words.is_some() - } - - // Param is passed by value, moved - pub fn set_max_net_usage_words(&mut self, v: u32) { - self.max_net_usage_words = ::std::option::Option::Some(v); - } - - // required uint32 max_cpu_usage_ms = 5; - - pub fn max_cpu_usage_ms(&self) -> u32 { - self.max_cpu_usage_ms.unwrap_or(0) - } - - pub fn clear_max_cpu_usage_ms(&mut self) { - self.max_cpu_usage_ms = ::std::option::Option::None; - } - - pub fn has_max_cpu_usage_ms(&self) -> bool { - self.max_cpu_usage_ms.is_some() - } - - // Param is passed by value, moved - pub fn set_max_cpu_usage_ms(&mut self, v: u32) { - self.max_cpu_usage_ms = ::std::option::Option::Some(v); - } - - // required uint32 delay_sec = 6; - - pub fn delay_sec(&self) -> u32 { - self.delay_sec.unwrap_or(0) - } - - pub fn clear_delay_sec(&mut self) { - self.delay_sec = ::std::option::Option::None; - } - - pub fn has_delay_sec(&self) -> bool { - self.delay_sec.is_some() - } - - // Param is passed by value, moved - pub fn set_delay_sec(&mut self, v: u32) { - self.delay_sec = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "expiration", - |m: &EosTxHeader| { &m.expiration }, - |m: &mut EosTxHeader| { &mut m.expiration }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ref_block_num", - |m: &EosTxHeader| { &m.ref_block_num }, - |m: &mut EosTxHeader| { &mut m.ref_block_num }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ref_block_prefix", - |m: &EosTxHeader| { &m.ref_block_prefix }, - |m: &mut EosTxHeader| { &mut m.ref_block_prefix }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "max_net_usage_words", - |m: &EosTxHeader| { &m.max_net_usage_words }, - |m: &mut EosTxHeader| { &mut m.max_net_usage_words }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "max_cpu_usage_ms", - |m: &EosTxHeader| { &m.max_cpu_usage_ms }, - |m: &mut EosTxHeader| { &mut m.max_cpu_usage_ms }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "delay_sec", - |m: &EosTxHeader| { &m.delay_sec }, - |m: &mut EosTxHeader| { &mut m.delay_sec }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosSignTx.EosTxHeader", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosTxHeader { - const NAME: &'static str = "EosTxHeader"; - - fn is_initialized(&self) -> bool { - if self.expiration.is_none() { - return false; - } - if self.ref_block_num.is_none() { - return false; - } - if self.ref_block_prefix.is_none() { - return false; - } - if self.max_net_usage_words.is_none() { - return false; - } - if self.max_cpu_usage_ms.is_none() { - return false; - } - if self.delay_sec.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.expiration = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.ref_block_num = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.ref_block_prefix = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.max_net_usage_words = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.max_cpu_usage_ms = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.delay_sec = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.expiration { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.ref_block_num { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.ref_block_prefix { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.max_net_usage_words { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.max_cpu_usage_ms { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.delay_sec { - my_size += ::protobuf::rt::uint32_size(6, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.expiration { - os.write_uint32(1, v)?; - } - if let Some(v) = self.ref_block_num { - os.write_uint32(2, v)?; - } - if let Some(v) = self.ref_block_prefix { - os.write_uint32(3, v)?; - } - if let Some(v) = self.max_net_usage_words { - os.write_uint32(4, v)?; - } - if let Some(v) = self.max_cpu_usage_ms { - os.write_uint32(5, v)?; - } - if let Some(v) = self.delay_sec { - os.write_uint32(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosTxHeader { - EosTxHeader::new() - } - - fn clear(&mut self) { - self.expiration = ::std::option::Option::None; - self.ref_block_num = ::std::option::Option::None; - self.ref_block_prefix = ::std::option::Option::None; - self.max_net_usage_words = ::std::option::Option::None; - self.max_cpu_usage_ms = ::std::option::Option::None; - self.delay_sec = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosTxHeader { - static instance: EosTxHeader = EosTxHeader { - expiration: ::std::option::Option::None, - ref_block_num: ::std::option::Option::None, - ref_block_prefix: ::std::option::Option::None, - max_net_usage_words: ::std::option::Option::None, - max_cpu_usage_ms: ::std::option::Option::None, - delay_sec: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosTxHeader { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosSignTx.EosTxHeader").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosTxHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosTxHeader { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EosTxActionRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionRequest.data_size) - pub data_size: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EosTxActionRequest { - fn default() -> &'a EosTxActionRequest { - ::default_instance() - } -} - -impl EosTxActionRequest { - pub fn new() -> EosTxActionRequest { - ::std::default::Default::default() - } - - // optional uint32 data_size = 1; - - pub fn data_size(&self) -> u32 { - self.data_size.unwrap_or(0) - } - - pub fn clear_data_size(&mut self) { - self.data_size = ::std::option::Option::None; - } - - pub fn has_data_size(&self) -> bool { - self.data_size.is_some() - } - - // Param is passed by value, moved - pub fn set_data_size(&mut self, v: u32) { - self.data_size = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_size", - |m: &EosTxActionRequest| { &m.data_size }, - |m: &mut EosTxActionRequest| { &mut m.data_size }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EosTxActionRequest { - const NAME: &'static str = "EosTxActionRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.data_size = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_size { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_size { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosTxActionRequest { - EosTxActionRequest::new() - } - - fn clear(&mut self) { - self.data_size = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosTxActionRequest { - static instance: EosTxActionRequest = EosTxActionRequest { - data_size: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EosTxActionRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EosTxActionRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EosTxActionRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EosTxActionRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EosTxActionAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.common) - pub common: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.transfer) - pub transfer: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.delegate) - pub delegate: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.undelegate) - pub undelegate: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.refund) - pub refund: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.buy_ram) - pub buy_ram: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.buy_ram_bytes) - pub buy_ram_bytes: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.sell_ram) - pub sell_ram: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.vote_producer) - pub vote_producer: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.update_auth) - pub update_auth: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.delete_auth) - pub delete_auth: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.link_auth) - pub link_auth: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.unlink_auth) - pub unlink_auth: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.new_account) - pub new_account: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.unknown) - pub unknown: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EosTxActionAck { - fn default() -> &'a EosTxActionAck { - ::default_instance() - } -} - -impl EosTxActionAck { - pub fn new() -> EosTxActionAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(15); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionCommon>( - "common", - |m: &EosTxActionAck| { &m.common }, - |m: &mut EosTxActionAck| { &mut m.common }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionTransfer>( - "transfer", - |m: &EosTxActionAck| { &m.transfer }, - |m: &mut EosTxActionAck| { &mut m.transfer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionDelegate>( - "delegate", - |m: &EosTxActionAck| { &m.delegate }, - |m: &mut EosTxActionAck| { &mut m.delegate }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUndelegate>( - "undelegate", - |m: &EosTxActionAck| { &m.undelegate }, - |m: &mut EosTxActionAck| { &mut m.undelegate }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionRefund>( - "refund", - |m: &EosTxActionAck| { &m.refund }, - |m: &mut EosTxActionAck| { &mut m.refund }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionBuyRam>( - "buy_ram", - |m: &EosTxActionAck| { &m.buy_ram }, - |m: &mut EosTxActionAck| { &mut m.buy_ram }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionBuyRamBytes>( - "buy_ram_bytes", - |m: &EosTxActionAck| { &m.buy_ram_bytes }, - |m: &mut EosTxActionAck| { &mut m.buy_ram_bytes }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionSellRam>( - "sell_ram", - |m: &EosTxActionAck| { &m.sell_ram }, - |m: &mut EosTxActionAck| { &mut m.sell_ram }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionVoteProducer>( - "vote_producer", - |m: &EosTxActionAck| { &m.vote_producer }, - |m: &mut EosTxActionAck| { &mut m.vote_producer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUpdateAuth>( - "update_auth", - |m: &EosTxActionAck| { &m.update_auth }, - |m: &mut EosTxActionAck| { &mut m.update_auth }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionDeleteAuth>( - "delete_auth", - |m: &EosTxActionAck| { &m.delete_auth }, - |m: &mut EosTxActionAck| { &mut m.delete_auth }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionLinkAuth>( - "link_auth", - |m: &EosTxActionAck| { &m.link_auth }, - |m: &mut EosTxActionAck| { &mut m.link_auth }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUnlinkAuth>( - "unlink_auth", - |m: &EosTxActionAck| { &m.unlink_auth }, - |m: &mut EosTxActionAck| { &mut m.unlink_auth }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionNewAccount>( - "new_account", - |m: &EosTxActionAck| { &m.new_account }, - |m: &mut EosTxActionAck| { &mut m.new_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, eos_tx_action_ack::EosActionUnknown>( - "unknown", - |m: &EosTxActionAck| { &m.unknown }, - |m: &mut EosTxActionAck| { &mut m.unknown }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EosTxActionAck { - const NAME: &'static str = "EosTxActionAck"; - - fn is_initialized(&self) -> bool { - if self.common.is_none() { - return false; - } - for v in &self.common { - if !v.is_initialized() { - return false; - } - }; - for v in &self.transfer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delegate { - if !v.is_initialized() { - return false; - } - }; - for v in &self.undelegate { - if !v.is_initialized() { - return false; - } - }; - for v in &self.refund { - if !v.is_initialized() { - return false; - } - }; - for v in &self.buy_ram { - if !v.is_initialized() { - return false; - } - }; - for v in &self.buy_ram_bytes { - if !v.is_initialized() { - return false; - } - }; - for v in &self.sell_ram { - if !v.is_initialized() { - return false; - } - }; - for v in &self.vote_producer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.update_auth { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delete_auth { - if !v.is_initialized() { - return false; - } - }; - for v in &self.link_auth { - if !v.is_initialized() { - return false; - } - }; - for v in &self.unlink_auth { - if !v.is_initialized() { - return false; - } - }; - for v in &self.new_account { - if !v.is_initialized() { - return false; - } - }; - for v in &self.unknown { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.common)?; - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.delegate)?; - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.undelegate)?; - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.refund)?; - }, - 50 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.buy_ram)?; - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.buy_ram_bytes)?; - }, - 66 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.sell_ram)?; - }, - 74 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.vote_producer)?; - }, - 82 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.update_auth)?; - }, - 90 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.delete_auth)?; - }, - 98 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.link_auth)?; - }, - 106 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.unlink_auth)?; - }, - 114 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.new_account)?; - }, - 122 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.unknown)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.common.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.transfer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.delegate.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.undelegate.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.refund.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.buy_ram.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.buy_ram_bytes.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.sell_ram.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.vote_producer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.update_auth.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.delete_auth.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.link_auth.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.unlink_auth.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.new_account.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.unknown.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.common.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.transfer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.delegate.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.undelegate.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.refund.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.buy_ram.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - } - if let Some(v) = self.buy_ram_bytes.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.sell_ram.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; - } - if let Some(v) = self.vote_producer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; - } - if let Some(v) = self.update_auth.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; - } - if let Some(v) = self.delete_auth.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; - } - if let Some(v) = self.link_auth.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; - } - if let Some(v) = self.unlink_auth.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(13, v, os)?; - } - if let Some(v) = self.new_account.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(14, v, os)?; - } - if let Some(v) = self.unknown.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(15, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosTxActionAck { - EosTxActionAck::new() - } - - fn clear(&mut self) { - self.common.clear(); - self.transfer.clear(); - self.delegate.clear(); - self.undelegate.clear(); - self.refund.clear(); - self.buy_ram.clear(); - self.buy_ram_bytes.clear(); - self.sell_ram.clear(); - self.vote_producer.clear(); - self.update_auth.clear(); - self.delete_auth.clear(); - self.link_auth.clear(); - self.unlink_auth.clear(); - self.new_account.clear(); - self.unknown.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosTxActionAck { - static instance: EosTxActionAck = EosTxActionAck { - common: ::protobuf::MessageField::none(), - transfer: ::protobuf::MessageField::none(), - delegate: ::protobuf::MessageField::none(), - undelegate: ::protobuf::MessageField::none(), - refund: ::protobuf::MessageField::none(), - buy_ram: ::protobuf::MessageField::none(), - buy_ram_bytes: ::protobuf::MessageField::none(), - sell_ram: ::protobuf::MessageField::none(), - vote_producer: ::protobuf::MessageField::none(), - update_auth: ::protobuf::MessageField::none(), - delete_auth: ::protobuf::MessageField::none(), - link_auth: ::protobuf::MessageField::none(), - unlink_auth: ::protobuf::MessageField::none(), - new_account: ::protobuf::MessageField::none(), - unknown: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EosTxActionAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EosTxActionAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EosTxActionAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EosTxActionAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `EosTxActionAck` -pub mod eos_tx_action_ack { - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAsset) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosAsset { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAsset.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAsset.symbol) - pub symbol: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAsset.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosAsset { - fn default() -> &'a EosAsset { - ::default_instance() - } - } - - impl EosAsset { - pub fn new() -> EosAsset { - ::std::default::Default::default() - } - - // required sint64 amount = 1; - - pub fn amount(&self) -> i64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: i64) { - self.amount = ::std::option::Option::Some(v); - } - - // required uint64 symbol = 2; - - pub fn symbol(&self) -> u64 { - self.symbol.unwrap_or(0) - } - - pub fn clear_symbol(&mut self) { - self.symbol = ::std::option::Option::None; - } - - pub fn has_symbol(&self) -> bool { - self.symbol.is_some() - } - - // Param is passed by value, moved - pub fn set_symbol(&mut self, v: u64) { - self.symbol = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &EosAsset| { &m.amount }, - |m: &mut EosAsset| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "symbol", - |m: &EosAsset| { &m.symbol }, - |m: &mut EosAsset| { &mut m.symbol }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosAsset", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosAsset { - const NAME: &'static str = "EosAsset"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - if self.symbol.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.amount = ::std::option::Option::Some(is.read_sint64()?); - }, - 16 => { - self.symbol = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::sint64_size(1, v); - } - if let Some(v) = self.symbol { - my_size += ::protobuf::rt::uint64_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount { - os.write_sint64(1, v)?; - } - if let Some(v) = self.symbol { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosAsset { - EosAsset::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.symbol = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosAsset { - static instance: EosAsset = EosAsset { - amount: ::std::option::Option::None, - symbol: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosAsset { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAsset").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosAsset { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosAsset { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosPermissionLevel { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel.actor) - pub actor: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel.permission) - pub permission: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosPermissionLevel.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosPermissionLevel { - fn default() -> &'a EosPermissionLevel { - ::default_instance() - } - } - - impl EosPermissionLevel { - pub fn new() -> EosPermissionLevel { - ::std::default::Default::default() - } - - // required uint64 actor = 1; - - pub fn actor(&self) -> u64 { - self.actor.unwrap_or(0) - } - - pub fn clear_actor(&mut self) { - self.actor = ::std::option::Option::None; - } - - pub fn has_actor(&self) -> bool { - self.actor.is_some() - } - - // Param is passed by value, moved - pub fn set_actor(&mut self, v: u64) { - self.actor = ::std::option::Option::Some(v); - } - - // required uint64 permission = 2; - - pub fn permission(&self) -> u64 { - self.permission.unwrap_or(0) - } - - pub fn clear_permission(&mut self) { - self.permission = ::std::option::Option::None; - } - - pub fn has_permission(&self) -> bool { - self.permission.is_some() - } - - // Param is passed by value, moved - pub fn set_permission(&mut self, v: u64) { - self.permission = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "actor", - |m: &EosPermissionLevel| { &m.actor }, - |m: &mut EosPermissionLevel| { &mut m.actor }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "permission", - |m: &EosPermissionLevel| { &m.permission }, - |m: &mut EosPermissionLevel| { &mut m.permission }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosPermissionLevel", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosPermissionLevel { - const NAME: &'static str = "EosPermissionLevel"; - - fn is_initialized(&self) -> bool { - if self.actor.is_none() { - return false; - } - if self.permission.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.actor = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.permission = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.actor { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.permission { - my_size += ::protobuf::rt::uint64_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.actor { - os.write_uint64(1, v)?; - } - if let Some(v) = self.permission { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosPermissionLevel { - EosPermissionLevel::new() - } - - fn clear(&mut self) { - self.actor = ::std::option::Option::None; - self.permission = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosPermissionLevel { - static instance: EosPermissionLevel = EosPermissionLevel { - actor: ::std::option::Option::None, - permission: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosPermissionLevel { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosPermissionLevel").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosPermissionLevel { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosPermissionLevel { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosAuthorizationKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.type) - pub type_: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.key) - pub key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.weight) - pub weight: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosAuthorizationKey { - fn default() -> &'a EosAuthorizationKey { - ::default_instance() - } - } - - impl EosAuthorizationKey { - pub fn new() -> EosAuthorizationKey { - ::std::default::Default::default() - } - - // required uint32 type = 1; - - pub fn type_(&self) -> u32 { - self.type_.unwrap_or(0) - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: u32) { - self.type_ = ::std::option::Option::Some(v); - } - - // optional bytes key = 2; - - pub fn key(&self) -> &[u8] { - match self.key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_key(&mut self) { - self.key = ::std::option::Option::None; - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - if self.key.is_none() { - self.key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 weight = 4; - - pub fn weight(&self) -> u32 { - self.weight.unwrap_or(0) - } - - pub fn clear_weight(&mut self) { - self.weight = ::std::option::Option::None; - } - - pub fn has_weight(&self) -> bool { - self.weight.is_some() - } - - // Param is passed by value, moved - pub fn set_weight(&mut self, v: u32) { - self.weight = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &EosAuthorizationKey| { &m.type_ }, - |m: &mut EosAuthorizationKey| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key", - |m: &EosAuthorizationKey| { &m.key }, - |m: &mut EosAuthorizationKey| { &mut m.key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EosAuthorizationKey| { &m.address_n }, - |m: &mut EosAuthorizationKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "weight", - |m: &EosAuthorizationKey| { &m.weight }, - |m: &mut EosAuthorizationKey| { &mut m.weight }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosAuthorizationKey", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosAuthorizationKey { - const NAME: &'static str = "EosAuthorizationKey"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - if self.weight.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.key = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 24 => { - self.address_n.push(is.read_uint32()?); - }, - 32 => { - self.weight = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(3, *value); - }; - if let Some(v) = self.weight { - my_size += ::protobuf::rt::uint32_size(4, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_uint32(1, v)?; - } - if let Some(v) = self.key.as_ref() { - os.write_bytes(2, v)?; - } - for v in &self.address_n { - os.write_uint32(3, *v)?; - }; - if let Some(v) = self.weight { - os.write_uint32(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosAuthorizationKey { - EosAuthorizationKey::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.key = ::std::option::Option::None; - self.address_n.clear(); - self.weight = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosAuthorizationKey { - static instance: EosAuthorizationKey = EosAuthorizationKey { - type_: ::std::option::Option::None, - key: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - weight: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosAuthorizationKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorizationKey").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosAuthorizationKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosAuthorizationKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosAuthorizationAccount { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount.account) - pub account: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount.weight) - pub weight: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationAccount.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosAuthorizationAccount { - fn default() -> &'a EosAuthorizationAccount { - ::default_instance() - } - } - - impl EosAuthorizationAccount { - pub fn new() -> EosAuthorizationAccount { - ::std::default::Default::default() - } - - // required uint32 weight = 2; - - pub fn weight(&self) -> u32 { - self.weight.unwrap_or(0) - } - - pub fn clear_weight(&mut self) { - self.weight = ::std::option::Option::None; - } - - pub fn has_weight(&self) -> bool { - self.weight.is_some() - } - - // Param is passed by value, moved - pub fn set_weight(&mut self, v: u32) { - self.weight = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosPermissionLevel>( - "account", - |m: &EosAuthorizationAccount| { &m.account }, - |m: &mut EosAuthorizationAccount| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "weight", - |m: &EosAuthorizationAccount| { &m.weight }, - |m: &mut EosAuthorizationAccount| { &mut m.weight }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosAuthorizationAccount", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosAuthorizationAccount { - const NAME: &'static str = "EosAuthorizationAccount"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - if self.weight.is_none() { - return false; - } - for v in &self.account { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.account)?; - }, - 16 => { - self.weight = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.weight { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.weight { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosAuthorizationAccount { - EosAuthorizationAccount::new() - } - - fn clear(&mut self) { - self.account.clear(); - self.weight = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosAuthorizationAccount { - static instance: EosAuthorizationAccount = EosAuthorizationAccount { - account: ::protobuf::MessageField::none(), - weight: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosAuthorizationAccount { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorizationAccount").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosAuthorizationAccount { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosAuthorizationAccount { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosAuthorizationWait { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait.wait_sec) - pub wait_sec: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait.weight) - pub weight: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWait.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosAuthorizationWait { - fn default() -> &'a EosAuthorizationWait { - ::default_instance() - } - } - - impl EosAuthorizationWait { - pub fn new() -> EosAuthorizationWait { - ::std::default::Default::default() - } - - // required uint32 wait_sec = 1; - - pub fn wait_sec(&self) -> u32 { - self.wait_sec.unwrap_or(0) - } - - pub fn clear_wait_sec(&mut self) { - self.wait_sec = ::std::option::Option::None; - } - - pub fn has_wait_sec(&self) -> bool { - self.wait_sec.is_some() - } - - // Param is passed by value, moved - pub fn set_wait_sec(&mut self, v: u32) { - self.wait_sec = ::std::option::Option::Some(v); - } - - // required uint32 weight = 2; - - pub fn weight(&self) -> u32 { - self.weight.unwrap_or(0) - } - - pub fn clear_weight(&mut self) { - self.weight = ::std::option::Option::None; - } - - pub fn has_weight(&self) -> bool { - self.weight.is_some() - } - - // Param is passed by value, moved - pub fn set_weight(&mut self, v: u32) { - self.weight = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "wait_sec", - |m: &EosAuthorizationWait| { &m.wait_sec }, - |m: &mut EosAuthorizationWait| { &mut m.wait_sec }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "weight", - |m: &EosAuthorizationWait| { &m.weight }, - |m: &mut EosAuthorizationWait| { &mut m.weight }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosAuthorizationWait", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosAuthorizationWait { - const NAME: &'static str = "EosAuthorizationWait"; - - fn is_initialized(&self) -> bool { - if self.wait_sec.is_none() { - return false; - } - if self.weight.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.wait_sec = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.weight = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.wait_sec { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.weight { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.wait_sec { - os.write_uint32(1, v)?; - } - if let Some(v) = self.weight { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosAuthorizationWait { - EosAuthorizationWait::new() - } - - fn clear(&mut self) { - self.wait_sec = ::std::option::Option::None; - self.weight = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosAuthorizationWait { - static instance: EosAuthorizationWait = EosAuthorizationWait { - wait_sec: ::std::option::Option::None, - weight: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosAuthorizationWait { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorizationWait").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosAuthorizationWait { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosAuthorizationWait { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosAuthorization { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.threshold) - pub threshold: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.keys) - pub keys: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.accounts) - pub accounts: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.waits) - pub waits: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosAuthorization.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosAuthorization { - fn default() -> &'a EosAuthorization { - ::default_instance() - } - } - - impl EosAuthorization { - pub fn new() -> EosAuthorization { - ::std::default::Default::default() - } - - // required uint32 threshold = 1; - - pub fn threshold(&self) -> u32 { - self.threshold.unwrap_or(0) - } - - pub fn clear_threshold(&mut self) { - self.threshold = ::std::option::Option::None; - } - - pub fn has_threshold(&self) -> bool { - self.threshold.is_some() - } - - // Param is passed by value, moved - pub fn set_threshold(&mut self, v: u32) { - self.threshold = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "threshold", - |m: &EosAuthorization| { &m.threshold }, - |m: &mut EosAuthorization| { &mut m.threshold }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "keys", - |m: &EosAuthorization| { &m.keys }, - |m: &mut EosAuthorization| { &mut m.keys }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "accounts", - |m: &EosAuthorization| { &m.accounts }, - |m: &mut EosAuthorization| { &mut m.accounts }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "waits", - |m: &EosAuthorization| { &m.waits }, - |m: &mut EosAuthorization| { &mut m.waits }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosAuthorization", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosAuthorization { - const NAME: &'static str = "EosAuthorization"; - - fn is_initialized(&self) -> bool { - if self.threshold.is_none() { - return false; - } - for v in &self.keys { - if !v.is_initialized() { - return false; - } - }; - for v in &self.accounts { - if !v.is_initialized() { - return false; - } - }; - for v in &self.waits { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.threshold = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.keys.push(is.read_message()?); - }, - 26 => { - self.accounts.push(is.read_message()?); - }, - 34 => { - self.waits.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.threshold { - my_size += ::protobuf::rt::uint32_size(1, v); - } - for value in &self.keys { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.accounts { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.waits { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.threshold { - os.write_uint32(1, v)?; - } - for v in &self.keys { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - for v in &self.accounts { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - }; - for v in &self.waits { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosAuthorization { - EosAuthorization::new() - } - - fn clear(&mut self) { - self.threshold = ::std::option::Option::None; - self.keys.clear(); - self.accounts.clear(); - self.waits.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosAuthorization { - static instance: EosAuthorization = EosAuthorization { - threshold: ::std::option::Option::None, - keys: ::std::vec::Vec::new(), - accounts: ::std::vec::Vec::new(), - waits: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosAuthorization { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosAuthorization").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosAuthorization { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosAuthorization { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionCommon { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.name) - pub name: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.authorization) - pub authorization: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionCommon.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionCommon { - fn default() -> &'a EosActionCommon { - ::default_instance() - } - } - - impl EosActionCommon { - pub fn new() -> EosActionCommon { - ::std::default::Default::default() - } - - // required uint64 account = 1; - - pub fn account(&self) -> u64 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u64) { - self.account = ::std::option::Option::Some(v); - } - - // required uint64 name = 2; - - pub fn name(&self) -> u64 { - self.name.unwrap_or(0) - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: u64) { - self.name = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &EosActionCommon| { &m.account }, - |m: &mut EosActionCommon| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &EosActionCommon| { &m.name }, - |m: &mut EosActionCommon| { &mut m.name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "authorization", - |m: &EosActionCommon| { &m.authorization }, - |m: &mut EosActionCommon| { &mut m.authorization }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionCommon", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionCommon { - const NAME: &'static str = "EosActionCommon"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - if self.name.is_none() { - return false; - } - for v in &self.authorization { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.account = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.name = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - self.authorization.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.name { - my_size += ::protobuf::rt::uint64_size(2, v); - } - for value in &self.authorization { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account { - os.write_uint64(1, v)?; - } - if let Some(v) = self.name { - os.write_uint64(2, v)?; - } - for v in &self.authorization { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionCommon { - EosActionCommon::new() - } - - fn clear(&mut self) { - self.account = ::std::option::Option::None; - self.name = ::std::option::Option::None; - self.authorization.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionCommon { - static instance: EosActionCommon = EosActionCommon { - account: ::std::option::Option::None, - name: ::std::option::Option::None, - authorization: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionCommon { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionCommon").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionCommon { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionCommon { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionTransfer { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.sender) - pub sender: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.receiver) - pub receiver: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.quantity) - pub quantity: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.memo) - pub memo: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionTransfer.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionTransfer { - fn default() -> &'a EosActionTransfer { - ::default_instance() - } - } - - impl EosActionTransfer { - pub fn new() -> EosActionTransfer { - ::std::default::Default::default() - } - - // required uint64 sender = 1; - - pub fn sender(&self) -> u64 { - self.sender.unwrap_or(0) - } - - pub fn clear_sender(&mut self) { - self.sender = ::std::option::Option::None; - } - - pub fn has_sender(&self) -> bool { - self.sender.is_some() - } - - // Param is passed by value, moved - pub fn set_sender(&mut self, v: u64) { - self.sender = ::std::option::Option::Some(v); - } - - // required uint64 receiver = 2; - - pub fn receiver(&self) -> u64 { - self.receiver.unwrap_or(0) - } - - pub fn clear_receiver(&mut self) { - self.receiver = ::std::option::Option::None; - } - - pub fn has_receiver(&self) -> bool { - self.receiver.is_some() - } - - // Param is passed by value, moved - pub fn set_receiver(&mut self, v: u64) { - self.receiver = ::std::option::Option::Some(v); - } - - // required string memo = 4; - - pub fn memo(&self) -> &str { - match self.memo.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_memo(&mut self) { - self.memo = ::std::option::Option::None; - } - - pub fn has_memo(&self) -> bool { - self.memo.is_some() - } - - // Param is passed by value, moved - pub fn set_memo(&mut self, v: ::std::string::String) { - self.memo = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_memo(&mut self) -> &mut ::std::string::String { - if self.memo.is_none() { - self.memo = ::std::option::Option::Some(::std::string::String::new()); - } - self.memo.as_mut().unwrap() - } - - // Take field - pub fn take_memo(&mut self) -> ::std::string::String { - self.memo.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sender", - |m: &EosActionTransfer| { &m.sender }, - |m: &mut EosActionTransfer| { &mut m.sender }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "receiver", - |m: &EosActionTransfer| { &m.receiver }, - |m: &mut EosActionTransfer| { &mut m.receiver }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( - "quantity", - |m: &EosActionTransfer| { &m.quantity }, - |m: &mut EosActionTransfer| { &mut m.quantity }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memo", - |m: &EosActionTransfer| { &m.memo }, - |m: &mut EosActionTransfer| { &mut m.memo }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionTransfer", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionTransfer { - const NAME: &'static str = "EosActionTransfer"; - - fn is_initialized(&self) -> bool { - if self.sender.is_none() { - return false; - } - if self.receiver.is_none() { - return false; - } - if self.quantity.is_none() { - return false; - } - if self.memo.is_none() { - return false; - } - for v in &self.quantity { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.sender = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.receiver = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.quantity)?; - }, - 34 => { - self.memo = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.sender { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.receiver { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.quantity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.memo.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.sender { - os.write_uint64(1, v)?; - } - if let Some(v) = self.receiver { - os.write_uint64(2, v)?; - } - if let Some(v) = self.quantity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.memo.as_ref() { - os.write_string(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionTransfer { - EosActionTransfer::new() - } - - fn clear(&mut self) { - self.sender = ::std::option::Option::None; - self.receiver = ::std::option::Option::None; - self.quantity.clear(); - self.memo = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionTransfer { - static instance: EosActionTransfer = EosActionTransfer { - sender: ::std::option::Option::None, - receiver: ::std::option::Option::None, - quantity: ::protobuf::MessageField::none(), - memo: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionTransfer { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionTransfer").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionTransfer { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionTransfer { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionDelegate { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.sender) - pub sender: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.receiver) - pub receiver: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.net_quantity) - pub net_quantity: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.cpu_quantity) - pub cpu_quantity: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.transfer) - pub transfer: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionDelegate.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionDelegate { - fn default() -> &'a EosActionDelegate { - ::default_instance() - } - } - - impl EosActionDelegate { - pub fn new() -> EosActionDelegate { - ::std::default::Default::default() - } - - // required uint64 sender = 1; - - pub fn sender(&self) -> u64 { - self.sender.unwrap_or(0) - } - - pub fn clear_sender(&mut self) { - self.sender = ::std::option::Option::None; - } - - pub fn has_sender(&self) -> bool { - self.sender.is_some() - } - - // Param is passed by value, moved - pub fn set_sender(&mut self, v: u64) { - self.sender = ::std::option::Option::Some(v); - } - - // required uint64 receiver = 2; - - pub fn receiver(&self) -> u64 { - self.receiver.unwrap_or(0) - } - - pub fn clear_receiver(&mut self) { - self.receiver = ::std::option::Option::None; - } - - pub fn has_receiver(&self) -> bool { - self.receiver.is_some() - } - - // Param is passed by value, moved - pub fn set_receiver(&mut self, v: u64) { - self.receiver = ::std::option::Option::Some(v); - } - - // required bool transfer = 5; - - pub fn transfer(&self) -> bool { - self.transfer.unwrap_or(false) - } - - pub fn clear_transfer(&mut self) { - self.transfer = ::std::option::Option::None; - } - - pub fn has_transfer(&self) -> bool { - self.transfer.is_some() - } - - // Param is passed by value, moved - pub fn set_transfer(&mut self, v: bool) { - self.transfer = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sender", - |m: &EosActionDelegate| { &m.sender }, - |m: &mut EosActionDelegate| { &mut m.sender }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "receiver", - |m: &EosActionDelegate| { &m.receiver }, - |m: &mut EosActionDelegate| { &mut m.receiver }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( - "net_quantity", - |m: &EosActionDelegate| { &m.net_quantity }, - |m: &mut EosActionDelegate| { &mut m.net_quantity }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( - "cpu_quantity", - |m: &EosActionDelegate| { &m.cpu_quantity }, - |m: &mut EosActionDelegate| { &mut m.cpu_quantity }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "transfer", - |m: &EosActionDelegate| { &m.transfer }, - |m: &mut EosActionDelegate| { &mut m.transfer }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionDelegate", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionDelegate { - const NAME: &'static str = "EosActionDelegate"; - - fn is_initialized(&self) -> bool { - if self.sender.is_none() { - return false; - } - if self.receiver.is_none() { - return false; - } - if self.net_quantity.is_none() { - return false; - } - if self.cpu_quantity.is_none() { - return false; - } - if self.transfer.is_none() { - return false; - } - for v in &self.net_quantity { - if !v.is_initialized() { - return false; - } - }; - for v in &self.cpu_quantity { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.sender = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.receiver = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.net_quantity)?; - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.cpu_quantity)?; - }, - 40 => { - self.transfer = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.sender { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.receiver { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.net_quantity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.cpu_quantity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.transfer { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.sender { - os.write_uint64(1, v)?; - } - if let Some(v) = self.receiver { - os.write_uint64(2, v)?; - } - if let Some(v) = self.net_quantity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.cpu_quantity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.transfer { - os.write_bool(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionDelegate { - EosActionDelegate::new() - } - - fn clear(&mut self) { - self.sender = ::std::option::Option::None; - self.receiver = ::std::option::Option::None; - self.net_quantity.clear(); - self.cpu_quantity.clear(); - self.transfer = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionDelegate { - static instance: EosActionDelegate = EosActionDelegate { - sender: ::std::option::Option::None, - receiver: ::std::option::Option::None, - net_quantity: ::protobuf::MessageField::none(), - cpu_quantity: ::protobuf::MessageField::none(), - transfer: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionDelegate { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionDelegate").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionDelegate { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionDelegate { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionUndelegate { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.sender) - pub sender: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.receiver) - pub receiver: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.net_quantity) - pub net_quantity: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.cpu_quantity) - pub cpu_quantity: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUndelegate.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionUndelegate { - fn default() -> &'a EosActionUndelegate { - ::default_instance() - } - } - - impl EosActionUndelegate { - pub fn new() -> EosActionUndelegate { - ::std::default::Default::default() - } - - // required uint64 sender = 1; - - pub fn sender(&self) -> u64 { - self.sender.unwrap_or(0) - } - - pub fn clear_sender(&mut self) { - self.sender = ::std::option::Option::None; - } - - pub fn has_sender(&self) -> bool { - self.sender.is_some() - } - - // Param is passed by value, moved - pub fn set_sender(&mut self, v: u64) { - self.sender = ::std::option::Option::Some(v); - } - - // required uint64 receiver = 2; - - pub fn receiver(&self) -> u64 { - self.receiver.unwrap_or(0) - } - - pub fn clear_receiver(&mut self) { - self.receiver = ::std::option::Option::None; - } - - pub fn has_receiver(&self) -> bool { - self.receiver.is_some() - } - - // Param is passed by value, moved - pub fn set_receiver(&mut self, v: u64) { - self.receiver = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sender", - |m: &EosActionUndelegate| { &m.sender }, - |m: &mut EosActionUndelegate| { &mut m.sender }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "receiver", - |m: &EosActionUndelegate| { &m.receiver }, - |m: &mut EosActionUndelegate| { &mut m.receiver }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( - "net_quantity", - |m: &EosActionUndelegate| { &m.net_quantity }, - |m: &mut EosActionUndelegate| { &mut m.net_quantity }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( - "cpu_quantity", - |m: &EosActionUndelegate| { &m.cpu_quantity }, - |m: &mut EosActionUndelegate| { &mut m.cpu_quantity }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionUndelegate", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionUndelegate { - const NAME: &'static str = "EosActionUndelegate"; - - fn is_initialized(&self) -> bool { - if self.sender.is_none() { - return false; - } - if self.receiver.is_none() { - return false; - } - if self.net_quantity.is_none() { - return false; - } - if self.cpu_quantity.is_none() { - return false; - } - for v in &self.net_quantity { - if !v.is_initialized() { - return false; - } - }; - for v in &self.cpu_quantity { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.sender = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.receiver = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.net_quantity)?; - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.cpu_quantity)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.sender { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.receiver { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.net_quantity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.cpu_quantity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.sender { - os.write_uint64(1, v)?; - } - if let Some(v) = self.receiver { - os.write_uint64(2, v)?; - } - if let Some(v) = self.net_quantity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.cpu_quantity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionUndelegate { - EosActionUndelegate::new() - } - - fn clear(&mut self) { - self.sender = ::std::option::Option::None; - self.receiver = ::std::option::Option::None; - self.net_quantity.clear(); - self.cpu_quantity.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionUndelegate { - static instance: EosActionUndelegate = EosActionUndelegate { - sender: ::std::option::Option::None, - receiver: ::std::option::Option::None, - net_quantity: ::protobuf::MessageField::none(), - cpu_quantity: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionUndelegate { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUndelegate").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionUndelegate { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionUndelegate { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionRefund) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionRefund { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionRefund.owner) - pub owner: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionRefund.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionRefund { - fn default() -> &'a EosActionRefund { - ::default_instance() - } - } - - impl EosActionRefund { - pub fn new() -> EosActionRefund { - ::std::default::Default::default() - } - - // required uint64 owner = 1; - - pub fn owner(&self) -> u64 { - self.owner.unwrap_or(0) - } - - pub fn clear_owner(&mut self) { - self.owner = ::std::option::Option::None; - } - - pub fn has_owner(&self) -> bool { - self.owner.is_some() - } - - // Param is passed by value, moved - pub fn set_owner(&mut self, v: u64) { - self.owner = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "owner", - |m: &EosActionRefund| { &m.owner }, - |m: &mut EosActionRefund| { &mut m.owner }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionRefund", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionRefund { - const NAME: &'static str = "EosActionRefund"; - - fn is_initialized(&self) -> bool { - if self.owner.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.owner = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.owner { - my_size += ::protobuf::rt::uint64_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.owner { - os.write_uint64(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionRefund { - EosActionRefund::new() - } - - fn clear(&mut self) { - self.owner = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionRefund { - static instance: EosActionRefund = EosActionRefund { - owner: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionRefund { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionRefund").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionRefund { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionRefund { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionBuyRam { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.payer) - pub payer: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.receiver) - pub receiver: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.quantity) - pub quantity: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRam.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionBuyRam { - fn default() -> &'a EosActionBuyRam { - ::default_instance() - } - } - - impl EosActionBuyRam { - pub fn new() -> EosActionBuyRam { - ::std::default::Default::default() - } - - // required uint64 payer = 1; - - pub fn payer(&self) -> u64 { - self.payer.unwrap_or(0) - } - - pub fn clear_payer(&mut self) { - self.payer = ::std::option::Option::None; - } - - pub fn has_payer(&self) -> bool { - self.payer.is_some() - } - - // Param is passed by value, moved - pub fn set_payer(&mut self, v: u64) { - self.payer = ::std::option::Option::Some(v); - } - - // required uint64 receiver = 2; - - pub fn receiver(&self) -> u64 { - self.receiver.unwrap_or(0) - } - - pub fn clear_receiver(&mut self) { - self.receiver = ::std::option::Option::None; - } - - pub fn has_receiver(&self) -> bool { - self.receiver.is_some() - } - - // Param is passed by value, moved - pub fn set_receiver(&mut self, v: u64) { - self.receiver = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payer", - |m: &EosActionBuyRam| { &m.payer }, - |m: &mut EosActionBuyRam| { &mut m.payer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "receiver", - |m: &EosActionBuyRam| { &m.receiver }, - |m: &mut EosActionBuyRam| { &mut m.receiver }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAsset>( - "quantity", - |m: &EosActionBuyRam| { &m.quantity }, - |m: &mut EosActionBuyRam| { &mut m.quantity }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionBuyRam", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionBuyRam { - const NAME: &'static str = "EosActionBuyRam"; - - fn is_initialized(&self) -> bool { - if self.payer.is_none() { - return false; - } - if self.receiver.is_none() { - return false; - } - if self.quantity.is_none() { - return false; - } - for v in &self.quantity { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.payer = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.receiver = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.quantity)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.payer { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.receiver { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.quantity.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.payer { - os.write_uint64(1, v)?; - } - if let Some(v) = self.receiver { - os.write_uint64(2, v)?; - } - if let Some(v) = self.quantity.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionBuyRam { - EosActionBuyRam::new() - } - - fn clear(&mut self) { - self.payer = ::std::option::Option::None; - self.receiver = ::std::option::Option::None; - self.quantity.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionBuyRam { - static instance: EosActionBuyRam = EosActionBuyRam { - payer: ::std::option::Option::None, - receiver: ::std::option::Option::None, - quantity: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionBuyRam { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionBuyRam").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionBuyRam { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionBuyRam { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionBuyRamBytes { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.payer) - pub payer: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.receiver) - pub receiver: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.bytes) - pub bytes: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytes.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionBuyRamBytes { - fn default() -> &'a EosActionBuyRamBytes { - ::default_instance() - } - } - - impl EosActionBuyRamBytes { - pub fn new() -> EosActionBuyRamBytes { - ::std::default::Default::default() - } - - // required uint64 payer = 1; - - pub fn payer(&self) -> u64 { - self.payer.unwrap_or(0) - } - - pub fn clear_payer(&mut self) { - self.payer = ::std::option::Option::None; - } - - pub fn has_payer(&self) -> bool { - self.payer.is_some() - } - - // Param is passed by value, moved - pub fn set_payer(&mut self, v: u64) { - self.payer = ::std::option::Option::Some(v); - } - - // required uint64 receiver = 2; - - pub fn receiver(&self) -> u64 { - self.receiver.unwrap_or(0) - } - - pub fn clear_receiver(&mut self) { - self.receiver = ::std::option::Option::None; - } - - pub fn has_receiver(&self) -> bool { - self.receiver.is_some() - } - - // Param is passed by value, moved - pub fn set_receiver(&mut self, v: u64) { - self.receiver = ::std::option::Option::Some(v); - } - - // required uint32 bytes = 3; - - pub fn bytes(&self) -> u32 { - self.bytes.unwrap_or(0) - } - - pub fn clear_bytes(&mut self) { - self.bytes = ::std::option::Option::None; - } - - pub fn has_bytes(&self) -> bool { - self.bytes.is_some() - } - - // Param is passed by value, moved - pub fn set_bytes(&mut self, v: u32) { - self.bytes = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payer", - |m: &EosActionBuyRamBytes| { &m.payer }, - |m: &mut EosActionBuyRamBytes| { &mut m.payer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "receiver", - |m: &EosActionBuyRamBytes| { &m.receiver }, - |m: &mut EosActionBuyRamBytes| { &mut m.receiver }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bytes", - |m: &EosActionBuyRamBytes| { &m.bytes }, - |m: &mut EosActionBuyRamBytes| { &mut m.bytes }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionBuyRamBytes", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionBuyRamBytes { - const NAME: &'static str = "EosActionBuyRamBytes"; - - fn is_initialized(&self) -> bool { - if self.payer.is_none() { - return false; - } - if self.receiver.is_none() { - return false; - } - if self.bytes.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.payer = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.receiver = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.bytes = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.payer { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.receiver { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.bytes { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.payer { - os.write_uint64(1, v)?; - } - if let Some(v) = self.receiver { - os.write_uint64(2, v)?; - } - if let Some(v) = self.bytes { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionBuyRamBytes { - EosActionBuyRamBytes::new() - } - - fn clear(&mut self) { - self.payer = ::std::option::Option::None; - self.receiver = ::std::option::Option::None; - self.bytes = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionBuyRamBytes { - static instance: EosActionBuyRamBytes = EosActionBuyRamBytes { - payer: ::std::option::Option::None, - receiver: ::std::option::Option::None, - bytes: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionBuyRamBytes { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionBuyRamBytes").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionBuyRamBytes { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionBuyRamBytes { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionSellRam { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam.bytes) - pub bytes: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionSellRam.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionSellRam { - fn default() -> &'a EosActionSellRam { - ::default_instance() - } - } - - impl EosActionSellRam { - pub fn new() -> EosActionSellRam { - ::std::default::Default::default() - } - - // required uint64 account = 1; - - pub fn account(&self) -> u64 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u64) { - self.account = ::std::option::Option::Some(v); - } - - // required uint64 bytes = 2; - - pub fn bytes(&self) -> u64 { - self.bytes.unwrap_or(0) - } - - pub fn clear_bytes(&mut self) { - self.bytes = ::std::option::Option::None; - } - - pub fn has_bytes(&self) -> bool { - self.bytes.is_some() - } - - // Param is passed by value, moved - pub fn set_bytes(&mut self, v: u64) { - self.bytes = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &EosActionSellRam| { &m.account }, - |m: &mut EosActionSellRam| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bytes", - |m: &EosActionSellRam| { &m.bytes }, - |m: &mut EosActionSellRam| { &mut m.bytes }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionSellRam", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionSellRam { - const NAME: &'static str = "EosActionSellRam"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - if self.bytes.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.account = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.bytes = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.bytes { - my_size += ::protobuf::rt::uint64_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account { - os.write_uint64(1, v)?; - } - if let Some(v) = self.bytes { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionSellRam { - EosActionSellRam::new() - } - - fn clear(&mut self) { - self.account = ::std::option::Option::None; - self.bytes = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionSellRam { - static instance: EosActionSellRam = EosActionSellRam { - account: ::std::option::Option::None, - bytes: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionSellRam { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionSellRam").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionSellRam { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionSellRam { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionVoteProducer { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.voter) - pub voter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.proxy) - pub proxy: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.producers) - pub producers: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducer.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionVoteProducer { - fn default() -> &'a EosActionVoteProducer { - ::default_instance() - } - } - - impl EosActionVoteProducer { - pub fn new() -> EosActionVoteProducer { - ::std::default::Default::default() - } - - // required uint64 voter = 1; - - pub fn voter(&self) -> u64 { - self.voter.unwrap_or(0) - } - - pub fn clear_voter(&mut self) { - self.voter = ::std::option::Option::None; - } - - pub fn has_voter(&self) -> bool { - self.voter.is_some() - } - - // Param is passed by value, moved - pub fn set_voter(&mut self, v: u64) { - self.voter = ::std::option::Option::Some(v); - } - - // required uint64 proxy = 2; - - pub fn proxy(&self) -> u64 { - self.proxy.unwrap_or(0) - } - - pub fn clear_proxy(&mut self) { - self.proxy = ::std::option::Option::None; - } - - pub fn has_proxy(&self) -> bool { - self.proxy.is_some() - } - - // Param is passed by value, moved - pub fn set_proxy(&mut self, v: u64) { - self.proxy = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "voter", - |m: &EosActionVoteProducer| { &m.voter }, - |m: &mut EosActionVoteProducer| { &mut m.voter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "proxy", - |m: &EosActionVoteProducer| { &m.proxy }, - |m: &mut EosActionVoteProducer| { &mut m.proxy }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "producers", - |m: &EosActionVoteProducer| { &m.producers }, - |m: &mut EosActionVoteProducer| { &mut m.producers }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionVoteProducer", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionVoteProducer { - const NAME: &'static str = "EosActionVoteProducer"; - - fn is_initialized(&self) -> bool { - if self.voter.is_none() { - return false; - } - if self.proxy.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.voter = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.proxy = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - is.read_repeated_packed_uint64_into(&mut self.producers)?; - }, - 24 => { - self.producers.push(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.voter { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.proxy { - my_size += ::protobuf::rt::uint64_size(2, v); - } - for value in &self.producers { - my_size += ::protobuf::rt::uint64_size(3, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.voter { - os.write_uint64(1, v)?; - } - if let Some(v) = self.proxy { - os.write_uint64(2, v)?; - } - for v in &self.producers { - os.write_uint64(3, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionVoteProducer { - EosActionVoteProducer::new() - } - - fn clear(&mut self) { - self.voter = ::std::option::Option::None; - self.proxy = ::std::option::Option::None; - self.producers.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionVoteProducer { - static instance: EosActionVoteProducer = EosActionVoteProducer { - voter: ::std::option::Option::None, - proxy: ::std::option::Option::None, - producers: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionVoteProducer { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionVoteProducer").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionVoteProducer { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionVoteProducer { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionUpdateAuth { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.permission) - pub permission: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.parent) - pub parent: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.auth) - pub auth: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUpdateAuth.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionUpdateAuth { - fn default() -> &'a EosActionUpdateAuth { - ::default_instance() - } - } - - impl EosActionUpdateAuth { - pub fn new() -> EosActionUpdateAuth { - ::std::default::Default::default() - } - - // required uint64 account = 1; - - pub fn account(&self) -> u64 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u64) { - self.account = ::std::option::Option::Some(v); - } - - // required uint64 permission = 2; - - pub fn permission(&self) -> u64 { - self.permission.unwrap_or(0) - } - - pub fn clear_permission(&mut self) { - self.permission = ::std::option::Option::None; - } - - pub fn has_permission(&self) -> bool { - self.permission.is_some() - } - - // Param is passed by value, moved - pub fn set_permission(&mut self, v: u64) { - self.permission = ::std::option::Option::Some(v); - } - - // required uint64 parent = 3; - - pub fn parent(&self) -> u64 { - self.parent.unwrap_or(0) - } - - pub fn clear_parent(&mut self) { - self.parent = ::std::option::Option::None; - } - - pub fn has_parent(&self) -> bool { - self.parent.is_some() - } - - // Param is passed by value, moved - pub fn set_parent(&mut self, v: u64) { - self.parent = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &EosActionUpdateAuth| { &m.account }, - |m: &mut EosActionUpdateAuth| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "permission", - |m: &EosActionUpdateAuth| { &m.permission }, - |m: &mut EosActionUpdateAuth| { &mut m.permission }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "parent", - |m: &EosActionUpdateAuth| { &m.parent }, - |m: &mut EosActionUpdateAuth| { &mut m.parent }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAuthorization>( - "auth", - |m: &EosActionUpdateAuth| { &m.auth }, - |m: &mut EosActionUpdateAuth| { &mut m.auth }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionUpdateAuth", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionUpdateAuth { - const NAME: &'static str = "EosActionUpdateAuth"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - if self.permission.is_none() { - return false; - } - if self.parent.is_none() { - return false; - } - if self.auth.is_none() { - return false; - } - for v in &self.auth { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.account = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.permission = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.parent = ::std::option::Option::Some(is.read_uint64()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.auth)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.permission { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.parent { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.auth.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account { - os.write_uint64(1, v)?; - } - if let Some(v) = self.permission { - os.write_uint64(2, v)?; - } - if let Some(v) = self.parent { - os.write_uint64(3, v)?; - } - if let Some(v) = self.auth.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionUpdateAuth { - EosActionUpdateAuth::new() - } - - fn clear(&mut self) { - self.account = ::std::option::Option::None; - self.permission = ::std::option::Option::None; - self.parent = ::std::option::Option::None; - self.auth.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionUpdateAuth { - static instance: EosActionUpdateAuth = EosActionUpdateAuth { - account: ::std::option::Option::None, - permission: ::std::option::Option::None, - parent: ::std::option::Option::None, - auth: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionUpdateAuth { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUpdateAuth").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionUpdateAuth { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionUpdateAuth { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionDeleteAuth { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth.permission) - pub permission: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionDeleteAuth.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionDeleteAuth { - fn default() -> &'a EosActionDeleteAuth { - ::default_instance() - } - } - - impl EosActionDeleteAuth { - pub fn new() -> EosActionDeleteAuth { - ::std::default::Default::default() - } - - // required uint64 account = 1; - - pub fn account(&self) -> u64 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u64) { - self.account = ::std::option::Option::Some(v); - } - - // required uint64 permission = 2; - - pub fn permission(&self) -> u64 { - self.permission.unwrap_or(0) - } - - pub fn clear_permission(&mut self) { - self.permission = ::std::option::Option::None; - } - - pub fn has_permission(&self) -> bool { - self.permission.is_some() - } - - // Param is passed by value, moved - pub fn set_permission(&mut self, v: u64) { - self.permission = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &EosActionDeleteAuth| { &m.account }, - |m: &mut EosActionDeleteAuth| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "permission", - |m: &EosActionDeleteAuth| { &m.permission }, - |m: &mut EosActionDeleteAuth| { &mut m.permission }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionDeleteAuth", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionDeleteAuth { - const NAME: &'static str = "EosActionDeleteAuth"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - if self.permission.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.account = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.permission = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.permission { - my_size += ::protobuf::rt::uint64_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account { - os.write_uint64(1, v)?; - } - if let Some(v) = self.permission { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionDeleteAuth { - EosActionDeleteAuth::new() - } - - fn clear(&mut self) { - self.account = ::std::option::Option::None; - self.permission = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionDeleteAuth { - static instance: EosActionDeleteAuth = EosActionDeleteAuth { - account: ::std::option::Option::None, - permission: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionDeleteAuth { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionDeleteAuth").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionDeleteAuth { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionDeleteAuth { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionLinkAuth { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.code) - pub code: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.type) - pub type_: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.requirement) - pub requirement: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuth.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionLinkAuth { - fn default() -> &'a EosActionLinkAuth { - ::default_instance() - } - } - - impl EosActionLinkAuth { - pub fn new() -> EosActionLinkAuth { - ::std::default::Default::default() - } - - // required uint64 account = 1; - - pub fn account(&self) -> u64 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u64) { - self.account = ::std::option::Option::Some(v); - } - - // required uint64 code = 2; - - pub fn code(&self) -> u64 { - self.code.unwrap_or(0) - } - - pub fn clear_code(&mut self) { - self.code = ::std::option::Option::None; - } - - pub fn has_code(&self) -> bool { - self.code.is_some() - } - - // Param is passed by value, moved - pub fn set_code(&mut self, v: u64) { - self.code = ::std::option::Option::Some(v); - } - - // required uint64 type = 3; - - pub fn type_(&self) -> u64 { - self.type_.unwrap_or(0) - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: u64) { - self.type_ = ::std::option::Option::Some(v); - } - - // required uint64 requirement = 4; - - pub fn requirement(&self) -> u64 { - self.requirement.unwrap_or(0) - } - - pub fn clear_requirement(&mut self) { - self.requirement = ::std::option::Option::None; - } - - pub fn has_requirement(&self) -> bool { - self.requirement.is_some() - } - - // Param is passed by value, moved - pub fn set_requirement(&mut self, v: u64) { - self.requirement = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &EosActionLinkAuth| { &m.account }, - |m: &mut EosActionLinkAuth| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "code", - |m: &EosActionLinkAuth| { &m.code }, - |m: &mut EosActionLinkAuth| { &mut m.code }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &EosActionLinkAuth| { &m.type_ }, - |m: &mut EosActionLinkAuth| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "requirement", - |m: &EosActionLinkAuth| { &m.requirement }, - |m: &mut EosActionLinkAuth| { &mut m.requirement }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionLinkAuth", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionLinkAuth { - const NAME: &'static str = "EosActionLinkAuth"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - if self.code.is_none() { - return false; - } - if self.type_.is_none() { - return false; - } - if self.requirement.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.account = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.code = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.type_ = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.requirement = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.code { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.requirement { - my_size += ::protobuf::rt::uint64_size(4, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account { - os.write_uint64(1, v)?; - } - if let Some(v) = self.code { - os.write_uint64(2, v)?; - } - if let Some(v) = self.type_ { - os.write_uint64(3, v)?; - } - if let Some(v) = self.requirement { - os.write_uint64(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionLinkAuth { - EosActionLinkAuth::new() - } - - fn clear(&mut self) { - self.account = ::std::option::Option::None; - self.code = ::std::option::Option::None; - self.type_ = ::std::option::Option::None; - self.requirement = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionLinkAuth { - static instance: EosActionLinkAuth = EosActionLinkAuth { - account: ::std::option::Option::None, - code: ::std::option::Option::None, - type_: ::std::option::Option::None, - requirement: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionLinkAuth { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionLinkAuth").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionLinkAuth { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionLinkAuth { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionUnlinkAuth { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.code) - pub code: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.type) - pub type_: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnlinkAuth.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionUnlinkAuth { - fn default() -> &'a EosActionUnlinkAuth { - ::default_instance() - } - } - - impl EosActionUnlinkAuth { - pub fn new() -> EosActionUnlinkAuth { - ::std::default::Default::default() - } - - // required uint64 account = 1; - - pub fn account(&self) -> u64 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u64) { - self.account = ::std::option::Option::Some(v); - } - - // required uint64 code = 2; - - pub fn code(&self) -> u64 { - self.code.unwrap_or(0) - } - - pub fn clear_code(&mut self) { - self.code = ::std::option::Option::None; - } - - pub fn has_code(&self) -> bool { - self.code.is_some() - } - - // Param is passed by value, moved - pub fn set_code(&mut self, v: u64) { - self.code = ::std::option::Option::Some(v); - } - - // required uint64 type = 3; - - pub fn type_(&self) -> u64 { - self.type_.unwrap_or(0) - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: u64) { - self.type_ = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &EosActionUnlinkAuth| { &m.account }, - |m: &mut EosActionUnlinkAuth| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "code", - |m: &EosActionUnlinkAuth| { &m.code }, - |m: &mut EosActionUnlinkAuth| { &mut m.code }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &EosActionUnlinkAuth| { &m.type_ }, - |m: &mut EosActionUnlinkAuth| { &mut m.type_ }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionUnlinkAuth", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionUnlinkAuth { - const NAME: &'static str = "EosActionUnlinkAuth"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - if self.code.is_none() { - return false; - } - if self.type_.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.account = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.code = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.type_ = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.code { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::uint64_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account { - os.write_uint64(1, v)?; - } - if let Some(v) = self.code { - os.write_uint64(2, v)?; - } - if let Some(v) = self.type_ { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionUnlinkAuth { - EosActionUnlinkAuth::new() - } - - fn clear(&mut self) { - self.account = ::std::option::Option::None; - self.code = ::std::option::Option::None; - self.type_ = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionUnlinkAuth { - static instance: EosActionUnlinkAuth = EosActionUnlinkAuth { - account: ::std::option::Option::None, - code: ::std::option::Option::None, - type_: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionUnlinkAuth { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUnlinkAuth").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionUnlinkAuth { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionUnlinkAuth { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionNewAccount { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.creator) - pub creator: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.name) - pub name: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.owner) - pub owner: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.active) - pub active: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccount.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionNewAccount { - fn default() -> &'a EosActionNewAccount { - ::default_instance() - } - } - - impl EosActionNewAccount { - pub fn new() -> EosActionNewAccount { - ::std::default::Default::default() - } - - // required uint64 creator = 1; - - pub fn creator(&self) -> u64 { - self.creator.unwrap_or(0) - } - - pub fn clear_creator(&mut self) { - self.creator = ::std::option::Option::None; - } - - pub fn has_creator(&self) -> bool { - self.creator.is_some() - } - - // Param is passed by value, moved - pub fn set_creator(&mut self, v: u64) { - self.creator = ::std::option::Option::Some(v); - } - - // required uint64 name = 2; - - pub fn name(&self) -> u64 { - self.name.unwrap_or(0) - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: u64) { - self.name = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "creator", - |m: &EosActionNewAccount| { &m.creator }, - |m: &mut EosActionNewAccount| { &mut m.creator }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &EosActionNewAccount| { &m.name }, - |m: &mut EosActionNewAccount| { &mut m.name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAuthorization>( - "owner", - |m: &EosActionNewAccount| { &m.owner }, - |m: &mut EosActionNewAccount| { &mut m.owner }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EosAuthorization>( - "active", - |m: &EosActionNewAccount| { &m.active }, - |m: &mut EosActionNewAccount| { &mut m.active }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionNewAccount", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionNewAccount { - const NAME: &'static str = "EosActionNewAccount"; - - fn is_initialized(&self) -> bool { - if self.creator.is_none() { - return false; - } - if self.name.is_none() { - return false; - } - if self.owner.is_none() { - return false; - } - if self.active.is_none() { - return false; - } - for v in &self.owner { - if !v.is_initialized() { - return false; - } - }; - for v in &self.active { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.creator = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.name = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.owner)?; - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.active)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.creator { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.name { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.owner.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.active.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.creator { - os.write_uint64(1, v)?; - } - if let Some(v) = self.name { - os.write_uint64(2, v)?; - } - if let Some(v) = self.owner.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.active.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionNewAccount { - EosActionNewAccount::new() - } - - fn clear(&mut self) { - self.creator = ::std::option::Option::None; - self.name = ::std::option::Option::None; - self.owner.clear(); - self.active.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionNewAccount { - static instance: EosActionNewAccount = EosActionNewAccount { - creator: ::std::option::Option::None, - name: ::std::option::Option::None, - owner: ::protobuf::MessageField::none(), - active: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionNewAccount { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionNewAccount").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionNewAccount { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionNewAccount { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EosActionUnknown { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown.data_size) - pub data_size: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown.data_chunk) - pub data_chunk: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosTxActionAck.EosActionUnknown.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EosActionUnknown { - fn default() -> &'a EosActionUnknown { - ::default_instance() - } - } - - impl EosActionUnknown { - pub fn new() -> EosActionUnknown { - ::std::default::Default::default() - } - - // required uint32 data_size = 1; - - pub fn data_size(&self) -> u32 { - self.data_size.unwrap_or(0) - } - - pub fn clear_data_size(&mut self) { - self.data_size = ::std::option::Option::None; - } - - pub fn has_data_size(&self) -> bool { - self.data_size.is_some() - } - - // Param is passed by value, moved - pub fn set_data_size(&mut self, v: u32) { - self.data_size = ::std::option::Option::Some(v); - } - - // required bytes data_chunk = 2; - - pub fn data_chunk(&self) -> &[u8] { - match self.data_chunk.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data_chunk(&mut self) { - self.data_chunk = ::std::option::Option::None; - } - - pub fn has_data_chunk(&self) -> bool { - self.data_chunk.is_some() - } - - // Param is passed by value, moved - pub fn set_data_chunk(&mut self, v: ::std::vec::Vec) { - self.data_chunk = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data_chunk(&mut self) -> &mut ::std::vec::Vec { - if self.data_chunk.is_none() { - self.data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data_chunk.as_mut().unwrap() - } - - // Take field - pub fn take_data_chunk(&mut self) -> ::std::vec::Vec { - self.data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_size", - |m: &EosActionUnknown| { &m.data_size }, - |m: &mut EosActionUnknown| { &mut m.data_size }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_chunk", - |m: &EosActionUnknown| { &m.data_chunk }, - |m: &mut EosActionUnknown| { &mut m.data_chunk }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosTxActionAck.EosActionUnknown", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EosActionUnknown { - const NAME: &'static str = "EosActionUnknown"; - - fn is_initialized(&self) -> bool { - if self.data_size.is_none() { - return false; - } - if self.data_chunk.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.data_size = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.data_chunk = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_size { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.data_chunk.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_size { - os.write_uint32(1, v)?; - } - if let Some(v) = self.data_chunk.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosActionUnknown { - EosActionUnknown::new() - } - - fn clear(&mut self) { - self.data_size = ::std::option::Option::None; - self.data_chunk = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosActionUnknown { - static instance: EosActionUnknown = EosActionUnknown { - data_size: ::std::option::Option::None, - data_chunk: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EosActionUnknown { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EosTxActionAck.EosActionUnknown").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EosActionUnknown { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EosActionUnknown { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.eos.EosSignedTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EosSignedTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.eos.EosSignedTx.signature) - pub signature: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.eos.EosSignedTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EosSignedTx { - fn default() -> &'a EosSignedTx { - ::default_instance() - } -} - -impl EosSignedTx { - pub fn new() -> EosSignedTx { - ::std::default::Default::default() - } - - // required string signature = 1; - - pub fn signature(&self) -> &str { - match self.signature.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::string::String) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::string::String { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::string::String::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::string::String { - self.signature.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &EosSignedTx| { &m.signature }, - |m: &mut EosSignedTx| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EosSignedTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EosSignedTx { - const NAME: &'static str = "EosSignedTx"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EosSignedTx { - EosSignedTx::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EosSignedTx { - static instance: EosSignedTx = EosSignedTx { - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EosSignedTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EosSignedTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EosSignedTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EosSignedTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x12messages-eos.proto\x12\x16hw.trezor.messages.eos\"m\n\x0fEosGetPub\ - licKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0csh\ - ow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\ - \x18\x03\x20\x01(\x08R\x08chunkify\"Z\n\x0cEosPublicKey\x12$\n\x0ewif_pu\ - blic_key\x18\x01\x20\x02(\tR\x0cwifPublicKey\x12$\n\x0eraw_public_key\ - \x18\x02\x20\x02(\x0cR\x0crawPublicKey\"\xba\x03\n\tEosSignTx\x12\x1b\n\ - \taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x19\n\x08chain_id\x18\ - \x02\x20\x02(\x0cR\x07chainId\x12E\n\x06header\x18\x03\x20\x02(\x0b2-.hw\ - .trezor.messages.eos.EosSignTx.EosTxHeaderR\x06header\x12\x1f\n\x0bnum_a\ - ctions\x18\x04\x20\x02(\rR\nnumActions\x12\x1a\n\x08chunkify\x18\x05\x20\ - \x01(\x08R\x08chunkify\x1a\xf0\x01\n\x0bEosTxHeader\x12\x1e\n\nexpiratio\ - n\x18\x01\x20\x02(\rR\nexpiration\x12\"\n\rref_block_num\x18\x02\x20\x02\ - (\rR\x0brefBlockNum\x12(\n\x10ref_block_prefix\x18\x03\x20\x02(\rR\x0ere\ - fBlockPrefix\x12-\n\x13max_net_usage_words\x18\x04\x20\x02(\rR\x10maxNet\ - UsageWords\x12'\n\x10max_cpu_usage_ms\x18\x05\x20\x02(\rR\rmaxCpuUsageMs\ - \x12\x1b\n\tdelay_sec\x18\x06\x20\x02(\rR\x08delaySec\"1\n\x12EosTxActio\ - nRequest\x12\x1b\n\tdata_size\x18\x01\x20\x01(\rR\x08dataSize\"\xe2\x20\ - \n\x0eEosTxActionAck\x12N\n\x06common\x18\x01\x20\x02(\x0b26.hw.trezor.m\ - essages.eos.EosTxActionAck.EosActionCommonR\x06common\x12T\n\x08transfer\ - \x18\x02\x20\x01(\x0b28.hw.trezor.messages.eos.EosTxActionAck.EosActionT\ - ransferR\x08transfer\x12T\n\x08delegate\x18\x03\x20\x01(\x0b28.hw.trezor\ - .messages.eos.EosTxActionAck.EosActionDelegateR\x08delegate\x12Z\n\nunde\ - legate\x18\x04\x20\x01(\x0b2:.hw.trezor.messages.eos.EosTxActionAck.EosA\ - ctionUndelegateR\nundelegate\x12N\n\x06refund\x18\x05\x20\x01(\x0b26.hw.\ - trezor.messages.eos.EosTxActionAck.EosActionRefundR\x06refund\x12O\n\x07\ - buy_ram\x18\x06\x20\x01(\x0b26.hw.trezor.messages.eos.EosTxActionAck.Eos\ - ActionBuyRamR\x06buyRam\x12_\n\rbuy_ram_bytes\x18\x07\x20\x01(\x0b2;.hw.\ - trezor.messages.eos.EosTxActionAck.EosActionBuyRamBytesR\x0bbuyRamBytes\ - \x12R\n\x08sell_ram\x18\x08\x20\x01(\x0b27.hw.trezor.messages.eos.EosTxA\ - ctionAck.EosActionSellRamR\x07sellRam\x12a\n\rvote_producer\x18\t\x20\ - \x01(\x0b2<.hw.trezor.messages.eos.EosTxActionAck.EosActionVoteProducerR\ - \x0cvoteProducer\x12[\n\x0bupdate_auth\x18\n\x20\x01(\x0b2:.hw.trezor.me\ - ssages.eos.EosTxActionAck.EosActionUpdateAuthR\nupdateAuth\x12[\n\x0bdel\ - ete_auth\x18\x0b\x20\x01(\x0b2:.hw.trezor.messages.eos.EosTxActionAck.Eo\ - sActionDeleteAuthR\ndeleteAuth\x12U\n\tlink_auth\x18\x0c\x20\x01(\x0b28.\ - hw.trezor.messages.eos.EosTxActionAck.EosActionLinkAuthR\x08linkAuth\x12\ - [\n\x0bunlink_auth\x18\r\x20\x01(\x0b2:.hw.trezor.messages.eos.EosTxActi\ - onAck.EosActionUnlinkAuthR\nunlinkAuth\x12[\n\x0bnew_account\x18\x0e\x20\ - \x01(\x0b2:.hw.trezor.messages.eos.EosTxActionAck.EosActionNewAccountR\n\ - newAccount\x12Q\n\x07unknown\x18\x0f\x20\x01(\x0b27.hw.trezor.messages.e\ - os.EosTxActionAck.EosActionUnknownR\x07unknown\x1a:\n\x08EosAsset\x12\ - \x16\n\x06amount\x18\x01\x20\x02(\x12R\x06amount\x12\x16\n\x06symbol\x18\ - \x02\x20\x02(\x04R\x06symbol\x1aJ\n\x12EosPermissionLevel\x12\x14\n\x05a\ - ctor\x18\x01\x20\x02(\x04R\x05actor\x12\x1e\n\npermission\x18\x02\x20\ - \x02(\x04R\npermission\x1ap\n\x13EosAuthorizationKey\x12\x12\n\x04type\ - \x18\x01\x20\x02(\rR\x04type\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03k\ - ey\x12\x1b\n\taddress_n\x18\x03\x20\x03(\rR\x08addressN\x12\x16\n\x06wei\ - ght\x18\x04\x20\x02(\rR\x06weight\x1a\x86\x01\n\x17EosAuthorizationAccou\ - nt\x12S\n\x07account\x18\x01\x20\x02(\x0b29.hw.trezor.messages.eos.EosTx\ - ActionAck.EosPermissionLevelR\x07account\x12\x16\n\x06weight\x18\x02\x20\ - \x02(\rR\x06weight\x1aI\n\x14EosAuthorizationWait\x12\x19\n\x08wait_sec\ - \x18\x01\x20\x02(\rR\x07waitSec\x12\x16\n\x06weight\x18\x02\x20\x02(\rR\ - \x06weight\x1a\xaf\x02\n\x10EosAuthorization\x12\x1c\n\tthreshold\x18\ - \x01\x20\x02(\rR\tthreshold\x12N\n\x04keys\x18\x02\x20\x03(\x0b2:.hw.tre\ - zor.messages.eos.EosTxActionAck.EosAuthorizationKeyR\x04keys\x12Z\n\x08a\ - ccounts\x18\x03\x20\x03(\x0b2>.hw.trezor.messages.eos.EosTxActionAck.Eos\ - AuthorizationAccountR\x08accounts\x12Q\n\x05waits\x18\x04\x20\x03(\x0b2;\ - .hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationWaitR\x05waits\ - \x1a\xa0\x01\n\x0fEosActionCommon\x12\x18\n\x07account\x18\x01\x20\x02(\ - \x04R\x07account\x12\x12\n\x04name\x18\x02\x20\x02(\x04R\x04name\x12_\n\ - \rauthorization\x18\x03\x20\x03(\x0b29.hw.trezor.messages.eos.EosTxActio\ - nAck.EosPermissionLevelR\rauthorization\x1a\xa8\x01\n\x11EosActionTransf\ - er\x12\x16\n\x06sender\x18\x01\x20\x02(\x04R\x06sender\x12\x1a\n\x08rece\ - iver\x18\x02\x20\x02(\x04R\x08receiver\x12K\n\x08quantity\x18\x03\x20\ - \x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\x08quantity\ - \x12\x12\n\x04memo\x18\x04\x20\x02(\tR\x04memo\x1a\x8b\x02\n\x11EosActio\ - nDelegate\x12\x16\n\x06sender\x18\x01\x20\x02(\x04R\x06sender\x12\x1a\n\ - \x08receiver\x18\x02\x20\x02(\x04R\x08receiver\x12R\n\x0cnet_quantity\ - \x18\x03\x20\x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\ - \x0bnetQuantity\x12R\n\x0ccpu_quantity\x18\x04\x20\x02(\x0b2/.hw.trezor.\ - messages.eos.EosTxActionAck.EosAssetR\x0bcpuQuantity\x12\x1a\n\x08transf\ - er\x18\x05\x20\x02(\x08R\x08transfer\x1a\xf1\x01\n\x13EosActionUndelegat\ - e\x12\x16\n\x06sender\x18\x01\x20\x02(\x04R\x06sender\x12\x1a\n\x08recei\ - ver\x18\x02\x20\x02(\x04R\x08receiver\x12R\n\x0cnet_quantity\x18\x03\x20\ - \x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\x0bnetQuanti\ - ty\x12R\n\x0ccpu_quantity\x18\x04\x20\x02(\x0b2/.hw.trezor.messages.eos.\ - EosTxActionAck.EosAssetR\x0bcpuQuantity\x1a'\n\x0fEosActionRefund\x12\ - \x14\n\x05owner\x18\x01\x20\x02(\x04R\x05owner\x1a\x90\x01\n\x0fEosActio\ - nBuyRam\x12\x14\n\x05payer\x18\x01\x20\x02(\x04R\x05payer\x12\x1a\n\x08r\ - eceiver\x18\x02\x20\x02(\x04R\x08receiver\x12K\n\x08quantity\x18\x03\x20\ - \x02(\x0b2/.hw.trezor.messages.eos.EosTxActionAck.EosAssetR\x08quantity\ - \x1a^\n\x14EosActionBuyRamBytes\x12\x14\n\x05payer\x18\x01\x20\x02(\x04R\ - \x05payer\x12\x1a\n\x08receiver\x18\x02\x20\x02(\x04R\x08receiver\x12\ - \x14\n\x05bytes\x18\x03\x20\x02(\rR\x05bytes\x1aB\n\x10EosActionSellRam\ - \x12\x18\n\x07account\x18\x01\x20\x02(\x04R\x07account\x12\x14\n\x05byte\ - s\x18\x02\x20\x02(\x04R\x05bytes\x1aa\n\x15EosActionVoteProducer\x12\x14\ - \n\x05voter\x18\x01\x20\x02(\x04R\x05voter\x12\x14\n\x05proxy\x18\x02\ - \x20\x02(\x04R\x05proxy\x12\x1c\n\tproducers\x18\x03\x20\x03(\x04R\tprod\ - ucers\x1a\xb4\x01\n\x13EosActionUpdateAuth\x12\x18\n\x07account\x18\x01\ - \x20\x02(\x04R\x07account\x12\x1e\n\npermission\x18\x02\x20\x02(\x04R\np\ - ermission\x12\x16\n\x06parent\x18\x03\x20\x02(\x04R\x06parent\x12K\n\x04\ - auth\x18\x04\x20\x02(\x0b27.hw.trezor.messages.eos.EosTxActionAck.EosAut\ - horizationR\x04auth\x1aO\n\x13EosActionDeleteAuth\x12\x18\n\x07account\ - \x18\x01\x20\x02(\x04R\x07account\x12\x1e\n\npermission\x18\x02\x20\x02(\ - \x04R\npermission\x1aw\n\x11EosActionLinkAuth\x12\x18\n\x07account\x18\ - \x01\x20\x02(\x04R\x07account\x12\x12\n\x04code\x18\x02\x20\x02(\x04R\ - \x04code\x12\x12\n\x04type\x18\x03\x20\x02(\x04R\x04type\x12\x20\n\x0bre\ - quirement\x18\x04\x20\x02(\x04R\x0brequirement\x1aW\n\x13EosActionUnlink\ - Auth\x12\x18\n\x07account\x18\x01\x20\x02(\x04R\x07account\x12\x12\n\x04\ - code\x18\x02\x20\x02(\x04R\x04code\x12\x12\n\x04type\x18\x03\x20\x02(\ - \x04R\x04type\x1a\xe3\x01\n\x13EosActionNewAccount\x12\x18\n\x07creator\ - \x18\x01\x20\x02(\x04R\x07creator\x12\x12\n\x04name\x18\x02\x20\x02(\x04\ - R\x04name\x12M\n\x05owner\x18\x03\x20\x02(\x0b27.hw.trezor.messages.eos.\ - EosTxActionAck.EosAuthorizationR\x05owner\x12O\n\x06active\x18\x04\x20\ - \x02(\x0b27.hw.trezor.messages.eos.EosTxActionAck.EosAuthorizationR\x06a\ - ctive\x1aN\n\x10EosActionUnknown\x12\x1b\n\tdata_size\x18\x01\x20\x02(\r\ - R\x08dataSize\x12\x1d\n\ndata_chunk\x18\x02\x20\x02(\x0cR\tdataChunk\"+\ - \n\x0bEosSignedTx\x12\x1c\n\tsignature\x18\x01\x20\x02(\tR\tsignatureB7\ - \n#com.satoshilabs.trezor.lib.protobufB\x10TrezorMessageEos\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(28); - messages.push(EosGetPublicKey::generated_message_descriptor_data()); - messages.push(EosPublicKey::generated_message_descriptor_data()); - messages.push(EosSignTx::generated_message_descriptor_data()); - messages.push(EosTxActionRequest::generated_message_descriptor_data()); - messages.push(EosTxActionAck::generated_message_descriptor_data()); - messages.push(EosSignedTx::generated_message_descriptor_data()); - messages.push(eos_sign_tx::EosTxHeader::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosAsset::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosPermissionLevel::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosAuthorizationKey::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosAuthorizationAccount::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosAuthorizationWait::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosAuthorization::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionCommon::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionTransfer::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionDelegate::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionUndelegate::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionRefund::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionBuyRam::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionBuyRamBytes::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionSellRam::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionVoteProducer::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionUpdateAuth::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionDeleteAuth::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionLinkAuth::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionUnlinkAuth::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionNewAccount::generated_message_descriptor_data()); - messages.push(eos_tx_action_ack::EosActionUnknown::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_ethereum.rs b/wallet/trezor-client/src/protos/generated/messages_ethereum.rs deleted file mode 100644 index 701dda7126..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_ethereum.rs +++ /dev/null @@ -1,4199 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-ethereum.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumGetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumGetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetPublicKey.show_display) - pub show_display: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumGetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumGetPublicKey { - fn default() -> &'a EthereumGetPublicKey { - ::default_instance() - } -} - -impl EthereumGetPublicKey { - pub fn new() -> EthereumGetPublicKey { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EthereumGetPublicKey| { &m.address_n }, - |m: &mut EthereumGetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &EthereumGetPublicKey| { &m.show_display }, - |m: &mut EthereumGetPublicKey| { &mut m.show_display }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumGetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumGetPublicKey { - const NAME: &'static str = "EthereumGetPublicKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumGetPublicKey { - EthereumGetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumGetPublicKey { - static instance: EthereumGetPublicKey = EthereumGetPublicKey { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumGetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumGetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumGetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumGetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumPublicKey.node) - pub node: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumPublicKey.xpub) - pub xpub: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumPublicKey { - fn default() -> &'a EthereumPublicKey { - ::default_instance() - } -} - -impl EthereumPublicKey { - pub fn new() -> EthereumPublicKey { - ::std::default::Default::default() - } - - // required string xpub = 2; - - pub fn xpub(&self) -> &str { - match self.xpub.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_xpub(&mut self) { - self.xpub = ::std::option::Option::None; - } - - pub fn has_xpub(&self) -> bool { - self.xpub.is_some() - } - - // Param is passed by value, moved - pub fn set_xpub(&mut self, v: ::std::string::String) { - self.xpub = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_xpub(&mut self) -> &mut ::std::string::String { - if self.xpub.is_none() { - self.xpub = ::std::option::Option::Some(::std::string::String::new()); - } - self.xpub.as_mut().unwrap() - } - - // Take field - pub fn take_xpub(&mut self) -> ::std::string::String { - self.xpub.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_common::HDNodeType>( - "node", - |m: &EthereumPublicKey| { &m.node }, - |m: &mut EthereumPublicKey| { &mut m.node }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "xpub", - |m: &EthereumPublicKey| { &m.xpub }, - |m: &mut EthereumPublicKey| { &mut m.xpub }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumPublicKey { - const NAME: &'static str = "EthereumPublicKey"; - - fn is_initialized(&self) -> bool { - if self.node.is_none() { - return false; - } - if self.xpub.is_none() { - return false; - } - for v in &self.node { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; - }, - 18 => { - self.xpub = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.node.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.xpub.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.node.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.xpub.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumPublicKey { - EthereumPublicKey::new() - } - - fn clear(&mut self) { - self.node.clear(); - self.xpub = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumPublicKey { - static instance: EthereumPublicKey = EthereumPublicKey { - node: ::protobuf::MessageField::none(), - xpub: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.encoded_network) - pub encoded_network: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumGetAddress { - fn default() -> &'a EthereumGetAddress { - ::default_instance() - } -} - -impl EthereumGetAddress { - pub fn new() -> EthereumGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bytes encoded_network = 3; - - pub fn encoded_network(&self) -> &[u8] { - match self.encoded_network.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_encoded_network(&mut self) { - self.encoded_network = ::std::option::Option::None; - } - - pub fn has_encoded_network(&self) -> bool { - self.encoded_network.is_some() - } - - // Param is passed by value, moved - pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { - self.encoded_network = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { - if self.encoded_network.is_none() { - self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.encoded_network.as_mut().unwrap() - } - - // Take field - pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { - self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool chunkify = 4; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EthereumGetAddress| { &m.address_n }, - |m: &mut EthereumGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &EthereumGetAddress| { &m.show_display }, - |m: &mut EthereumGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "encoded_network", - |m: &EthereumGetAddress| { &m.encoded_network }, - |m: &mut EthereumGetAddress| { &mut m.encoded_network }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &EthereumGetAddress| { &m.chunkify }, - |m: &mut EthereumGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumGetAddress { - const NAME: &'static str = "EthereumGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 26 => { - self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); - }, - 32 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.encoded_network.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.encoded_network.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumGetAddress { - EthereumGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.encoded_network = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumGetAddress { - static instance: EthereumGetAddress = EthereumGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - encoded_network: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumAddress._old_address) - pub _old_address: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumAddress { - fn default() -> &'a EthereumAddress { - ::default_instance() - } -} - -impl EthereumAddress { - pub fn new() -> EthereumAddress { - ::std::default::Default::default() - } - - // optional bytes _old_address = 1; - - pub fn _old_address(&self) -> &[u8] { - match self._old_address.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear__old_address(&mut self) { - self._old_address = ::std::option::Option::None; - } - - pub fn has__old_address(&self) -> bool { - self._old_address.is_some() - } - - // Param is passed by value, moved - pub fn set__old_address(&mut self, v: ::std::vec::Vec) { - self._old_address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut__old_address(&mut self) -> &mut ::std::vec::Vec { - if self._old_address.is_none() { - self._old_address = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self._old_address.as_mut().unwrap() - } - - // Take field - pub fn take__old_address(&mut self) -> ::std::vec::Vec { - self._old_address.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string address = 2; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "_old_address", - |m: &EthereumAddress| { &m._old_address }, - |m: &mut EthereumAddress| { &mut m._old_address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &EthereumAddress| { &m.address }, - |m: &mut EthereumAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumAddress { - const NAME: &'static str = "EthereumAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self._old_address = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self._old_address.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self._old_address.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.address.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumAddress { - EthereumAddress::new() - } - - fn clear(&mut self) { - self._old_address = ::std::option::Option::None; - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumAddress { - static instance: EthereumAddress = EthereumAddress { - _old_address: ::std::option::Option::None, - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.nonce) - pub nonce: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.gas_price) - pub gas_price: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.gas_limit) - pub gas_limit: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.to) - pub to: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.value) - pub value: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.data_initial_chunk) - pub data_initial_chunk: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.data_length) - pub data_length: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.chain_id) - pub chain_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.tx_type) - pub tx_type: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.definitions) - pub definitions: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumSignTx { - fn default() -> &'a EthereumSignTx { - ::default_instance() - } -} - -impl EthereumSignTx { - pub fn new() -> EthereumSignTx { - ::std::default::Default::default() - } - - // optional bytes nonce = 2; - - pub fn nonce(&self) -> &[u8] { - match self.nonce.as_ref() { - Some(v) => v, - None => b"", - } - } - - pub fn clear_nonce(&mut self) { - self.nonce = ::std::option::Option::None; - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: ::std::vec::Vec) { - self.nonce = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { - if self.nonce.is_none() { - self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.nonce.as_mut().unwrap() - } - - // Take field - pub fn take_nonce(&mut self) -> ::std::vec::Vec { - self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes gas_price = 3; - - pub fn gas_price(&self) -> &[u8] { - match self.gas_price.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_gas_price(&mut self) { - self.gas_price = ::std::option::Option::None; - } - - pub fn has_gas_price(&self) -> bool { - self.gas_price.is_some() - } - - // Param is passed by value, moved - pub fn set_gas_price(&mut self, v: ::std::vec::Vec) { - self.gas_price = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_gas_price(&mut self) -> &mut ::std::vec::Vec { - if self.gas_price.is_none() { - self.gas_price = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.gas_price.as_mut().unwrap() - } - - // Take field - pub fn take_gas_price(&mut self) -> ::std::vec::Vec { - self.gas_price.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes gas_limit = 4; - - pub fn gas_limit(&self) -> &[u8] { - match self.gas_limit.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_gas_limit(&mut self) { - self.gas_limit = ::std::option::Option::None; - } - - pub fn has_gas_limit(&self) -> bool { - self.gas_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_gas_limit(&mut self, v: ::std::vec::Vec) { - self.gas_limit = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_gas_limit(&mut self) -> &mut ::std::vec::Vec { - if self.gas_limit.is_none() { - self.gas_limit = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.gas_limit.as_mut().unwrap() - } - - // Take field - pub fn take_gas_limit(&mut self) -> ::std::vec::Vec { - self.gas_limit.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string to = 11; - - pub fn to(&self) -> &str { - match self.to.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_to(&mut self) { - self.to = ::std::option::Option::None; - } - - pub fn has_to(&self) -> bool { - self.to.is_some() - } - - // Param is passed by value, moved - pub fn set_to(&mut self, v: ::std::string::String) { - self.to = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_to(&mut self) -> &mut ::std::string::String { - if self.to.is_none() { - self.to = ::std::option::Option::Some(::std::string::String::new()); - } - self.to.as_mut().unwrap() - } - - // Take field - pub fn take_to(&mut self) -> ::std::string::String { - self.to.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bytes value = 6; - - pub fn value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => v, - None => b"", - } - } - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes data_initial_chunk = 7; - - pub fn data_initial_chunk(&self) -> &[u8] { - match self.data_initial_chunk.as_ref() { - Some(v) => v, - None => b"", - } - } - - pub fn clear_data_initial_chunk(&mut self) { - self.data_initial_chunk = ::std::option::Option::None; - } - - pub fn has_data_initial_chunk(&self) -> bool { - self.data_initial_chunk.is_some() - } - - // Param is passed by value, moved - pub fn set_data_initial_chunk(&mut self, v: ::std::vec::Vec) { - self.data_initial_chunk = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data_initial_chunk(&mut self) -> &mut ::std::vec::Vec { - if self.data_initial_chunk.is_none() { - self.data_initial_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data_initial_chunk.as_mut().unwrap() - } - - // Take field - pub fn take_data_initial_chunk(&mut self) -> ::std::vec::Vec { - self.data_initial_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 data_length = 8; - - pub fn data_length(&self) -> u32 { - self.data_length.unwrap_or(0u32) - } - - pub fn clear_data_length(&mut self) { - self.data_length = ::std::option::Option::None; - } - - pub fn has_data_length(&self) -> bool { - self.data_length.is_some() - } - - // Param is passed by value, moved - pub fn set_data_length(&mut self, v: u32) { - self.data_length = ::std::option::Option::Some(v); - } - - // required uint64 chain_id = 9; - - pub fn chain_id(&self) -> u64 { - self.chain_id.unwrap_or(0) - } - - pub fn clear_chain_id(&mut self) { - self.chain_id = ::std::option::Option::None; - } - - pub fn has_chain_id(&self) -> bool { - self.chain_id.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_id(&mut self, v: u64) { - self.chain_id = ::std::option::Option::Some(v); - } - - // optional uint32 tx_type = 10; - - pub fn tx_type(&self) -> u32 { - self.tx_type.unwrap_or(0) - } - - pub fn clear_tx_type(&mut self) { - self.tx_type = ::std::option::Option::None; - } - - pub fn has_tx_type(&self) -> bool { - self.tx_type.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_type(&mut self, v: u32) { - self.tx_type = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 13; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(12); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EthereumSignTx| { &m.address_n }, - |m: &mut EthereumSignTx| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "nonce", - |m: &EthereumSignTx| { &m.nonce }, - |m: &mut EthereumSignTx| { &mut m.nonce }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "gas_price", - |m: &EthereumSignTx| { &m.gas_price }, - |m: &mut EthereumSignTx| { &mut m.gas_price }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "gas_limit", - |m: &EthereumSignTx| { &m.gas_limit }, - |m: &mut EthereumSignTx| { &mut m.gas_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "to", - |m: &EthereumSignTx| { &m.to }, - |m: &mut EthereumSignTx| { &mut m.to }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "value", - |m: &EthereumSignTx| { &m.value }, - |m: &mut EthereumSignTx| { &mut m.value }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_initial_chunk", - |m: &EthereumSignTx| { &m.data_initial_chunk }, - |m: &mut EthereumSignTx| { &mut m.data_initial_chunk }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_length", - |m: &EthereumSignTx| { &m.data_length }, - |m: &mut EthereumSignTx| { &mut m.data_length }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_id", - |m: &EthereumSignTx| { &m.chain_id }, - |m: &mut EthereumSignTx| { &mut m.chain_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_type", - |m: &EthereumSignTx| { &m.tx_type }, - |m: &mut EthereumSignTx| { &mut m.tx_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( - "definitions", - |m: &EthereumSignTx| { &m.definitions }, - |m: &mut EthereumSignTx| { &mut m.definitions }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &EthereumSignTx| { &m.chunkify }, - |m: &mut EthereumSignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumSignTx { - const NAME: &'static str = "EthereumSignTx"; - - fn is_initialized(&self) -> bool { - if self.gas_price.is_none() { - return false; - } - if self.gas_limit.is_none() { - return false; - } - if self.chain_id.is_none() { - return false; - } - for v in &self.definitions { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.nonce = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.gas_price = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.gas_limit = ::std::option::Option::Some(is.read_bytes()?); - }, - 90 => { - self.to = ::std::option::Option::Some(is.read_string()?); - }, - 50 => { - self.value = ::std::option::Option::Some(is.read_bytes()?); - }, - 58 => { - self.data_initial_chunk = ::std::option::Option::Some(is.read_bytes()?); - }, - 64 => { - self.data_length = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.chain_id = ::std::option::Option::Some(is.read_uint64()?); - }, - 80 => { - self.tx_type = ::std::option::Option::Some(is.read_uint32()?); - }, - 98 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.definitions)?; - }, - 104 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.nonce.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.gas_price.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.gas_limit.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.to.as_ref() { - my_size += ::protobuf::rt::string_size(11, &v); - } - if let Some(v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.data_initial_chunk.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - if let Some(v) = self.data_length { - my_size += ::protobuf::rt::uint32_size(8, v); - } - if let Some(v) = self.chain_id { - my_size += ::protobuf::rt::uint64_size(9, v); - } - if let Some(v) = self.tx_type { - my_size += ::protobuf::rt::uint32_size(10, v); - } - if let Some(v) = self.definitions.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.nonce.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.gas_price.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.gas_limit.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.to.as_ref() { - os.write_string(11, v)?; - } - if let Some(v) = self.value.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.data_initial_chunk.as_ref() { - os.write_bytes(7, v)?; - } - if let Some(v) = self.data_length { - os.write_uint32(8, v)?; - } - if let Some(v) = self.chain_id { - os.write_uint64(9, v)?; - } - if let Some(v) = self.tx_type { - os.write_uint32(10, v)?; - } - if let Some(v) = self.definitions.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; - } - if let Some(v) = self.chunkify { - os.write_bool(13, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumSignTx { - EthereumSignTx::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.nonce = ::std::option::Option::None; - self.gas_price = ::std::option::Option::None; - self.gas_limit = ::std::option::Option::None; - self.to = ::std::option::Option::None; - self.value = ::std::option::Option::None; - self.data_initial_chunk = ::std::option::Option::None; - self.data_length = ::std::option::Option::None; - self.chain_id = ::std::option::Option::None; - self.tx_type = ::std::option::Option::None; - self.definitions.clear(); - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumSignTx { - static instance: EthereumSignTx = EthereumSignTx { - address_n: ::std::vec::Vec::new(), - nonce: ::std::option::Option::None, - gas_price: ::std::option::Option::None, - gas_limit: ::std::option::Option::None, - to: ::std::option::Option::None, - value: ::std::option::Option::None, - data_initial_chunk: ::std::option::Option::None, - data_length: ::std::option::Option::None, - chain_id: ::std::option::Option::None, - tx_type: ::std::option::Option::None, - definitions: ::protobuf::MessageField::none(), - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTxEIP1559) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumSignTxEIP1559 { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.nonce) - pub nonce: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.max_gas_fee) - pub max_gas_fee: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.max_priority_fee) - pub max_priority_fee: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.gas_limit) - pub gas_limit: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.to) - pub to: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.value) - pub value: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.data_initial_chunk) - pub data_initial_chunk: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.data_length) - pub data_length: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.chain_id) - pub chain_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.access_list) - pub access_list: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.definitions) - pub definitions: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumSignTxEIP1559 { - fn default() -> &'a EthereumSignTxEIP1559 { - ::default_instance() - } -} - -impl EthereumSignTxEIP1559 { - pub fn new() -> EthereumSignTxEIP1559 { - ::std::default::Default::default() - } - - // required bytes nonce = 2; - - pub fn nonce(&self) -> &[u8] { - match self.nonce.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_nonce(&mut self) { - self.nonce = ::std::option::Option::None; - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: ::std::vec::Vec) { - self.nonce = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { - if self.nonce.is_none() { - self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.nonce.as_mut().unwrap() - } - - // Take field - pub fn take_nonce(&mut self) -> ::std::vec::Vec { - self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes max_gas_fee = 3; - - pub fn max_gas_fee(&self) -> &[u8] { - match self.max_gas_fee.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_max_gas_fee(&mut self) { - self.max_gas_fee = ::std::option::Option::None; - } - - pub fn has_max_gas_fee(&self) -> bool { - self.max_gas_fee.is_some() - } - - // Param is passed by value, moved - pub fn set_max_gas_fee(&mut self, v: ::std::vec::Vec) { - self.max_gas_fee = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_max_gas_fee(&mut self) -> &mut ::std::vec::Vec { - if self.max_gas_fee.is_none() { - self.max_gas_fee = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.max_gas_fee.as_mut().unwrap() - } - - // Take field - pub fn take_max_gas_fee(&mut self) -> ::std::vec::Vec { - self.max_gas_fee.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes max_priority_fee = 4; - - pub fn max_priority_fee(&self) -> &[u8] { - match self.max_priority_fee.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_max_priority_fee(&mut self) { - self.max_priority_fee = ::std::option::Option::None; - } - - pub fn has_max_priority_fee(&self) -> bool { - self.max_priority_fee.is_some() - } - - // Param is passed by value, moved - pub fn set_max_priority_fee(&mut self, v: ::std::vec::Vec) { - self.max_priority_fee = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_max_priority_fee(&mut self) -> &mut ::std::vec::Vec { - if self.max_priority_fee.is_none() { - self.max_priority_fee = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.max_priority_fee.as_mut().unwrap() - } - - // Take field - pub fn take_max_priority_fee(&mut self) -> ::std::vec::Vec { - self.max_priority_fee.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes gas_limit = 5; - - pub fn gas_limit(&self) -> &[u8] { - match self.gas_limit.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_gas_limit(&mut self) { - self.gas_limit = ::std::option::Option::None; - } - - pub fn has_gas_limit(&self) -> bool { - self.gas_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_gas_limit(&mut self, v: ::std::vec::Vec) { - self.gas_limit = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_gas_limit(&mut self) -> &mut ::std::vec::Vec { - if self.gas_limit.is_none() { - self.gas_limit = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.gas_limit.as_mut().unwrap() - } - - // Take field - pub fn take_gas_limit(&mut self) -> ::std::vec::Vec { - self.gas_limit.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string to = 6; - - pub fn to(&self) -> &str { - match self.to.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_to(&mut self) { - self.to = ::std::option::Option::None; - } - - pub fn has_to(&self) -> bool { - self.to.is_some() - } - - // Param is passed by value, moved - pub fn set_to(&mut self, v: ::std::string::String) { - self.to = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_to(&mut self) -> &mut ::std::string::String { - if self.to.is_none() { - self.to = ::std::option::Option::Some(::std::string::String::new()); - } - self.to.as_mut().unwrap() - } - - // Take field - pub fn take_to(&mut self) -> ::std::string::String { - self.to.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes value = 7; - - pub fn value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes data_initial_chunk = 8; - - pub fn data_initial_chunk(&self) -> &[u8] { - match self.data_initial_chunk.as_ref() { - Some(v) => v, - None => b"", - } - } - - pub fn clear_data_initial_chunk(&mut self) { - self.data_initial_chunk = ::std::option::Option::None; - } - - pub fn has_data_initial_chunk(&self) -> bool { - self.data_initial_chunk.is_some() - } - - // Param is passed by value, moved - pub fn set_data_initial_chunk(&mut self, v: ::std::vec::Vec) { - self.data_initial_chunk = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data_initial_chunk(&mut self) -> &mut ::std::vec::Vec { - if self.data_initial_chunk.is_none() { - self.data_initial_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data_initial_chunk.as_mut().unwrap() - } - - // Take field - pub fn take_data_initial_chunk(&mut self) -> ::std::vec::Vec { - self.data_initial_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 data_length = 9; - - pub fn data_length(&self) -> u32 { - self.data_length.unwrap_or(0) - } - - pub fn clear_data_length(&mut self) { - self.data_length = ::std::option::Option::None; - } - - pub fn has_data_length(&self) -> bool { - self.data_length.is_some() - } - - // Param is passed by value, moved - pub fn set_data_length(&mut self, v: u32) { - self.data_length = ::std::option::Option::Some(v); - } - - // required uint64 chain_id = 10; - - pub fn chain_id(&self) -> u64 { - self.chain_id.unwrap_or(0) - } - - pub fn clear_chain_id(&mut self) { - self.chain_id = ::std::option::Option::None; - } - - pub fn has_chain_id(&self) -> bool { - self.chain_id.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_id(&mut self, v: u64) { - self.chain_id = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 13; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(13); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EthereumSignTxEIP1559| { &m.address_n }, - |m: &mut EthereumSignTxEIP1559| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "nonce", - |m: &EthereumSignTxEIP1559| { &m.nonce }, - |m: &mut EthereumSignTxEIP1559| { &mut m.nonce }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "max_gas_fee", - |m: &EthereumSignTxEIP1559| { &m.max_gas_fee }, - |m: &mut EthereumSignTxEIP1559| { &mut m.max_gas_fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "max_priority_fee", - |m: &EthereumSignTxEIP1559| { &m.max_priority_fee }, - |m: &mut EthereumSignTxEIP1559| { &mut m.max_priority_fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "gas_limit", - |m: &EthereumSignTxEIP1559| { &m.gas_limit }, - |m: &mut EthereumSignTxEIP1559| { &mut m.gas_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "to", - |m: &EthereumSignTxEIP1559| { &m.to }, - |m: &mut EthereumSignTxEIP1559| { &mut m.to }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "value", - |m: &EthereumSignTxEIP1559| { &m.value }, - |m: &mut EthereumSignTxEIP1559| { &mut m.value }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_initial_chunk", - |m: &EthereumSignTxEIP1559| { &m.data_initial_chunk }, - |m: &mut EthereumSignTxEIP1559| { &mut m.data_initial_chunk }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_length", - |m: &EthereumSignTxEIP1559| { &m.data_length }, - |m: &mut EthereumSignTxEIP1559| { &mut m.data_length }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_id", - |m: &EthereumSignTxEIP1559| { &m.chain_id }, - |m: &mut EthereumSignTxEIP1559| { &mut m.chain_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "access_list", - |m: &EthereumSignTxEIP1559| { &m.access_list }, - |m: &mut EthereumSignTxEIP1559| { &mut m.access_list }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( - "definitions", - |m: &EthereumSignTxEIP1559| { &m.definitions }, - |m: &mut EthereumSignTxEIP1559| { &mut m.definitions }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &EthereumSignTxEIP1559| { &m.chunkify }, - |m: &mut EthereumSignTxEIP1559| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumSignTxEIP1559", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumSignTxEIP1559 { - const NAME: &'static str = "EthereumSignTxEIP1559"; - - fn is_initialized(&self) -> bool { - if self.nonce.is_none() { - return false; - } - if self.max_gas_fee.is_none() { - return false; - } - if self.max_priority_fee.is_none() { - return false; - } - if self.gas_limit.is_none() { - return false; - } - if self.value.is_none() { - return false; - } - if self.data_length.is_none() { - return false; - } - if self.chain_id.is_none() { - return false; - } - for v in &self.access_list { - if !v.is_initialized() { - return false; - } - }; - for v in &self.definitions { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.nonce = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.max_gas_fee = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.max_priority_fee = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.gas_limit = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.to = ::std::option::Option::Some(is.read_string()?); - }, - 58 => { - self.value = ::std::option::Option::Some(is.read_bytes()?); - }, - 66 => { - self.data_initial_chunk = ::std::option::Option::Some(is.read_bytes()?); - }, - 72 => { - self.data_length = ::std::option::Option::Some(is.read_uint32()?); - }, - 80 => { - self.chain_id = ::std::option::Option::Some(is.read_uint64()?); - }, - 90 => { - self.access_list.push(is.read_message()?); - }, - 98 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.definitions)?; - }, - 104 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.nonce.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.max_gas_fee.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.max_priority_fee.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.gas_limit.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.to.as_ref() { - my_size += ::protobuf::rt::string_size(6, &v); - } - if let Some(v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - if let Some(v) = self.data_initial_chunk.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - if let Some(v) = self.data_length { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.chain_id { - my_size += ::protobuf::rt::uint64_size(10, v); - } - for value in &self.access_list { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.definitions.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.nonce.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.max_gas_fee.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.max_priority_fee.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.gas_limit.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.to.as_ref() { - os.write_string(6, v)?; - } - if let Some(v) = self.value.as_ref() { - os.write_bytes(7, v)?; - } - if let Some(v) = self.data_initial_chunk.as_ref() { - os.write_bytes(8, v)?; - } - if let Some(v) = self.data_length { - os.write_uint32(9, v)?; - } - if let Some(v) = self.chain_id { - os.write_uint64(10, v)?; - } - for v in &self.access_list { - ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; - }; - if let Some(v) = self.definitions.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; - } - if let Some(v) = self.chunkify { - os.write_bool(13, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumSignTxEIP1559 { - EthereumSignTxEIP1559::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.nonce = ::std::option::Option::None; - self.max_gas_fee = ::std::option::Option::None; - self.max_priority_fee = ::std::option::Option::None; - self.gas_limit = ::std::option::Option::None; - self.to = ::std::option::Option::None; - self.value = ::std::option::Option::None; - self.data_initial_chunk = ::std::option::Option::None; - self.data_length = ::std::option::Option::None; - self.chain_id = ::std::option::Option::None; - self.access_list.clear(); - self.definitions.clear(); - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumSignTxEIP1559 { - static instance: EthereumSignTxEIP1559 = EthereumSignTxEIP1559 { - address_n: ::std::vec::Vec::new(), - nonce: ::std::option::Option::None, - max_gas_fee: ::std::option::Option::None, - max_priority_fee: ::std::option::Option::None, - gas_limit: ::std::option::Option::None, - to: ::std::option::Option::None, - value: ::std::option::Option::None, - data_initial_chunk: ::std::option::Option::None, - data_length: ::std::option::Option::None, - chain_id: ::std::option::Option::None, - access_list: ::std::vec::Vec::new(), - definitions: ::protobuf::MessageField::none(), - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumSignTxEIP1559 { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTxEIP1559").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumSignTxEIP1559 { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumSignTxEIP1559 { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `EthereumSignTxEIP1559` -pub mod ethereum_sign_tx_eip1559 { - // @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EthereumAccessList { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList.storage_keys) - pub storage_keys: ::std::vec::Vec<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EthereumAccessList { - fn default() -> &'a EthereumAccessList { - ::default_instance() - } - } - - impl EthereumAccessList { - pub fn new() -> EthereumAccessList { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &EthereumAccessList| { &m.address }, - |m: &mut EthereumAccessList| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "storage_keys", - |m: &EthereumAccessList| { &m.storage_keys }, - |m: &mut EthereumAccessList| { &mut m.storage_keys }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumSignTxEIP1559.EthereumAccessList", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EthereumAccessList { - const NAME: &'static str = "EthereumAccessList"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.storage_keys.push(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - for value in &self.storage_keys { - my_size += ::protobuf::rt::bytes_size(2, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - for v in &self.storage_keys { - os.write_bytes(2, &v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumAccessList { - EthereumAccessList::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.storage_keys.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumAccessList { - static instance: EthereumAccessList = EthereumAccessList { - address: ::std::option::Option::None, - storage_keys: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EthereumAccessList { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EthereumSignTxEIP1559.EthereumAccessList").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EthereumAccessList { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EthereumAccessList { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumTxRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTxRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.data_length) - pub data_length: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.signature_v) - pub signature_v: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.signature_r) - pub signature_r: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.signature_s) - pub signature_s: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTxRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTxRequest { - fn default() -> &'a EthereumTxRequest { - ::default_instance() - } -} - -impl EthereumTxRequest { - pub fn new() -> EthereumTxRequest { - ::std::default::Default::default() - } - - // optional uint32 data_length = 1; - - pub fn data_length(&self) -> u32 { - self.data_length.unwrap_or(0) - } - - pub fn clear_data_length(&mut self) { - self.data_length = ::std::option::Option::None; - } - - pub fn has_data_length(&self) -> bool { - self.data_length.is_some() - } - - // Param is passed by value, moved - pub fn set_data_length(&mut self, v: u32) { - self.data_length = ::std::option::Option::Some(v); - } - - // optional uint32 signature_v = 2; - - pub fn signature_v(&self) -> u32 { - self.signature_v.unwrap_or(0) - } - - pub fn clear_signature_v(&mut self) { - self.signature_v = ::std::option::Option::None; - } - - pub fn has_signature_v(&self) -> bool { - self.signature_v.is_some() - } - - // Param is passed by value, moved - pub fn set_signature_v(&mut self, v: u32) { - self.signature_v = ::std::option::Option::Some(v); - } - - // optional bytes signature_r = 3; - - pub fn signature_r(&self) -> &[u8] { - match self.signature_r.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature_r(&mut self) { - self.signature_r = ::std::option::Option::None; - } - - pub fn has_signature_r(&self) -> bool { - self.signature_r.is_some() - } - - // Param is passed by value, moved - pub fn set_signature_r(&mut self, v: ::std::vec::Vec) { - self.signature_r = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature_r(&mut self) -> &mut ::std::vec::Vec { - if self.signature_r.is_none() { - self.signature_r = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature_r.as_mut().unwrap() - } - - // Take field - pub fn take_signature_r(&mut self) -> ::std::vec::Vec { - self.signature_r.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes signature_s = 4; - - pub fn signature_s(&self) -> &[u8] { - match self.signature_s.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature_s(&mut self) { - self.signature_s = ::std::option::Option::None; - } - - pub fn has_signature_s(&self) -> bool { - self.signature_s.is_some() - } - - // Param is passed by value, moved - pub fn set_signature_s(&mut self, v: ::std::vec::Vec) { - self.signature_s = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature_s(&mut self) -> &mut ::std::vec::Vec { - if self.signature_s.is_none() { - self.signature_s = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature_s.as_mut().unwrap() - } - - // Take field - pub fn take_signature_s(&mut self) -> ::std::vec::Vec { - self.signature_s.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_length", - |m: &EthereumTxRequest| { &m.data_length }, - |m: &mut EthereumTxRequest| { &mut m.data_length }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature_v", - |m: &EthereumTxRequest| { &m.signature_v }, - |m: &mut EthereumTxRequest| { &mut m.signature_v }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature_r", - |m: &EthereumTxRequest| { &m.signature_r }, - |m: &mut EthereumTxRequest| { &mut m.signature_r }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature_s", - |m: &EthereumTxRequest| { &m.signature_s }, - |m: &mut EthereumTxRequest| { &mut m.signature_s }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTxRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTxRequest { - const NAME: &'static str = "EthereumTxRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.data_length = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.signature_v = ::std::option::Option::Some(is.read_uint32()?); - }, - 26 => { - self.signature_r = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.signature_s = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_length { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.signature_v { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.signature_r.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.signature_s.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_length { - os.write_uint32(1, v)?; - } - if let Some(v) = self.signature_v { - os.write_uint32(2, v)?; - } - if let Some(v) = self.signature_r.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.signature_s.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTxRequest { - EthereumTxRequest::new() - } - - fn clear(&mut self) { - self.data_length = ::std::option::Option::None; - self.signature_v = ::std::option::Option::None; - self.signature_r = ::std::option::Option::None; - self.signature_s = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTxRequest { - static instance: EthereumTxRequest = EthereumTxRequest { - data_length: ::std::option::Option::None, - signature_v: ::std::option::Option::None, - signature_r: ::std::option::Option::None, - signature_s: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTxRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTxRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTxRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTxRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumTxAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTxAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxAck.data_chunk) - pub data_chunk: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTxAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTxAck { - fn default() -> &'a EthereumTxAck { - ::default_instance() - } -} - -impl EthereumTxAck { - pub fn new() -> EthereumTxAck { - ::std::default::Default::default() - } - - // required bytes data_chunk = 1; - - pub fn data_chunk(&self) -> &[u8] { - match self.data_chunk.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data_chunk(&mut self) { - self.data_chunk = ::std::option::Option::None; - } - - pub fn has_data_chunk(&self) -> bool { - self.data_chunk.is_some() - } - - // Param is passed by value, moved - pub fn set_data_chunk(&mut self, v: ::std::vec::Vec) { - self.data_chunk = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data_chunk(&mut self) -> &mut ::std::vec::Vec { - if self.data_chunk.is_none() { - self.data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data_chunk.as_mut().unwrap() - } - - // Take field - pub fn take_data_chunk(&mut self) -> ::std::vec::Vec { - self.data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_chunk", - |m: &EthereumTxAck| { &m.data_chunk }, - |m: &mut EthereumTxAck| { &mut m.data_chunk }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTxAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTxAck { - const NAME: &'static str = "EthereumTxAck"; - - fn is_initialized(&self) -> bool { - if self.data_chunk.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.data_chunk = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_chunk.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_chunk.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTxAck { - EthereumTxAck::new() - } - - fn clear(&mut self) { - self.data_chunk = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTxAck { - static instance: EthereumTxAck = EthereumTxAck { - data_chunk: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTxAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTxAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTxAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTxAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignMessage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumSignMessage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.message) - pub message: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.encoded_network) - pub encoded_network: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignMessage.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignMessage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumSignMessage { - fn default() -> &'a EthereumSignMessage { - ::default_instance() - } -} - -impl EthereumSignMessage { - pub fn new() -> EthereumSignMessage { - ::std::default::Default::default() - } - - // required bytes message = 2; - - pub fn message(&self) -> &[u8] { - match self.message.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::vec::Vec) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::vec::Vec { - self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes encoded_network = 3; - - pub fn encoded_network(&self) -> &[u8] { - match self.encoded_network.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_encoded_network(&mut self) { - self.encoded_network = ::std::option::Option::None; - } - - pub fn has_encoded_network(&self) -> bool { - self.encoded_network.is_some() - } - - // Param is passed by value, moved - pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { - self.encoded_network = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { - if self.encoded_network.is_none() { - self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.encoded_network.as_mut().unwrap() - } - - // Take field - pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { - self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool chunkify = 4; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EthereumSignMessage| { &m.address_n }, - |m: &mut EthereumSignMessage| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &EthereumSignMessage| { &m.message }, - |m: &mut EthereumSignMessage| { &mut m.message }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "encoded_network", - |m: &EthereumSignMessage| { &m.encoded_network }, - |m: &mut EthereumSignMessage| { &mut m.encoded_network }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &EthereumSignMessage| { &m.chunkify }, - |m: &mut EthereumSignMessage| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumSignMessage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumSignMessage { - const NAME: &'static str = "EthereumSignMessage"; - - fn is_initialized(&self) -> bool { - if self.message.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.message = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); - }, - 32 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.encoded_network.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.message.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.encoded_network.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumSignMessage { - EthereumSignMessage::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.message = ::std::option::Option::None; - self.encoded_network = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumSignMessage { - static instance: EthereumSignMessage = EthereumSignMessage { - address_n: ::std::vec::Vec::new(), - message: ::std::option::Option::None, - encoded_network: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumSignMessage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignMessage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumSignMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumSignMessage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumMessageSignature) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumMessageSignature { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumMessageSignature.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumMessageSignature.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumMessageSignature.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumMessageSignature { - fn default() -> &'a EthereumMessageSignature { - ::default_instance() - } -} - -impl EthereumMessageSignature { - pub fn new() -> EthereumMessageSignature { - ::std::default::Default::default() - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string address = 3; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &EthereumMessageSignature| { &m.signature }, - |m: &mut EthereumMessageSignature| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &EthereumMessageSignature| { &m.address }, - |m: &mut EthereumMessageSignature| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumMessageSignature", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumMessageSignature { - const NAME: &'static str = "EthereumMessageSignature"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.address.as_ref() { - os.write_string(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumMessageSignature { - EthereumMessageSignature::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumMessageSignature { - static instance: EthereumMessageSignature = EthereumMessageSignature { - signature: ::std::option::Option::None, - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumMessageSignature { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumMessageSignature").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumMessageSignature { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumMessageSignature { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumVerifyMessage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumVerifyMessage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.message) - pub message: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumVerifyMessage.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumVerifyMessage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumVerifyMessage { - fn default() -> &'a EthereumVerifyMessage { - ::default_instance() - } -} - -impl EthereumVerifyMessage { - pub fn new() -> EthereumVerifyMessage { - ::std::default::Default::default() - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes message = 3; - - pub fn message(&self) -> &[u8] { - match self.message.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::vec::Vec) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::vec::Vec { - self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string address = 4; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool chunkify = 5; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &EthereumVerifyMessage| { &m.signature }, - |m: &mut EthereumVerifyMessage| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &EthereumVerifyMessage| { &m.message }, - |m: &mut EthereumVerifyMessage| { &mut m.message }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &EthereumVerifyMessage| { &m.address }, - |m: &mut EthereumVerifyMessage| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &EthereumVerifyMessage| { &m.chunkify }, - |m: &mut EthereumVerifyMessage| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumVerifyMessage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumVerifyMessage { - const NAME: &'static str = "EthereumVerifyMessage"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - if self.message.is_none() { - return false; - } - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.message = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 40 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.message.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.address.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumVerifyMessage { - EthereumVerifyMessage::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.message = ::std::option::Option::None; - self.address = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumVerifyMessage { - static instance: EthereumVerifyMessage = EthereumVerifyMessage { - signature: ::std::option::Option::None, - message: ::std::option::Option::None, - address: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumVerifyMessage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumVerifyMessage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumVerifyMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumVerifyMessage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumSignTypedHash) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumSignTypedHash { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.domain_separator_hash) - pub domain_separator_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.message_hash) - pub message_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTypedHash.encoded_network) - pub encoded_network: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTypedHash.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumSignTypedHash { - fn default() -> &'a EthereumSignTypedHash { - ::default_instance() - } -} - -impl EthereumSignTypedHash { - pub fn new() -> EthereumSignTypedHash { - ::std::default::Default::default() - } - - // required bytes domain_separator_hash = 2; - - pub fn domain_separator_hash(&self) -> &[u8] { - match self.domain_separator_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_domain_separator_hash(&mut self) { - self.domain_separator_hash = ::std::option::Option::None; - } - - pub fn has_domain_separator_hash(&self) -> bool { - self.domain_separator_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_domain_separator_hash(&mut self, v: ::std::vec::Vec) { - self.domain_separator_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_domain_separator_hash(&mut self) -> &mut ::std::vec::Vec { - if self.domain_separator_hash.is_none() { - self.domain_separator_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.domain_separator_hash.as_mut().unwrap() - } - - // Take field - pub fn take_domain_separator_hash(&mut self) -> ::std::vec::Vec { - self.domain_separator_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes message_hash = 3; - - pub fn message_hash(&self) -> &[u8] { - match self.message_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_message_hash(&mut self) { - self.message_hash = ::std::option::Option::None; - } - - pub fn has_message_hash(&self) -> bool { - self.message_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_message_hash(&mut self, v: ::std::vec::Vec) { - self.message_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message_hash(&mut self) -> &mut ::std::vec::Vec { - if self.message_hash.is_none() { - self.message_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.message_hash.as_mut().unwrap() - } - - // Take field - pub fn take_message_hash(&mut self) -> ::std::vec::Vec { - self.message_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes encoded_network = 4; - - pub fn encoded_network(&self) -> &[u8] { - match self.encoded_network.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_encoded_network(&mut self) { - self.encoded_network = ::std::option::Option::None; - } - - pub fn has_encoded_network(&self) -> bool { - self.encoded_network.is_some() - } - - // Param is passed by value, moved - pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { - self.encoded_network = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { - if self.encoded_network.is_none() { - self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.encoded_network.as_mut().unwrap() - } - - // Take field - pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { - self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EthereumSignTypedHash| { &m.address_n }, - |m: &mut EthereumSignTypedHash| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "domain_separator_hash", - |m: &EthereumSignTypedHash| { &m.domain_separator_hash }, - |m: &mut EthereumSignTypedHash| { &mut m.domain_separator_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message_hash", - |m: &EthereumSignTypedHash| { &m.message_hash }, - |m: &mut EthereumSignTypedHash| { &mut m.message_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "encoded_network", - |m: &EthereumSignTypedHash| { &m.encoded_network }, - |m: &mut EthereumSignTypedHash| { &mut m.encoded_network }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumSignTypedHash", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumSignTypedHash { - const NAME: &'static str = "EthereumSignTypedHash"; - - fn is_initialized(&self) -> bool { - if self.domain_separator_hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.domain_separator_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.message_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.domain_separator_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.message_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.encoded_network.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.domain_separator_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.message_hash.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.encoded_network.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumSignTypedHash { - EthereumSignTypedHash::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.domain_separator_hash = ::std::option::Option::None; - self.message_hash = ::std::option::Option::None; - self.encoded_network = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumSignTypedHash { - static instance: EthereumSignTypedHash = EthereumSignTypedHash { - address_n: ::std::vec::Vec::new(), - domain_separator_hash: ::std::option::Option::None, - message_hash: ::std::option::Option::None, - encoded_network: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumSignTypedHash { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTypedHash").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumSignTypedHash { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumSignTypedHash { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumTypedDataSignature) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTypedDataSignature { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTypedDataSignature.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTypedDataSignature.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTypedDataSignature.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTypedDataSignature { - fn default() -> &'a EthereumTypedDataSignature { - ::default_instance() - } -} - -impl EthereumTypedDataSignature { - pub fn new() -> EthereumTypedDataSignature { - ::std::default::Default::default() - } - - // required bytes signature = 1; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string address = 2; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &EthereumTypedDataSignature| { &m.signature }, - |m: &mut EthereumTypedDataSignature| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &EthereumTypedDataSignature| { &m.address }, - |m: &mut EthereumTypedDataSignature| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTypedDataSignature", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTypedDataSignature { - const NAME: &'static str = "EthereumTypedDataSignature"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.address.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTypedDataSignature { - EthereumTypedDataSignature::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTypedDataSignature { - static instance: EthereumTypedDataSignature = EthereumTypedDataSignature { - signature: ::std::option::Option::None, - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTypedDataSignature { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataSignature").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTypedDataSignature { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataSignature { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x17messages-ethereum.proto\x12\x1bhw.trezor.messages.ethereum\x1a\x15\ - messages-common.proto\x1a#messages-ethereum-definitions.proto\"V\n\x14Et\ - hereumGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"b\n\x11Eth\ - ereumPublicKey\x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trezor.messages.\ - common.HDNodeTypeR\x04node\x12\x12\n\x04xpub\x18\x02\x20\x02(\tR\x04xpub\ - \"\x99\x01\n\x12EthereumGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\ - \rR\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisp\ - lay\x12'\n\x0fencoded_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\ - \x12\x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\x08chunkify\"Q\n\x0fEthereu\ - mAddress\x12$\n\x0c_old_address\x18\x01\x20\x01(\x0cR\nOldAddressB\x02\ - \x18\x01\x12\x18\n\x07address\x18\x02\x20\x01(\tR\x07address\"\xad\x03\n\ - \x0eEthereumSignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12\x16\n\x05nonce\x18\x02\x20\x01(\x0c:\0R\x05nonce\x12\x1b\n\tgas_pri\ - ce\x18\x03\x20\x02(\x0cR\x08gasPrice\x12\x1b\n\tgas_limit\x18\x04\x20\ - \x02(\x0cR\x08gasLimit\x12\x10\n\x02to\x18\x0b\x20\x01(\t:\0R\x02to\x12\ - \x16\n\x05value\x18\x06\x20\x01(\x0c:\0R\x05value\x12.\n\x12data_initial\ - _chunk\x18\x07\x20\x01(\x0c:\0R\x10dataInitialChunk\x12\"\n\x0bdata_leng\ - th\x18\x08\x20\x01(\r:\x010R\ndataLength\x12\x19\n\x08chain_id\x18\t\x20\ - \x02(\x04R\x07chainId\x12\x17\n\x07tx_type\x18\n\x20\x01(\rR\x06txType\ - \x12^\n\x0bdefinitions\x18\x0c\x20\x01(\x0b2<.hw.trezor.messages.ethereu\ - m_definitions.EthereumDefinitionsR\x0bdefinitions\x12\x1a\n\x08chunkify\ - \x18\r\x20\x01(\x08R\x08chunkify\"\xfc\x04\n\x15EthereumSignTxEIP1559\ - \x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x14\n\x05nonce\ - \x18\x02\x20\x02(\x0cR\x05nonce\x12\x1e\n\x0bmax_gas_fee\x18\x03\x20\x02\ - (\x0cR\tmaxGasFee\x12(\n\x10max_priority_fee\x18\x04\x20\x02(\x0cR\x0ema\ - xPriorityFee\x12\x1b\n\tgas_limit\x18\x05\x20\x02(\x0cR\x08gasLimit\x12\ - \x10\n\x02to\x18\x06\x20\x01(\t:\0R\x02to\x12\x14\n\x05value\x18\x07\x20\ - \x02(\x0cR\x05value\x12.\n\x12data_initial_chunk\x18\x08\x20\x01(\x0c:\0\ - R\x10dataInitialChunk\x12\x1f\n\x0bdata_length\x18\t\x20\x02(\rR\ndataLe\ - ngth\x12\x19\n\x08chain_id\x18\n\x20\x02(\x04R\x07chainId\x12f\n\x0bacce\ - ss_list\x18\x0b\x20\x03(\x0b2E.hw.trezor.messages.ethereum.EthereumSignT\ - xEIP1559.EthereumAccessListR\naccessList\x12^\n\x0bdefinitions\x18\x0c\ - \x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions.EthereumDefiniti\ - onsR\x0bdefinitions\x12\x1a\n\x08chunkify\x18\r\x20\x01(\x08R\x08chunkif\ - y\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ - \x07address\x12!\n\x0cstorage_keys\x18\x02\x20\x03(\x0cR\x0bstorageKeys\ - \"\x97\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\ - \x01(\rR\ndataLength\x12\x1f\n\x0bsignature_v\x18\x02\x20\x01(\rR\nsigna\ - tureV\x12\x1f\n\x0bsignature_r\x18\x03\x20\x01(\x0cR\nsignatureR\x12\x1f\ - \n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\".\n\rEthereumTxAck\ - \x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\x91\x01\n\x13E\ - thereumSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07message\x12'\n\x0fencoded\ - _network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\ - \x18\x04\x20\x01(\x08R\x08chunkify\"R\n\x18EthereumMessageSignature\x12\ - \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\ - \x18\x03\x20\x02(\tR\x07address\"\x85\x01\n\x15EthereumVerifyMessage\x12\ - \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\ - \x18\x03\x20\x02(\x0cR\x07message\x12\x18\n\x07address\x18\x04\x20\x02(\ - \tR\x07address\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\ - \xb4\x01\n\x15EthereumSignTypedHash\x12\x1b\n\taddress_n\x18\x01\x20\x03\ - (\rR\x08addressN\x122\n\x15domain_separator_hash\x18\x02\x20\x02(\x0cR\ - \x13domainSeparatorHash\x12!\n\x0cmessage_hash\x18\x03\x20\x01(\x0cR\x0b\ - messageHash\x12'\n\x0fencoded_network\x18\x04\x20\x01(\x0cR\x0eencodedNe\ - twork\"T\n\x1aEthereumTypedDataSignature\x12\x1c\n\tsignature\x18\x01\ - \x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07ad\ - dressB<\n#com.satoshilabs.trezor.lib.protobufB\x15TrezorMessageEthereum\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(2); - deps.push(super::messages_common::file_descriptor().clone()); - deps.push(super::messages_ethereum_definitions::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(14); - messages.push(EthereumGetPublicKey::generated_message_descriptor_data()); - messages.push(EthereumPublicKey::generated_message_descriptor_data()); - messages.push(EthereumGetAddress::generated_message_descriptor_data()); - messages.push(EthereumAddress::generated_message_descriptor_data()); - messages.push(EthereumSignTx::generated_message_descriptor_data()); - messages.push(EthereumSignTxEIP1559::generated_message_descriptor_data()); - messages.push(EthereumTxRequest::generated_message_descriptor_data()); - messages.push(EthereumTxAck::generated_message_descriptor_data()); - messages.push(EthereumSignMessage::generated_message_descriptor_data()); - messages.push(EthereumMessageSignature::generated_message_descriptor_data()); - messages.push(EthereumVerifyMessage::generated_message_descriptor_data()); - messages.push(EthereumSignTypedHash::generated_message_descriptor_data()); - messages.push(EthereumTypedDataSignature::generated_message_descriptor_data()); - messages.push(ethereum_sign_tx_eip1559::EthereumAccessList::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs b/wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs deleted file mode 100644 index a212384667..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_ethereum_definitions.rs +++ /dev/null @@ -1,1001 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-ethereum-definitions.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumNetworkInfo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.chain_id) - pub chain_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.symbol) - pub symbol: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.slip44) - pub slip44: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.name) - pub name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumNetworkInfo { - fn default() -> &'a EthereumNetworkInfo { - ::default_instance() - } -} - -impl EthereumNetworkInfo { - pub fn new() -> EthereumNetworkInfo { - ::std::default::Default::default() - } - - // required uint64 chain_id = 1; - - pub fn chain_id(&self) -> u64 { - self.chain_id.unwrap_or(0) - } - - pub fn clear_chain_id(&mut self) { - self.chain_id = ::std::option::Option::None; - } - - pub fn has_chain_id(&self) -> bool { - self.chain_id.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_id(&mut self, v: u64) { - self.chain_id = ::std::option::Option::Some(v); - } - - // required string symbol = 2; - - pub fn symbol(&self) -> &str { - match self.symbol.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_symbol(&mut self) { - self.symbol = ::std::option::Option::None; - } - - pub fn has_symbol(&self) -> bool { - self.symbol.is_some() - } - - // Param is passed by value, moved - pub fn set_symbol(&mut self, v: ::std::string::String) { - self.symbol = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_symbol(&mut self) -> &mut ::std::string::String { - if self.symbol.is_none() { - self.symbol = ::std::option::Option::Some(::std::string::String::new()); - } - self.symbol.as_mut().unwrap() - } - - // Take field - pub fn take_symbol(&mut self) -> ::std::string::String { - self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint32 slip44 = 3; - - pub fn slip44(&self) -> u32 { - self.slip44.unwrap_or(0) - } - - pub fn clear_slip44(&mut self) { - self.slip44 = ::std::option::Option::None; - } - - pub fn has_slip44(&self) -> bool { - self.slip44.is_some() - } - - // Param is passed by value, moved - pub fn set_slip44(&mut self, v: u32) { - self.slip44 = ::std::option::Option::Some(v); - } - - // required string name = 4; - - pub fn name(&self) -> &str { - match self.name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if self.name.is_none() { - self.name = ::std::option::Option::Some(::std::string::String::new()); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - self.name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_id", - |m: &EthereumNetworkInfo| { &m.chain_id }, - |m: &mut EthereumNetworkInfo| { &mut m.chain_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "symbol", - |m: &EthereumNetworkInfo| { &m.symbol }, - |m: &mut EthereumNetworkInfo| { &mut m.symbol }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "slip44", - |m: &EthereumNetworkInfo| { &m.slip44 }, - |m: &mut EthereumNetworkInfo| { &mut m.slip44 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &EthereumNetworkInfo| { &m.name }, - |m: &mut EthereumNetworkInfo| { &mut m.name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumNetworkInfo", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumNetworkInfo { - const NAME: &'static str = "EthereumNetworkInfo"; - - fn is_initialized(&self) -> bool { - if self.chain_id.is_none() { - return false; - } - if self.symbol.is_none() { - return false; - } - if self.slip44.is_none() { - return false; - } - if self.name.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.chain_id = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - self.symbol = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.slip44 = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - self.name = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.chain_id { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.symbol.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.slip44 { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.chain_id { - os.write_uint64(1, v)?; - } - if let Some(v) = self.symbol.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.slip44 { - os.write_uint32(3, v)?; - } - if let Some(v) = self.name.as_ref() { - os.write_string(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumNetworkInfo { - EthereumNetworkInfo::new() - } - - fn clear(&mut self) { - self.chain_id = ::std::option::Option::None; - self.symbol = ::std::option::Option::None; - self.slip44 = ::std::option::Option::None; - self.name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumNetworkInfo { - static instance: EthereumNetworkInfo = EthereumNetworkInfo { - chain_id: ::std::option::Option::None, - symbol: ::std::option::Option::None, - slip44: ::std::option::Option::None, - name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumNetworkInfo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumNetworkInfo").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumNetworkInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumNetworkInfo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTokenInfo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.address) - pub address: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.chain_id) - pub chain_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.symbol) - pub symbol: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.decimals) - pub decimals: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.name) - pub name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTokenInfo { - fn default() -> &'a EthereumTokenInfo { - ::default_instance() - } -} - -impl EthereumTokenInfo { - pub fn new() -> EthereumTokenInfo { - ::std::default::Default::default() - } - - // required bytes address = 1; - - pub fn address(&self) -> &[u8] { - match self.address.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::vec::Vec) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::vec::Vec { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::vec::Vec { - self.address.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 chain_id = 2; - - pub fn chain_id(&self) -> u64 { - self.chain_id.unwrap_or(0) - } - - pub fn clear_chain_id(&mut self) { - self.chain_id = ::std::option::Option::None; - } - - pub fn has_chain_id(&self) -> bool { - self.chain_id.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_id(&mut self, v: u64) { - self.chain_id = ::std::option::Option::Some(v); - } - - // required string symbol = 3; - - pub fn symbol(&self) -> &str { - match self.symbol.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_symbol(&mut self) { - self.symbol = ::std::option::Option::None; - } - - pub fn has_symbol(&self) -> bool { - self.symbol.is_some() - } - - // Param is passed by value, moved - pub fn set_symbol(&mut self, v: ::std::string::String) { - self.symbol = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_symbol(&mut self) -> &mut ::std::string::String { - if self.symbol.is_none() { - self.symbol = ::std::option::Option::Some(::std::string::String::new()); - } - self.symbol.as_mut().unwrap() - } - - // Take field - pub fn take_symbol(&mut self) -> ::std::string::String { - self.symbol.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint32 decimals = 4; - - pub fn decimals(&self) -> u32 { - self.decimals.unwrap_or(0) - } - - pub fn clear_decimals(&mut self) { - self.decimals = ::std::option::Option::None; - } - - pub fn has_decimals(&self) -> bool { - self.decimals.is_some() - } - - // Param is passed by value, moved - pub fn set_decimals(&mut self, v: u32) { - self.decimals = ::std::option::Option::Some(v); - } - - // required string name = 5; - - pub fn name(&self) -> &str { - match self.name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if self.name.is_none() { - self.name = ::std::option::Option::Some(::std::string::String::new()); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - self.name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &EthereumTokenInfo| { &m.address }, - |m: &mut EthereumTokenInfo| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_id", - |m: &EthereumTokenInfo| { &m.chain_id }, - |m: &mut EthereumTokenInfo| { &mut m.chain_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "symbol", - |m: &EthereumTokenInfo| { &m.symbol }, - |m: &mut EthereumTokenInfo| { &mut m.symbol }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decimals", - |m: &EthereumTokenInfo| { &m.decimals }, - |m: &mut EthereumTokenInfo| { &mut m.decimals }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &EthereumTokenInfo| { &m.name }, - |m: &mut EthereumTokenInfo| { &mut m.name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTokenInfo", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTokenInfo { - const NAME: &'static str = "EthereumTokenInfo"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.chain_id.is_none() { - return false; - } - if self.symbol.is_none() { - return false; - } - if self.decimals.is_none() { - return false; - } - if self.name.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.chain_id = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - self.symbol = ::std::option::Option::Some(is.read_string()?); - }, - 32 => { - self.decimals = ::std::option::Option::Some(is.read_uint32()?); - }, - 42 => { - self.name = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.chain_id { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.symbol.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.decimals { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.chain_id { - os.write_uint64(2, v)?; - } - if let Some(v) = self.symbol.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.decimals { - os.write_uint32(4, v)?; - } - if let Some(v) = self.name.as_ref() { - os.write_string(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTokenInfo { - EthereumTokenInfo::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.chain_id = ::std::option::Option::None; - self.symbol = ::std::option::Option::None; - self.decimals = ::std::option::Option::None; - self.name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTokenInfo { - static instance: EthereumTokenInfo = EthereumTokenInfo { - address: ::std::option::Option::None, - chain_id: ::std::option::Option::None, - symbol: ::std::option::Option::None, - decimals: ::std::option::Option::None, - name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTokenInfo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTokenInfo").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTokenInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTokenInfo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumDefinitions) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumDefinitions { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_network) - pub encoded_network: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_token) - pub encoded_token: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumDefinitions { - fn default() -> &'a EthereumDefinitions { - ::default_instance() - } -} - -impl EthereumDefinitions { - pub fn new() -> EthereumDefinitions { - ::std::default::Default::default() - } - - // optional bytes encoded_network = 1; - - pub fn encoded_network(&self) -> &[u8] { - match self.encoded_network.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_encoded_network(&mut self) { - self.encoded_network = ::std::option::Option::None; - } - - pub fn has_encoded_network(&self) -> bool { - self.encoded_network.is_some() - } - - // Param is passed by value, moved - pub fn set_encoded_network(&mut self, v: ::std::vec::Vec) { - self.encoded_network = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec { - if self.encoded_network.is_none() { - self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.encoded_network.as_mut().unwrap() - } - - // Take field - pub fn take_encoded_network(&mut self) -> ::std::vec::Vec { - self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes encoded_token = 2; - - pub fn encoded_token(&self) -> &[u8] { - match self.encoded_token.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_encoded_token(&mut self) { - self.encoded_token = ::std::option::Option::None; - } - - pub fn has_encoded_token(&self) -> bool { - self.encoded_token.is_some() - } - - // Param is passed by value, moved - pub fn set_encoded_token(&mut self, v: ::std::vec::Vec) { - self.encoded_token = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_encoded_token(&mut self) -> &mut ::std::vec::Vec { - if self.encoded_token.is_none() { - self.encoded_token = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.encoded_token.as_mut().unwrap() - } - - // Take field - pub fn take_encoded_token(&mut self) -> ::std::vec::Vec { - self.encoded_token.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "encoded_network", - |m: &EthereumDefinitions| { &m.encoded_network }, - |m: &mut EthereumDefinitions| { &mut m.encoded_network }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "encoded_token", - |m: &EthereumDefinitions| { &m.encoded_token }, - |m: &mut EthereumDefinitions| { &mut m.encoded_token }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumDefinitions", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumDefinitions { - const NAME: &'static str = "EthereumDefinitions"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.encoded_token = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.encoded_network.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.encoded_token.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.encoded_network.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.encoded_token.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumDefinitions { - EthereumDefinitions::new() - } - - fn clear(&mut self) { - self.encoded_network = ::std::option::Option::None; - self.encoded_token = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumDefinitions { - static instance: EthereumDefinitions = EthereumDefinitions { - encoded_network: ::std::option::Option::None, - encoded_token: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumDefinitions { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumDefinitions").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumDefinitions { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumDefinitions { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType) -pub enum EthereumDefinitionType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.NETWORK) - NETWORK = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.TOKEN) - TOKEN = 1, -} - -impl ::protobuf::Enum for EthereumDefinitionType { - const NAME: &'static str = "EthereumDefinitionType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(EthereumDefinitionType::NETWORK), - 1 => ::std::option::Option::Some(EthereumDefinitionType::TOKEN), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "NETWORK" => ::std::option::Option::Some(EthereumDefinitionType::NETWORK), - "TOKEN" => ::std::option::Option::Some(EthereumDefinitionType::TOKEN), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [EthereumDefinitionType] = &[ - EthereumDefinitionType::NETWORK, - EthereumDefinitionType::TOKEN, - ]; -} - -impl ::protobuf::EnumFull for EthereumDefinitionType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("EthereumDefinitionType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for EthereumDefinitionType { - fn default() -> Self { - EthereumDefinitionType::NETWORK - } -} - -impl EthereumDefinitionType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("EthereumDefinitionType") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n#messages-ethereum-definitions.proto\x12'hw.trezor.messages.ethereum_d\ - efinitions\"t\n\x13EthereumNetworkInfo\x12\x19\n\x08chain_id\x18\x01\x20\ - \x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06symbol\ - \x12\x16\n\x06slip44\x18\x03\x20\x02(\rR\x06slip44\x12\x12\n\x04name\x18\ - \x04\x20\x02(\tR\x04name\"\x90\x01\n\x11EthereumTokenInfo\x12\x18\n\x07a\ - ddress\x18\x01\x20\x02(\x0cR\x07address\x12\x19\n\x08chain_id\x18\x02\ - \x20\x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x03\x20\x02(\tR\x06sym\ - bol\x12\x1a\n\x08decimals\x18\x04\x20\x02(\rR\x08decimals\x12\x12\n\x04n\ - ame\x18\x05\x20\x02(\tR\x04name\"c\n\x13EthereumDefinitions\x12'\n\x0fen\ - coded_network\x18\x01\x20\x01(\x0cR\x0eencodedNetwork\x12#\n\rencoded_to\ - ken\x18\x02\x20\x01(\x0cR\x0cencodedToken*0\n\x16EthereumDefinitionType\ - \x12\x0b\n\x07NETWORK\x10\0\x12\t\n\x05TOKEN\x10\x01BG\n#com.satoshilabs\ - .trezor.lib.protobufB\x20TrezorMessageEthereumDefinitions\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(3); - messages.push(EthereumNetworkInfo::generated_message_descriptor_data()); - messages.push(EthereumTokenInfo::generated_message_descriptor_data()); - messages.push(EthereumDefinitions::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(1); - enums.push(EthereumDefinitionType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs b/wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs deleted file mode 100644 index 6e982994fb..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_ethereum_eip712.rs +++ /dev/null @@ -1,1465 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-ethereum-eip712.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumSignTypedData { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.primary_type) - pub primary_type: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.metamask_v4_compat) - pub metamask_v4_compat: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.definitions) - pub definitions: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumSignTypedData { - fn default() -> &'a EthereumSignTypedData { - ::default_instance() - } -} - -impl EthereumSignTypedData { - pub fn new() -> EthereumSignTypedData { - ::std::default::Default::default() - } - - // required string primary_type = 2; - - pub fn primary_type(&self) -> &str { - match self.primary_type.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_primary_type(&mut self) { - self.primary_type = ::std::option::Option::None; - } - - pub fn has_primary_type(&self) -> bool { - self.primary_type.is_some() - } - - // Param is passed by value, moved - pub fn set_primary_type(&mut self, v: ::std::string::String) { - self.primary_type = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_primary_type(&mut self) -> &mut ::std::string::String { - if self.primary_type.is_none() { - self.primary_type = ::std::option::Option::Some(::std::string::String::new()); - } - self.primary_type.as_mut().unwrap() - } - - // Take field - pub fn take_primary_type(&mut self) -> ::std::string::String { - self.primary_type.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool metamask_v4_compat = 3; - - pub fn metamask_v4_compat(&self) -> bool { - self.metamask_v4_compat.unwrap_or(true) - } - - pub fn clear_metamask_v4_compat(&mut self) { - self.metamask_v4_compat = ::std::option::Option::None; - } - - pub fn has_metamask_v4_compat(&self) -> bool { - self.metamask_v4_compat.is_some() - } - - // Param is passed by value, moved - pub fn set_metamask_v4_compat(&mut self, v: bool) { - self.metamask_v4_compat = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &EthereumSignTypedData| { &m.address_n }, - |m: &mut EthereumSignTypedData| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "primary_type", - |m: &EthereumSignTypedData| { &m.primary_type }, - |m: &mut EthereumSignTypedData| { &mut m.primary_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "metamask_v4_compat", - |m: &EthereumSignTypedData| { &m.metamask_v4_compat }, - |m: &mut EthereumSignTypedData| { &mut m.metamask_v4_compat }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( - "definitions", - |m: &EthereumSignTypedData| { &m.definitions }, - |m: &mut EthereumSignTypedData| { &mut m.definitions }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumSignTypedData", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumSignTypedData { - const NAME: &'static str = "EthereumSignTypedData"; - - fn is_initialized(&self) -> bool { - if self.primary_type.is_none() { - return false; - } - for v in &self.definitions { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.primary_type = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.metamask_v4_compat = ::std::option::Option::Some(is.read_bool()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.definitions)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.primary_type.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.metamask_v4_compat { - my_size += 1 + 1; - } - if let Some(v) = self.definitions.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.primary_type.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.metamask_v4_compat { - os.write_bool(3, v)?; - } - if let Some(v) = self.definitions.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumSignTypedData { - EthereumSignTypedData::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.primary_type = ::std::option::Option::None; - self.metamask_v4_compat = ::std::option::Option::None; - self.definitions.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumSignTypedData { - static instance: EthereumSignTypedData = EthereumSignTypedData { - address_n: ::std::vec::Vec::new(), - primary_type: ::std::option::Option::None, - metamask_v4_compat: ::std::option::Option::None, - definitions: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumSignTypedData { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumSignTypedData").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumSignTypedData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumSignTypedData { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTypedDataStructRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructRequest.name) - pub name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTypedDataStructRequest { - fn default() -> &'a EthereumTypedDataStructRequest { - ::default_instance() - } -} - -impl EthereumTypedDataStructRequest { - pub fn new() -> EthereumTypedDataStructRequest { - ::std::default::Default::default() - } - - // required string name = 1; - - pub fn name(&self) -> &str { - match self.name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if self.name.is_none() { - self.name = ::std::option::Option::Some(::std::string::String::new()); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - self.name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &EthereumTypedDataStructRequest| { &m.name }, - |m: &mut EthereumTypedDataStructRequest| { &mut m.name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTypedDataStructRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTypedDataStructRequest { - const NAME: &'static str = "EthereumTypedDataStructRequest"; - - fn is_initialized(&self) -> bool { - if self.name.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.name = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.name.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTypedDataStructRequest { - EthereumTypedDataStructRequest::new() - } - - fn clear(&mut self) { - self.name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTypedDataStructRequest { - static instance: EthereumTypedDataStructRequest = EthereumTypedDataStructRequest { - name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTypedDataStructRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataStructRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTypedDataStructRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataStructRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTypedDataStructAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.members) - pub members: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTypedDataStructAck { - fn default() -> &'a EthereumTypedDataStructAck { - ::default_instance() - } -} - -impl EthereumTypedDataStructAck { - pub fn new() -> EthereumTypedDataStructAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "members", - |m: &EthereumTypedDataStructAck| { &m.members }, - |m: &mut EthereumTypedDataStructAck| { &mut m.members }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTypedDataStructAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTypedDataStructAck { - const NAME: &'static str = "EthereumTypedDataStructAck"; - - fn is_initialized(&self) -> bool { - for v in &self.members { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.members.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.members { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.members { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTypedDataStructAck { - EthereumTypedDataStructAck::new() - } - - fn clear(&mut self) { - self.members.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTypedDataStructAck { - static instance: EthereumTypedDataStructAck = EthereumTypedDataStructAck { - members: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTypedDataStructAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataStructAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTypedDataStructAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataStructAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `EthereumTypedDataStructAck` -pub mod ethereum_typed_data_struct_ack { - // @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EthereumStructMember { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember.type) - pub type_: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember.name) - pub name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMember.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EthereumStructMember { - fn default() -> &'a EthereumStructMember { - ::default_instance() - } - } - - impl EthereumStructMember { - pub fn new() -> EthereumStructMember { - ::std::default::Default::default() - } - - // required string name = 2; - - pub fn name(&self) -> &str { - match self.name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if self.name.is_none() { - self.name = ::std::option::Option::Some(::std::string::String::new()); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - self.name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumFieldType>( - "type", - |m: &EthereumStructMember| { &m.type_ }, - |m: &mut EthereumStructMember| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &EthereumStructMember| { &m.name }, - |m: &mut EthereumStructMember| { &mut m.name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTypedDataStructAck.EthereumStructMember", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EthereumStructMember { - const NAME: &'static str = "EthereumStructMember"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - if self.name.is_none() { - return false; - } - for v in &self.type_ { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.type_)?; - }, - 18 => { - self.name = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.name.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumStructMember { - EthereumStructMember::new() - } - - fn clear(&mut self) { - self.type_.clear(); - self.name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumStructMember { - static instance: EthereumStructMember = EthereumStructMember { - type_: ::protobuf::MessageField::none(), - name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EthereumStructMember { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EthereumTypedDataStructAck.EthereumStructMember").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EthereumStructMember { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EthereumStructMember { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct EthereumFieldType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.data_type) - pub data_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.size) - pub size: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.entry_type) - pub entry_type: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.struct_name) - pub struct_name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumFieldType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a EthereumFieldType { - fn default() -> &'a EthereumFieldType { - ::default_instance() - } - } - - impl EthereumFieldType { - pub fn new() -> EthereumFieldType { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType data_type = 1; - - pub fn data_type(&self) -> EthereumDataType { - match self.data_type { - Some(e) => e.enum_value_or(EthereumDataType::UINT), - None => EthereumDataType::UINT, - } - } - - pub fn clear_data_type(&mut self) { - self.data_type = ::std::option::Option::None; - } - - pub fn has_data_type(&self) -> bool { - self.data_type.is_some() - } - - // Param is passed by value, moved - pub fn set_data_type(&mut self, v: EthereumDataType) { - self.data_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint32 size = 2; - - pub fn size(&self) -> u32 { - self.size.unwrap_or(0) - } - - pub fn clear_size(&mut self) { - self.size = ::std::option::Option::None; - } - - pub fn has_size(&self) -> bool { - self.size.is_some() - } - - // Param is passed by value, moved - pub fn set_size(&mut self, v: u32) { - self.size = ::std::option::Option::Some(v); - } - - // optional string struct_name = 4; - - pub fn struct_name(&self) -> &str { - match self.struct_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_struct_name(&mut self) { - self.struct_name = ::std::option::Option::None; - } - - pub fn has_struct_name(&self) -> bool { - self.struct_name.is_some() - } - - // Param is passed by value, moved - pub fn set_struct_name(&mut self, v: ::std::string::String) { - self.struct_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_struct_name(&mut self) -> &mut ::std::string::String { - if self.struct_name.is_none() { - self.struct_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.struct_name.as_mut().unwrap() - } - - // Take field - pub fn take_struct_name(&mut self) -> ::std::string::String { - self.struct_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_type", - |m: &EthereumFieldType| { &m.data_type }, - |m: &mut EthereumFieldType| { &mut m.data_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "size", - |m: &EthereumFieldType| { &m.size }, - |m: &mut EthereumFieldType| { &mut m.size }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumFieldType>( - "entry_type", - |m: &EthereumFieldType| { &m.entry_type }, - |m: &mut EthereumFieldType| { &mut m.entry_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "struct_name", - |m: &EthereumFieldType| { &m.struct_name }, - |m: &mut EthereumFieldType| { &mut m.struct_name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTypedDataStructAck.EthereumFieldType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for EthereumFieldType { - const NAME: &'static str = "EthereumFieldType"; - - fn is_initialized(&self) -> bool { - if self.data_type.is_none() { - return false; - } - for v in &self.entry_type { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.data_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 16 => { - self.size = ::std::option::Option::Some(is.read_uint32()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.entry_type)?; - }, - 34 => { - self.struct_name = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_type { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.size { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.entry_type.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.struct_name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_type { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.size { - os.write_uint32(2, v)?; - } - if let Some(v) = self.entry_type.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.struct_name.as_ref() { - os.write_string(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumFieldType { - EthereumFieldType::new() - } - - fn clear(&mut self) { - self.data_type = ::std::option::Option::None; - self.size = ::std::option::Option::None; - self.entry_type.clear(); - self.struct_name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumFieldType { - static instance: EthereumFieldType = EthereumFieldType { - data_type: ::std::option::Option::None, - size: ::std::option::Option::None, - entry_type: ::protobuf::MessageField::none(), - struct_name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for EthereumFieldType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("EthereumTypedDataStructAck.EthereumFieldType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for EthereumFieldType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for EthereumFieldType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType) - pub enum EthereumDataType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.UINT) - UINT = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.INT) - INT = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.BYTES) - BYTES = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.STRING) - STRING = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.BOOL) - BOOL = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.ADDRESS) - ADDRESS = 6, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.ARRAY) - ARRAY = 7, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataType.STRUCT) - STRUCT = 8, - } - - impl ::protobuf::Enum for EthereumDataType { - const NAME: &'static str = "EthereumDataType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(EthereumDataType::UINT), - 2 => ::std::option::Option::Some(EthereumDataType::INT), - 3 => ::std::option::Option::Some(EthereumDataType::BYTES), - 4 => ::std::option::Option::Some(EthereumDataType::STRING), - 5 => ::std::option::Option::Some(EthereumDataType::BOOL), - 6 => ::std::option::Option::Some(EthereumDataType::ADDRESS), - 7 => ::std::option::Option::Some(EthereumDataType::ARRAY), - 8 => ::std::option::Option::Some(EthereumDataType::STRUCT), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "UINT" => ::std::option::Option::Some(EthereumDataType::UINT), - "INT" => ::std::option::Option::Some(EthereumDataType::INT), - "BYTES" => ::std::option::Option::Some(EthereumDataType::BYTES), - "STRING" => ::std::option::Option::Some(EthereumDataType::STRING), - "BOOL" => ::std::option::Option::Some(EthereumDataType::BOOL), - "ADDRESS" => ::std::option::Option::Some(EthereumDataType::ADDRESS), - "ARRAY" => ::std::option::Option::Some(EthereumDataType::ARRAY), - "STRUCT" => ::std::option::Option::Some(EthereumDataType::STRUCT), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [EthereumDataType] = &[ - EthereumDataType::UINT, - EthereumDataType::INT, - EthereumDataType::BYTES, - EthereumDataType::STRING, - EthereumDataType::BOOL, - EthereumDataType::ADDRESS, - EthereumDataType::ARRAY, - EthereumDataType::STRUCT, - ]; - } - - impl ::protobuf::EnumFull for EthereumDataType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("EthereumTypedDataStructAck.EthereumDataType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - EthereumDataType::UINT => 0, - EthereumDataType::INT => 1, - EthereumDataType::BYTES => 2, - EthereumDataType::STRING => 3, - EthereumDataType::BOOL => 4, - EthereumDataType::ADDRESS => 5, - EthereumDataType::ARRAY => 6, - EthereumDataType::STRUCT => 7, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for EthereumDataType { - fn default() -> Self { - EthereumDataType::UINT - } - } - - impl EthereumDataType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("EthereumTypedDataStructAck.EthereumDataType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTypedDataValueRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueRequest.member_path) - pub member_path: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTypedDataValueRequest { - fn default() -> &'a EthereumTypedDataValueRequest { - ::default_instance() - } -} - -impl EthereumTypedDataValueRequest { - pub fn new() -> EthereumTypedDataValueRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "member_path", - |m: &EthereumTypedDataValueRequest| { &m.member_path }, - |m: &mut EthereumTypedDataValueRequest| { &mut m.member_path }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTypedDataValueRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTypedDataValueRequest { - const NAME: &'static str = "EthereumTypedDataValueRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.member_path)?; - }, - 8 => { - self.member_path.push(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.member_path { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.member_path { - os.write_uint32(1, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTypedDataValueRequest { - EthereumTypedDataValueRequest::new() - } - - fn clear(&mut self) { - self.member_path.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTypedDataValueRequest { - static instance: EthereumTypedDataValueRequest = EthereumTypedDataValueRequest { - member_path: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTypedDataValueRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataValueRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTypedDataValueRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataValueRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EthereumTypedDataValueAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueAck.value) - pub value: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumTypedDataValueAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EthereumTypedDataValueAck { - fn default() -> &'a EthereumTypedDataValueAck { - ::default_instance() - } -} - -impl EthereumTypedDataValueAck { - pub fn new() -> EthereumTypedDataValueAck { - ::std::default::Default::default() - } - - // required bytes value = 1; - - pub fn value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "value", - |m: &EthereumTypedDataValueAck| { &m.value }, - |m: &mut EthereumTypedDataValueAck| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EthereumTypedDataValueAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EthereumTypedDataValueAck { - const NAME: &'static str = "EthereumTypedDataValueAck"; - - fn is_initialized(&self) -> bool { - if self.value.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.value = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.value.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EthereumTypedDataValueAck { - EthereumTypedDataValueAck::new() - } - - fn clear(&mut self) { - self.value = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EthereumTypedDataValueAck { - static instance: EthereumTypedDataValueAck = EthereumTypedDataValueAck { - value: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EthereumTypedDataValueAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumTypedDataValueAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EthereumTypedDataValueAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataValueAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x1emessages-ethereum-eip712.proto\x12\"hw.trezor.messages.ethereum_ei\ - p712\x1a#messages-ethereum-definitions.proto\"\xeb\x01\n\x15EthereumSign\ - TypedData\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ - \x0cprimary_type\x18\x02\x20\x02(\tR\x0bprimaryType\x122\n\x12metamask_v\ - 4_compat\x18\x03\x20\x01(\x08:\x04trueR\x10metamaskV4Compat\x12^\n\x0bde\ - finitions\x18\x04\x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions\ - .EthereumDefinitionsR\x0bdefinitions\"4\n\x1eEthereumTypedDataStructRequ\ - est\x12\x12\n\x04name\x18\x01\x20\x02(\tR\x04name\"\xb4\x05\n\x1aEthereu\ - mTypedDataStructAck\x12m\n\x07members\x18\x01\x20\x03(\x0b2S.hw.trezor.m\ - essages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMemberR\ - \x07members\x1a\x90\x01\n\x14EthereumStructMember\x12d\n\x04type\x18\x01\ - \x20\x02(\x0b2P.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\ - ctAck.EthereumFieldTypeR\x04type\x12\x12\n\x04name\x18\x02\x20\x02(\tR\ - \x04name\x1a\xa7\x02\n\x11EthereumFieldType\x12l\n\tdata_type\x18\x01\ - \x20\x02(\x0e2O.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\ - ctAck.EthereumDataTypeR\x08dataType\x12\x12\n\x04size\x18\x02\x20\x01(\r\ - R\x04size\x12o\n\nentry_type\x18\x03\x20\x01(\x0b2P.hw.trezor.messages.e\ - thereum_eip712.EthereumTypedDataStructAck.EthereumFieldTypeR\tentryType\ - \x12\x1f\n\x0bstruct_name\x18\x04\x20\x01(\tR\nstructName\"j\n\x10Ethere\ - umDataType\x12\x08\n\x04UINT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\t\n\ - \x05BYTES\x10\x03\x12\n\n\x06STRING\x10\x04\x12\x08\n\x04BOOL\x10\x05\ - \x12\x0b\n\x07ADDRESS\x10\x06\x12\t\n\x05ARRAY\x10\x07\x12\n\n\x06STRUCT\ - \x10\x08\"@\n\x1dEthereumTypedDataValueRequest\x12\x1f\n\x0bmember_path\ - \x18\x01\x20\x03(\rR\nmemberPath\"1\n\x19EthereumTypedDataValueAck\x12\ - \x14\n\x05value\x18\x01\x20\x02(\x0cR\x05valueBB\n#com.satoshilabs.trezo\ - r.lib.protobufB\x1bTrezorMessageEthereumEIP712\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(1); - deps.push(super::messages_ethereum_definitions::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(7); - messages.push(EthereumSignTypedData::generated_message_descriptor_data()); - messages.push(EthereumTypedDataStructRequest::generated_message_descriptor_data()); - messages.push(EthereumTypedDataStructAck::generated_message_descriptor_data()); - messages.push(EthereumTypedDataValueRequest::generated_message_descriptor_data()); - messages.push(EthereumTypedDataValueAck::generated_message_descriptor_data()); - messages.push(ethereum_typed_data_struct_ack::EthereumStructMember::generated_message_descriptor_data()); - messages.push(ethereum_typed_data_struct_ack::EthereumFieldType::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(1); - enums.push(ethereum_typed_data_struct_ack::EthereumDataType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_management.rs b/wallet/trezor-client/src/protos/generated/messages_management.rs deleted file mode 100644 index 8a9b86eb3b..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_management.rs +++ /dev/null @@ -1,10842 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-management.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.management.Initialize) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Initialize { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.Initialize.session_id) - pub session_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Initialize._skip_passphrase) - pub _skip_passphrase: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Initialize.derive_cardano) - pub derive_cardano: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Initialize.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Initialize { - fn default() -> &'a Initialize { - ::default_instance() - } -} - -impl Initialize { - pub fn new() -> Initialize { - ::std::default::Default::default() - } - - // optional bytes session_id = 1; - - pub fn session_id(&self) -> &[u8] { - match self.session_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_session_id(&mut self) { - self.session_id = ::std::option::Option::None; - } - - pub fn has_session_id(&self) -> bool { - self.session_id.is_some() - } - - // Param is passed by value, moved - pub fn set_session_id(&mut self, v: ::std::vec::Vec) { - self.session_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_session_id(&mut self) -> &mut ::std::vec::Vec { - if self.session_id.is_none() { - self.session_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.session_id.as_mut().unwrap() - } - - // Take field - pub fn take_session_id(&mut self) -> ::std::vec::Vec { - self.session_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool _skip_passphrase = 2; - - pub fn _skip_passphrase(&self) -> bool { - self._skip_passphrase.unwrap_or(false) - } - - pub fn clear__skip_passphrase(&mut self) { - self._skip_passphrase = ::std::option::Option::None; - } - - pub fn has__skip_passphrase(&self) -> bool { - self._skip_passphrase.is_some() - } - - // Param is passed by value, moved - pub fn set__skip_passphrase(&mut self, v: bool) { - self._skip_passphrase = ::std::option::Option::Some(v); - } - - // optional bool derive_cardano = 3; - - pub fn derive_cardano(&self) -> bool { - self.derive_cardano.unwrap_or(false) - } - - pub fn clear_derive_cardano(&mut self) { - self.derive_cardano = ::std::option::Option::None; - } - - pub fn has_derive_cardano(&self) -> bool { - self.derive_cardano.is_some() - } - - // Param is passed by value, moved - pub fn set_derive_cardano(&mut self, v: bool) { - self.derive_cardano = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "session_id", - |m: &Initialize| { &m.session_id }, - |m: &mut Initialize| { &mut m.session_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "_skip_passphrase", - |m: &Initialize| { &m._skip_passphrase }, - |m: &mut Initialize| { &mut m._skip_passphrase }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "derive_cardano", - |m: &Initialize| { &m.derive_cardano }, - |m: &mut Initialize| { &mut m.derive_cardano }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Initialize", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Initialize { - const NAME: &'static str = "Initialize"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.session_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self._skip_passphrase = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.derive_cardano = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.session_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self._skip_passphrase { - my_size += 1 + 1; - } - if let Some(v) = self.derive_cardano { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.session_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self._skip_passphrase { - os.write_bool(2, v)?; - } - if let Some(v) = self.derive_cardano { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Initialize { - Initialize::new() - } - - fn clear(&mut self) { - self.session_id = ::std::option::Option::None; - self._skip_passphrase = ::std::option::Option::None; - self.derive_cardano = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Initialize { - static instance: Initialize = Initialize { - session_id: ::std::option::Option::None, - _skip_passphrase: ::std::option::Option::None, - derive_cardano: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Initialize { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Initialize").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Initialize { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Initialize { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.GetFeatures) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetFeatures { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetFeatures.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetFeatures { - fn default() -> &'a GetFeatures { - ::default_instance() - } -} - -impl GetFeatures { - pub fn new() -> GetFeatures { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetFeatures", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetFeatures { - const NAME: &'static str = "GetFeatures"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetFeatures { - GetFeatures::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetFeatures { - static instance: GetFeatures = GetFeatures { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetFeatures { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetFeatures").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetFeatures { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetFeatures { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.Features) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Features { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.vendor) - pub vendor: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.major_version) - pub major_version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.minor_version) - pub minor_version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.patch_version) - pub patch_version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.bootloader_mode) - pub bootloader_mode: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.device_id) - pub device_id: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.pin_protection) - pub pin_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.passphrase_protection) - pub passphrase_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.language) - pub language: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.label) - pub label: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.initialized) - pub initialized: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.revision) - pub revision: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.bootloader_hash) - pub bootloader_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.imported) - pub imported: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unlocked) - pub unlocked: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features._passphrase_cached) - pub _passphrase_cached: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.firmware_present) - pub firmware_present: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.needs_backup) - pub needs_backup: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.flags) - pub flags: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.model) - pub model: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_major) - pub fw_major: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_minor) - pub fw_minor: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_patch) - pub fw_patch: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.fw_vendor) - pub fw_vendor: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unfinished_backup) - pub unfinished_backup: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.no_backup) - pub no_backup: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.recovery_mode) - pub recovery_mode: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.capabilities) - pub capabilities: ::std::vec::Vec<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.backup_type) - pub backup_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.sd_card_present) - pub sd_card_present: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.sd_protection) - pub sd_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.wipe_code_protection) - pub wipe_code_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.session_id) - pub session_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.passphrase_always_on_device) - pub passphrase_always_on_device: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.safety_checks) - pub safety_checks: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.auto_lock_delay_ms) - pub auto_lock_delay_ms: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.display_rotation) - pub display_rotation: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.experimental_features) - pub experimental_features: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.busy) - pub busy: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.homescreen_format) - pub homescreen_format: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.hide_passphrase_from_host) - pub hide_passphrase_from_host: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.internal_model) - pub internal_model: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unit_color) - pub unit_color: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unit_btconly) - pub unit_btconly: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.homescreen_width) - pub homescreen_width: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.homescreen_height) - pub homescreen_height: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.bootloader_locked) - pub bootloader_locked: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.language_version_matches) - pub language_version_matches: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unit_packaging) - pub unit_packaging: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Features.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Features { - fn default() -> &'a Features { - ::default_instance() - } -} - -impl Features { - pub fn new() -> Features { - ::std::default::Default::default() - } - - // optional string vendor = 1; - - pub fn vendor(&self) -> &str { - match self.vendor.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_vendor(&mut self) { - self.vendor = ::std::option::Option::None; - } - - pub fn has_vendor(&self) -> bool { - self.vendor.is_some() - } - - // Param is passed by value, moved - pub fn set_vendor(&mut self, v: ::std::string::String) { - self.vendor = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vendor(&mut self) -> &mut ::std::string::String { - if self.vendor.is_none() { - self.vendor = ::std::option::Option::Some(::std::string::String::new()); - } - self.vendor.as_mut().unwrap() - } - - // Take field - pub fn take_vendor(&mut self) -> ::std::string::String { - self.vendor.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint32 major_version = 2; - - pub fn major_version(&self) -> u32 { - self.major_version.unwrap_or(0) - } - - pub fn clear_major_version(&mut self) { - self.major_version = ::std::option::Option::None; - } - - pub fn has_major_version(&self) -> bool { - self.major_version.is_some() - } - - // Param is passed by value, moved - pub fn set_major_version(&mut self, v: u32) { - self.major_version = ::std::option::Option::Some(v); - } - - // required uint32 minor_version = 3; - - pub fn minor_version(&self) -> u32 { - self.minor_version.unwrap_or(0) - } - - pub fn clear_minor_version(&mut self) { - self.minor_version = ::std::option::Option::None; - } - - pub fn has_minor_version(&self) -> bool { - self.minor_version.is_some() - } - - // Param is passed by value, moved - pub fn set_minor_version(&mut self, v: u32) { - self.minor_version = ::std::option::Option::Some(v); - } - - // required uint32 patch_version = 4; - - pub fn patch_version(&self) -> u32 { - self.patch_version.unwrap_or(0) - } - - pub fn clear_patch_version(&mut self) { - self.patch_version = ::std::option::Option::None; - } - - pub fn has_patch_version(&self) -> bool { - self.patch_version.is_some() - } - - // Param is passed by value, moved - pub fn set_patch_version(&mut self, v: u32) { - self.patch_version = ::std::option::Option::Some(v); - } - - // optional bool bootloader_mode = 5; - - pub fn bootloader_mode(&self) -> bool { - self.bootloader_mode.unwrap_or(false) - } - - pub fn clear_bootloader_mode(&mut self) { - self.bootloader_mode = ::std::option::Option::None; - } - - pub fn has_bootloader_mode(&self) -> bool { - self.bootloader_mode.is_some() - } - - // Param is passed by value, moved - pub fn set_bootloader_mode(&mut self, v: bool) { - self.bootloader_mode = ::std::option::Option::Some(v); - } - - // optional string device_id = 6; - - pub fn device_id(&self) -> &str { - match self.device_id.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_device_id(&mut self) { - self.device_id = ::std::option::Option::None; - } - - pub fn has_device_id(&self) -> bool { - self.device_id.is_some() - } - - // Param is passed by value, moved - pub fn set_device_id(&mut self, v: ::std::string::String) { - self.device_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_device_id(&mut self) -> &mut ::std::string::String { - if self.device_id.is_none() { - self.device_id = ::std::option::Option::Some(::std::string::String::new()); - } - self.device_id.as_mut().unwrap() - } - - // Take field - pub fn take_device_id(&mut self) -> ::std::string::String { - self.device_id.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool pin_protection = 7; - - pub fn pin_protection(&self) -> bool { - self.pin_protection.unwrap_or(false) - } - - pub fn clear_pin_protection(&mut self) { - self.pin_protection = ::std::option::Option::None; - } - - pub fn has_pin_protection(&self) -> bool { - self.pin_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_pin_protection(&mut self, v: bool) { - self.pin_protection = ::std::option::Option::Some(v); - } - - // optional bool passphrase_protection = 8; - - pub fn passphrase_protection(&self) -> bool { - self.passphrase_protection.unwrap_or(false) - } - - pub fn clear_passphrase_protection(&mut self) { - self.passphrase_protection = ::std::option::Option::None; - } - - pub fn has_passphrase_protection(&self) -> bool { - self.passphrase_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase_protection(&mut self, v: bool) { - self.passphrase_protection = ::std::option::Option::Some(v); - } - - // optional string language = 9; - - pub fn language(&self) -> &str { - match self.language.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_language(&mut self) { - self.language = ::std::option::Option::None; - } - - pub fn has_language(&self) -> bool { - self.language.is_some() - } - - // Param is passed by value, moved - pub fn set_language(&mut self, v: ::std::string::String) { - self.language = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_language(&mut self) -> &mut ::std::string::String { - if self.language.is_none() { - self.language = ::std::option::Option::Some(::std::string::String::new()); - } - self.language.as_mut().unwrap() - } - - // Take field - pub fn take_language(&mut self) -> ::std::string::String { - self.language.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string label = 10; - - pub fn label(&self) -> &str { - match self.label.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_label(&mut self) { - self.label = ::std::option::Option::None; - } - - pub fn has_label(&self) -> bool { - self.label.is_some() - } - - // Param is passed by value, moved - pub fn set_label(&mut self, v: ::std::string::String) { - self.label = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_label(&mut self) -> &mut ::std::string::String { - if self.label.is_none() { - self.label = ::std::option::Option::Some(::std::string::String::new()); - } - self.label.as_mut().unwrap() - } - - // Take field - pub fn take_label(&mut self) -> ::std::string::String { - self.label.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool initialized = 12; - - pub fn initialized(&self) -> bool { - self.initialized.unwrap_or(false) - } - - pub fn clear_initialized(&mut self) { - self.initialized = ::std::option::Option::None; - } - - pub fn has_initialized(&self) -> bool { - self.initialized.is_some() - } - - // Param is passed by value, moved - pub fn set_initialized(&mut self, v: bool) { - self.initialized = ::std::option::Option::Some(v); - } - - // optional bytes revision = 13; - - pub fn revision(&self) -> &[u8] { - match self.revision.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_revision(&mut self) { - self.revision = ::std::option::Option::None; - } - - pub fn has_revision(&self) -> bool { - self.revision.is_some() - } - - // Param is passed by value, moved - pub fn set_revision(&mut self, v: ::std::vec::Vec) { - self.revision = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_revision(&mut self) -> &mut ::std::vec::Vec { - if self.revision.is_none() { - self.revision = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.revision.as_mut().unwrap() - } - - // Take field - pub fn take_revision(&mut self) -> ::std::vec::Vec { - self.revision.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes bootloader_hash = 14; - - pub fn bootloader_hash(&self) -> &[u8] { - match self.bootloader_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_bootloader_hash(&mut self) { - self.bootloader_hash = ::std::option::Option::None; - } - - pub fn has_bootloader_hash(&self) -> bool { - self.bootloader_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_bootloader_hash(&mut self, v: ::std::vec::Vec) { - self.bootloader_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_bootloader_hash(&mut self) -> &mut ::std::vec::Vec { - if self.bootloader_hash.is_none() { - self.bootloader_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.bootloader_hash.as_mut().unwrap() - } - - // Take field - pub fn take_bootloader_hash(&mut self) -> ::std::vec::Vec { - self.bootloader_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool imported = 15; - - pub fn imported(&self) -> bool { - self.imported.unwrap_or(false) - } - - pub fn clear_imported(&mut self) { - self.imported = ::std::option::Option::None; - } - - pub fn has_imported(&self) -> bool { - self.imported.is_some() - } - - // Param is passed by value, moved - pub fn set_imported(&mut self, v: bool) { - self.imported = ::std::option::Option::Some(v); - } - - // optional bool unlocked = 16; - - pub fn unlocked(&self) -> bool { - self.unlocked.unwrap_or(false) - } - - pub fn clear_unlocked(&mut self) { - self.unlocked = ::std::option::Option::None; - } - - pub fn has_unlocked(&self) -> bool { - self.unlocked.is_some() - } - - // Param is passed by value, moved - pub fn set_unlocked(&mut self, v: bool) { - self.unlocked = ::std::option::Option::Some(v); - } - - // optional bool _passphrase_cached = 17; - - pub fn _passphrase_cached(&self) -> bool { - self._passphrase_cached.unwrap_or(false) - } - - pub fn clear__passphrase_cached(&mut self) { - self._passphrase_cached = ::std::option::Option::None; - } - - pub fn has__passphrase_cached(&self) -> bool { - self._passphrase_cached.is_some() - } - - // Param is passed by value, moved - pub fn set__passphrase_cached(&mut self, v: bool) { - self._passphrase_cached = ::std::option::Option::Some(v); - } - - // optional bool firmware_present = 18; - - pub fn firmware_present(&self) -> bool { - self.firmware_present.unwrap_or(false) - } - - pub fn clear_firmware_present(&mut self) { - self.firmware_present = ::std::option::Option::None; - } - - pub fn has_firmware_present(&self) -> bool { - self.firmware_present.is_some() - } - - // Param is passed by value, moved - pub fn set_firmware_present(&mut self, v: bool) { - self.firmware_present = ::std::option::Option::Some(v); - } - - // optional bool needs_backup = 19; - - pub fn needs_backup(&self) -> bool { - self.needs_backup.unwrap_or(false) - } - - pub fn clear_needs_backup(&mut self) { - self.needs_backup = ::std::option::Option::None; - } - - pub fn has_needs_backup(&self) -> bool { - self.needs_backup.is_some() - } - - // Param is passed by value, moved - pub fn set_needs_backup(&mut self, v: bool) { - self.needs_backup = ::std::option::Option::Some(v); - } - - // optional uint32 flags = 20; - - pub fn flags(&self) -> u32 { - self.flags.unwrap_or(0) - } - - pub fn clear_flags(&mut self) { - self.flags = ::std::option::Option::None; - } - - pub fn has_flags(&self) -> bool { - self.flags.is_some() - } - - // Param is passed by value, moved - pub fn set_flags(&mut self, v: u32) { - self.flags = ::std::option::Option::Some(v); - } - - // optional string model = 21; - - pub fn model(&self) -> &str { - match self.model.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_model(&mut self) { - self.model = ::std::option::Option::None; - } - - pub fn has_model(&self) -> bool { - self.model.is_some() - } - - // Param is passed by value, moved - pub fn set_model(&mut self, v: ::std::string::String) { - self.model = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_model(&mut self) -> &mut ::std::string::String { - if self.model.is_none() { - self.model = ::std::option::Option::Some(::std::string::String::new()); - } - self.model.as_mut().unwrap() - } - - // Take field - pub fn take_model(&mut self) -> ::std::string::String { - self.model.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 fw_major = 22; - - pub fn fw_major(&self) -> u32 { - self.fw_major.unwrap_or(0) - } - - pub fn clear_fw_major(&mut self) { - self.fw_major = ::std::option::Option::None; - } - - pub fn has_fw_major(&self) -> bool { - self.fw_major.is_some() - } - - // Param is passed by value, moved - pub fn set_fw_major(&mut self, v: u32) { - self.fw_major = ::std::option::Option::Some(v); - } - - // optional uint32 fw_minor = 23; - - pub fn fw_minor(&self) -> u32 { - self.fw_minor.unwrap_or(0) - } - - pub fn clear_fw_minor(&mut self) { - self.fw_minor = ::std::option::Option::None; - } - - pub fn has_fw_minor(&self) -> bool { - self.fw_minor.is_some() - } - - // Param is passed by value, moved - pub fn set_fw_minor(&mut self, v: u32) { - self.fw_minor = ::std::option::Option::Some(v); - } - - // optional uint32 fw_patch = 24; - - pub fn fw_patch(&self) -> u32 { - self.fw_patch.unwrap_or(0) - } - - pub fn clear_fw_patch(&mut self) { - self.fw_patch = ::std::option::Option::None; - } - - pub fn has_fw_patch(&self) -> bool { - self.fw_patch.is_some() - } - - // Param is passed by value, moved - pub fn set_fw_patch(&mut self, v: u32) { - self.fw_patch = ::std::option::Option::Some(v); - } - - // optional string fw_vendor = 25; - - pub fn fw_vendor(&self) -> &str { - match self.fw_vendor.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_fw_vendor(&mut self) { - self.fw_vendor = ::std::option::Option::None; - } - - pub fn has_fw_vendor(&self) -> bool { - self.fw_vendor.is_some() - } - - // Param is passed by value, moved - pub fn set_fw_vendor(&mut self, v: ::std::string::String) { - self.fw_vendor = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_fw_vendor(&mut self) -> &mut ::std::string::String { - if self.fw_vendor.is_none() { - self.fw_vendor = ::std::option::Option::Some(::std::string::String::new()); - } - self.fw_vendor.as_mut().unwrap() - } - - // Take field - pub fn take_fw_vendor(&mut self) -> ::std::string::String { - self.fw_vendor.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool unfinished_backup = 27; - - pub fn unfinished_backup(&self) -> bool { - self.unfinished_backup.unwrap_or(false) - } - - pub fn clear_unfinished_backup(&mut self) { - self.unfinished_backup = ::std::option::Option::None; - } - - pub fn has_unfinished_backup(&self) -> bool { - self.unfinished_backup.is_some() - } - - // Param is passed by value, moved - pub fn set_unfinished_backup(&mut self, v: bool) { - self.unfinished_backup = ::std::option::Option::Some(v); - } - - // optional bool no_backup = 28; - - pub fn no_backup(&self) -> bool { - self.no_backup.unwrap_or(false) - } - - pub fn clear_no_backup(&mut self) { - self.no_backup = ::std::option::Option::None; - } - - pub fn has_no_backup(&self) -> bool { - self.no_backup.is_some() - } - - // Param is passed by value, moved - pub fn set_no_backup(&mut self, v: bool) { - self.no_backup = ::std::option::Option::Some(v); - } - - // optional bool recovery_mode = 29; - - pub fn recovery_mode(&self) -> bool { - self.recovery_mode.unwrap_or(false) - } - - pub fn clear_recovery_mode(&mut self) { - self.recovery_mode = ::std::option::Option::None; - } - - pub fn has_recovery_mode(&self) -> bool { - self.recovery_mode.is_some() - } - - // Param is passed by value, moved - pub fn set_recovery_mode(&mut self, v: bool) { - self.recovery_mode = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.management.BackupType backup_type = 31; - - pub fn backup_type(&self) -> BackupType { - match self.backup_type { - Some(e) => e.enum_value_or(BackupType::Bip39), - None => BackupType::Bip39, - } - } - - pub fn clear_backup_type(&mut self) { - self.backup_type = ::std::option::Option::None; - } - - pub fn has_backup_type(&self) -> bool { - self.backup_type.is_some() - } - - // Param is passed by value, moved - pub fn set_backup_type(&mut self, v: BackupType) { - self.backup_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool sd_card_present = 32; - - pub fn sd_card_present(&self) -> bool { - self.sd_card_present.unwrap_or(false) - } - - pub fn clear_sd_card_present(&mut self) { - self.sd_card_present = ::std::option::Option::None; - } - - pub fn has_sd_card_present(&self) -> bool { - self.sd_card_present.is_some() - } - - // Param is passed by value, moved - pub fn set_sd_card_present(&mut self, v: bool) { - self.sd_card_present = ::std::option::Option::Some(v); - } - - // optional bool sd_protection = 33; - - pub fn sd_protection(&self) -> bool { - self.sd_protection.unwrap_or(false) - } - - pub fn clear_sd_protection(&mut self) { - self.sd_protection = ::std::option::Option::None; - } - - pub fn has_sd_protection(&self) -> bool { - self.sd_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_sd_protection(&mut self, v: bool) { - self.sd_protection = ::std::option::Option::Some(v); - } - - // optional bool wipe_code_protection = 34; - - pub fn wipe_code_protection(&self) -> bool { - self.wipe_code_protection.unwrap_or(false) - } - - pub fn clear_wipe_code_protection(&mut self) { - self.wipe_code_protection = ::std::option::Option::None; - } - - pub fn has_wipe_code_protection(&self) -> bool { - self.wipe_code_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_wipe_code_protection(&mut self, v: bool) { - self.wipe_code_protection = ::std::option::Option::Some(v); - } - - // optional bytes session_id = 35; - - pub fn session_id(&self) -> &[u8] { - match self.session_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_session_id(&mut self) { - self.session_id = ::std::option::Option::None; - } - - pub fn has_session_id(&self) -> bool { - self.session_id.is_some() - } - - // Param is passed by value, moved - pub fn set_session_id(&mut self, v: ::std::vec::Vec) { - self.session_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_session_id(&mut self) -> &mut ::std::vec::Vec { - if self.session_id.is_none() { - self.session_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.session_id.as_mut().unwrap() - } - - // Take field - pub fn take_session_id(&mut self) -> ::std::vec::Vec { - self.session_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool passphrase_always_on_device = 36; - - pub fn passphrase_always_on_device(&self) -> bool { - self.passphrase_always_on_device.unwrap_or(false) - } - - pub fn clear_passphrase_always_on_device(&mut self) { - self.passphrase_always_on_device = ::std::option::Option::None; - } - - pub fn has_passphrase_always_on_device(&self) -> bool { - self.passphrase_always_on_device.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase_always_on_device(&mut self, v: bool) { - self.passphrase_always_on_device = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.management.SafetyCheckLevel safety_checks = 37; - - pub fn safety_checks(&self) -> SafetyCheckLevel { - match self.safety_checks { - Some(e) => e.enum_value_or(SafetyCheckLevel::Strict), - None => SafetyCheckLevel::Strict, - } - } - - pub fn clear_safety_checks(&mut self) { - self.safety_checks = ::std::option::Option::None; - } - - pub fn has_safety_checks(&self) -> bool { - self.safety_checks.is_some() - } - - // Param is passed by value, moved - pub fn set_safety_checks(&mut self, v: SafetyCheckLevel) { - self.safety_checks = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint32 auto_lock_delay_ms = 38; - - pub fn auto_lock_delay_ms(&self) -> u32 { - self.auto_lock_delay_ms.unwrap_or(0) - } - - pub fn clear_auto_lock_delay_ms(&mut self) { - self.auto_lock_delay_ms = ::std::option::Option::None; - } - - pub fn has_auto_lock_delay_ms(&self) -> bool { - self.auto_lock_delay_ms.is_some() - } - - // Param is passed by value, moved - pub fn set_auto_lock_delay_ms(&mut self, v: u32) { - self.auto_lock_delay_ms = ::std::option::Option::Some(v); - } - - // optional uint32 display_rotation = 39; - - pub fn display_rotation(&self) -> u32 { - self.display_rotation.unwrap_or(0) - } - - pub fn clear_display_rotation(&mut self) { - self.display_rotation = ::std::option::Option::None; - } - - pub fn has_display_rotation(&self) -> bool { - self.display_rotation.is_some() - } - - // Param is passed by value, moved - pub fn set_display_rotation(&mut self, v: u32) { - self.display_rotation = ::std::option::Option::Some(v); - } - - // optional bool experimental_features = 40; - - pub fn experimental_features(&self) -> bool { - self.experimental_features.unwrap_or(false) - } - - pub fn clear_experimental_features(&mut self) { - self.experimental_features = ::std::option::Option::None; - } - - pub fn has_experimental_features(&self) -> bool { - self.experimental_features.is_some() - } - - // Param is passed by value, moved - pub fn set_experimental_features(&mut self, v: bool) { - self.experimental_features = ::std::option::Option::Some(v); - } - - // optional bool busy = 41; - - pub fn busy(&self) -> bool { - self.busy.unwrap_or(false) - } - - pub fn clear_busy(&mut self) { - self.busy = ::std::option::Option::None; - } - - pub fn has_busy(&self) -> bool { - self.busy.is_some() - } - - // Param is passed by value, moved - pub fn set_busy(&mut self, v: bool) { - self.busy = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.management.HomescreenFormat homescreen_format = 42; - - pub fn homescreen_format(&self) -> HomescreenFormat { - match self.homescreen_format { - Some(e) => e.enum_value_or(HomescreenFormat::Toif), - None => HomescreenFormat::Toif, - } - } - - pub fn clear_homescreen_format(&mut self) { - self.homescreen_format = ::std::option::Option::None; - } - - pub fn has_homescreen_format(&self) -> bool { - self.homescreen_format.is_some() - } - - // Param is passed by value, moved - pub fn set_homescreen_format(&mut self, v: HomescreenFormat) { - self.homescreen_format = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool hide_passphrase_from_host = 43; - - pub fn hide_passphrase_from_host(&self) -> bool { - self.hide_passphrase_from_host.unwrap_or(false) - } - - pub fn clear_hide_passphrase_from_host(&mut self) { - self.hide_passphrase_from_host = ::std::option::Option::None; - } - - pub fn has_hide_passphrase_from_host(&self) -> bool { - self.hide_passphrase_from_host.is_some() - } - - // Param is passed by value, moved - pub fn set_hide_passphrase_from_host(&mut self, v: bool) { - self.hide_passphrase_from_host = ::std::option::Option::Some(v); - } - - // optional string internal_model = 44; - - pub fn internal_model(&self) -> &str { - match self.internal_model.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_internal_model(&mut self) { - self.internal_model = ::std::option::Option::None; - } - - pub fn has_internal_model(&self) -> bool { - self.internal_model.is_some() - } - - // Param is passed by value, moved - pub fn set_internal_model(&mut self, v: ::std::string::String) { - self.internal_model = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_internal_model(&mut self) -> &mut ::std::string::String { - if self.internal_model.is_none() { - self.internal_model = ::std::option::Option::Some(::std::string::String::new()); - } - self.internal_model.as_mut().unwrap() - } - - // Take field - pub fn take_internal_model(&mut self) -> ::std::string::String { - self.internal_model.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 unit_color = 45; - - pub fn unit_color(&self) -> u32 { - self.unit_color.unwrap_or(0) - } - - pub fn clear_unit_color(&mut self) { - self.unit_color = ::std::option::Option::None; - } - - pub fn has_unit_color(&self) -> bool { - self.unit_color.is_some() - } - - // Param is passed by value, moved - pub fn set_unit_color(&mut self, v: u32) { - self.unit_color = ::std::option::Option::Some(v); - } - - // optional bool unit_btconly = 46; - - pub fn unit_btconly(&self) -> bool { - self.unit_btconly.unwrap_or(false) - } - - pub fn clear_unit_btconly(&mut self) { - self.unit_btconly = ::std::option::Option::None; - } - - pub fn has_unit_btconly(&self) -> bool { - self.unit_btconly.is_some() - } - - // Param is passed by value, moved - pub fn set_unit_btconly(&mut self, v: bool) { - self.unit_btconly = ::std::option::Option::Some(v); - } - - // optional uint32 homescreen_width = 47; - - pub fn homescreen_width(&self) -> u32 { - self.homescreen_width.unwrap_or(0) - } - - pub fn clear_homescreen_width(&mut self) { - self.homescreen_width = ::std::option::Option::None; - } - - pub fn has_homescreen_width(&self) -> bool { - self.homescreen_width.is_some() - } - - // Param is passed by value, moved - pub fn set_homescreen_width(&mut self, v: u32) { - self.homescreen_width = ::std::option::Option::Some(v); - } - - // optional uint32 homescreen_height = 48; - - pub fn homescreen_height(&self) -> u32 { - self.homescreen_height.unwrap_or(0) - } - - pub fn clear_homescreen_height(&mut self) { - self.homescreen_height = ::std::option::Option::None; - } - - pub fn has_homescreen_height(&self) -> bool { - self.homescreen_height.is_some() - } - - // Param is passed by value, moved - pub fn set_homescreen_height(&mut self, v: u32) { - self.homescreen_height = ::std::option::Option::Some(v); - } - - // optional bool bootloader_locked = 49; - - pub fn bootloader_locked(&self) -> bool { - self.bootloader_locked.unwrap_or(false) - } - - pub fn clear_bootloader_locked(&mut self) { - self.bootloader_locked = ::std::option::Option::None; - } - - pub fn has_bootloader_locked(&self) -> bool { - self.bootloader_locked.is_some() - } - - // Param is passed by value, moved - pub fn set_bootloader_locked(&mut self, v: bool) { - self.bootloader_locked = ::std::option::Option::Some(v); - } - - // optional bool language_version_matches = 50; - - pub fn language_version_matches(&self) -> bool { - self.language_version_matches.unwrap_or(true) - } - - pub fn clear_language_version_matches(&mut self) { - self.language_version_matches = ::std::option::Option::None; - } - - pub fn has_language_version_matches(&self) -> bool { - self.language_version_matches.is_some() - } - - // Param is passed by value, moved - pub fn set_language_version_matches(&mut self, v: bool) { - self.language_version_matches = ::std::option::Option::Some(v); - } - - // optional uint32 unit_packaging = 51; - - pub fn unit_packaging(&self) -> u32 { - self.unit_packaging.unwrap_or(0) - } - - pub fn clear_unit_packaging(&mut self) { - self.unit_packaging = ::std::option::Option::None; - } - - pub fn has_unit_packaging(&self) -> bool { - self.unit_packaging.is_some() - } - - // Param is passed by value, moved - pub fn set_unit_packaging(&mut self, v: u32) { - self.unit_packaging = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(49); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vendor", - |m: &Features| { &m.vendor }, - |m: &mut Features| { &mut m.vendor }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "major_version", - |m: &Features| { &m.major_version }, - |m: &mut Features| { &mut m.major_version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "minor_version", - |m: &Features| { &m.minor_version }, - |m: &mut Features| { &mut m.minor_version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "patch_version", - |m: &Features| { &m.patch_version }, - |m: &mut Features| { &mut m.patch_version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bootloader_mode", - |m: &Features| { &m.bootloader_mode }, - |m: &mut Features| { &mut m.bootloader_mode }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "device_id", - |m: &Features| { &m.device_id }, - |m: &mut Features| { &mut m.device_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pin_protection", - |m: &Features| { &m.pin_protection }, - |m: &mut Features| { &mut m.pin_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase_protection", - |m: &Features| { &m.passphrase_protection }, - |m: &mut Features| { &mut m.passphrase_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "language", - |m: &Features| { &m.language }, - |m: &mut Features| { &mut m.language }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "label", - |m: &Features| { &m.label }, - |m: &mut Features| { &mut m.label }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "initialized", - |m: &Features| { &m.initialized }, - |m: &mut Features| { &mut m.initialized }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "revision", - |m: &Features| { &m.revision }, - |m: &mut Features| { &mut m.revision }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bootloader_hash", - |m: &Features| { &m.bootloader_hash }, - |m: &mut Features| { &mut m.bootloader_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "imported", - |m: &Features| { &m.imported }, - |m: &mut Features| { &mut m.imported }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "unlocked", - |m: &Features| { &m.unlocked }, - |m: &mut Features| { &mut m.unlocked }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "_passphrase_cached", - |m: &Features| { &m._passphrase_cached }, - |m: &mut Features| { &mut m._passphrase_cached }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "firmware_present", - |m: &Features| { &m.firmware_present }, - |m: &mut Features| { &mut m.firmware_present }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "needs_backup", - |m: &Features| { &m.needs_backup }, - |m: &mut Features| { &mut m.needs_backup }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "flags", - |m: &Features| { &m.flags }, - |m: &mut Features| { &mut m.flags }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "model", - |m: &Features| { &m.model }, - |m: &mut Features| { &mut m.model }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fw_major", - |m: &Features| { &m.fw_major }, - |m: &mut Features| { &mut m.fw_major }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fw_minor", - |m: &Features| { &m.fw_minor }, - |m: &mut Features| { &mut m.fw_minor }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fw_patch", - |m: &Features| { &m.fw_patch }, - |m: &mut Features| { &mut m.fw_patch }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fw_vendor", - |m: &Features| { &m.fw_vendor }, - |m: &mut Features| { &mut m.fw_vendor }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "unfinished_backup", - |m: &Features| { &m.unfinished_backup }, - |m: &mut Features| { &mut m.unfinished_backup }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "no_backup", - |m: &Features| { &m.no_backup }, - |m: &mut Features| { &mut m.no_backup }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "recovery_mode", - |m: &Features| { &m.recovery_mode }, - |m: &mut Features| { &mut m.recovery_mode }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "capabilities", - |m: &Features| { &m.capabilities }, - |m: &mut Features| { &mut m.capabilities }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "backup_type", - |m: &Features| { &m.backup_type }, - |m: &mut Features| { &mut m.backup_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sd_card_present", - |m: &Features| { &m.sd_card_present }, - |m: &mut Features| { &mut m.sd_card_present }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sd_protection", - |m: &Features| { &m.sd_protection }, - |m: &mut Features| { &mut m.sd_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "wipe_code_protection", - |m: &Features| { &m.wipe_code_protection }, - |m: &mut Features| { &mut m.wipe_code_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "session_id", - |m: &Features| { &m.session_id }, - |m: &mut Features| { &mut m.session_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase_always_on_device", - |m: &Features| { &m.passphrase_always_on_device }, - |m: &mut Features| { &mut m.passphrase_always_on_device }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "safety_checks", - |m: &Features| { &m.safety_checks }, - |m: &mut Features| { &mut m.safety_checks }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "auto_lock_delay_ms", - |m: &Features| { &m.auto_lock_delay_ms }, - |m: &mut Features| { &mut m.auto_lock_delay_ms }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "display_rotation", - |m: &Features| { &m.display_rotation }, - |m: &mut Features| { &mut m.display_rotation }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "experimental_features", - |m: &Features| { &m.experimental_features }, - |m: &mut Features| { &mut m.experimental_features }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "busy", - |m: &Features| { &m.busy }, - |m: &mut Features| { &mut m.busy }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "homescreen_format", - |m: &Features| { &m.homescreen_format }, - |m: &mut Features| { &mut m.homescreen_format }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hide_passphrase_from_host", - |m: &Features| { &m.hide_passphrase_from_host }, - |m: &mut Features| { &mut m.hide_passphrase_from_host }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "internal_model", - |m: &Features| { &m.internal_model }, - |m: &mut Features| { &mut m.internal_model }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "unit_color", - |m: &Features| { &m.unit_color }, - |m: &mut Features| { &mut m.unit_color }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "unit_btconly", - |m: &Features| { &m.unit_btconly }, - |m: &mut Features| { &mut m.unit_btconly }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "homescreen_width", - |m: &Features| { &m.homescreen_width }, - |m: &mut Features| { &mut m.homescreen_width }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "homescreen_height", - |m: &Features| { &m.homescreen_height }, - |m: &mut Features| { &mut m.homescreen_height }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bootloader_locked", - |m: &Features| { &m.bootloader_locked }, - |m: &mut Features| { &mut m.bootloader_locked }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "language_version_matches", - |m: &Features| { &m.language_version_matches }, - |m: &mut Features| { &mut m.language_version_matches }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "unit_packaging", - |m: &Features| { &m.unit_packaging }, - |m: &mut Features| { &mut m.unit_packaging }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Features", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Features { - const NAME: &'static str = "Features"; - - fn is_initialized(&self) -> bool { - if self.major_version.is_none() { - return false; - } - if self.minor_version.is_none() { - return false; - } - if self.patch_version.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.vendor = ::std::option::Option::Some(is.read_string()?); - }, - 16 => { - self.major_version = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.minor_version = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.patch_version = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.bootloader_mode = ::std::option::Option::Some(is.read_bool()?); - }, - 50 => { - self.device_id = ::std::option::Option::Some(is.read_string()?); - }, - 56 => { - self.pin_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 64 => { - self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 74 => { - self.language = ::std::option::Option::Some(is.read_string()?); - }, - 82 => { - self.label = ::std::option::Option::Some(is.read_string()?); - }, - 96 => { - self.initialized = ::std::option::Option::Some(is.read_bool()?); - }, - 106 => { - self.revision = ::std::option::Option::Some(is.read_bytes()?); - }, - 114 => { - self.bootloader_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 120 => { - self.imported = ::std::option::Option::Some(is.read_bool()?); - }, - 128 => { - self.unlocked = ::std::option::Option::Some(is.read_bool()?); - }, - 136 => { - self._passphrase_cached = ::std::option::Option::Some(is.read_bool()?); - }, - 144 => { - self.firmware_present = ::std::option::Option::Some(is.read_bool()?); - }, - 152 => { - self.needs_backup = ::std::option::Option::Some(is.read_bool()?); - }, - 160 => { - self.flags = ::std::option::Option::Some(is.read_uint32()?); - }, - 170 => { - self.model = ::std::option::Option::Some(is.read_string()?); - }, - 176 => { - self.fw_major = ::std::option::Option::Some(is.read_uint32()?); - }, - 184 => { - self.fw_minor = ::std::option::Option::Some(is.read_uint32()?); - }, - 192 => { - self.fw_patch = ::std::option::Option::Some(is.read_uint32()?); - }, - 202 => { - self.fw_vendor = ::std::option::Option::Some(is.read_string()?); - }, - 216 => { - self.unfinished_backup = ::std::option::Option::Some(is.read_bool()?); - }, - 224 => { - self.no_backup = ::std::option::Option::Some(is.read_bool()?); - }, - 232 => { - self.recovery_mode = ::std::option::Option::Some(is.read_bool()?); - }, - 240 => { - self.capabilities.push(is.read_enum_or_unknown()?); - }, - 242 => { - ::protobuf::rt::read_repeated_packed_enum_or_unknown_into(is, &mut self.capabilities)? - }, - 248 => { - self.backup_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 256 => { - self.sd_card_present = ::std::option::Option::Some(is.read_bool()?); - }, - 264 => { - self.sd_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 272 => { - self.wipe_code_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 282 => { - self.session_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 288 => { - self.passphrase_always_on_device = ::std::option::Option::Some(is.read_bool()?); - }, - 296 => { - self.safety_checks = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 304 => { - self.auto_lock_delay_ms = ::std::option::Option::Some(is.read_uint32()?); - }, - 312 => { - self.display_rotation = ::std::option::Option::Some(is.read_uint32()?); - }, - 320 => { - self.experimental_features = ::std::option::Option::Some(is.read_bool()?); - }, - 328 => { - self.busy = ::std::option::Option::Some(is.read_bool()?); - }, - 336 => { - self.homescreen_format = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 344 => { - self.hide_passphrase_from_host = ::std::option::Option::Some(is.read_bool()?); - }, - 354 => { - self.internal_model = ::std::option::Option::Some(is.read_string()?); - }, - 360 => { - self.unit_color = ::std::option::Option::Some(is.read_uint32()?); - }, - 368 => { - self.unit_btconly = ::std::option::Option::Some(is.read_bool()?); - }, - 376 => { - self.homescreen_width = ::std::option::Option::Some(is.read_uint32()?); - }, - 384 => { - self.homescreen_height = ::std::option::Option::Some(is.read_uint32()?); - }, - 392 => { - self.bootloader_locked = ::std::option::Option::Some(is.read_bool()?); - }, - 400 => { - self.language_version_matches = ::std::option::Option::Some(is.read_bool()?); - }, - 408 => { - self.unit_packaging = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.vendor.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.major_version { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.minor_version { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.patch_version { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.bootloader_mode { - my_size += 1 + 1; - } - if let Some(v) = self.device_id.as_ref() { - my_size += ::protobuf::rt::string_size(6, &v); - } - if let Some(v) = self.pin_protection { - my_size += 1 + 1; - } - if let Some(v) = self.passphrase_protection { - my_size += 1 + 1; - } - if let Some(v) = self.language.as_ref() { - my_size += ::protobuf::rt::string_size(9, &v); - } - if let Some(v) = self.label.as_ref() { - my_size += ::protobuf::rt::string_size(10, &v); - } - if let Some(v) = self.initialized { - my_size += 1 + 1; - } - if let Some(v) = self.revision.as_ref() { - my_size += ::protobuf::rt::bytes_size(13, &v); - } - if let Some(v) = self.bootloader_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(14, &v); - } - if let Some(v) = self.imported { - my_size += 1 + 1; - } - if let Some(v) = self.unlocked { - my_size += 2 + 1; - } - if let Some(v) = self._passphrase_cached { - my_size += 2 + 1; - } - if let Some(v) = self.firmware_present { - my_size += 2 + 1; - } - if let Some(v) = self.needs_backup { - my_size += 2 + 1; - } - if let Some(v) = self.flags { - my_size += ::protobuf::rt::uint32_size(20, v); - } - if let Some(v) = self.model.as_ref() { - my_size += ::protobuf::rt::string_size(21, &v); - } - if let Some(v) = self.fw_major { - my_size += ::protobuf::rt::uint32_size(22, v); - } - if let Some(v) = self.fw_minor { - my_size += ::protobuf::rt::uint32_size(23, v); - } - if let Some(v) = self.fw_patch { - my_size += ::protobuf::rt::uint32_size(24, v); - } - if let Some(v) = self.fw_vendor.as_ref() { - my_size += ::protobuf::rt::string_size(25, &v); - } - if let Some(v) = self.unfinished_backup { - my_size += 2 + 1; - } - if let Some(v) = self.no_backup { - my_size += 2 + 1; - } - if let Some(v) = self.recovery_mode { - my_size += 2 + 1; - } - for value in &self.capabilities { - my_size += ::protobuf::rt::int32_size(30, value.value()); - }; - if let Some(v) = self.backup_type { - my_size += ::protobuf::rt::int32_size(31, v.value()); - } - if let Some(v) = self.sd_card_present { - my_size += 2 + 1; - } - if let Some(v) = self.sd_protection { - my_size += 2 + 1; - } - if let Some(v) = self.wipe_code_protection { - my_size += 2 + 1; - } - if let Some(v) = self.session_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(35, &v); - } - if let Some(v) = self.passphrase_always_on_device { - my_size += 2 + 1; - } - if let Some(v) = self.safety_checks { - my_size += ::protobuf::rt::int32_size(37, v.value()); - } - if let Some(v) = self.auto_lock_delay_ms { - my_size += ::protobuf::rt::uint32_size(38, v); - } - if let Some(v) = self.display_rotation { - my_size += ::protobuf::rt::uint32_size(39, v); - } - if let Some(v) = self.experimental_features { - my_size += 2 + 1; - } - if let Some(v) = self.busy { - my_size += 2 + 1; - } - if let Some(v) = self.homescreen_format { - my_size += ::protobuf::rt::int32_size(42, v.value()); - } - if let Some(v) = self.hide_passphrase_from_host { - my_size += 2 + 1; - } - if let Some(v) = self.internal_model.as_ref() { - my_size += ::protobuf::rt::string_size(44, &v); - } - if let Some(v) = self.unit_color { - my_size += ::protobuf::rt::uint32_size(45, v); - } - if let Some(v) = self.unit_btconly { - my_size += 2 + 1; - } - if let Some(v) = self.homescreen_width { - my_size += ::protobuf::rt::uint32_size(47, v); - } - if let Some(v) = self.homescreen_height { - my_size += ::protobuf::rt::uint32_size(48, v); - } - if let Some(v) = self.bootloader_locked { - my_size += 2 + 1; - } - if let Some(v) = self.language_version_matches { - my_size += 2 + 1; - } - if let Some(v) = self.unit_packaging { - my_size += ::protobuf::rt::uint32_size(51, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.vendor.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.major_version { - os.write_uint32(2, v)?; - } - if let Some(v) = self.minor_version { - os.write_uint32(3, v)?; - } - if let Some(v) = self.patch_version { - os.write_uint32(4, v)?; - } - if let Some(v) = self.bootloader_mode { - os.write_bool(5, v)?; - } - if let Some(v) = self.device_id.as_ref() { - os.write_string(6, v)?; - } - if let Some(v) = self.pin_protection { - os.write_bool(7, v)?; - } - if let Some(v) = self.passphrase_protection { - os.write_bool(8, v)?; - } - if let Some(v) = self.language.as_ref() { - os.write_string(9, v)?; - } - if let Some(v) = self.label.as_ref() { - os.write_string(10, v)?; - } - if let Some(v) = self.initialized { - os.write_bool(12, v)?; - } - if let Some(v) = self.revision.as_ref() { - os.write_bytes(13, v)?; - } - if let Some(v) = self.bootloader_hash.as_ref() { - os.write_bytes(14, v)?; - } - if let Some(v) = self.imported { - os.write_bool(15, v)?; - } - if let Some(v) = self.unlocked { - os.write_bool(16, v)?; - } - if let Some(v) = self._passphrase_cached { - os.write_bool(17, v)?; - } - if let Some(v) = self.firmware_present { - os.write_bool(18, v)?; - } - if let Some(v) = self.needs_backup { - os.write_bool(19, v)?; - } - if let Some(v) = self.flags { - os.write_uint32(20, v)?; - } - if let Some(v) = self.model.as_ref() { - os.write_string(21, v)?; - } - if let Some(v) = self.fw_major { - os.write_uint32(22, v)?; - } - if let Some(v) = self.fw_minor { - os.write_uint32(23, v)?; - } - if let Some(v) = self.fw_patch { - os.write_uint32(24, v)?; - } - if let Some(v) = self.fw_vendor.as_ref() { - os.write_string(25, v)?; - } - if let Some(v) = self.unfinished_backup { - os.write_bool(27, v)?; - } - if let Some(v) = self.no_backup { - os.write_bool(28, v)?; - } - if let Some(v) = self.recovery_mode { - os.write_bool(29, v)?; - } - for v in &self.capabilities { - os.write_enum(30, ::protobuf::EnumOrUnknown::value(v))?; - }; - if let Some(v) = self.backup_type { - os.write_enum(31, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.sd_card_present { - os.write_bool(32, v)?; - } - if let Some(v) = self.sd_protection { - os.write_bool(33, v)?; - } - if let Some(v) = self.wipe_code_protection { - os.write_bool(34, v)?; - } - if let Some(v) = self.session_id.as_ref() { - os.write_bytes(35, v)?; - } - if let Some(v) = self.passphrase_always_on_device { - os.write_bool(36, v)?; - } - if let Some(v) = self.safety_checks { - os.write_enum(37, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.auto_lock_delay_ms { - os.write_uint32(38, v)?; - } - if let Some(v) = self.display_rotation { - os.write_uint32(39, v)?; - } - if let Some(v) = self.experimental_features { - os.write_bool(40, v)?; - } - if let Some(v) = self.busy { - os.write_bool(41, v)?; - } - if let Some(v) = self.homescreen_format { - os.write_enum(42, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.hide_passphrase_from_host { - os.write_bool(43, v)?; - } - if let Some(v) = self.internal_model.as_ref() { - os.write_string(44, v)?; - } - if let Some(v) = self.unit_color { - os.write_uint32(45, v)?; - } - if let Some(v) = self.unit_btconly { - os.write_bool(46, v)?; - } - if let Some(v) = self.homescreen_width { - os.write_uint32(47, v)?; - } - if let Some(v) = self.homescreen_height { - os.write_uint32(48, v)?; - } - if let Some(v) = self.bootloader_locked { - os.write_bool(49, v)?; - } - if let Some(v) = self.language_version_matches { - os.write_bool(50, v)?; - } - if let Some(v) = self.unit_packaging { - os.write_uint32(51, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Features { - Features::new() - } - - fn clear(&mut self) { - self.vendor = ::std::option::Option::None; - self.major_version = ::std::option::Option::None; - self.minor_version = ::std::option::Option::None; - self.patch_version = ::std::option::Option::None; - self.bootloader_mode = ::std::option::Option::None; - self.device_id = ::std::option::Option::None; - self.pin_protection = ::std::option::Option::None; - self.passphrase_protection = ::std::option::Option::None; - self.language = ::std::option::Option::None; - self.label = ::std::option::Option::None; - self.initialized = ::std::option::Option::None; - self.revision = ::std::option::Option::None; - self.bootloader_hash = ::std::option::Option::None; - self.imported = ::std::option::Option::None; - self.unlocked = ::std::option::Option::None; - self._passphrase_cached = ::std::option::Option::None; - self.firmware_present = ::std::option::Option::None; - self.needs_backup = ::std::option::Option::None; - self.flags = ::std::option::Option::None; - self.model = ::std::option::Option::None; - self.fw_major = ::std::option::Option::None; - self.fw_minor = ::std::option::Option::None; - self.fw_patch = ::std::option::Option::None; - self.fw_vendor = ::std::option::Option::None; - self.unfinished_backup = ::std::option::Option::None; - self.no_backup = ::std::option::Option::None; - self.recovery_mode = ::std::option::Option::None; - self.capabilities.clear(); - self.backup_type = ::std::option::Option::None; - self.sd_card_present = ::std::option::Option::None; - self.sd_protection = ::std::option::Option::None; - self.wipe_code_protection = ::std::option::Option::None; - self.session_id = ::std::option::Option::None; - self.passphrase_always_on_device = ::std::option::Option::None; - self.safety_checks = ::std::option::Option::None; - self.auto_lock_delay_ms = ::std::option::Option::None; - self.display_rotation = ::std::option::Option::None; - self.experimental_features = ::std::option::Option::None; - self.busy = ::std::option::Option::None; - self.homescreen_format = ::std::option::Option::None; - self.hide_passphrase_from_host = ::std::option::Option::None; - self.internal_model = ::std::option::Option::None; - self.unit_color = ::std::option::Option::None; - self.unit_btconly = ::std::option::Option::None; - self.homescreen_width = ::std::option::Option::None; - self.homescreen_height = ::std::option::Option::None; - self.bootloader_locked = ::std::option::Option::None; - self.language_version_matches = ::std::option::Option::None; - self.unit_packaging = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Features { - static instance: Features = Features { - vendor: ::std::option::Option::None, - major_version: ::std::option::Option::None, - minor_version: ::std::option::Option::None, - patch_version: ::std::option::Option::None, - bootloader_mode: ::std::option::Option::None, - device_id: ::std::option::Option::None, - pin_protection: ::std::option::Option::None, - passphrase_protection: ::std::option::Option::None, - language: ::std::option::Option::None, - label: ::std::option::Option::None, - initialized: ::std::option::Option::None, - revision: ::std::option::Option::None, - bootloader_hash: ::std::option::Option::None, - imported: ::std::option::Option::None, - unlocked: ::std::option::Option::None, - _passphrase_cached: ::std::option::Option::None, - firmware_present: ::std::option::Option::None, - needs_backup: ::std::option::Option::None, - flags: ::std::option::Option::None, - model: ::std::option::Option::None, - fw_major: ::std::option::Option::None, - fw_minor: ::std::option::Option::None, - fw_patch: ::std::option::Option::None, - fw_vendor: ::std::option::Option::None, - unfinished_backup: ::std::option::Option::None, - no_backup: ::std::option::Option::None, - recovery_mode: ::std::option::Option::None, - capabilities: ::std::vec::Vec::new(), - backup_type: ::std::option::Option::None, - sd_card_present: ::std::option::Option::None, - sd_protection: ::std::option::Option::None, - wipe_code_protection: ::std::option::Option::None, - session_id: ::std::option::Option::None, - passphrase_always_on_device: ::std::option::Option::None, - safety_checks: ::std::option::Option::None, - auto_lock_delay_ms: ::std::option::Option::None, - display_rotation: ::std::option::Option::None, - experimental_features: ::std::option::Option::None, - busy: ::std::option::Option::None, - homescreen_format: ::std::option::Option::None, - hide_passphrase_from_host: ::std::option::Option::None, - internal_model: ::std::option::Option::None, - unit_color: ::std::option::Option::None, - unit_btconly: ::std::option::Option::None, - homescreen_width: ::std::option::Option::None, - homescreen_height: ::std::option::Option::None, - bootloader_locked: ::std::option::Option::None, - language_version_matches: ::std::option::Option::None, - unit_packaging: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Features { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Features").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Features { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Features { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `Features` -pub mod features { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.management.Features.Capability) - pub enum Capability { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Bitcoin) - Capability_Bitcoin = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Bitcoin_like) - Capability_Bitcoin_like = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Binance) - Capability_Binance = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Cardano) - Capability_Cardano = 4, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Crypto) - Capability_Crypto = 5, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_EOS) - Capability_EOS = 6, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Ethereum) - Capability_Ethereum = 7, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Lisk) - Capability_Lisk = 8, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Monero) - Capability_Monero = 9, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_NEM) - Capability_NEM = 10, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Ripple) - Capability_Ripple = 11, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Stellar) - Capability_Stellar = 12, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Tezos) - Capability_Tezos = 13, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_U2F) - Capability_U2F = 14, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Shamir) - Capability_Shamir = 15, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_ShamirGroups) - Capability_ShamirGroups = 16, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_PassphraseEntry) - Capability_PassphraseEntry = 17, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Solana) - Capability_Solana = 18, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Translations) - Capability_Translations = 19, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.Capability.Capability_Mintlayer) - Capability_Mintlayer = 20, - } - - impl ::protobuf::Enum for Capability { - const NAME: &'static str = "Capability"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(Capability::Capability_Bitcoin), - 2 => ::std::option::Option::Some(Capability::Capability_Bitcoin_like), - 3 => ::std::option::Option::Some(Capability::Capability_Binance), - 4 => ::std::option::Option::Some(Capability::Capability_Cardano), - 5 => ::std::option::Option::Some(Capability::Capability_Crypto), - 6 => ::std::option::Option::Some(Capability::Capability_EOS), - 7 => ::std::option::Option::Some(Capability::Capability_Ethereum), - 8 => ::std::option::Option::Some(Capability::Capability_Lisk), - 9 => ::std::option::Option::Some(Capability::Capability_Monero), - 10 => ::std::option::Option::Some(Capability::Capability_NEM), - 11 => ::std::option::Option::Some(Capability::Capability_Ripple), - 12 => ::std::option::Option::Some(Capability::Capability_Stellar), - 13 => ::std::option::Option::Some(Capability::Capability_Tezos), - 14 => ::std::option::Option::Some(Capability::Capability_U2F), - 15 => ::std::option::Option::Some(Capability::Capability_Shamir), - 16 => ::std::option::Option::Some(Capability::Capability_ShamirGroups), - 17 => ::std::option::Option::Some(Capability::Capability_PassphraseEntry), - 18 => ::std::option::Option::Some(Capability::Capability_Solana), - 19 => ::std::option::Option::Some(Capability::Capability_Translations), - 20 => ::std::option::Option::Some(Capability::Capability_Mintlayer), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "Capability_Bitcoin" => ::std::option::Option::Some(Capability::Capability_Bitcoin), - "Capability_Bitcoin_like" => ::std::option::Option::Some(Capability::Capability_Bitcoin_like), - "Capability_Binance" => ::std::option::Option::Some(Capability::Capability_Binance), - "Capability_Cardano" => ::std::option::Option::Some(Capability::Capability_Cardano), - "Capability_Crypto" => ::std::option::Option::Some(Capability::Capability_Crypto), - "Capability_EOS" => ::std::option::Option::Some(Capability::Capability_EOS), - "Capability_Ethereum" => ::std::option::Option::Some(Capability::Capability_Ethereum), - "Capability_Lisk" => ::std::option::Option::Some(Capability::Capability_Lisk), - "Capability_Monero" => ::std::option::Option::Some(Capability::Capability_Monero), - "Capability_NEM" => ::std::option::Option::Some(Capability::Capability_NEM), - "Capability_Ripple" => ::std::option::Option::Some(Capability::Capability_Ripple), - "Capability_Stellar" => ::std::option::Option::Some(Capability::Capability_Stellar), - "Capability_Tezos" => ::std::option::Option::Some(Capability::Capability_Tezos), - "Capability_U2F" => ::std::option::Option::Some(Capability::Capability_U2F), - "Capability_Shamir" => ::std::option::Option::Some(Capability::Capability_Shamir), - "Capability_ShamirGroups" => ::std::option::Option::Some(Capability::Capability_ShamirGroups), - "Capability_PassphraseEntry" => ::std::option::Option::Some(Capability::Capability_PassphraseEntry), - "Capability_Solana" => ::std::option::Option::Some(Capability::Capability_Solana), - "Capability_Translations" => ::std::option::Option::Some(Capability::Capability_Translations), - "Capability_Mintlayer" => ::std::option::Option::Some(Capability::Capability_Mintlayer), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [Capability] = &[ - Capability::Capability_Bitcoin, - Capability::Capability_Bitcoin_like, - Capability::Capability_Binance, - Capability::Capability_Cardano, - Capability::Capability_Crypto, - Capability::Capability_EOS, - Capability::Capability_Ethereum, - Capability::Capability_Lisk, - Capability::Capability_Monero, - Capability::Capability_NEM, - Capability::Capability_Ripple, - Capability::Capability_Stellar, - Capability::Capability_Tezos, - Capability::Capability_U2F, - Capability::Capability_Shamir, - Capability::Capability_ShamirGroups, - Capability::Capability_PassphraseEntry, - Capability::Capability_Solana, - Capability::Capability_Translations, - Capability::Capability_Mintlayer, - ]; - } - - impl ::protobuf::EnumFull for Capability { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Features.Capability").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - Capability::Capability_Bitcoin => 0, - Capability::Capability_Bitcoin_like => 1, - Capability::Capability_Binance => 2, - Capability::Capability_Cardano => 3, - Capability::Capability_Crypto => 4, - Capability::Capability_EOS => 5, - Capability::Capability_Ethereum => 6, - Capability::Capability_Lisk => 7, - Capability::Capability_Monero => 8, - Capability::Capability_NEM => 9, - Capability::Capability_Ripple => 10, - Capability::Capability_Stellar => 11, - Capability::Capability_Tezos => 12, - Capability::Capability_U2F => 13, - Capability::Capability_Shamir => 14, - Capability::Capability_ShamirGroups => 15, - Capability::Capability_PassphraseEntry => 16, - Capability::Capability_Solana => 17, - Capability::Capability_Translations => 18, - Capability::Capability_Mintlayer => 19, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for Capability { - fn default() -> Self { - Capability::Capability_Bitcoin - } - } - - impl Capability { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Features.Capability") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.LockDevice) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct LockDevice { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.LockDevice.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a LockDevice { - fn default() -> &'a LockDevice { - ::default_instance() - } -} - -impl LockDevice { - pub fn new() -> LockDevice { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "LockDevice", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for LockDevice { - const NAME: &'static str = "LockDevice"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> LockDevice { - LockDevice::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static LockDevice { - static instance: LockDevice = LockDevice { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for LockDevice { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("LockDevice").unwrap()).clone() - } -} - -impl ::std::fmt::Display for LockDevice { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for LockDevice { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.SetBusy) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SetBusy { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.SetBusy.expiry_ms) - pub expiry_ms: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.SetBusy.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SetBusy { - fn default() -> &'a SetBusy { - ::default_instance() - } -} - -impl SetBusy { - pub fn new() -> SetBusy { - ::std::default::Default::default() - } - - // optional uint32 expiry_ms = 1; - - pub fn expiry_ms(&self) -> u32 { - self.expiry_ms.unwrap_or(0) - } - - pub fn clear_expiry_ms(&mut self) { - self.expiry_ms = ::std::option::Option::None; - } - - pub fn has_expiry_ms(&self) -> bool { - self.expiry_ms.is_some() - } - - // Param is passed by value, moved - pub fn set_expiry_ms(&mut self, v: u32) { - self.expiry_ms = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "expiry_ms", - |m: &SetBusy| { &m.expiry_ms }, - |m: &mut SetBusy| { &mut m.expiry_ms }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SetBusy", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SetBusy { - const NAME: &'static str = "SetBusy"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.expiry_ms = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.expiry_ms { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.expiry_ms { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SetBusy { - SetBusy::new() - } - - fn clear(&mut self) { - self.expiry_ms = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SetBusy { - static instance: SetBusy = SetBusy { - expiry_ms: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SetBusy { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SetBusy").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SetBusy { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SetBusy { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.EndSession) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EndSession { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.EndSession.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EndSession { - fn default() -> &'a EndSession { - ::default_instance() - } -} - -impl EndSession { - pub fn new() -> EndSession { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EndSession", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EndSession { - const NAME: &'static str = "EndSession"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EndSession { - EndSession::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static EndSession { - static instance: EndSession = EndSession { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EndSession { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EndSession").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EndSession { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EndSession { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.ApplySettings) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ApplySettings { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.language) - pub language: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.label) - pub label: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.use_passphrase) - pub use_passphrase: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.homescreen) - pub homescreen: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings._passphrase_source) - pub _passphrase_source: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.auto_lock_delay_ms) - pub auto_lock_delay_ms: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.display_rotation) - pub display_rotation: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.passphrase_always_on_device) - pub passphrase_always_on_device: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.safety_checks) - pub safety_checks: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.experimental_features) - pub experimental_features: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplySettings.hide_passphrase_from_host) - pub hide_passphrase_from_host: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ApplySettings.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ApplySettings { - fn default() -> &'a ApplySettings { - ::default_instance() - } -} - -impl ApplySettings { - pub fn new() -> ApplySettings { - ::std::default::Default::default() - } - - // optional string language = 1; - - pub fn language(&self) -> &str { - match self.language.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_language(&mut self) { - self.language = ::std::option::Option::None; - } - - pub fn has_language(&self) -> bool { - self.language.is_some() - } - - // Param is passed by value, moved - pub fn set_language(&mut self, v: ::std::string::String) { - self.language = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_language(&mut self) -> &mut ::std::string::String { - if self.language.is_none() { - self.language = ::std::option::Option::Some(::std::string::String::new()); - } - self.language.as_mut().unwrap() - } - - // Take field - pub fn take_language(&mut self) -> ::std::string::String { - self.language.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string label = 2; - - pub fn label(&self) -> &str { - match self.label.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_label(&mut self) { - self.label = ::std::option::Option::None; - } - - pub fn has_label(&self) -> bool { - self.label.is_some() - } - - // Param is passed by value, moved - pub fn set_label(&mut self, v: ::std::string::String) { - self.label = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_label(&mut self) -> &mut ::std::string::String { - if self.label.is_none() { - self.label = ::std::option::Option::Some(::std::string::String::new()); - } - self.label.as_mut().unwrap() - } - - // Take field - pub fn take_label(&mut self) -> ::std::string::String { - self.label.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool use_passphrase = 3; - - pub fn use_passphrase(&self) -> bool { - self.use_passphrase.unwrap_or(false) - } - - pub fn clear_use_passphrase(&mut self) { - self.use_passphrase = ::std::option::Option::None; - } - - pub fn has_use_passphrase(&self) -> bool { - self.use_passphrase.is_some() - } - - // Param is passed by value, moved - pub fn set_use_passphrase(&mut self, v: bool) { - self.use_passphrase = ::std::option::Option::Some(v); - } - - // optional bytes homescreen = 4; - - pub fn homescreen(&self) -> &[u8] { - match self.homescreen.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_homescreen(&mut self) { - self.homescreen = ::std::option::Option::None; - } - - pub fn has_homescreen(&self) -> bool { - self.homescreen.is_some() - } - - // Param is passed by value, moved - pub fn set_homescreen(&mut self, v: ::std::vec::Vec) { - self.homescreen = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_homescreen(&mut self) -> &mut ::std::vec::Vec { - if self.homescreen.is_none() { - self.homescreen = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.homescreen.as_mut().unwrap() - } - - // Take field - pub fn take_homescreen(&mut self) -> ::std::vec::Vec { - self.homescreen.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 _passphrase_source = 5; - - pub fn _passphrase_source(&self) -> u32 { - self._passphrase_source.unwrap_or(0) - } - - pub fn clear__passphrase_source(&mut self) { - self._passphrase_source = ::std::option::Option::None; - } - - pub fn has__passphrase_source(&self) -> bool { - self._passphrase_source.is_some() - } - - // Param is passed by value, moved - pub fn set__passphrase_source(&mut self, v: u32) { - self._passphrase_source = ::std::option::Option::Some(v); - } - - // optional uint32 auto_lock_delay_ms = 6; - - pub fn auto_lock_delay_ms(&self) -> u32 { - self.auto_lock_delay_ms.unwrap_or(0) - } - - pub fn clear_auto_lock_delay_ms(&mut self) { - self.auto_lock_delay_ms = ::std::option::Option::None; - } - - pub fn has_auto_lock_delay_ms(&self) -> bool { - self.auto_lock_delay_ms.is_some() - } - - // Param is passed by value, moved - pub fn set_auto_lock_delay_ms(&mut self, v: u32) { - self.auto_lock_delay_ms = ::std::option::Option::Some(v); - } - - // optional uint32 display_rotation = 7; - - pub fn display_rotation(&self) -> u32 { - self.display_rotation.unwrap_or(0) - } - - pub fn clear_display_rotation(&mut self) { - self.display_rotation = ::std::option::Option::None; - } - - pub fn has_display_rotation(&self) -> bool { - self.display_rotation.is_some() - } - - // Param is passed by value, moved - pub fn set_display_rotation(&mut self, v: u32) { - self.display_rotation = ::std::option::Option::Some(v); - } - - // optional bool passphrase_always_on_device = 8; - - pub fn passphrase_always_on_device(&self) -> bool { - self.passphrase_always_on_device.unwrap_or(false) - } - - pub fn clear_passphrase_always_on_device(&mut self) { - self.passphrase_always_on_device = ::std::option::Option::None; - } - - pub fn has_passphrase_always_on_device(&self) -> bool { - self.passphrase_always_on_device.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase_always_on_device(&mut self, v: bool) { - self.passphrase_always_on_device = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.management.SafetyCheckLevel safety_checks = 9; - - pub fn safety_checks(&self) -> SafetyCheckLevel { - match self.safety_checks { - Some(e) => e.enum_value_or(SafetyCheckLevel::Strict), - None => SafetyCheckLevel::Strict, - } - } - - pub fn clear_safety_checks(&mut self) { - self.safety_checks = ::std::option::Option::None; - } - - pub fn has_safety_checks(&self) -> bool { - self.safety_checks.is_some() - } - - // Param is passed by value, moved - pub fn set_safety_checks(&mut self, v: SafetyCheckLevel) { - self.safety_checks = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bool experimental_features = 10; - - pub fn experimental_features(&self) -> bool { - self.experimental_features.unwrap_or(false) - } - - pub fn clear_experimental_features(&mut self) { - self.experimental_features = ::std::option::Option::None; - } - - pub fn has_experimental_features(&self) -> bool { - self.experimental_features.is_some() - } - - // Param is passed by value, moved - pub fn set_experimental_features(&mut self, v: bool) { - self.experimental_features = ::std::option::Option::Some(v); - } - - // optional bool hide_passphrase_from_host = 11; - - pub fn hide_passphrase_from_host(&self) -> bool { - self.hide_passphrase_from_host.unwrap_or(false) - } - - pub fn clear_hide_passphrase_from_host(&mut self) { - self.hide_passphrase_from_host = ::std::option::Option::None; - } - - pub fn has_hide_passphrase_from_host(&self) -> bool { - self.hide_passphrase_from_host.is_some() - } - - // Param is passed by value, moved - pub fn set_hide_passphrase_from_host(&mut self, v: bool) { - self.hide_passphrase_from_host = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(11); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "language", - |m: &ApplySettings| { &m.language }, - |m: &mut ApplySettings| { &mut m.language }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "label", - |m: &ApplySettings| { &m.label }, - |m: &mut ApplySettings| { &mut m.label }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "use_passphrase", - |m: &ApplySettings| { &m.use_passphrase }, - |m: &mut ApplySettings| { &mut m.use_passphrase }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "homescreen", - |m: &ApplySettings| { &m.homescreen }, - |m: &mut ApplySettings| { &mut m.homescreen }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "_passphrase_source", - |m: &ApplySettings| { &m._passphrase_source }, - |m: &mut ApplySettings| { &mut m._passphrase_source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "auto_lock_delay_ms", - |m: &ApplySettings| { &m.auto_lock_delay_ms }, - |m: &mut ApplySettings| { &mut m.auto_lock_delay_ms }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "display_rotation", - |m: &ApplySettings| { &m.display_rotation }, - |m: &mut ApplySettings| { &mut m.display_rotation }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase_always_on_device", - |m: &ApplySettings| { &m.passphrase_always_on_device }, - |m: &mut ApplySettings| { &mut m.passphrase_always_on_device }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "safety_checks", - |m: &ApplySettings| { &m.safety_checks }, - |m: &mut ApplySettings| { &mut m.safety_checks }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "experimental_features", - |m: &ApplySettings| { &m.experimental_features }, - |m: &mut ApplySettings| { &mut m.experimental_features }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hide_passphrase_from_host", - |m: &ApplySettings| { &m.hide_passphrase_from_host }, - |m: &mut ApplySettings| { &mut m.hide_passphrase_from_host }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ApplySettings", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ApplySettings { - const NAME: &'static str = "ApplySettings"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.language = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.label = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.use_passphrase = ::std::option::Option::Some(is.read_bool()?); - }, - 34 => { - self.homescreen = ::std::option::Option::Some(is.read_bytes()?); - }, - 40 => { - self._passphrase_source = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.auto_lock_delay_ms = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.display_rotation = ::std::option::Option::Some(is.read_uint32()?); - }, - 64 => { - self.passphrase_always_on_device = ::std::option::Option::Some(is.read_bool()?); - }, - 72 => { - self.safety_checks = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 80 => { - self.experimental_features = ::std::option::Option::Some(is.read_bool()?); - }, - 88 => { - self.hide_passphrase_from_host = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.language.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.label.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.use_passphrase { - my_size += 1 + 1; - } - if let Some(v) = self.homescreen.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self._passphrase_source { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.auto_lock_delay_ms { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.display_rotation { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.passphrase_always_on_device { - my_size += 1 + 1; - } - if let Some(v) = self.safety_checks { - my_size += ::protobuf::rt::int32_size(9, v.value()); - } - if let Some(v) = self.experimental_features { - my_size += 1 + 1; - } - if let Some(v) = self.hide_passphrase_from_host { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.language.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.label.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.use_passphrase { - os.write_bool(3, v)?; - } - if let Some(v) = self.homescreen.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self._passphrase_source { - os.write_uint32(5, v)?; - } - if let Some(v) = self.auto_lock_delay_ms { - os.write_uint32(6, v)?; - } - if let Some(v) = self.display_rotation { - os.write_uint32(7, v)?; - } - if let Some(v) = self.passphrase_always_on_device { - os.write_bool(8, v)?; - } - if let Some(v) = self.safety_checks { - os.write_enum(9, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.experimental_features { - os.write_bool(10, v)?; - } - if let Some(v) = self.hide_passphrase_from_host { - os.write_bool(11, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ApplySettings { - ApplySettings::new() - } - - fn clear(&mut self) { - self.language = ::std::option::Option::None; - self.label = ::std::option::Option::None; - self.use_passphrase = ::std::option::Option::None; - self.homescreen = ::std::option::Option::None; - self._passphrase_source = ::std::option::Option::None; - self.auto_lock_delay_ms = ::std::option::Option::None; - self.display_rotation = ::std::option::Option::None; - self.passphrase_always_on_device = ::std::option::Option::None; - self.safety_checks = ::std::option::Option::None; - self.experimental_features = ::std::option::Option::None; - self.hide_passphrase_from_host = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ApplySettings { - static instance: ApplySettings = ApplySettings { - language: ::std::option::Option::None, - label: ::std::option::Option::None, - use_passphrase: ::std::option::Option::None, - homescreen: ::std::option::Option::None, - _passphrase_source: ::std::option::Option::None, - auto_lock_delay_ms: ::std::option::Option::None, - display_rotation: ::std::option::Option::None, - passphrase_always_on_device: ::std::option::Option::None, - safety_checks: ::std::option::Option::None, - experimental_features: ::std::option::Option::None, - hide_passphrase_from_host: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ApplySettings { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ApplySettings").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ApplySettings { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ApplySettings { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.ChangeLanguage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ChangeLanguage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangeLanguage.data_length) - pub data_length: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangeLanguage.show_display) - pub show_display: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ChangeLanguage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ChangeLanguage { - fn default() -> &'a ChangeLanguage { - ::default_instance() - } -} - -impl ChangeLanguage { - pub fn new() -> ChangeLanguage { - ::std::default::Default::default() - } - - // required uint32 data_length = 1; - - pub fn data_length(&self) -> u32 { - self.data_length.unwrap_or(0) - } - - pub fn clear_data_length(&mut self) { - self.data_length = ::std::option::Option::None; - } - - pub fn has_data_length(&self) -> bool { - self.data_length.is_some() - } - - // Param is passed by value, moved - pub fn set_data_length(&mut self, v: u32) { - self.data_length = ::std::option::Option::Some(v); - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_length", - |m: &ChangeLanguage| { &m.data_length }, - |m: &mut ChangeLanguage| { &mut m.data_length }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &ChangeLanguage| { &m.show_display }, - |m: &mut ChangeLanguage| { &mut m.show_display }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ChangeLanguage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ChangeLanguage { - const NAME: &'static str = "ChangeLanguage"; - - fn is_initialized(&self) -> bool { - if self.data_length.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.data_length = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_length { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_length { - os.write_uint32(1, v)?; - } - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ChangeLanguage { - ChangeLanguage::new() - } - - fn clear(&mut self) { - self.data_length = ::std::option::Option::None; - self.show_display = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ChangeLanguage { - static instance: ChangeLanguage = ChangeLanguage { - data_length: ::std::option::Option::None, - show_display: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ChangeLanguage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ChangeLanguage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ChangeLanguage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ChangeLanguage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.TranslationDataRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TranslationDataRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.TranslationDataRequest.data_length) - pub data_length: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.TranslationDataRequest.data_offset) - pub data_offset: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.TranslationDataRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TranslationDataRequest { - fn default() -> &'a TranslationDataRequest { - ::default_instance() - } -} - -impl TranslationDataRequest { - pub fn new() -> TranslationDataRequest { - ::std::default::Default::default() - } - - // required uint32 data_length = 1; - - pub fn data_length(&self) -> u32 { - self.data_length.unwrap_or(0) - } - - pub fn clear_data_length(&mut self) { - self.data_length = ::std::option::Option::None; - } - - pub fn has_data_length(&self) -> bool { - self.data_length.is_some() - } - - // Param is passed by value, moved - pub fn set_data_length(&mut self, v: u32) { - self.data_length = ::std::option::Option::Some(v); - } - - // required uint32 data_offset = 2; - - pub fn data_offset(&self) -> u32 { - self.data_offset.unwrap_or(0) - } - - pub fn clear_data_offset(&mut self) { - self.data_offset = ::std::option::Option::None; - } - - pub fn has_data_offset(&self) -> bool { - self.data_offset.is_some() - } - - // Param is passed by value, moved - pub fn set_data_offset(&mut self, v: u32) { - self.data_offset = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_length", - |m: &TranslationDataRequest| { &m.data_length }, - |m: &mut TranslationDataRequest| { &mut m.data_length }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_offset", - |m: &TranslationDataRequest| { &m.data_offset }, - |m: &mut TranslationDataRequest| { &mut m.data_offset }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TranslationDataRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TranslationDataRequest { - const NAME: &'static str = "TranslationDataRequest"; - - fn is_initialized(&self) -> bool { - if self.data_length.is_none() { - return false; - } - if self.data_offset.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.data_length = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.data_offset = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_length { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.data_offset { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_length { - os.write_uint32(1, v)?; - } - if let Some(v) = self.data_offset { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TranslationDataRequest { - TranslationDataRequest::new() - } - - fn clear(&mut self) { - self.data_length = ::std::option::Option::None; - self.data_offset = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TranslationDataRequest { - static instance: TranslationDataRequest = TranslationDataRequest { - data_length: ::std::option::Option::None, - data_offset: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TranslationDataRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TranslationDataRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TranslationDataRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TranslationDataRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.TranslationDataAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TranslationDataAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.TranslationDataAck.data_chunk) - pub data_chunk: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.TranslationDataAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TranslationDataAck { - fn default() -> &'a TranslationDataAck { - ::default_instance() - } -} - -impl TranslationDataAck { - pub fn new() -> TranslationDataAck { - ::std::default::Default::default() - } - - // required bytes data_chunk = 1; - - pub fn data_chunk(&self) -> &[u8] { - match self.data_chunk.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data_chunk(&mut self) { - self.data_chunk = ::std::option::Option::None; - } - - pub fn has_data_chunk(&self) -> bool { - self.data_chunk.is_some() - } - - // Param is passed by value, moved - pub fn set_data_chunk(&mut self, v: ::std::vec::Vec) { - self.data_chunk = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data_chunk(&mut self) -> &mut ::std::vec::Vec { - if self.data_chunk.is_none() { - self.data_chunk = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data_chunk.as_mut().unwrap() - } - - // Take field - pub fn take_data_chunk(&mut self) -> ::std::vec::Vec { - self.data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data_chunk", - |m: &TranslationDataAck| { &m.data_chunk }, - |m: &mut TranslationDataAck| { &mut m.data_chunk }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TranslationDataAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TranslationDataAck { - const NAME: &'static str = "TranslationDataAck"; - - fn is_initialized(&self) -> bool { - if self.data_chunk.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.data_chunk = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data_chunk.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data_chunk.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TranslationDataAck { - TranslationDataAck::new() - } - - fn clear(&mut self) { - self.data_chunk = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TranslationDataAck { - static instance: TranslationDataAck = TranslationDataAck { - data_chunk: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TranslationDataAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TranslationDataAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TranslationDataAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TranslationDataAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.ApplyFlags) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ApplyFlags { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.ApplyFlags.flags) - pub flags: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ApplyFlags.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ApplyFlags { - fn default() -> &'a ApplyFlags { - ::default_instance() - } -} - -impl ApplyFlags { - pub fn new() -> ApplyFlags { - ::std::default::Default::default() - } - - // required uint32 flags = 1; - - pub fn flags(&self) -> u32 { - self.flags.unwrap_or(0) - } - - pub fn clear_flags(&mut self) { - self.flags = ::std::option::Option::None; - } - - pub fn has_flags(&self) -> bool { - self.flags.is_some() - } - - // Param is passed by value, moved - pub fn set_flags(&mut self, v: u32) { - self.flags = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "flags", - |m: &ApplyFlags| { &m.flags }, - |m: &mut ApplyFlags| { &mut m.flags }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ApplyFlags", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ApplyFlags { - const NAME: &'static str = "ApplyFlags"; - - fn is_initialized(&self) -> bool { - if self.flags.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.flags = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.flags { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.flags { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ApplyFlags { - ApplyFlags::new() - } - - fn clear(&mut self) { - self.flags = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ApplyFlags { - static instance: ApplyFlags = ApplyFlags { - flags: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ApplyFlags { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ApplyFlags").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ApplyFlags { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ApplyFlags { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.ChangePin) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ChangePin { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangePin.remove) - pub remove: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ChangePin.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ChangePin { - fn default() -> &'a ChangePin { - ::default_instance() - } -} - -impl ChangePin { - pub fn new() -> ChangePin { - ::std::default::Default::default() - } - - // optional bool remove = 1; - - pub fn remove(&self) -> bool { - self.remove.unwrap_or(false) - } - - pub fn clear_remove(&mut self) { - self.remove = ::std::option::Option::None; - } - - pub fn has_remove(&self) -> bool { - self.remove.is_some() - } - - // Param is passed by value, moved - pub fn set_remove(&mut self, v: bool) { - self.remove = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "remove", - |m: &ChangePin| { &m.remove }, - |m: &mut ChangePin| { &mut m.remove }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ChangePin", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ChangePin { - const NAME: &'static str = "ChangePin"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.remove = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.remove { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.remove { - os.write_bool(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ChangePin { - ChangePin::new() - } - - fn clear(&mut self) { - self.remove = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ChangePin { - static instance: ChangePin = ChangePin { - remove: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ChangePin { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ChangePin").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ChangePin { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ChangePin { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.ChangeWipeCode) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ChangeWipeCode { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.ChangeWipeCode.remove) - pub remove: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ChangeWipeCode.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ChangeWipeCode { - fn default() -> &'a ChangeWipeCode { - ::default_instance() - } -} - -impl ChangeWipeCode { - pub fn new() -> ChangeWipeCode { - ::std::default::Default::default() - } - - // optional bool remove = 1; - - pub fn remove(&self) -> bool { - self.remove.unwrap_or(false) - } - - pub fn clear_remove(&mut self) { - self.remove = ::std::option::Option::None; - } - - pub fn has_remove(&self) -> bool { - self.remove.is_some() - } - - // Param is passed by value, moved - pub fn set_remove(&mut self, v: bool) { - self.remove = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "remove", - |m: &ChangeWipeCode| { &m.remove }, - |m: &mut ChangeWipeCode| { &mut m.remove }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ChangeWipeCode", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ChangeWipeCode { - const NAME: &'static str = "ChangeWipeCode"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.remove = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.remove { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.remove { - os.write_bool(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ChangeWipeCode { - ChangeWipeCode::new() - } - - fn clear(&mut self) { - self.remove = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ChangeWipeCode { - static instance: ChangeWipeCode = ChangeWipeCode { - remove: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ChangeWipeCode { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ChangeWipeCode").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ChangeWipeCode { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ChangeWipeCode { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.SdProtect) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SdProtect { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.SdProtect.operation) - pub operation: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.SdProtect.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SdProtect { - fn default() -> &'a SdProtect { - ::default_instance() - } -} - -impl SdProtect { - pub fn new() -> SdProtect { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.management.SdProtect.SdProtectOperationType operation = 1; - - pub fn operation(&self) -> sd_protect::SdProtectOperationType { - match self.operation { - Some(e) => e.enum_value_or(sd_protect::SdProtectOperationType::DISABLE), - None => sd_protect::SdProtectOperationType::DISABLE, - } - } - - pub fn clear_operation(&mut self) { - self.operation = ::std::option::Option::None; - } - - pub fn has_operation(&self) -> bool { - self.operation.is_some() - } - - // Param is passed by value, moved - pub fn set_operation(&mut self, v: sd_protect::SdProtectOperationType) { - self.operation = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "operation", - |m: &SdProtect| { &m.operation }, - |m: &mut SdProtect| { &mut m.operation }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SdProtect", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SdProtect { - const NAME: &'static str = "SdProtect"; - - fn is_initialized(&self) -> bool { - if self.operation.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.operation = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.operation { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.operation { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SdProtect { - SdProtect::new() - } - - fn clear(&mut self) { - self.operation = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SdProtect { - static instance: SdProtect = SdProtect { - operation: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SdProtect { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SdProtect").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SdProtect { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SdProtect { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `SdProtect` -pub mod sd_protect { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.management.SdProtect.SdProtectOperationType) - pub enum SdProtectOperationType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdProtect.SdProtectOperationType.DISABLE) - DISABLE = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdProtect.SdProtectOperationType.ENABLE) - ENABLE = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdProtect.SdProtectOperationType.REFRESH) - REFRESH = 2, - } - - impl ::protobuf::Enum for SdProtectOperationType { - const NAME: &'static str = "SdProtectOperationType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(SdProtectOperationType::DISABLE), - 1 => ::std::option::Option::Some(SdProtectOperationType::ENABLE), - 2 => ::std::option::Option::Some(SdProtectOperationType::REFRESH), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "DISABLE" => ::std::option::Option::Some(SdProtectOperationType::DISABLE), - "ENABLE" => ::std::option::Option::Some(SdProtectOperationType::ENABLE), - "REFRESH" => ::std::option::Option::Some(SdProtectOperationType::REFRESH), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [SdProtectOperationType] = &[ - SdProtectOperationType::DISABLE, - SdProtectOperationType::ENABLE, - SdProtectOperationType::REFRESH, - ]; - } - - impl ::protobuf::EnumFull for SdProtectOperationType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("SdProtect.SdProtectOperationType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for SdProtectOperationType { - fn default() -> Self { - SdProtectOperationType::DISABLE - } - } - - impl SdProtectOperationType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("SdProtect.SdProtectOperationType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.Ping) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Ping { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.Ping.message) - pub message: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.Ping.button_protection) - pub button_protection: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Ping.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Ping { - fn default() -> &'a Ping { - ::default_instance() - } -} - -impl Ping { - pub fn new() -> Ping { - ::std::default::Default::default() - } - - // optional string message = 1; - - pub fn message(&self) -> &str { - match self.message.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::string::String) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::string::String { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::string::String::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::string::String { - self.message.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool button_protection = 2; - - pub fn button_protection(&self) -> bool { - self.button_protection.unwrap_or(false) - } - - pub fn clear_button_protection(&mut self) { - self.button_protection = ::std::option::Option::None; - } - - pub fn has_button_protection(&self) -> bool { - self.button_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_button_protection(&mut self, v: bool) { - self.button_protection = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &Ping| { &m.message }, - |m: &mut Ping| { &mut m.message }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "button_protection", - |m: &Ping| { &m.button_protection }, - |m: &mut Ping| { &mut m.button_protection }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Ping", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Ping { - const NAME: &'static str = "Ping"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.message = ::std::option::Option::Some(is.read_string()?); - }, - 16 => { - self.button_protection = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.button_protection { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.message.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.button_protection { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Ping { - Ping::new() - } - - fn clear(&mut self) { - self.message = ::std::option::Option::None; - self.button_protection = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Ping { - static instance: Ping = Ping { - message: ::std::option::Option::None, - button_protection: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Ping { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Ping").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Ping { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Ping { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.Cancel) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Cancel { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Cancel.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Cancel { - fn default() -> &'a Cancel { - ::default_instance() - } -} - -impl Cancel { - pub fn new() -> Cancel { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Cancel", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Cancel { - const NAME: &'static str = "Cancel"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Cancel { - Cancel::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static Cancel { - static instance: Cancel = Cancel { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Cancel { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Cancel").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Cancel { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Cancel { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.GetEntropy) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetEntropy { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.GetEntropy.size) - pub size: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetEntropy.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetEntropy { - fn default() -> &'a GetEntropy { - ::default_instance() - } -} - -impl GetEntropy { - pub fn new() -> GetEntropy { - ::std::default::Default::default() - } - - // required uint32 size = 1; - - pub fn size(&self) -> u32 { - self.size.unwrap_or(0) - } - - pub fn clear_size(&mut self) { - self.size = ::std::option::Option::None; - } - - pub fn has_size(&self) -> bool { - self.size.is_some() - } - - // Param is passed by value, moved - pub fn set_size(&mut self, v: u32) { - self.size = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "size", - |m: &GetEntropy| { &m.size }, - |m: &mut GetEntropy| { &mut m.size }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetEntropy", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetEntropy { - const NAME: &'static str = "GetEntropy"; - - fn is_initialized(&self) -> bool { - if self.size.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.size = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.size { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.size { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetEntropy { - GetEntropy::new() - } - - fn clear(&mut self) { - self.size = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetEntropy { - static instance: GetEntropy = GetEntropy { - size: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetEntropy { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetEntropy").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetEntropy { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetEntropy { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.Entropy) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Entropy { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.Entropy.entropy) - pub entropy: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Entropy.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Entropy { - fn default() -> &'a Entropy { - ::default_instance() - } -} - -impl Entropy { - pub fn new() -> Entropy { - ::std::default::Default::default() - } - - // required bytes entropy = 1; - - pub fn entropy(&self) -> &[u8] { - match self.entropy.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_entropy(&mut self) { - self.entropy = ::std::option::Option::None; - } - - pub fn has_entropy(&self) -> bool { - self.entropy.is_some() - } - - // Param is passed by value, moved - pub fn set_entropy(&mut self, v: ::std::vec::Vec) { - self.entropy = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_entropy(&mut self) -> &mut ::std::vec::Vec { - if self.entropy.is_none() { - self.entropy = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.entropy.as_mut().unwrap() - } - - // Take field - pub fn take_entropy(&mut self) -> ::std::vec::Vec { - self.entropy.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "entropy", - |m: &Entropy| { &m.entropy }, - |m: &mut Entropy| { &mut m.entropy }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Entropy", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Entropy { - const NAME: &'static str = "Entropy"; - - fn is_initialized(&self) -> bool { - if self.entropy.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.entropy = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.entropy.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.entropy.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Entropy { - Entropy::new() - } - - fn clear(&mut self) { - self.entropy = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Entropy { - static instance: Entropy = Entropy { - entropy: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Entropy { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Entropy").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Entropy { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Entropy { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.GetFirmwareHash) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetFirmwareHash { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.GetFirmwareHash.challenge) - pub challenge: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetFirmwareHash.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetFirmwareHash { - fn default() -> &'a GetFirmwareHash { - ::default_instance() - } -} - -impl GetFirmwareHash { - pub fn new() -> GetFirmwareHash { - ::std::default::Default::default() - } - - // optional bytes challenge = 1; - - pub fn challenge(&self) -> &[u8] { - match self.challenge.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_challenge(&mut self) { - self.challenge = ::std::option::Option::None; - } - - pub fn has_challenge(&self) -> bool { - self.challenge.is_some() - } - - // Param is passed by value, moved - pub fn set_challenge(&mut self, v: ::std::vec::Vec) { - self.challenge = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_challenge(&mut self) -> &mut ::std::vec::Vec { - if self.challenge.is_none() { - self.challenge = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.challenge.as_mut().unwrap() - } - - // Take field - pub fn take_challenge(&mut self) -> ::std::vec::Vec { - self.challenge.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "challenge", - |m: &GetFirmwareHash| { &m.challenge }, - |m: &mut GetFirmwareHash| { &mut m.challenge }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetFirmwareHash", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetFirmwareHash { - const NAME: &'static str = "GetFirmwareHash"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.challenge = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.challenge.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.challenge.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetFirmwareHash { - GetFirmwareHash::new() - } - - fn clear(&mut self) { - self.challenge = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetFirmwareHash { - static instance: GetFirmwareHash = GetFirmwareHash { - challenge: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetFirmwareHash { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetFirmwareHash").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetFirmwareHash { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetFirmwareHash { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.FirmwareHash) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct FirmwareHash { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.FirmwareHash.hash) - pub hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.FirmwareHash.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a FirmwareHash { - fn default() -> &'a FirmwareHash { - ::default_instance() - } -} - -impl FirmwareHash { - pub fn new() -> FirmwareHash { - ::std::default::Default::default() - } - - // required bytes hash = 1; - - pub fn hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hash", - |m: &FirmwareHash| { &m.hash }, - |m: &mut FirmwareHash| { &mut m.hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "FirmwareHash", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for FirmwareHash { - const NAME: &'static str = "FirmwareHash"; - - fn is_initialized(&self) -> bool { - if self.hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.hash.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> FirmwareHash { - FirmwareHash::new() - } - - fn clear(&mut self) { - self.hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static FirmwareHash { - static instance: FirmwareHash = FirmwareHash { - hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for FirmwareHash { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("FirmwareHash").unwrap()).clone() - } -} - -impl ::std::fmt::Display for FirmwareHash { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FirmwareHash { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.AuthenticateDevice) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct AuthenticateDevice { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.AuthenticateDevice.challenge) - pub challenge: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.AuthenticateDevice.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a AuthenticateDevice { - fn default() -> &'a AuthenticateDevice { - ::default_instance() - } -} - -impl AuthenticateDevice { - pub fn new() -> AuthenticateDevice { - ::std::default::Default::default() - } - - // required bytes challenge = 1; - - pub fn challenge(&self) -> &[u8] { - match self.challenge.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_challenge(&mut self) { - self.challenge = ::std::option::Option::None; - } - - pub fn has_challenge(&self) -> bool { - self.challenge.is_some() - } - - // Param is passed by value, moved - pub fn set_challenge(&mut self, v: ::std::vec::Vec) { - self.challenge = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_challenge(&mut self) -> &mut ::std::vec::Vec { - if self.challenge.is_none() { - self.challenge = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.challenge.as_mut().unwrap() - } - - // Take field - pub fn take_challenge(&mut self) -> ::std::vec::Vec { - self.challenge.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "challenge", - |m: &AuthenticateDevice| { &m.challenge }, - |m: &mut AuthenticateDevice| { &mut m.challenge }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "AuthenticateDevice", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for AuthenticateDevice { - const NAME: &'static str = "AuthenticateDevice"; - - fn is_initialized(&self) -> bool { - if self.challenge.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.challenge = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.challenge.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.challenge.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> AuthenticateDevice { - AuthenticateDevice::new() - } - - fn clear(&mut self) { - self.challenge = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static AuthenticateDevice { - static instance: AuthenticateDevice = AuthenticateDevice { - challenge: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for AuthenticateDevice { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("AuthenticateDevice").unwrap()).clone() - } -} - -impl ::std::fmt::Display for AuthenticateDevice { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AuthenticateDevice { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.AuthenticityProof) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct AuthenticityProof { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.AuthenticityProof.certificates) - pub certificates: ::std::vec::Vec<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.AuthenticityProof.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.AuthenticityProof.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a AuthenticityProof { - fn default() -> &'a AuthenticityProof { - ::default_instance() - } -} - -impl AuthenticityProof { - pub fn new() -> AuthenticityProof { - ::std::default::Default::default() - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "certificates", - |m: &AuthenticityProof| { &m.certificates }, - |m: &mut AuthenticityProof| { &mut m.certificates }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &AuthenticityProof| { &m.signature }, - |m: &mut AuthenticityProof| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "AuthenticityProof", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for AuthenticityProof { - const NAME: &'static str = "AuthenticityProof"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.certificates.push(is.read_bytes()?); - }, - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.certificates { - my_size += ::protobuf::rt::bytes_size(1, &value); - }; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.certificates { - os.write_bytes(1, &v)?; - }; - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> AuthenticityProof { - AuthenticityProof::new() - } - - fn clear(&mut self) { - self.certificates.clear(); - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static AuthenticityProof { - static instance: AuthenticityProof = AuthenticityProof { - certificates: ::std::vec::Vec::new(), - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for AuthenticityProof { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("AuthenticityProof").unwrap()).clone() - } -} - -impl ::std::fmt::Display for AuthenticityProof { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AuthenticityProof { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.WipeDevice) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct WipeDevice { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.WipeDevice.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a WipeDevice { - fn default() -> &'a WipeDevice { - ::default_instance() - } -} - -impl WipeDevice { - pub fn new() -> WipeDevice { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WipeDevice", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for WipeDevice { - const NAME: &'static str = "WipeDevice"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WipeDevice { - WipeDevice::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static WipeDevice { - static instance: WipeDevice = WipeDevice { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for WipeDevice { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("WipeDevice").unwrap()).clone() - } -} - -impl ::std::fmt::Display for WipeDevice { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WipeDevice { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.LoadDevice) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct LoadDevice { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.mnemonics) - pub mnemonics: ::std::vec::Vec<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.pin) - pub pin: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.passphrase_protection) - pub passphrase_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.language) - pub language: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.label) - pub label: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.skip_checksum) - pub skip_checksum: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.u2f_counter) - pub u2f_counter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.needs_backup) - pub needs_backup: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.LoadDevice.no_backup) - pub no_backup: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.LoadDevice.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a LoadDevice { - fn default() -> &'a LoadDevice { - ::default_instance() - } -} - -impl LoadDevice { - pub fn new() -> LoadDevice { - ::std::default::Default::default() - } - - // optional string pin = 3; - - pub fn pin(&self) -> &str { - match self.pin.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_pin(&mut self) { - self.pin = ::std::option::Option::None; - } - - pub fn has_pin(&self) -> bool { - self.pin.is_some() - } - - // Param is passed by value, moved - pub fn set_pin(&mut self, v: ::std::string::String) { - self.pin = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pin(&mut self) -> &mut ::std::string::String { - if self.pin.is_none() { - self.pin = ::std::option::Option::Some(::std::string::String::new()); - } - self.pin.as_mut().unwrap() - } - - // Take field - pub fn take_pin(&mut self) -> ::std::string::String { - self.pin.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool passphrase_protection = 4; - - pub fn passphrase_protection(&self) -> bool { - self.passphrase_protection.unwrap_or(false) - } - - pub fn clear_passphrase_protection(&mut self) { - self.passphrase_protection = ::std::option::Option::None; - } - - pub fn has_passphrase_protection(&self) -> bool { - self.passphrase_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase_protection(&mut self, v: bool) { - self.passphrase_protection = ::std::option::Option::Some(v); - } - - // optional string language = 5; - - pub fn language(&self) -> &str { - match self.language.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_language(&mut self) { - self.language = ::std::option::Option::None; - } - - pub fn has_language(&self) -> bool { - self.language.is_some() - } - - // Param is passed by value, moved - pub fn set_language(&mut self, v: ::std::string::String) { - self.language = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_language(&mut self) -> &mut ::std::string::String { - if self.language.is_none() { - self.language = ::std::option::Option::Some(::std::string::String::new()); - } - self.language.as_mut().unwrap() - } - - // Take field - pub fn take_language(&mut self) -> ::std::string::String { - self.language.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string label = 6; - - pub fn label(&self) -> &str { - match self.label.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_label(&mut self) { - self.label = ::std::option::Option::None; - } - - pub fn has_label(&self) -> bool { - self.label.is_some() - } - - // Param is passed by value, moved - pub fn set_label(&mut self, v: ::std::string::String) { - self.label = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_label(&mut self) -> &mut ::std::string::String { - if self.label.is_none() { - self.label = ::std::option::Option::Some(::std::string::String::new()); - } - self.label.as_mut().unwrap() - } - - // Take field - pub fn take_label(&mut self) -> ::std::string::String { - self.label.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool skip_checksum = 7; - - pub fn skip_checksum(&self) -> bool { - self.skip_checksum.unwrap_or(false) - } - - pub fn clear_skip_checksum(&mut self) { - self.skip_checksum = ::std::option::Option::None; - } - - pub fn has_skip_checksum(&self) -> bool { - self.skip_checksum.is_some() - } - - // Param is passed by value, moved - pub fn set_skip_checksum(&mut self, v: bool) { - self.skip_checksum = ::std::option::Option::Some(v); - } - - // optional uint32 u2f_counter = 8; - - pub fn u2f_counter(&self) -> u32 { - self.u2f_counter.unwrap_or(0) - } - - pub fn clear_u2f_counter(&mut self) { - self.u2f_counter = ::std::option::Option::None; - } - - pub fn has_u2f_counter(&self) -> bool { - self.u2f_counter.is_some() - } - - // Param is passed by value, moved - pub fn set_u2f_counter(&mut self, v: u32) { - self.u2f_counter = ::std::option::Option::Some(v); - } - - // optional bool needs_backup = 9; - - pub fn needs_backup(&self) -> bool { - self.needs_backup.unwrap_or(false) - } - - pub fn clear_needs_backup(&mut self) { - self.needs_backup = ::std::option::Option::None; - } - - pub fn has_needs_backup(&self) -> bool { - self.needs_backup.is_some() - } - - // Param is passed by value, moved - pub fn set_needs_backup(&mut self, v: bool) { - self.needs_backup = ::std::option::Option::Some(v); - } - - // optional bool no_backup = 10; - - pub fn no_backup(&self) -> bool { - self.no_backup.unwrap_or(false) - } - - pub fn clear_no_backup(&mut self) { - self.no_backup = ::std::option::Option::None; - } - - pub fn has_no_backup(&self) -> bool { - self.no_backup.is_some() - } - - // Param is passed by value, moved - pub fn set_no_backup(&mut self, v: bool) { - self.no_backup = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(9); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "mnemonics", - |m: &LoadDevice| { &m.mnemonics }, - |m: &mut LoadDevice| { &mut m.mnemonics }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pin", - |m: &LoadDevice| { &m.pin }, - |m: &mut LoadDevice| { &mut m.pin }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase_protection", - |m: &LoadDevice| { &m.passphrase_protection }, - |m: &mut LoadDevice| { &mut m.passphrase_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "language", - |m: &LoadDevice| { &m.language }, - |m: &mut LoadDevice| { &mut m.language }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "label", - |m: &LoadDevice| { &m.label }, - |m: &mut LoadDevice| { &mut m.label }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "skip_checksum", - |m: &LoadDevice| { &m.skip_checksum }, - |m: &mut LoadDevice| { &mut m.skip_checksum }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "u2f_counter", - |m: &LoadDevice| { &m.u2f_counter }, - |m: &mut LoadDevice| { &mut m.u2f_counter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "needs_backup", - |m: &LoadDevice| { &m.needs_backup }, - |m: &mut LoadDevice| { &mut m.needs_backup }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "no_backup", - |m: &LoadDevice| { &m.no_backup }, - |m: &mut LoadDevice| { &mut m.no_backup }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "LoadDevice", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for LoadDevice { - const NAME: &'static str = "LoadDevice"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.mnemonics.push(is.read_string()?); - }, - 26 => { - self.pin = ::std::option::Option::Some(is.read_string()?); - }, - 32 => { - self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 42 => { - self.language = ::std::option::Option::Some(is.read_string()?); - }, - 50 => { - self.label = ::std::option::Option::Some(is.read_string()?); - }, - 56 => { - self.skip_checksum = ::std::option::Option::Some(is.read_bool()?); - }, - 64 => { - self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.needs_backup = ::std::option::Option::Some(is.read_bool()?); - }, - 80 => { - self.no_backup = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.mnemonics { - my_size += ::protobuf::rt::string_size(1, &value); - }; - if let Some(v) = self.pin.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.passphrase_protection { - my_size += 1 + 1; - } - if let Some(v) = self.language.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.label.as_ref() { - my_size += ::protobuf::rt::string_size(6, &v); - } - if let Some(v) = self.skip_checksum { - my_size += 1 + 1; - } - if let Some(v) = self.u2f_counter { - my_size += ::protobuf::rt::uint32_size(8, v); - } - if let Some(v) = self.needs_backup { - my_size += 1 + 1; - } - if let Some(v) = self.no_backup { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.mnemonics { - os.write_string(1, &v)?; - }; - if let Some(v) = self.pin.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.passphrase_protection { - os.write_bool(4, v)?; - } - if let Some(v) = self.language.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.label.as_ref() { - os.write_string(6, v)?; - } - if let Some(v) = self.skip_checksum { - os.write_bool(7, v)?; - } - if let Some(v) = self.u2f_counter { - os.write_uint32(8, v)?; - } - if let Some(v) = self.needs_backup { - os.write_bool(9, v)?; - } - if let Some(v) = self.no_backup { - os.write_bool(10, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> LoadDevice { - LoadDevice::new() - } - - fn clear(&mut self) { - self.mnemonics.clear(); - self.pin = ::std::option::Option::None; - self.passphrase_protection = ::std::option::Option::None; - self.language = ::std::option::Option::None; - self.label = ::std::option::Option::None; - self.skip_checksum = ::std::option::Option::None; - self.u2f_counter = ::std::option::Option::None; - self.needs_backup = ::std::option::Option::None; - self.no_backup = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static LoadDevice { - static instance: LoadDevice = LoadDevice { - mnemonics: ::std::vec::Vec::new(), - pin: ::std::option::Option::None, - passphrase_protection: ::std::option::Option::None, - language: ::std::option::Option::None, - label: ::std::option::Option::None, - skip_checksum: ::std::option::Option::None, - u2f_counter: ::std::option::Option::None, - needs_backup: ::std::option::Option::None, - no_backup: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for LoadDevice { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("LoadDevice").unwrap()).clone() - } -} - -impl ::std::fmt::Display for LoadDevice { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for LoadDevice { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.ResetDevice) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ResetDevice { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.display_random) - pub display_random: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.strength) - pub strength: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.passphrase_protection) - pub passphrase_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.pin_protection) - pub pin_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.language) - pub language: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.label) - pub label: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.u2f_counter) - pub u2f_counter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.skip_backup) - pub skip_backup: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.no_backup) - pub no_backup: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.ResetDevice.backup_type) - pub backup_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ResetDevice.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ResetDevice { - fn default() -> &'a ResetDevice { - ::default_instance() - } -} - -impl ResetDevice { - pub fn new() -> ResetDevice { - ::std::default::Default::default() - } - - // optional bool display_random = 1; - - pub fn display_random(&self) -> bool { - self.display_random.unwrap_or(false) - } - - pub fn clear_display_random(&mut self) { - self.display_random = ::std::option::Option::None; - } - - pub fn has_display_random(&self) -> bool { - self.display_random.is_some() - } - - // Param is passed by value, moved - pub fn set_display_random(&mut self, v: bool) { - self.display_random = ::std::option::Option::Some(v); - } - - // optional uint32 strength = 2; - - pub fn strength(&self) -> u32 { - self.strength.unwrap_or(256u32) - } - - pub fn clear_strength(&mut self) { - self.strength = ::std::option::Option::None; - } - - pub fn has_strength(&self) -> bool { - self.strength.is_some() - } - - // Param is passed by value, moved - pub fn set_strength(&mut self, v: u32) { - self.strength = ::std::option::Option::Some(v); - } - - // optional bool passphrase_protection = 3; - - pub fn passphrase_protection(&self) -> bool { - self.passphrase_protection.unwrap_or(false) - } - - pub fn clear_passphrase_protection(&mut self) { - self.passphrase_protection = ::std::option::Option::None; - } - - pub fn has_passphrase_protection(&self) -> bool { - self.passphrase_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase_protection(&mut self, v: bool) { - self.passphrase_protection = ::std::option::Option::Some(v); - } - - // optional bool pin_protection = 4; - - pub fn pin_protection(&self) -> bool { - self.pin_protection.unwrap_or(false) - } - - pub fn clear_pin_protection(&mut self) { - self.pin_protection = ::std::option::Option::None; - } - - pub fn has_pin_protection(&self) -> bool { - self.pin_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_pin_protection(&mut self, v: bool) { - self.pin_protection = ::std::option::Option::Some(v); - } - - // optional string language = 5; - - pub fn language(&self) -> &str { - match self.language.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_language(&mut self) { - self.language = ::std::option::Option::None; - } - - pub fn has_language(&self) -> bool { - self.language.is_some() - } - - // Param is passed by value, moved - pub fn set_language(&mut self, v: ::std::string::String) { - self.language = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_language(&mut self) -> &mut ::std::string::String { - if self.language.is_none() { - self.language = ::std::option::Option::Some(::std::string::String::new()); - } - self.language.as_mut().unwrap() - } - - // Take field - pub fn take_language(&mut self) -> ::std::string::String { - self.language.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string label = 6; - - pub fn label(&self) -> &str { - match self.label.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_label(&mut self) { - self.label = ::std::option::Option::None; - } - - pub fn has_label(&self) -> bool { - self.label.is_some() - } - - // Param is passed by value, moved - pub fn set_label(&mut self, v: ::std::string::String) { - self.label = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_label(&mut self) -> &mut ::std::string::String { - if self.label.is_none() { - self.label = ::std::option::Option::Some(::std::string::String::new()); - } - self.label.as_mut().unwrap() - } - - // Take field - pub fn take_label(&mut self) -> ::std::string::String { - self.label.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 u2f_counter = 7; - - pub fn u2f_counter(&self) -> u32 { - self.u2f_counter.unwrap_or(0) - } - - pub fn clear_u2f_counter(&mut self) { - self.u2f_counter = ::std::option::Option::None; - } - - pub fn has_u2f_counter(&self) -> bool { - self.u2f_counter.is_some() - } - - // Param is passed by value, moved - pub fn set_u2f_counter(&mut self, v: u32) { - self.u2f_counter = ::std::option::Option::Some(v); - } - - // optional bool skip_backup = 8; - - pub fn skip_backup(&self) -> bool { - self.skip_backup.unwrap_or(false) - } - - pub fn clear_skip_backup(&mut self) { - self.skip_backup = ::std::option::Option::None; - } - - pub fn has_skip_backup(&self) -> bool { - self.skip_backup.is_some() - } - - // Param is passed by value, moved - pub fn set_skip_backup(&mut self, v: bool) { - self.skip_backup = ::std::option::Option::Some(v); - } - - // optional bool no_backup = 9; - - pub fn no_backup(&self) -> bool { - self.no_backup.unwrap_or(false) - } - - pub fn clear_no_backup(&mut self) { - self.no_backup = ::std::option::Option::None; - } - - pub fn has_no_backup(&self) -> bool { - self.no_backup.is_some() - } - - // Param is passed by value, moved - pub fn set_no_backup(&mut self, v: bool) { - self.no_backup = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.management.BackupType backup_type = 10; - - pub fn backup_type(&self) -> BackupType { - match self.backup_type { - Some(e) => e.enum_value_or(BackupType::Bip39), - None => BackupType::Bip39, - } - } - - pub fn clear_backup_type(&mut self) { - self.backup_type = ::std::option::Option::None; - } - - pub fn has_backup_type(&self) -> bool { - self.backup_type.is_some() - } - - // Param is passed by value, moved - pub fn set_backup_type(&mut self, v: BackupType) { - self.backup_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(10); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "display_random", - |m: &ResetDevice| { &m.display_random }, - |m: &mut ResetDevice| { &mut m.display_random }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "strength", - |m: &ResetDevice| { &m.strength }, - |m: &mut ResetDevice| { &mut m.strength }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase_protection", - |m: &ResetDevice| { &m.passphrase_protection }, - |m: &mut ResetDevice| { &mut m.passphrase_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pin_protection", - |m: &ResetDevice| { &m.pin_protection }, - |m: &mut ResetDevice| { &mut m.pin_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "language", - |m: &ResetDevice| { &m.language }, - |m: &mut ResetDevice| { &mut m.language }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "label", - |m: &ResetDevice| { &m.label }, - |m: &mut ResetDevice| { &mut m.label }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "u2f_counter", - |m: &ResetDevice| { &m.u2f_counter }, - |m: &mut ResetDevice| { &mut m.u2f_counter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "skip_backup", - |m: &ResetDevice| { &m.skip_backup }, - |m: &mut ResetDevice| { &mut m.skip_backup }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "no_backup", - |m: &ResetDevice| { &m.no_backup }, - |m: &mut ResetDevice| { &mut m.no_backup }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "backup_type", - |m: &ResetDevice| { &m.backup_type }, - |m: &mut ResetDevice| { &mut m.backup_type }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ResetDevice", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ResetDevice { - const NAME: &'static str = "ResetDevice"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.display_random = ::std::option::Option::Some(is.read_bool()?); - }, - 16 => { - self.strength = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 32 => { - self.pin_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 42 => { - self.language = ::std::option::Option::Some(is.read_string()?); - }, - 50 => { - self.label = ::std::option::Option::Some(is.read_string()?); - }, - 56 => { - self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); - }, - 64 => { - self.skip_backup = ::std::option::Option::Some(is.read_bool()?); - }, - 72 => { - self.no_backup = ::std::option::Option::Some(is.read_bool()?); - }, - 80 => { - self.backup_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.display_random { - my_size += 1 + 1; - } - if let Some(v) = self.strength { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.passphrase_protection { - my_size += 1 + 1; - } - if let Some(v) = self.pin_protection { - my_size += 1 + 1; - } - if let Some(v) = self.language.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.label.as_ref() { - my_size += ::protobuf::rt::string_size(6, &v); - } - if let Some(v) = self.u2f_counter { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.skip_backup { - my_size += 1 + 1; - } - if let Some(v) = self.no_backup { - my_size += 1 + 1; - } - if let Some(v) = self.backup_type { - my_size += ::protobuf::rt::int32_size(10, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.display_random { - os.write_bool(1, v)?; - } - if let Some(v) = self.strength { - os.write_uint32(2, v)?; - } - if let Some(v) = self.passphrase_protection { - os.write_bool(3, v)?; - } - if let Some(v) = self.pin_protection { - os.write_bool(4, v)?; - } - if let Some(v) = self.language.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.label.as_ref() { - os.write_string(6, v)?; - } - if let Some(v) = self.u2f_counter { - os.write_uint32(7, v)?; - } - if let Some(v) = self.skip_backup { - os.write_bool(8, v)?; - } - if let Some(v) = self.no_backup { - os.write_bool(9, v)?; - } - if let Some(v) = self.backup_type { - os.write_enum(10, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ResetDevice { - ResetDevice::new() - } - - fn clear(&mut self) { - self.display_random = ::std::option::Option::None; - self.strength = ::std::option::Option::None; - self.passphrase_protection = ::std::option::Option::None; - self.pin_protection = ::std::option::Option::None; - self.language = ::std::option::Option::None; - self.label = ::std::option::Option::None; - self.u2f_counter = ::std::option::Option::None; - self.skip_backup = ::std::option::Option::None; - self.no_backup = ::std::option::Option::None; - self.backup_type = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static ResetDevice { - static instance: ResetDevice = ResetDevice { - display_random: ::std::option::Option::None, - strength: ::std::option::Option::None, - passphrase_protection: ::std::option::Option::None, - pin_protection: ::std::option::Option::None, - language: ::std::option::Option::None, - label: ::std::option::Option::None, - u2f_counter: ::std::option::Option::None, - skip_backup: ::std::option::Option::None, - no_backup: ::std::option::Option::None, - backup_type: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ResetDevice { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ResetDevice").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ResetDevice { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ResetDevice { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.BackupDevice) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct BackupDevice { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.group_threshold) - pub group_threshold: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.groups) - pub groups: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.BackupDevice.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a BackupDevice { - fn default() -> &'a BackupDevice { - ::default_instance() - } -} - -impl BackupDevice { - pub fn new() -> BackupDevice { - ::std::default::Default::default() - } - - // optional uint32 group_threshold = 1; - - pub fn group_threshold(&self) -> u32 { - self.group_threshold.unwrap_or(0) - } - - pub fn clear_group_threshold(&mut self) { - self.group_threshold = ::std::option::Option::None; - } - - pub fn has_group_threshold(&self) -> bool { - self.group_threshold.is_some() - } - - // Param is passed by value, moved - pub fn set_group_threshold(&mut self, v: u32) { - self.group_threshold = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "group_threshold", - |m: &BackupDevice| { &m.group_threshold }, - |m: &mut BackupDevice| { &mut m.group_threshold }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "groups", - |m: &BackupDevice| { &m.groups }, - |m: &mut BackupDevice| { &mut m.groups }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BackupDevice", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for BackupDevice { - const NAME: &'static str = "BackupDevice"; - - fn is_initialized(&self) -> bool { - for v in &self.groups { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.group_threshold = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.groups.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.group_threshold { - my_size += ::protobuf::rt::uint32_size(1, v); - } - for value in &self.groups { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.group_threshold { - os.write_uint32(1, v)?; - } - for v in &self.groups { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> BackupDevice { - BackupDevice::new() - } - - fn clear(&mut self) { - self.group_threshold = ::std::option::Option::None; - self.groups.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static BackupDevice { - static instance: BackupDevice = BackupDevice { - group_threshold: ::std::option::Option::None, - groups: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for BackupDevice { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("BackupDevice").unwrap()).clone() - } -} - -impl ::std::fmt::Display for BackupDevice { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BackupDevice { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `BackupDevice` -pub mod backup_device { - // @@protoc_insertion_point(message:hw.trezor.messages.management.BackupDevice.Slip39Group) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct Slip39Group { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.Slip39Group.member_threshold) - pub member_threshold: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.BackupDevice.Slip39Group.member_count) - pub member_count: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.BackupDevice.Slip39Group.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a Slip39Group { - fn default() -> &'a Slip39Group { - ::default_instance() - } - } - - impl Slip39Group { - pub fn new() -> Slip39Group { - ::std::default::Default::default() - } - - // required uint32 member_threshold = 1; - - pub fn member_threshold(&self) -> u32 { - self.member_threshold.unwrap_or(0) - } - - pub fn clear_member_threshold(&mut self) { - self.member_threshold = ::std::option::Option::None; - } - - pub fn has_member_threshold(&self) -> bool { - self.member_threshold.is_some() - } - - // Param is passed by value, moved - pub fn set_member_threshold(&mut self, v: u32) { - self.member_threshold = ::std::option::Option::Some(v); - } - - // required uint32 member_count = 2; - - pub fn member_count(&self) -> u32 { - self.member_count.unwrap_or(0) - } - - pub fn clear_member_count(&mut self) { - self.member_count = ::std::option::Option::None; - } - - pub fn has_member_count(&self) -> bool { - self.member_count.is_some() - } - - // Param is passed by value, moved - pub fn set_member_count(&mut self, v: u32) { - self.member_count = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "member_threshold", - |m: &Slip39Group| { &m.member_threshold }, - |m: &mut Slip39Group| { &mut m.member_threshold }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "member_count", - |m: &Slip39Group| { &m.member_count }, - |m: &mut Slip39Group| { &mut m.member_count }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "BackupDevice.Slip39Group", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for Slip39Group { - const NAME: &'static str = "Slip39Group"; - - fn is_initialized(&self) -> bool { - if self.member_threshold.is_none() { - return false; - } - if self.member_count.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.member_threshold = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.member_count = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.member_threshold { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.member_count { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.member_threshold { - os.write_uint32(1, v)?; - } - if let Some(v) = self.member_count { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Slip39Group { - Slip39Group::new() - } - - fn clear(&mut self) { - self.member_threshold = ::std::option::Option::None; - self.member_count = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Slip39Group { - static instance: Slip39Group = Slip39Group { - member_threshold: ::std::option::Option::None, - member_count: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for Slip39Group { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BackupDevice.Slip39Group").unwrap()).clone() - } - } - - impl ::std::fmt::Display for Slip39Group { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for Slip39Group { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.EntropyRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EntropyRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.EntropyRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EntropyRequest { - fn default() -> &'a EntropyRequest { - ::default_instance() - } -} - -impl EntropyRequest { - pub fn new() -> EntropyRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EntropyRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EntropyRequest { - const NAME: &'static str = "EntropyRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EntropyRequest { - EntropyRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static EntropyRequest { - static instance: EntropyRequest = EntropyRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EntropyRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EntropyRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EntropyRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EntropyRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.EntropyAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct EntropyAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.EntropyAck.entropy) - pub entropy: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.EntropyAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a EntropyAck { - fn default() -> &'a EntropyAck { - ::default_instance() - } -} - -impl EntropyAck { - pub fn new() -> EntropyAck { - ::std::default::Default::default() - } - - // required bytes entropy = 1; - - pub fn entropy(&self) -> &[u8] { - match self.entropy.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_entropy(&mut self) { - self.entropy = ::std::option::Option::None; - } - - pub fn has_entropy(&self) -> bool { - self.entropy.is_some() - } - - // Param is passed by value, moved - pub fn set_entropy(&mut self, v: ::std::vec::Vec) { - self.entropy = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_entropy(&mut self) -> &mut ::std::vec::Vec { - if self.entropy.is_none() { - self.entropy = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.entropy.as_mut().unwrap() - } - - // Take field - pub fn take_entropy(&mut self) -> ::std::vec::Vec { - self.entropy.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "entropy", - |m: &EntropyAck| { &m.entropy }, - |m: &mut EntropyAck| { &mut m.entropy }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "EntropyAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for EntropyAck { - const NAME: &'static str = "EntropyAck"; - - fn is_initialized(&self) -> bool { - if self.entropy.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.entropy = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.entropy.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.entropy.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> EntropyAck { - EntropyAck::new() - } - - fn clear(&mut self) { - self.entropy = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static EntropyAck { - static instance: EntropyAck = EntropyAck { - entropy: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for EntropyAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("EntropyAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for EntropyAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EntropyAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.RecoveryDevice) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RecoveryDevice { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.word_count) - pub word_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.passphrase_protection) - pub passphrase_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.pin_protection) - pub pin_protection: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.language) - pub language: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.label) - pub label: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.enforce_wordlist) - pub enforce_wordlist: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.u2f_counter) - pub u2f_counter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RecoveryDevice.dry_run) - pub dry_run: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.RecoveryDevice.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RecoveryDevice { - fn default() -> &'a RecoveryDevice { - ::default_instance() - } -} - -impl RecoveryDevice { - pub fn new() -> RecoveryDevice { - ::std::default::Default::default() - } - - // optional uint32 word_count = 1; - - pub fn word_count(&self) -> u32 { - self.word_count.unwrap_or(0) - } - - pub fn clear_word_count(&mut self) { - self.word_count = ::std::option::Option::None; - } - - pub fn has_word_count(&self) -> bool { - self.word_count.is_some() - } - - // Param is passed by value, moved - pub fn set_word_count(&mut self, v: u32) { - self.word_count = ::std::option::Option::Some(v); - } - - // optional bool passphrase_protection = 2; - - pub fn passphrase_protection(&self) -> bool { - self.passphrase_protection.unwrap_or(false) - } - - pub fn clear_passphrase_protection(&mut self) { - self.passphrase_protection = ::std::option::Option::None; - } - - pub fn has_passphrase_protection(&self) -> bool { - self.passphrase_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_passphrase_protection(&mut self, v: bool) { - self.passphrase_protection = ::std::option::Option::Some(v); - } - - // optional bool pin_protection = 3; - - pub fn pin_protection(&self) -> bool { - self.pin_protection.unwrap_or(false) - } - - pub fn clear_pin_protection(&mut self) { - self.pin_protection = ::std::option::Option::None; - } - - pub fn has_pin_protection(&self) -> bool { - self.pin_protection.is_some() - } - - // Param is passed by value, moved - pub fn set_pin_protection(&mut self, v: bool) { - self.pin_protection = ::std::option::Option::Some(v); - } - - // optional string language = 4; - - pub fn language(&self) -> &str { - match self.language.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_language(&mut self) { - self.language = ::std::option::Option::None; - } - - pub fn has_language(&self) -> bool { - self.language.is_some() - } - - // Param is passed by value, moved - pub fn set_language(&mut self, v: ::std::string::String) { - self.language = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_language(&mut self) -> &mut ::std::string::String { - if self.language.is_none() { - self.language = ::std::option::Option::Some(::std::string::String::new()); - } - self.language.as_mut().unwrap() - } - - // Take field - pub fn take_language(&mut self) -> ::std::string::String { - self.language.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string label = 5; - - pub fn label(&self) -> &str { - match self.label.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_label(&mut self) { - self.label = ::std::option::Option::None; - } - - pub fn has_label(&self) -> bool { - self.label.is_some() - } - - // Param is passed by value, moved - pub fn set_label(&mut self, v: ::std::string::String) { - self.label = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_label(&mut self) -> &mut ::std::string::String { - if self.label.is_none() { - self.label = ::std::option::Option::Some(::std::string::String::new()); - } - self.label.as_mut().unwrap() - } - - // Take field - pub fn take_label(&mut self) -> ::std::string::String { - self.label.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bool enforce_wordlist = 6; - - pub fn enforce_wordlist(&self) -> bool { - self.enforce_wordlist.unwrap_or(false) - } - - pub fn clear_enforce_wordlist(&mut self) { - self.enforce_wordlist = ::std::option::Option::None; - } - - pub fn has_enforce_wordlist(&self) -> bool { - self.enforce_wordlist.is_some() - } - - // Param is passed by value, moved - pub fn set_enforce_wordlist(&mut self, v: bool) { - self.enforce_wordlist = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType type = 8; - - pub fn type_(&self) -> recovery_device::RecoveryDeviceType { - match self.type_ { - Some(e) => e.enum_value_or(recovery_device::RecoveryDeviceType::RecoveryDeviceType_ScrambledWords), - None => recovery_device::RecoveryDeviceType::RecoveryDeviceType_ScrambledWords, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: recovery_device::RecoveryDeviceType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint32 u2f_counter = 9; - - pub fn u2f_counter(&self) -> u32 { - self.u2f_counter.unwrap_or(0) - } - - pub fn clear_u2f_counter(&mut self) { - self.u2f_counter = ::std::option::Option::None; - } - - pub fn has_u2f_counter(&self) -> bool { - self.u2f_counter.is_some() - } - - // Param is passed by value, moved - pub fn set_u2f_counter(&mut self, v: u32) { - self.u2f_counter = ::std::option::Option::Some(v); - } - - // optional bool dry_run = 10; - - pub fn dry_run(&self) -> bool { - self.dry_run.unwrap_or(false) - } - - pub fn clear_dry_run(&mut self) { - self.dry_run = ::std::option::Option::None; - } - - pub fn has_dry_run(&self) -> bool { - self.dry_run.is_some() - } - - // Param is passed by value, moved - pub fn set_dry_run(&mut self, v: bool) { - self.dry_run = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(9); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "word_count", - |m: &RecoveryDevice| { &m.word_count }, - |m: &mut RecoveryDevice| { &mut m.word_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "passphrase_protection", - |m: &RecoveryDevice| { &m.passphrase_protection }, - |m: &mut RecoveryDevice| { &mut m.passphrase_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pin_protection", - |m: &RecoveryDevice| { &m.pin_protection }, - |m: &mut RecoveryDevice| { &mut m.pin_protection }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "language", - |m: &RecoveryDevice| { &m.language }, - |m: &mut RecoveryDevice| { &mut m.language }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "label", - |m: &RecoveryDevice| { &m.label }, - |m: &mut RecoveryDevice| { &mut m.label }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "enforce_wordlist", - |m: &RecoveryDevice| { &m.enforce_wordlist }, - |m: &mut RecoveryDevice| { &mut m.enforce_wordlist }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &RecoveryDevice| { &m.type_ }, - |m: &mut RecoveryDevice| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "u2f_counter", - |m: &RecoveryDevice| { &m.u2f_counter }, - |m: &mut RecoveryDevice| { &mut m.u2f_counter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "dry_run", - |m: &RecoveryDevice| { &m.dry_run }, - |m: &mut RecoveryDevice| { &mut m.dry_run }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "RecoveryDevice", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RecoveryDevice { - const NAME: &'static str = "RecoveryDevice"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.word_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.passphrase_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.pin_protection = ::std::option::Option::Some(is.read_bool()?); - }, - 34 => { - self.language = ::std::option::Option::Some(is.read_string()?); - }, - 42 => { - self.label = ::std::option::Option::Some(is.read_string()?); - }, - 48 => { - self.enforce_wordlist = ::std::option::Option::Some(is.read_bool()?); - }, - 64 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 72 => { - self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); - }, - 80 => { - self.dry_run = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.word_count { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.passphrase_protection { - my_size += 1 + 1; - } - if let Some(v) = self.pin_protection { - my_size += 1 + 1; - } - if let Some(v) = self.language.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.label.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.enforce_wordlist { - my_size += 1 + 1; - } - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(8, v.value()); - } - if let Some(v) = self.u2f_counter { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.dry_run { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.word_count { - os.write_uint32(1, v)?; - } - if let Some(v) = self.passphrase_protection { - os.write_bool(2, v)?; - } - if let Some(v) = self.pin_protection { - os.write_bool(3, v)?; - } - if let Some(v) = self.language.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.label.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.enforce_wordlist { - os.write_bool(6, v)?; - } - if let Some(v) = self.type_ { - os.write_enum(8, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.u2f_counter { - os.write_uint32(9, v)?; - } - if let Some(v) = self.dry_run { - os.write_bool(10, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RecoveryDevice { - RecoveryDevice::new() - } - - fn clear(&mut self) { - self.word_count = ::std::option::Option::None; - self.passphrase_protection = ::std::option::Option::None; - self.pin_protection = ::std::option::Option::None; - self.language = ::std::option::Option::None; - self.label = ::std::option::Option::None; - self.enforce_wordlist = ::std::option::Option::None; - self.type_ = ::std::option::Option::None; - self.u2f_counter = ::std::option::Option::None; - self.dry_run = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RecoveryDevice { - static instance: RecoveryDevice = RecoveryDevice { - word_count: ::std::option::Option::None, - passphrase_protection: ::std::option::Option::None, - pin_protection: ::std::option::Option::None, - language: ::std::option::Option::None, - label: ::std::option::Option::None, - enforce_wordlist: ::std::option::Option::None, - type_: ::std::option::Option::None, - u2f_counter: ::std::option::Option::None, - dry_run: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RecoveryDevice { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("RecoveryDevice").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RecoveryDevice { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RecoveryDevice { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `RecoveryDevice` -pub mod recovery_device { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType) - pub enum RecoveryDeviceType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType.RecoveryDeviceType_ScrambledWords) - RecoveryDeviceType_ScrambledWords = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RecoveryDevice.RecoveryDeviceType.RecoveryDeviceType_Matrix) - RecoveryDeviceType_Matrix = 1, - } - - impl ::protobuf::Enum for RecoveryDeviceType { - const NAME: &'static str = "RecoveryDeviceType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_ScrambledWords), - 1 => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_Matrix), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "RecoveryDeviceType_ScrambledWords" => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_ScrambledWords), - "RecoveryDeviceType_Matrix" => ::std::option::Option::Some(RecoveryDeviceType::RecoveryDeviceType_Matrix), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [RecoveryDeviceType] = &[ - RecoveryDeviceType::RecoveryDeviceType_ScrambledWords, - RecoveryDeviceType::RecoveryDeviceType_Matrix, - ]; - } - - impl ::protobuf::EnumFull for RecoveryDeviceType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("RecoveryDevice.RecoveryDeviceType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for RecoveryDeviceType { - fn default() -> Self { - RecoveryDeviceType::RecoveryDeviceType_ScrambledWords - } - } - - impl RecoveryDeviceType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("RecoveryDevice.RecoveryDeviceType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.WordRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct WordRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.WordRequest.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.WordRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a WordRequest { - fn default() -> &'a WordRequest { - ::default_instance() - } -} - -impl WordRequest { - pub fn new() -> WordRequest { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.management.WordRequest.WordRequestType type = 1; - - pub fn type_(&self) -> word_request::WordRequestType { - match self.type_ { - Some(e) => e.enum_value_or(word_request::WordRequestType::WordRequestType_Plain), - None => word_request::WordRequestType::WordRequestType_Plain, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: word_request::WordRequestType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &WordRequest| { &m.type_ }, - |m: &mut WordRequest| { &mut m.type_ }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WordRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for WordRequest { - const NAME: &'static str = "WordRequest"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WordRequest { - WordRequest::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static WordRequest { - static instance: WordRequest = WordRequest { - type_: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for WordRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("WordRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for WordRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WordRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `WordRequest` -pub mod word_request { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.management.WordRequest.WordRequestType) - pub enum WordRequestType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.WordRequest.WordRequestType.WordRequestType_Plain) - WordRequestType_Plain = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.WordRequest.WordRequestType.WordRequestType_Matrix9) - WordRequestType_Matrix9 = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.WordRequest.WordRequestType.WordRequestType_Matrix6) - WordRequestType_Matrix6 = 2, - } - - impl ::protobuf::Enum for WordRequestType { - const NAME: &'static str = "WordRequestType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(WordRequestType::WordRequestType_Plain), - 1 => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix9), - 2 => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix6), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "WordRequestType_Plain" => ::std::option::Option::Some(WordRequestType::WordRequestType_Plain), - "WordRequestType_Matrix9" => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix9), - "WordRequestType_Matrix6" => ::std::option::Option::Some(WordRequestType::WordRequestType_Matrix6), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [WordRequestType] = &[ - WordRequestType::WordRequestType_Plain, - WordRequestType::WordRequestType_Matrix9, - WordRequestType::WordRequestType_Matrix6, - ]; - } - - impl ::protobuf::EnumFull for WordRequestType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("WordRequest.WordRequestType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for WordRequestType { - fn default() -> Self { - WordRequestType::WordRequestType_Plain - } - } - - impl WordRequestType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("WordRequest.WordRequestType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.WordAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct WordAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.WordAck.word) - pub word: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.WordAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a WordAck { - fn default() -> &'a WordAck { - ::default_instance() - } -} - -impl WordAck { - pub fn new() -> WordAck { - ::std::default::Default::default() - } - - // required string word = 1; - - pub fn word(&self) -> &str { - match self.word.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_word(&mut self) { - self.word = ::std::option::Option::None; - } - - pub fn has_word(&self) -> bool { - self.word.is_some() - } - - // Param is passed by value, moved - pub fn set_word(&mut self, v: ::std::string::String) { - self.word = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_word(&mut self) -> &mut ::std::string::String { - if self.word.is_none() { - self.word = ::std::option::Option::Some(::std::string::String::new()); - } - self.word.as_mut().unwrap() - } - - // Take field - pub fn take_word(&mut self) -> ::std::string::String { - self.word.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "word", - |m: &WordAck| { &m.word }, - |m: &mut WordAck| { &mut m.word }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WordAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for WordAck { - const NAME: &'static str = "WordAck"; - - fn is_initialized(&self) -> bool { - if self.word.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.word = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.word.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.word.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WordAck { - WordAck::new() - } - - fn clear(&mut self) { - self.word = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static WordAck { - static instance: WordAck = WordAck { - word: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for WordAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("WordAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for WordAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WordAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.SetU2FCounter) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SetU2FCounter { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.SetU2FCounter.u2f_counter) - pub u2f_counter: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.SetU2FCounter.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SetU2FCounter { - fn default() -> &'a SetU2FCounter { - ::default_instance() - } -} - -impl SetU2FCounter { - pub fn new() -> SetU2FCounter { - ::std::default::Default::default() - } - - // required uint32 u2f_counter = 1; - - pub fn u2f_counter(&self) -> u32 { - self.u2f_counter.unwrap_or(0) - } - - pub fn clear_u2f_counter(&mut self) { - self.u2f_counter = ::std::option::Option::None; - } - - pub fn has_u2f_counter(&self) -> bool { - self.u2f_counter.is_some() - } - - // Param is passed by value, moved - pub fn set_u2f_counter(&mut self, v: u32) { - self.u2f_counter = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "u2f_counter", - |m: &SetU2FCounter| { &m.u2f_counter }, - |m: &mut SetU2FCounter| { &mut m.u2f_counter }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SetU2FCounter", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SetU2FCounter { - const NAME: &'static str = "SetU2FCounter"; - - fn is_initialized(&self) -> bool { - if self.u2f_counter.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.u2f_counter { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.u2f_counter { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SetU2FCounter { - SetU2FCounter::new() - } - - fn clear(&mut self) { - self.u2f_counter = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SetU2FCounter { - static instance: SetU2FCounter = SetU2FCounter { - u2f_counter: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SetU2FCounter { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SetU2FCounter").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SetU2FCounter { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SetU2FCounter { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.GetNextU2FCounter) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetNextU2FCounter { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetNextU2FCounter.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetNextU2FCounter { - fn default() -> &'a GetNextU2FCounter { - ::default_instance() - } -} - -impl GetNextU2FCounter { - pub fn new() -> GetNextU2FCounter { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetNextU2FCounter", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetNextU2FCounter { - const NAME: &'static str = "GetNextU2FCounter"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetNextU2FCounter { - GetNextU2FCounter::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetNextU2FCounter { - static instance: GetNextU2FCounter = GetNextU2FCounter { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetNextU2FCounter { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetNextU2FCounter").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetNextU2FCounter { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetNextU2FCounter { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.NextU2FCounter) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct NextU2FCounter { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.NextU2FCounter.u2f_counter) - pub u2f_counter: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.NextU2FCounter.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a NextU2FCounter { - fn default() -> &'a NextU2FCounter { - ::default_instance() - } -} - -impl NextU2FCounter { - pub fn new() -> NextU2FCounter { - ::std::default::Default::default() - } - - // required uint32 u2f_counter = 1; - - pub fn u2f_counter(&self) -> u32 { - self.u2f_counter.unwrap_or(0) - } - - pub fn clear_u2f_counter(&mut self) { - self.u2f_counter = ::std::option::Option::None; - } - - pub fn has_u2f_counter(&self) -> bool { - self.u2f_counter.is_some() - } - - // Param is passed by value, moved - pub fn set_u2f_counter(&mut self, v: u32) { - self.u2f_counter = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "u2f_counter", - |m: &NextU2FCounter| { &m.u2f_counter }, - |m: &mut NextU2FCounter| { &mut m.u2f_counter }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NextU2FCounter", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for NextU2FCounter { - const NAME: &'static str = "NextU2FCounter"; - - fn is_initialized(&self) -> bool { - if self.u2f_counter.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.u2f_counter = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.u2f_counter { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.u2f_counter { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NextU2FCounter { - NextU2FCounter::new() - } - - fn clear(&mut self) { - self.u2f_counter = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NextU2FCounter { - static instance: NextU2FCounter = NextU2FCounter { - u2f_counter: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for NextU2FCounter { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("NextU2FCounter").unwrap()).clone() - } -} - -impl ::std::fmt::Display for NextU2FCounter { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NextU2FCounter { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.DoPreauthorized) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DoPreauthorized { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.DoPreauthorized.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DoPreauthorized { - fn default() -> &'a DoPreauthorized { - ::default_instance() - } -} - -impl DoPreauthorized { - pub fn new() -> DoPreauthorized { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DoPreauthorized", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DoPreauthorized { - const NAME: &'static str = "DoPreauthorized"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DoPreauthorized { - DoPreauthorized::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static DoPreauthorized { - static instance: DoPreauthorized = DoPreauthorized { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DoPreauthorized { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DoPreauthorized").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DoPreauthorized { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DoPreauthorized { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.PreauthorizedRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct PreauthorizedRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.PreauthorizedRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a PreauthorizedRequest { - fn default() -> &'a PreauthorizedRequest { - ::default_instance() - } -} - -impl PreauthorizedRequest { - pub fn new() -> PreauthorizedRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "PreauthorizedRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for PreauthorizedRequest { - const NAME: &'static str = "PreauthorizedRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> PreauthorizedRequest { - PreauthorizedRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static PreauthorizedRequest { - static instance: PreauthorizedRequest = PreauthorizedRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for PreauthorizedRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("PreauthorizedRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for PreauthorizedRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PreauthorizedRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.CancelAuthorization) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct CancelAuthorization { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.CancelAuthorization.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a CancelAuthorization { - fn default() -> &'a CancelAuthorization { - ::default_instance() - } -} - -impl CancelAuthorization { - pub fn new() -> CancelAuthorization { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "CancelAuthorization", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for CancelAuthorization { - const NAME: &'static str = "CancelAuthorization"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> CancelAuthorization { - CancelAuthorization::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static CancelAuthorization { - static instance: CancelAuthorization = CancelAuthorization { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for CancelAuthorization { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("CancelAuthorization").unwrap()).clone() - } -} - -impl ::std::fmt::Display for CancelAuthorization { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CancelAuthorization { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.RebootToBootloader) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RebootToBootloader { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.RebootToBootloader.boot_command) - pub boot_command: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RebootToBootloader.firmware_header) - pub firmware_header: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.management.RebootToBootloader.language_data_length) - pub language_data_length: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.RebootToBootloader.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RebootToBootloader { - fn default() -> &'a RebootToBootloader { - ::default_instance() - } -} - -impl RebootToBootloader { - pub fn new() -> RebootToBootloader { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.management.RebootToBootloader.BootCommand boot_command = 1; - - pub fn boot_command(&self) -> reboot_to_bootloader::BootCommand { - match self.boot_command { - Some(e) => e.enum_value_or(reboot_to_bootloader::BootCommand::STOP_AND_WAIT), - None => reboot_to_bootloader::BootCommand::STOP_AND_WAIT, - } - } - - pub fn clear_boot_command(&mut self) { - self.boot_command = ::std::option::Option::None; - } - - pub fn has_boot_command(&self) -> bool { - self.boot_command.is_some() - } - - // Param is passed by value, moved - pub fn set_boot_command(&mut self, v: reboot_to_bootloader::BootCommand) { - self.boot_command = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes firmware_header = 2; - - pub fn firmware_header(&self) -> &[u8] { - match self.firmware_header.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_firmware_header(&mut self) { - self.firmware_header = ::std::option::Option::None; - } - - pub fn has_firmware_header(&self) -> bool { - self.firmware_header.is_some() - } - - // Param is passed by value, moved - pub fn set_firmware_header(&mut self, v: ::std::vec::Vec) { - self.firmware_header = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_firmware_header(&mut self) -> &mut ::std::vec::Vec { - if self.firmware_header.is_none() { - self.firmware_header = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.firmware_header.as_mut().unwrap() - } - - // Take field - pub fn take_firmware_header(&mut self) -> ::std::vec::Vec { - self.firmware_header.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 language_data_length = 3; - - pub fn language_data_length(&self) -> u32 { - self.language_data_length.unwrap_or(0u32) - } - - pub fn clear_language_data_length(&mut self) { - self.language_data_length = ::std::option::Option::None; - } - - pub fn has_language_data_length(&self) -> bool { - self.language_data_length.is_some() - } - - // Param is passed by value, moved - pub fn set_language_data_length(&mut self, v: u32) { - self.language_data_length = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "boot_command", - |m: &RebootToBootloader| { &m.boot_command }, - |m: &mut RebootToBootloader| { &mut m.boot_command }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "firmware_header", - |m: &RebootToBootloader| { &m.firmware_header }, - |m: &mut RebootToBootloader| { &mut m.firmware_header }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "language_data_length", - |m: &RebootToBootloader| { &m.language_data_length }, - |m: &mut RebootToBootloader| { &mut m.language_data_length }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "RebootToBootloader", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RebootToBootloader { - const NAME: &'static str = "RebootToBootloader"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.boot_command = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.firmware_header = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.language_data_length = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.boot_command { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.firmware_header.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.language_data_length { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.boot_command { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.firmware_header.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.language_data_length { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RebootToBootloader { - RebootToBootloader::new() - } - - fn clear(&mut self) { - self.boot_command = ::std::option::Option::None; - self.firmware_header = ::std::option::Option::None; - self.language_data_length = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RebootToBootloader { - static instance: RebootToBootloader = RebootToBootloader { - boot_command: ::std::option::Option::None, - firmware_header: ::std::option::Option::None, - language_data_length: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RebootToBootloader { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("RebootToBootloader").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RebootToBootloader { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RebootToBootloader { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `RebootToBootloader` -pub mod reboot_to_bootloader { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.management.RebootToBootloader.BootCommand) - pub enum BootCommand { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RebootToBootloader.BootCommand.STOP_AND_WAIT) - STOP_AND_WAIT = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.RebootToBootloader.BootCommand.INSTALL_UPGRADE) - INSTALL_UPGRADE = 1, - } - - impl ::protobuf::Enum for BootCommand { - const NAME: &'static str = "BootCommand"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(BootCommand::STOP_AND_WAIT), - 1 => ::std::option::Option::Some(BootCommand::INSTALL_UPGRADE), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "STOP_AND_WAIT" => ::std::option::Option::Some(BootCommand::STOP_AND_WAIT), - "INSTALL_UPGRADE" => ::std::option::Option::Some(BootCommand::INSTALL_UPGRADE), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [BootCommand] = &[ - BootCommand::STOP_AND_WAIT, - BootCommand::INSTALL_UPGRADE, - ]; - } - - impl ::protobuf::EnumFull for BootCommand { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("RebootToBootloader.BootCommand").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for BootCommand { - fn default() -> Self { - BootCommand::STOP_AND_WAIT - } - } - - impl BootCommand { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("RebootToBootloader.BootCommand") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.GetNonce) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct GetNonce { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.GetNonce.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a GetNonce { - fn default() -> &'a GetNonce { - ::default_instance() - } -} - -impl GetNonce { - pub fn new() -> GetNonce { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "GetNonce", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for GetNonce { - const NAME: &'static str = "GetNonce"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> GetNonce { - GetNonce::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static GetNonce { - static instance: GetNonce = GetNonce { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for GetNonce { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("GetNonce").unwrap()).clone() - } -} - -impl ::std::fmt::Display for GetNonce { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetNonce { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.Nonce) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Nonce { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.Nonce.nonce) - pub nonce: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.Nonce.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Nonce { - fn default() -> &'a Nonce { - ::default_instance() - } -} - -impl Nonce { - pub fn new() -> Nonce { - ::std::default::Default::default() - } - - // required bytes nonce = 1; - - pub fn nonce(&self) -> &[u8] { - match self.nonce.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_nonce(&mut self) { - self.nonce = ::std::option::Option::None; - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: ::std::vec::Vec) { - self.nonce = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { - if self.nonce.is_none() { - self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.nonce.as_mut().unwrap() - } - - // Take field - pub fn take_nonce(&mut self) -> ::std::vec::Vec { - self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "nonce", - |m: &Nonce| { &m.nonce }, - |m: &mut Nonce| { &mut m.nonce }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Nonce", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Nonce { - const NAME: &'static str = "Nonce"; - - fn is_initialized(&self) -> bool { - if self.nonce.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.nonce = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.nonce.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.nonce.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> Nonce { - Nonce::new() - } - - fn clear(&mut self) { - self.nonce = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Nonce { - static instance: Nonce = Nonce { - nonce: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Nonce { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("Nonce").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Nonce { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Nonce { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.UnlockPath) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct UnlockPath { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.UnlockPath.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.management.UnlockPath.mac) - pub mac: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.UnlockPath.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a UnlockPath { - fn default() -> &'a UnlockPath { - ::default_instance() - } -} - -impl UnlockPath { - pub fn new() -> UnlockPath { - ::std::default::Default::default() - } - - // optional bytes mac = 2; - - pub fn mac(&self) -> &[u8] { - match self.mac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mac(&mut self) { - self.mac = ::std::option::Option::None; - } - - pub fn has_mac(&self) -> bool { - self.mac.is_some() - } - - // Param is passed by value, moved - pub fn set_mac(&mut self, v: ::std::vec::Vec) { - self.mac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { - if self.mac.is_none() { - self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mac.as_mut().unwrap() - } - - // Take field - pub fn take_mac(&mut self) -> ::std::vec::Vec { - self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &UnlockPath| { &m.address_n }, - |m: &mut UnlockPath| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mac", - |m: &UnlockPath| { &m.mac }, - |m: &mut UnlockPath| { &mut m.mac }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "UnlockPath", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for UnlockPath { - const NAME: &'static str = "UnlockPath"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.mac = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.mac.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.mac.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> UnlockPath { - UnlockPath::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.mac = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static UnlockPath { - static instance: UnlockPath = UnlockPath { - address_n: ::std::vec::Vec::new(), - mac: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for UnlockPath { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("UnlockPath").unwrap()).clone() - } -} - -impl ::std::fmt::Display for UnlockPath { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for UnlockPath { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.UnlockedPathRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct UnlockedPathRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.management.UnlockedPathRequest.mac) - pub mac: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.UnlockedPathRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a UnlockedPathRequest { - fn default() -> &'a UnlockedPathRequest { - ::default_instance() - } -} - -impl UnlockedPathRequest { - pub fn new() -> UnlockedPathRequest { - ::std::default::Default::default() - } - - // optional bytes mac = 1; - - pub fn mac(&self) -> &[u8] { - match self.mac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mac(&mut self) { - self.mac = ::std::option::Option::None; - } - - pub fn has_mac(&self) -> bool { - self.mac.is_some() - } - - // Param is passed by value, moved - pub fn set_mac(&mut self, v: ::std::vec::Vec) { - self.mac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mac(&mut self) -> &mut ::std::vec::Vec { - if self.mac.is_none() { - self.mac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mac.as_mut().unwrap() - } - - // Take field - pub fn take_mac(&mut self) -> ::std::vec::Vec { - self.mac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mac", - |m: &UnlockedPathRequest| { &m.mac }, - |m: &mut UnlockedPathRequest| { &mut m.mac }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "UnlockedPathRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for UnlockedPathRequest { - const NAME: &'static str = "UnlockedPathRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.mac = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.mac.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.mac.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> UnlockedPathRequest { - UnlockedPathRequest::new() - } - - fn clear(&mut self) { - self.mac = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static UnlockedPathRequest { - static instance: UnlockedPathRequest = UnlockedPathRequest { - mac: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for UnlockedPathRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("UnlockedPathRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for UnlockedPathRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for UnlockedPathRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.ShowDeviceTutorial) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ShowDeviceTutorial { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.ShowDeviceTutorial.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ShowDeviceTutorial { - fn default() -> &'a ShowDeviceTutorial { - ::default_instance() - } -} - -impl ShowDeviceTutorial { - pub fn new() -> ShowDeviceTutorial { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "ShowDeviceTutorial", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ShowDeviceTutorial { - const NAME: &'static str = "ShowDeviceTutorial"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> ShowDeviceTutorial { - ShowDeviceTutorial::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static ShowDeviceTutorial { - static instance: ShowDeviceTutorial = ShowDeviceTutorial { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ShowDeviceTutorial { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("ShowDeviceTutorial").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ShowDeviceTutorial { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ShowDeviceTutorial { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.management.UnlockBootloader) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct UnlockBootloader { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.management.UnlockBootloader.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a UnlockBootloader { - fn default() -> &'a UnlockBootloader { - ::default_instance() - } -} - -impl UnlockBootloader { - pub fn new() -> UnlockBootloader { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "UnlockBootloader", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for UnlockBootloader { - const NAME: &'static str = "UnlockBootloader"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> UnlockBootloader { - UnlockBootloader::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static UnlockBootloader { - static instance: UnlockBootloader = UnlockBootloader { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for UnlockBootloader { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("UnlockBootloader").unwrap()).clone() - } -} - -impl ::std::fmt::Display for UnlockBootloader { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for UnlockBootloader { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.management.BackupType) -pub enum BackupType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.BackupType.Bip39) - Bip39 = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.BackupType.Slip39_Basic) - Slip39_Basic = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.BackupType.Slip39_Advanced) - Slip39_Advanced = 2, -} - -impl ::protobuf::Enum for BackupType { - const NAME: &'static str = "BackupType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(BackupType::Bip39), - 1 => ::std::option::Option::Some(BackupType::Slip39_Basic), - 2 => ::std::option::Option::Some(BackupType::Slip39_Advanced), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "Bip39" => ::std::option::Option::Some(BackupType::Bip39), - "Slip39_Basic" => ::std::option::Option::Some(BackupType::Slip39_Basic), - "Slip39_Advanced" => ::std::option::Option::Some(BackupType::Slip39_Advanced), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [BackupType] = &[ - BackupType::Bip39, - BackupType::Slip39_Basic, - BackupType::Slip39_Advanced, - ]; -} - -impl ::protobuf::EnumFull for BackupType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("BackupType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for BackupType { - fn default() -> Self { - BackupType::Bip39 - } -} - -impl BackupType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BackupType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.management.SafetyCheckLevel) -pub enum SafetyCheckLevel { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SafetyCheckLevel.Strict) - Strict = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SafetyCheckLevel.PromptAlways) - PromptAlways = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SafetyCheckLevel.PromptTemporarily) - PromptTemporarily = 2, -} - -impl ::protobuf::Enum for SafetyCheckLevel { - const NAME: &'static str = "SafetyCheckLevel"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(SafetyCheckLevel::Strict), - 1 => ::std::option::Option::Some(SafetyCheckLevel::PromptAlways), - 2 => ::std::option::Option::Some(SafetyCheckLevel::PromptTemporarily), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "Strict" => ::std::option::Option::Some(SafetyCheckLevel::Strict), - "PromptAlways" => ::std::option::Option::Some(SafetyCheckLevel::PromptAlways), - "PromptTemporarily" => ::std::option::Option::Some(SafetyCheckLevel::PromptTemporarily), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [SafetyCheckLevel] = &[ - SafetyCheckLevel::Strict, - SafetyCheckLevel::PromptAlways, - SafetyCheckLevel::PromptTemporarily, - ]; -} - -impl ::protobuf::EnumFull for SafetyCheckLevel { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("SafetyCheckLevel").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for SafetyCheckLevel { - fn default() -> Self { - SafetyCheckLevel::Strict - } -} - -impl SafetyCheckLevel { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("SafetyCheckLevel") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.management.HomescreenFormat) -pub enum HomescreenFormat { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.HomescreenFormat.Toif) - Toif = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.HomescreenFormat.Jpeg) - Jpeg = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.management.HomescreenFormat.ToiG) - ToiG = 3, -} - -impl ::protobuf::Enum for HomescreenFormat { - const NAME: &'static str = "HomescreenFormat"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(HomescreenFormat::Toif), - 2 => ::std::option::Option::Some(HomescreenFormat::Jpeg), - 3 => ::std::option::Option::Some(HomescreenFormat::ToiG), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "Toif" => ::std::option::Option::Some(HomescreenFormat::Toif), - "Jpeg" => ::std::option::Option::Some(HomescreenFormat::Jpeg), - "ToiG" => ::std::option::Option::Some(HomescreenFormat::ToiG), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [HomescreenFormat] = &[ - HomescreenFormat::Toif, - HomescreenFormat::Jpeg, - HomescreenFormat::ToiG, - ]; -} - -impl ::protobuf::EnumFull for HomescreenFormat { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("HomescreenFormat").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - HomescreenFormat::Toif => 0, - HomescreenFormat::Jpeg => 1, - HomescreenFormat::ToiG => 2, - }; - Self::enum_descriptor().value_by_index(index) - } -} - -// Note, `Default` is implemented although default value is not 0 -impl ::std::default::Default for HomescreenFormat { - fn default() -> Self { - HomescreenFormat::Toif - } -} - -impl HomescreenFormat { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("HomescreenFormat") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x19messages-management.proto\x12\x1dhw.trezor.messages.management\x1a\ - \x0emessages.proto\"\x80\x01\n\nInitialize\x12\x1d\n\nsession_id\x18\x01\ - \x20\x01(\x0cR\tsessionId\x12,\n\x10_skip_passphrase\x18\x02\x20\x01(\ - \x08R\x0eSkipPassphraseB\x02\x18\x01\x12%\n\x0ederive_cardano\x18\x03\ - \x20\x01(\x08R\rderiveCardano\"\r\n\x0bGetFeatures\"\x94\x14\n\x08Featur\ - es\x12\x16\n\x06vendor\x18\x01\x20\x01(\tR\x06vendor\x12#\n\rmajor_versi\ - on\x18\x02\x20\x02(\rR\x0cmajorVersion\x12#\n\rminor_version\x18\x03\x20\ - \x02(\rR\x0cminorVersion\x12#\n\rpatch_version\x18\x04\x20\x02(\rR\x0cpa\ - tchVersion\x12'\n\x0fbootloader_mode\x18\x05\x20\x01(\x08R\x0ebootloader\ - Mode\x12\x1b\n\tdevice_id\x18\x06\x20\x01(\tR\x08deviceId\x12%\n\x0epin_\ - protection\x18\x07\x20\x01(\x08R\rpinProtection\x123\n\x15passphrase_pro\ - tection\x18\x08\x20\x01(\x08R\x14passphraseProtection\x12\x1a\n\x08langu\ - age\x18\t\x20\x01(\tR\x08language\x12\x14\n\x05label\x18\n\x20\x01(\tR\ - \x05label\x12\x20\n\x0binitialized\x18\x0c\x20\x01(\x08R\x0binitialized\ - \x12\x1a\n\x08revision\x18\r\x20\x01(\x0cR\x08revision\x12'\n\x0fbootloa\ - der_hash\x18\x0e\x20\x01(\x0cR\x0ebootloaderHash\x12\x1a\n\x08imported\ - \x18\x0f\x20\x01(\x08R\x08imported\x12\x1a\n\x08unlocked\x18\x10\x20\x01\ - (\x08R\x08unlocked\x120\n\x12_passphrase_cached\x18\x11\x20\x01(\x08R\ - \x10PassphraseCachedB\x02\x18\x01\x12)\n\x10firmware_present\x18\x12\x20\ - \x01(\x08R\x0ffirmwarePresent\x12!\n\x0cneeds_backup\x18\x13\x20\x01(\ - \x08R\x0bneedsBackup\x12\x14\n\x05flags\x18\x14\x20\x01(\rR\x05flags\x12\ - \x14\n\x05model\x18\x15\x20\x01(\tR\x05model\x12\x19\n\x08fw_major\x18\ - \x16\x20\x01(\rR\x07fwMajor\x12\x19\n\x08fw_minor\x18\x17\x20\x01(\rR\ - \x07fwMinor\x12\x19\n\x08fw_patch\x18\x18\x20\x01(\rR\x07fwPatch\x12\x1b\ - \n\tfw_vendor\x18\x19\x20\x01(\tR\x08fwVendor\x12+\n\x11unfinished_backu\ - p\x18\x1b\x20\x01(\x08R\x10unfinishedBackup\x12\x1b\n\tno_backup\x18\x1c\ - \x20\x01(\x08R\x08noBackup\x12#\n\rrecovery_mode\x18\x1d\x20\x01(\x08R\ - \x0crecoveryMode\x12V\n\x0ccapabilities\x18\x1e\x20\x03(\x0e22.hw.trezor\ - .messages.management.Features.CapabilityR\x0ccapabilities\x12J\n\x0bback\ - up_type\x18\x1f\x20\x01(\x0e2).hw.trezor.messages.management.BackupTypeR\ - \nbackupType\x12&\n\x0fsd_card_present\x18\x20\x20\x01(\x08R\rsdCardPres\ - ent\x12#\n\rsd_protection\x18!\x20\x01(\x08R\x0csdProtection\x120\n\x14w\ - ipe_code_protection\x18\"\x20\x01(\x08R\x12wipeCodeProtection\x12\x1d\n\ - \nsession_id\x18#\x20\x01(\x0cR\tsessionId\x12=\n\x1bpassphrase_always_o\ - n_device\x18$\x20\x01(\x08R\x18passphraseAlwaysOnDevice\x12T\n\rsafety_c\ - hecks\x18%\x20\x01(\x0e2/.hw.trezor.messages.management.SafetyCheckLevel\ - R\x0csafetyChecks\x12+\n\x12auto_lock_delay_ms\x18&\x20\x01(\rR\x0fautoL\ - ockDelayMs\x12)\n\x10display_rotation\x18'\x20\x01(\rR\x0fdisplayRotatio\ - n\x123\n\x15experimental_features\x18(\x20\x01(\x08R\x14experimentalFeat\ - ures\x12\x12\n\x04busy\x18)\x20\x01(\x08R\x04busy\x12\\\n\x11homescreen_\ - format\x18*\x20\x01(\x0e2/.hw.trezor.messages.management.HomescreenForma\ - tR\x10homescreenFormat\x129\n\x19hide_passphrase_from_host\x18+\x20\x01(\ - \x08R\x16hidePassphraseFromHost\x12%\n\x0einternal_model\x18,\x20\x01(\t\ - R\rinternalModel\x12\x1d\n\nunit_color\x18-\x20\x01(\rR\tunitColor\x12!\ - \n\x0cunit_btconly\x18.\x20\x01(\x08R\x0bunitBtconly\x12)\n\x10homescree\ - n_width\x18/\x20\x01(\rR\x0fhomescreenWidth\x12+\n\x11homescreen_height\ - \x180\x20\x01(\rR\x10homescreenHeight\x12+\n\x11bootloader_locked\x181\ - \x20\x01(\x08R\x10bootloaderLocked\x12>\n\x18language_version_matches\ - \x182\x20\x01(\x08:\x04trueR\x16languageVersionMatches\x12%\n\x0eunit_pa\ - ckaging\x183\x20\x01(\rR\runitPackaging\"\x9e\x04\n\nCapability\x12\x1c\ - \n\x12Capability_Bitcoin\x10\x01\x1a\x04\x80\xa6\x1d\x01\x12\x1b\n\x17Ca\ - pability_Bitcoin_like\x10\x02\x12\x16\n\x12Capability_Binance\x10\x03\ - \x12\x16\n\x12Capability_Cardano\x10\x04\x12\x1b\n\x11Capability_Crypto\ - \x10\x05\x1a\x04\x80\xa6\x1d\x01\x12\x12\n\x0eCapability_EOS\x10\x06\x12\ - \x17\n\x13Capability_Ethereum\x10\x07\x12\x17\n\x0fCapability_Lisk\x10\ - \x08\x1a\x02\x08\x01\x12\x15\n\x11Capability_Monero\x10\t\x12\x12\n\x0eC\ - apability_NEM\x10\n\x12\x15\n\x11Capability_Ripple\x10\x0b\x12\x16\n\x12\ - Capability_Stellar\x10\x0c\x12\x14\n\x10Capability_Tezos\x10\r\x12\x12\n\ - \x0eCapability_U2F\x10\x0e\x12\x1b\n\x11Capability_Shamir\x10\x0f\x1a\ - \x04\x80\xa6\x1d\x01\x12!\n\x17Capability_ShamirGroups\x10\x10\x1a\x04\ - \x80\xa6\x1d\x01\x12$\n\x1aCapability_PassphraseEntry\x10\x11\x1a\x04\ - \x80\xa6\x1d\x01\x12\x15\n\x11Capability_Solana\x10\x12\x12!\n\x17Capabi\ - lity_Translations\x10\x13\x1a\x04\x80\xa6\x1d\x01\x12\x18\n\x14Capabilit\ - y_Mintlayer\x10\x14\x1a\x04\xc8\xf3\x18\x01\"\x0c\n\nLockDevice\"&\n\x07\ - SetBusy\x12\x1b\n\texpiry_ms\x18\x01\x20\x01(\rR\x08expiryMs\"\x0c\n\nEn\ - dSession\"\x9b\x04\n\rApplySettings\x12\x1e\n\x08language\x18\x01\x20\ - \x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x02\x20\x01(\tR\ - \x05label\x12%\n\x0euse_passphrase\x18\x03\x20\x01(\x08R\rusePassphrase\ - \x12\x1e\n\nhomescreen\x18\x04\x20\x01(\x0cR\nhomescreen\x120\n\x12_pass\ - phrase_source\x18\x05\x20\x01(\rR\x10PassphraseSourceB\x02\x18\x01\x12+\ - \n\x12auto_lock_delay_ms\x18\x06\x20\x01(\rR\x0fautoLockDelayMs\x12)\n\ - \x10display_rotation\x18\x07\x20\x01(\rR\x0fdisplayRotation\x12=\n\x1bpa\ - ssphrase_always_on_device\x18\x08\x20\x01(\x08R\x18passphraseAlwaysOnDev\ - ice\x12T\n\rsafety_checks\x18\t\x20\x01(\x0e2/.hw.trezor.messages.manage\ - ment.SafetyCheckLevelR\x0csafetyChecks\x123\n\x15experimental_features\ - \x18\n\x20\x01(\x08R\x14experimentalFeatures\x129\n\x19hide_passphrase_f\ - rom_host\x18\x0b\x20\x01(\x08R\x16hidePassphraseFromHost\"T\n\x0eChangeL\ - anguage\x12\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndataLength\x12!\n\ - \x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"Z\n\x16Translatio\ - nDataRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndataLength\ - \x12\x1f\n\x0bdata_offset\x18\x02\x20\x02(\rR\ndataOffset\"3\n\x12Transl\ - ationDataAck\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\"\ - \n\nApplyFlags\x12\x14\n\x05flags\x18\x01\x20\x02(\rR\x05flags\"#\n\tCha\ - ngePin\x12\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\"(\n\x0eChang\ - eWipeCode\x12\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\"\xaa\x01\ - \n\tSdProtect\x12]\n\toperation\x18\x01\x20\x02(\x0e2?.hw.trezor.message\ - s.management.SdProtect.SdProtectOperationTypeR\toperation\">\n\x16SdProt\ - ectOperationType\x12\x0b\n\x07DISABLE\x10\0\x12\n\n\x06ENABLE\x10\x01\ - \x12\x0b\n\x07REFRESH\x10\x02\"O\n\x04Ping\x12\x1a\n\x07message\x18\x01\ - \x20\x01(\t:\0R\x07message\x12+\n\x11button_protection\x18\x02\x20\x01(\ - \x08R\x10buttonProtection\"\x08\n\x06Cancel\"\x20\n\nGetEntropy\x12\x12\ - \n\x04size\x18\x01\x20\x02(\rR\x04size\"#\n\x07Entropy\x12\x18\n\x07entr\ - opy\x18\x01\x20\x02(\x0cR\x07entropy\"/\n\x0fGetFirmwareHash\x12\x1c\n\t\ - challenge\x18\x01\x20\x01(\x0cR\tchallenge\"\"\n\x0cFirmwareHash\x12\x12\ - \n\x04hash\x18\x01\x20\x02(\x0cR\x04hash\"2\n\x12AuthenticateDevice\x12\ - \x1c\n\tchallenge\x18\x01\x20\x02(\x0cR\tchallenge\"U\n\x11AuthenticityP\ - roof\x12\"\n\x0ccertificates\x18\x01\x20\x03(\x0cR\x0ccertificates\x12\ - \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\"\x0c\n\nWipeDevice\"\ - \xad\x02\n\nLoadDevice\x12\x1c\n\tmnemonics\x18\x01\x20\x03(\tR\tmnemoni\ - cs\x12\x10\n\x03pin\x18\x03\x20\x01(\tR\x03pin\x123\n\x15passphrase_prot\ - ection\x18\x04\x20\x01(\x08R\x14passphraseProtection\x12\x1e\n\x08langua\ - ge\x18\x05\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\ - \x06\x20\x01(\tR\x05label\x12#\n\rskip_checksum\x18\x07\x20\x01(\x08R\ - \x0cskipChecksum\x12\x1f\n\x0bu2f_counter\x18\x08\x20\x01(\rR\nu2fCounte\ - r\x12!\n\x0cneeds_backup\x18\t\x20\x01(\x08R\x0bneedsBackup\x12\x1b\n\tn\ - o_backup\x18\n\x20\x01(\x08R\x08noBackup\"\x99\x03\n\x0bResetDevice\x12%\ - \n\x0edisplay_random\x18\x01\x20\x01(\x08R\rdisplayRandom\x12\x1f\n\x08s\ - trength\x18\x02\x20\x01(\r:\x03256R\x08strength\x123\n\x15passphrase_pro\ - tection\x18\x03\x20\x01(\x08R\x14passphraseProtection\x12%\n\x0epin_prot\ - ection\x18\x04\x20\x01(\x08R\rpinProtection\x12\x1e\n\x08language\x18\ - \x05\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x06\x20\ - \x01(\tR\x05label\x12\x1f\n\x0bu2f_counter\x18\x07\x20\x01(\rR\nu2fCount\ - er\x12\x1f\n\x0bskip_backup\x18\x08\x20\x01(\x08R\nskipBackup\x12\x1b\n\ - \tno_backup\x18\t\x20\x01(\x08R\x08noBackup\x12Q\n\x0bbackup_type\x18\n\ - \x20\x01(\x0e2).hw.trezor.messages.management.BackupType:\x05Bip39R\nbac\ - kupType\"\xe5\x01\n\x0cBackupDevice\x12'\n\x0fgroup_threshold\x18\x01\ - \x20\x01(\rR\x0egroupThreshold\x12O\n\x06groups\x18\x02\x20\x03(\x0b27.h\ - w.trezor.messages.management.BackupDevice.Slip39GroupR\x06groups\x1a[\n\ - \x0bSlip39Group\x12)\n\x10member_threshold\x18\x01\x20\x02(\rR\x0fmember\ - Threshold\x12!\n\x0cmember_count\x18\x02\x20\x02(\rR\x0bmemberCount\"\ - \x10\n\x0eEntropyRequest\"&\n\nEntropyAck\x12\x18\n\x07entropy\x18\x01\ - \x20\x02(\x0cR\x07entropy\"\xd8\x03\n\x0eRecoveryDevice\x12\x1d\n\nword_\ - count\x18\x01\x20\x01(\rR\twordCount\x123\n\x15passphrase_protection\x18\ - \x02\x20\x01(\x08R\x14passphraseProtection\x12%\n\x0epin_protection\x18\ - \x03\x20\x01(\x08R\rpinProtection\x12\x1e\n\x08language\x18\x04\x20\x01(\ - \tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x05\x20\x01(\tR\x05l\ - abel\x12)\n\x10enforce_wordlist\x18\x06\x20\x01(\x08R\x0fenforceWordlist\ - \x12T\n\x04type\x18\x08\x20\x01(\x0e2@.hw.trezor.messages.management.Rec\ - overyDevice.RecoveryDeviceTypeR\x04type\x12\x1f\n\x0bu2f_counter\x18\t\ - \x20\x01(\rR\nu2fCounter\x12\x17\n\x07dry_run\x18\n\x20\x01(\x08R\x06dry\ - Run\"Z\n\x12RecoveryDeviceType\x12%\n!RecoveryDeviceType_ScrambledWords\ - \x10\0\x12\x1d\n\x19RecoveryDeviceType_Matrix\x10\x01\"\xc5\x01\n\x0bWor\ - dRequest\x12N\n\x04type\x18\x01\x20\x02(\x0e2:.hw.trezor.messages.manage\ - ment.WordRequest.WordRequestTypeR\x04type\"f\n\x0fWordRequestType\x12\ - \x19\n\x15WordRequestType_Plain\x10\0\x12\x1b\n\x17WordRequestType_Matri\ - x9\x10\x01\x12\x1b\n\x17WordRequestType_Matrix6\x10\x02\"\x1d\n\x07WordA\ - ck\x12\x12\n\x04word\x18\x01\x20\x02(\tR\x04word\"0\n\rSetU2FCounter\x12\ - \x1f\n\x0bu2f_counter\x18\x01\x20\x02(\rR\nu2fCounter\"\x13\n\x11GetNext\ - U2FCounter\"1\n\x0eNextU2FCounter\x12\x1f\n\x0bu2f_counter\x18\x01\x20\ - \x02(\rR\nu2fCounter\"\x11\n\x0fDoPreauthorized\"\x16\n\x14Preauthorized\ - Request\"\x15\n\x13CancelAuthorization\"\x9a\x02\n\x12RebootToBootloader\ - \x12o\n\x0cboot_command\x18\x01\x20\x01(\x0e2=.hw.trezor.messages.manage\ - ment.RebootToBootloader.BootCommand:\rSTOP_AND_WAITR\x0bbootCommand\x12'\ - \n\x0ffirmware_header\x18\x02\x20\x01(\x0cR\x0efirmwareHeader\x123\n\x14\ - language_data_length\x18\x03\x20\x01(\r:\x010R\x12languageDataLength\"5\ - \n\x0bBootCommand\x12\x11\n\rSTOP_AND_WAIT\x10\0\x12\x13\n\x0fINSTALL_UP\ - GRADE\x10\x01\"\x10\n\x08GetNonce:\x04\x88\xb2\x19\x01\"#\n\x05Nonce\x12\ - \x14\n\x05nonce\x18\x01\x20\x02(\x0cR\x05nonce:\x04\x88\xb2\x19\x01\";\n\ - \nUnlockPath\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\ - \x10\n\x03mac\x18\x02\x20\x01(\x0cR\x03mac\"'\n\x13UnlockedPathRequest\ - \x12\x10\n\x03mac\x18\x01\x20\x01(\x0cR\x03mac\"\x14\n\x12ShowDeviceTuto\ - rial\"\x12\n\x10UnlockBootloader*>\n\nBackupType\x12\t\n\x05Bip39\x10\0\ - \x12\x10\n\x0cSlip39_Basic\x10\x01\x12\x13\n\x0fSlip39_Advanced\x10\x02*\ - G\n\x10SafetyCheckLevel\x12\n\n\x06Strict\x10\0\x12\x10\n\x0cPromptAlway\ - s\x10\x01\x12\x15\n\x11PromptTemporarily\x10\x02*0\n\x10HomescreenFormat\ - \x12\x08\n\x04Toif\x10\x01\x12\x08\n\x04Jpeg\x10\x02\x12\x08\n\x04ToiG\ - \x10\x03BB\n#com.satoshilabs.trezor.lib.protobufB\x17TrezorMessageManage\ - ment\x80\xa6\x1d\x01\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(1); - deps.push(super::messages::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(45); - messages.push(Initialize::generated_message_descriptor_data()); - messages.push(GetFeatures::generated_message_descriptor_data()); - messages.push(Features::generated_message_descriptor_data()); - messages.push(LockDevice::generated_message_descriptor_data()); - messages.push(SetBusy::generated_message_descriptor_data()); - messages.push(EndSession::generated_message_descriptor_data()); - messages.push(ApplySettings::generated_message_descriptor_data()); - messages.push(ChangeLanguage::generated_message_descriptor_data()); - messages.push(TranslationDataRequest::generated_message_descriptor_data()); - messages.push(TranslationDataAck::generated_message_descriptor_data()); - messages.push(ApplyFlags::generated_message_descriptor_data()); - messages.push(ChangePin::generated_message_descriptor_data()); - messages.push(ChangeWipeCode::generated_message_descriptor_data()); - messages.push(SdProtect::generated_message_descriptor_data()); - messages.push(Ping::generated_message_descriptor_data()); - messages.push(Cancel::generated_message_descriptor_data()); - messages.push(GetEntropy::generated_message_descriptor_data()); - messages.push(Entropy::generated_message_descriptor_data()); - messages.push(GetFirmwareHash::generated_message_descriptor_data()); - messages.push(FirmwareHash::generated_message_descriptor_data()); - messages.push(AuthenticateDevice::generated_message_descriptor_data()); - messages.push(AuthenticityProof::generated_message_descriptor_data()); - messages.push(WipeDevice::generated_message_descriptor_data()); - messages.push(LoadDevice::generated_message_descriptor_data()); - messages.push(ResetDevice::generated_message_descriptor_data()); - messages.push(BackupDevice::generated_message_descriptor_data()); - messages.push(EntropyRequest::generated_message_descriptor_data()); - messages.push(EntropyAck::generated_message_descriptor_data()); - messages.push(RecoveryDevice::generated_message_descriptor_data()); - messages.push(WordRequest::generated_message_descriptor_data()); - messages.push(WordAck::generated_message_descriptor_data()); - messages.push(SetU2FCounter::generated_message_descriptor_data()); - messages.push(GetNextU2FCounter::generated_message_descriptor_data()); - messages.push(NextU2FCounter::generated_message_descriptor_data()); - messages.push(DoPreauthorized::generated_message_descriptor_data()); - messages.push(PreauthorizedRequest::generated_message_descriptor_data()); - messages.push(CancelAuthorization::generated_message_descriptor_data()); - messages.push(RebootToBootloader::generated_message_descriptor_data()); - messages.push(GetNonce::generated_message_descriptor_data()); - messages.push(Nonce::generated_message_descriptor_data()); - messages.push(UnlockPath::generated_message_descriptor_data()); - messages.push(UnlockedPathRequest::generated_message_descriptor_data()); - messages.push(ShowDeviceTutorial::generated_message_descriptor_data()); - messages.push(UnlockBootloader::generated_message_descriptor_data()); - messages.push(backup_device::Slip39Group::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(8); - enums.push(BackupType::generated_enum_descriptor_data()); - enums.push(SafetyCheckLevel::generated_enum_descriptor_data()); - enums.push(HomescreenFormat::generated_enum_descriptor_data()); - enums.push(features::Capability::generated_enum_descriptor_data()); - enums.push(sd_protect::SdProtectOperationType::generated_enum_descriptor_data()); - enums.push(recovery_device::RecoveryDeviceType::generated_enum_descriptor_data()); - enums.push(word_request::WordRequestType::generated_enum_descriptor_data()); - enums.push(reboot_to_bootloader::BootCommand::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs b/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs deleted file mode 100644 index a69dd08fdb..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_mintlayer.rs +++ /dev/null @@ -1,10116 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-mintlayer.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerGetAddress { - fn default() -> &'a MintlayerGetAddress { - ::default_instance() - } -} - -impl MintlayerGetAddress { - pub fn new() -> MintlayerGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerGetAddress| { &m.address_n }, - |m: &mut MintlayerGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &MintlayerGetAddress| { &m.show_display }, - |m: &mut MintlayerGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &MintlayerGetAddress| { &m.chunkify }, - |m: &mut MintlayerGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerGetAddress { - const NAME: &'static str = "MintlayerGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerGetAddress { - MintlayerGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerGetAddress { - static instance: MintlayerGetAddress = MintlayerGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerAddress { - fn default() -> &'a MintlayerAddress { - ::default_instance() - } -} - -impl MintlayerAddress { - pub fn new() -> MintlayerAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerAddress| { &m.address }, - |m: &mut MintlayerAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerAddress { - const NAME: &'static str = "MintlayerAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerAddress { - MintlayerAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerAddress { - static instance: MintlayerAddress = MintlayerAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerGetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerGetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerGetPublicKey.show_display) - pub show_display: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerGetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerGetPublicKey { - fn default() -> &'a MintlayerGetPublicKey { - ::default_instance() - } -} - -impl MintlayerGetPublicKey { - pub fn new() -> MintlayerGetPublicKey { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerGetPublicKey| { &m.address_n }, - |m: &mut MintlayerGetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &MintlayerGetPublicKey| { &m.show_display }, - |m: &mut MintlayerGetPublicKey| { &mut m.show_display }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerGetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerGetPublicKey { - const NAME: &'static str = "MintlayerGetPublicKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerGetPublicKey { - MintlayerGetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerGetPublicKey { - static instance: MintlayerGetPublicKey = MintlayerGetPublicKey { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerGetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerGetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerGetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerGetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPublicKey.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPublicKey.chain_code) - pub chain_code: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerPublicKey { - fn default() -> &'a MintlayerPublicKey { - ::default_instance() - } -} - -impl MintlayerPublicKey { - pub fn new() -> MintlayerPublicKey { - ::std::default::Default::default() - } - - // required bytes public_key = 1; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes chain_code = 2; - - pub fn chain_code(&self) -> &[u8] { - match self.chain_code.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_chain_code(&mut self) { - self.chain_code = ::std::option::Option::None; - } - - pub fn has_chain_code(&self) -> bool { - self.chain_code.is_some() - } - - // Param is passed by value, moved - pub fn set_chain_code(&mut self, v: ::std::vec::Vec) { - self.chain_code = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_chain_code(&mut self) -> &mut ::std::vec::Vec { - if self.chain_code.is_none() { - self.chain_code = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.chain_code.as_mut().unwrap() - } - - // Take field - pub fn take_chain_code(&mut self) -> ::std::vec::Vec { - self.chain_code.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &MintlayerPublicKey| { &m.public_key }, - |m: &mut MintlayerPublicKey| { &mut m.public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chain_code", - |m: &MintlayerPublicKey| { &m.chain_code }, - |m: &mut MintlayerPublicKey| { &mut m.chain_code }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerPublicKey { - const NAME: &'static str = "MintlayerPublicKey"; - - fn is_initialized(&self) -> bool { - if self.public_key.is_none() { - return false; - } - if self.chain_code.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.chain_code = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.chain_code.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.chain_code.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerPublicKey { - MintlayerPublicKey::new() - } - - fn clear(&mut self) { - self.public_key = ::std::option::Option::None; - self.chain_code = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerPublicKey { - static instance: MintlayerPublicKey = MintlayerPublicKey { - public_key: ::std::option::Option::None, - chain_code: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerSignMessage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerSignMessage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignMessage.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignMessage.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignMessage.message) - pub message: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerSignMessage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerSignMessage { - fn default() -> &'a MintlayerSignMessage { - ::default_instance() - } -} - -impl MintlayerSignMessage { - pub fn new() -> MintlayerSignMessage { - ::std::default::Default::default() - } - - // required string address = 2; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes message = 3; - - pub fn message(&self) -> &[u8] { - match self.message.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::vec::Vec) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::vec::Vec { - self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerSignMessage| { &m.address_n }, - |m: &mut MintlayerSignMessage| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerSignMessage| { &m.address }, - |m: &mut MintlayerSignMessage| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &MintlayerSignMessage| { &m.message }, - |m: &mut MintlayerSignMessage| { &mut m.message }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerSignMessage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerSignMessage { - const NAME: &'static str = "MintlayerSignMessage"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.message.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.message = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.address.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.message.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerSignMessage { - MintlayerSignMessage::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.address = ::std::option::Option::None; - self.message = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerSignMessage { - static instance: MintlayerSignMessage = MintlayerSignMessage { - address_n: ::std::vec::Vec::new(), - address: ::std::option::Option::None, - message: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerSignMessage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerSignMessage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerSignMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerSignMessage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.outputs_count) - pub outputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.inputs_count) - pub inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.serialize) - pub serialize: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerSignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerSignTx { - fn default() -> &'a MintlayerSignTx { - ::default_instance() - } -} - -impl MintlayerSignTx { - pub fn new() -> MintlayerSignTx { - ::std::default::Default::default() - } - - // required uint32 outputs_count = 1; - - pub fn outputs_count(&self) -> u32 { - self.outputs_count.unwrap_or(0) - } - - pub fn clear_outputs_count(&mut self) { - self.outputs_count = ::std::option::Option::None; - } - - pub fn has_outputs_count(&self) -> bool { - self.outputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_outputs_count(&mut self, v: u32) { - self.outputs_count = ::std::option::Option::Some(v); - } - - // required uint32 inputs_count = 2; - - pub fn inputs_count(&self) -> u32 { - self.inputs_count.unwrap_or(0) - } - - pub fn clear_inputs_count(&mut self) { - self.inputs_count = ::std::option::Option::None; - } - - pub fn has_inputs_count(&self) -> bool { - self.inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_inputs_count(&mut self, v: u32) { - self.inputs_count = ::std::option::Option::Some(v); - } - - // optional uint32 version = 3; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(1u32) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // optional bool serialize = 4; - - pub fn serialize(&self) -> bool { - self.serialize.unwrap_or(true) - } - - pub fn clear_serialize(&mut self) { - self.serialize = ::std::option::Option::None; - } - - pub fn has_serialize(&self) -> bool { - self.serialize.is_some() - } - - // Param is passed by value, moved - pub fn set_serialize(&mut self, v: bool) { - self.serialize = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 5; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "outputs_count", - |m: &MintlayerSignTx| { &m.outputs_count }, - |m: &mut MintlayerSignTx| { &mut m.outputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inputs_count", - |m: &MintlayerSignTx| { &m.inputs_count }, - |m: &mut MintlayerSignTx| { &mut m.inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version", - |m: &MintlayerSignTx| { &m.version }, - |m: &mut MintlayerSignTx| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "serialize", - |m: &MintlayerSignTx| { &m.serialize }, - |m: &mut MintlayerSignTx| { &mut m.serialize }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &MintlayerSignTx| { &m.chunkify }, - |m: &mut MintlayerSignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerSignTx { - const NAME: &'static str = "MintlayerSignTx"; - - fn is_initialized(&self) -> bool { - if self.outputs_count.is_none() { - return false; - } - if self.inputs_count.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.serialize = ::std::option::Option::Some(is.read_bool()?); - }, - 40 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.outputs_count { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.inputs_count { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.serialize { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.outputs_count { - os.write_uint32(1, v)?; - } - if let Some(v) = self.inputs_count { - os.write_uint32(2, v)?; - } - if let Some(v) = self.version { - os.write_uint32(3, v)?; - } - if let Some(v) = self.serialize { - os.write_bool(4, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerSignTx { - MintlayerSignTx::new() - } - - fn clear(&mut self) { - self.outputs_count = ::std::option::Option::None; - self.inputs_count = ::std::option::Option::None; - self.version = ::std::option::Option::None; - self.serialize = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerSignTx { - static instance: MintlayerSignTx = MintlayerSignTx { - outputs_count: ::std::option::Option::None, - inputs_count: ::std::option::Option::None, - version: ::std::option::Option::None, - serialize: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTxRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.request_type) - pub request_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.details) - pub details: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.serialized) - pub serialized: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTxRequest { - fn default() -> &'a MintlayerTxRequest { - ::default_instance() - } -} - -impl MintlayerTxRequest { - pub fn new() -> MintlayerTxRequest { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType request_type = 1; - - pub fn request_type(&self) -> mintlayer_tx_request::MintlayerRequestType { - match self.request_type { - Some(e) => e.enum_value_or(mintlayer_tx_request::MintlayerRequestType::TXINPUT), - None => mintlayer_tx_request::MintlayerRequestType::TXINPUT, - } - } - - pub fn clear_request_type(&mut self) { - self.request_type = ::std::option::Option::None; - } - - pub fn has_request_type(&self) -> bool { - self.request_type.is_some() - } - - // Param is passed by value, moved - pub fn set_request_type(&mut self, v: mintlayer_tx_request::MintlayerRequestType) { - self.request_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "request_type", - |m: &MintlayerTxRequest| { &m.request_type }, - |m: &mut MintlayerTxRequest| { &mut m.request_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_request::MintlayerTxRequestDetailsType>( - "details", - |m: &MintlayerTxRequest| { &m.details }, - |m: &mut MintlayerTxRequest| { &mut m.details }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "serialized", - |m: &MintlayerTxRequest| { &m.serialized }, - |m: &mut MintlayerTxRequest| { &mut m.serialized }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTxRequest { - const NAME: &'static str = "MintlayerTxRequest"; - - fn is_initialized(&self) -> bool { - for v in &self.details { - if !v.is_initialized() { - return false; - } - }; - for v in &self.serialized { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.request_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.details)?; - }, - 26 => { - self.serialized.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.request_type { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.details.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - for value in &self.serialized { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.request_type { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.details.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - for v in &self.serialized { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxRequest { - MintlayerTxRequest::new() - } - - fn clear(&mut self) { - self.request_type = ::std::option::Option::None; - self.details.clear(); - self.serialized.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxRequest { - static instance: MintlayerTxRequest = MintlayerTxRequest { - request_type: ::std::option::Option::None, - details: ::protobuf::MessageField::none(), - serialized: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerTxRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerTxRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerTxRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MintlayerTxRequest` -pub mod mintlayer_tx_request { - // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MintlayerTxRequestDetailsType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType.request_index) - pub request_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType.tx_hash) - pub tx_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MintlayerTxRequestDetailsType { - fn default() -> &'a MintlayerTxRequestDetailsType { - ::default_instance() - } - } - - impl MintlayerTxRequestDetailsType { - pub fn new() -> MintlayerTxRequestDetailsType { - ::std::default::Default::default() - } - - // optional uint32 request_index = 1; - - pub fn request_index(&self) -> u32 { - self.request_index.unwrap_or(0) - } - - pub fn clear_request_index(&mut self) { - self.request_index = ::std::option::Option::None; - } - - pub fn has_request_index(&self) -> bool { - self.request_index.is_some() - } - - // Param is passed by value, moved - pub fn set_request_index(&mut self, v: u32) { - self.request_index = ::std::option::Option::Some(v); - } - - // optional bytes tx_hash = 2; - - pub fn tx_hash(&self) -> &[u8] { - match self.tx_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_hash(&mut self) { - self.tx_hash = ::std::option::Option::None; - } - - pub fn has_tx_hash(&self) -> bool { - self.tx_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_hash(&mut self, v: ::std::vec::Vec) { - self.tx_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_hash(&mut self) -> &mut ::std::vec::Vec { - if self.tx_hash.is_none() { - self.tx_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_hash.as_mut().unwrap() - } - - // Take field - pub fn take_tx_hash(&mut self) -> ::std::vec::Vec { - self.tx_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "request_index", - |m: &MintlayerTxRequestDetailsType| { &m.request_index }, - |m: &mut MintlayerTxRequestDetailsType| { &mut m.request_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_hash", - |m: &MintlayerTxRequestDetailsType| { &m.tx_hash }, - |m: &mut MintlayerTxRequestDetailsType| { &mut m.tx_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxRequest.MintlayerTxRequestDetailsType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MintlayerTxRequestDetailsType { - const NAME: &'static str = "MintlayerTxRequestDetailsType"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.request_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.tx_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.request_index { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.tx_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.request_index { - os.write_uint32(1, v)?; - } - if let Some(v) = self.tx_hash.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxRequestDetailsType { - MintlayerTxRequestDetailsType::new() - } - - fn clear(&mut self) { - self.request_index = ::std::option::Option::None; - self.tx_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxRequestDetailsType { - static instance: MintlayerTxRequestDetailsType = MintlayerTxRequestDetailsType { - request_index: ::std::option::Option::None, - tx_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MintlayerTxRequestDetailsType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxRequest.MintlayerTxRequestDetailsType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MintlayerTxRequestDetailsType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MintlayerTxRequestDetailsType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MintlayerSignature { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature.multisig_idx) - pub multisig_idx: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerSignature.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MintlayerSignature { - fn default() -> &'a MintlayerSignature { - ::default_instance() - } - } - - impl MintlayerSignature { - pub fn new() -> MintlayerSignature { - ::std::default::Default::default() - } - - // required bytes signature = 1; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 multisig_idx = 2; - - pub fn multisig_idx(&self) -> u32 { - self.multisig_idx.unwrap_or(0) - } - - pub fn clear_multisig_idx(&mut self) { - self.multisig_idx = ::std::option::Option::None; - } - - pub fn has_multisig_idx(&self) -> bool { - self.multisig_idx.is_some() - } - - // Param is passed by value, moved - pub fn set_multisig_idx(&mut self, v: u32) { - self.multisig_idx = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &MintlayerSignature| { &m.signature }, - |m: &mut MintlayerSignature| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "multisig_idx", - |m: &MintlayerSignature| { &m.multisig_idx }, - |m: &mut MintlayerSignature| { &mut m.multisig_idx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxRequest.MintlayerSignature", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MintlayerSignature { - const NAME: &'static str = "MintlayerSignature"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.multisig_idx = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.multisig_idx { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.multisig_idx { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerSignature { - MintlayerSignature::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.multisig_idx = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerSignature { - static instance: MintlayerSignature = MintlayerSignature { - signature: ::std::option::Option::None, - multisig_idx: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MintlayerSignature { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxRequest.MintlayerSignature").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MintlayerSignature { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MintlayerSignature { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MintlayerTxRequestSerializedType { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signature_index) - pub signature_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.signatures) - pub signatures: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.serialized_tx) - pub serialized_tx: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerTxRequestSerializedType.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MintlayerTxRequestSerializedType { - fn default() -> &'a MintlayerTxRequestSerializedType { - ::default_instance() - } - } - - impl MintlayerTxRequestSerializedType { - pub fn new() -> MintlayerTxRequestSerializedType { - ::std::default::Default::default() - } - - // optional uint32 signature_index = 1; - - pub fn signature_index(&self) -> u32 { - self.signature_index.unwrap_or(0) - } - - pub fn clear_signature_index(&mut self) { - self.signature_index = ::std::option::Option::None; - } - - pub fn has_signature_index(&self) -> bool { - self.signature_index.is_some() - } - - // Param is passed by value, moved - pub fn set_signature_index(&mut self, v: u32) { - self.signature_index = ::std::option::Option::Some(v); - } - - // optional bytes serialized_tx = 3; - - pub fn serialized_tx(&self) -> &[u8] { - match self.serialized_tx.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_serialized_tx(&mut self) { - self.serialized_tx = ::std::option::Option::None; - } - - pub fn has_serialized_tx(&self) -> bool { - self.serialized_tx.is_some() - } - - // Param is passed by value, moved - pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { - self.serialized_tx = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { - if self.serialized_tx.is_none() { - self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.serialized_tx.as_mut().unwrap() - } - - // Take field - pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { - self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature_index", - |m: &MintlayerTxRequestSerializedType| { &m.signature_index }, - |m: &mut MintlayerTxRequestSerializedType| { &mut m.signature_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "signatures", - |m: &MintlayerTxRequestSerializedType| { &m.signatures }, - |m: &mut MintlayerTxRequestSerializedType| { &mut m.signatures }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "serialized_tx", - |m: &MintlayerTxRequestSerializedType| { &m.serialized_tx }, - |m: &mut MintlayerTxRequestSerializedType| { &mut m.serialized_tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxRequest.MintlayerTxRequestSerializedType", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MintlayerTxRequestSerializedType { - const NAME: &'static str = "MintlayerTxRequestSerializedType"; - - fn is_initialized(&self) -> bool { - for v in &self.signatures { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.signature_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.signatures.push(is.read_message()?); - }, - 26 => { - self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature_index { - my_size += ::protobuf::rt::uint32_size(1, v); - } - for value in &self.signatures { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.serialized_tx.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature_index { - os.write_uint32(1, v)?; - } - for v in &self.signatures { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - if let Some(v) = self.serialized_tx.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxRequestSerializedType { - MintlayerTxRequestSerializedType::new() - } - - fn clear(&mut self) { - self.signature_index = ::std::option::Option::None; - self.signatures.clear(); - self.serialized_tx = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxRequestSerializedType { - static instance: MintlayerTxRequestSerializedType = MintlayerTxRequestSerializedType { - signature_index: ::std::option::Option::None, - signatures: ::std::vec::Vec::new(), - serialized_tx: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MintlayerTxRequestSerializedType { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxRequest.MintlayerTxRequestSerializedType").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MintlayerTxRequestSerializedType { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MintlayerTxRequestSerializedType { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType) - pub enum MintlayerRequestType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXINPUT) - TXINPUT = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXOUTPUT) - TXOUTPUT = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXMETA) - TXMETA = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestType.TXFINISHED) - TXFINISHED = 3, - } - - impl ::protobuf::Enum for MintlayerRequestType { - const NAME: &'static str = "MintlayerRequestType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(MintlayerRequestType::TXINPUT), - 1 => ::std::option::Option::Some(MintlayerRequestType::TXOUTPUT), - 2 => ::std::option::Option::Some(MintlayerRequestType::TXMETA), - 3 => ::std::option::Option::Some(MintlayerRequestType::TXFINISHED), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "TXINPUT" => ::std::option::Option::Some(MintlayerRequestType::TXINPUT), - "TXOUTPUT" => ::std::option::Option::Some(MintlayerRequestType::TXOUTPUT), - "TXMETA" => ::std::option::Option::Some(MintlayerRequestType::TXMETA), - "TXFINISHED" => ::std::option::Option::Some(MintlayerRequestType::TXFINISHED), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [MintlayerRequestType] = &[ - MintlayerRequestType::TXINPUT, - MintlayerRequestType::TXOUTPUT, - MintlayerRequestType::TXMETA, - MintlayerRequestType::TXFINISHED, - ]; - } - - impl ::protobuf::EnumFull for MintlayerRequestType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("MintlayerTxRequest.MintlayerRequestType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for MintlayerRequestType { - fn default() -> Self { - MintlayerRequestType::TXINPUT - } - } - - impl MintlayerRequestType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MintlayerTxRequest.MintlayerRequestType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTxInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxInput.utxo) - pub utxo: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxInput.account) - pub account: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxInput.account_command) - pub account_command: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTxInput { - fn default() -> &'a MintlayerTxInput { - ::default_instance() - } -} - -impl MintlayerTxInput { - pub fn new() -> MintlayerTxInput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerUtxoTxInput>( - "utxo", - |m: &MintlayerTxInput| { &m.utxo }, - |m: &mut MintlayerTxInput| { &mut m.utxo }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerAccountTxInput>( - "account", - |m: &MintlayerTxInput| { &m.account }, - |m: &mut MintlayerTxInput| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerAccountCommandTxInput>( - "account_command", - |m: &MintlayerTxInput| { &m.account_command }, - |m: &mut MintlayerTxInput| { &mut m.account_command }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTxInput { - const NAME: &'static str = "MintlayerTxInput"; - - fn is_initialized(&self) -> bool { - for v in &self.utxo { - if !v.is_initialized() { - return false; - } - }; - for v in &self.account { - if !v.is_initialized() { - return false; - } - }; - for v in &self.account_command { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.utxo)?; - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.account)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.account_command)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.utxo.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.account.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.account_command.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.utxo.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.account.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.account_command.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxInput { - MintlayerTxInput::new() - } - - fn clear(&mut self) { - self.utxo.clear(); - self.account.clear(); - self.account_command.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxInput { - static instance: MintlayerTxInput = MintlayerTxInput { - utxo: ::protobuf::MessageField::none(), - account: ::protobuf::MessageField::none(), - account_command: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerTxInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerTxInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerTxInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAddressPath) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerAddressPath { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAddressPath.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAddressPath.multisig_idx) - pub multisig_idx: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAddressPath.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerAddressPath { - fn default() -> &'a MintlayerAddressPath { - ::default_instance() - } -} - -impl MintlayerAddressPath { - pub fn new() -> MintlayerAddressPath { - ::std::default::Default::default() - } - - // optional uint32 multisig_idx = 2; - - pub fn multisig_idx(&self) -> u32 { - self.multisig_idx.unwrap_or(0) - } - - pub fn clear_multisig_idx(&mut self) { - self.multisig_idx = ::std::option::Option::None; - } - - pub fn has_multisig_idx(&self) -> bool { - self.multisig_idx.is_some() - } - - // Param is passed by value, moved - pub fn set_multisig_idx(&mut self, v: u32) { - self.multisig_idx = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerAddressPath| { &m.address_n }, - |m: &mut MintlayerAddressPath| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "multisig_idx", - |m: &MintlayerAddressPath| { &m.multisig_idx }, - |m: &mut MintlayerAddressPath| { &mut m.multisig_idx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerAddressPath", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerAddressPath { - const NAME: &'static str = "MintlayerAddressPath"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.multisig_idx = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.multisig_idx { - my_size += ::protobuf::rt::uint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.multisig_idx { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerAddressPath { - MintlayerAddressPath::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.multisig_idx = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerAddressPath { - static instance: MintlayerAddressPath = MintlayerAddressPath { - address_n: ::std::vec::Vec::new(), - multisig_idx: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerAddressPath { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAddressPath").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerAddressPath { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerAddressPath { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerUtxoTxInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.prev_index) - pub prev_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.value) - pub value: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerUtxoTxInput { - fn default() -> &'a MintlayerUtxoTxInput { - ::default_instance() - } -} - -impl MintlayerUtxoTxInput { - pub fn new() -> MintlayerUtxoTxInput { - ::std::default::Default::default() - } - - // required string address = 2; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes prev_hash = 3; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 4; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - // required .hw.trezor.messages.mintlayer.MintlayerUtxoType type = 5; - - pub fn type_(&self) -> MintlayerUtxoType { - match self.type_ { - Some(e) => e.enum_value_or(MintlayerUtxoType::TRANSACTION), - None => MintlayerUtxoType::TRANSACTION, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: MintlayerUtxoType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint32 sequence = 6; - - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(4294967295u32) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerUtxoTxInput| { &m.address_n }, - |m: &mut MintlayerUtxoTxInput| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerUtxoTxInput| { &m.address }, - |m: &mut MintlayerUtxoTxInput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &MintlayerUtxoTxInput| { &m.prev_hash }, - |m: &mut MintlayerUtxoTxInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &MintlayerUtxoTxInput| { &m.prev_index }, - |m: &mut MintlayerUtxoTxInput| { &mut m.prev_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &MintlayerUtxoTxInput| { &m.type_ }, - |m: &mut MintlayerUtxoTxInput| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &MintlayerUtxoTxInput| { &m.sequence }, - |m: &mut MintlayerUtxoTxInput| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerUtxoTxInput| { &m.value }, - |m: &mut MintlayerUtxoTxInput| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerUtxoTxInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerUtxoTxInput { - const NAME: &'static str = "MintlayerUtxoTxInput"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - if self.type_.is_none() { - return false; - } - if self.value.is_none() { - return false; - } - for v in &self.address_n { - if !v.is_initialized() { - return false; - } - }; - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address_n.push(is.read_message()?); - }, - 18 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 32 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 48 => { - self.sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(5, v.value()); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - if let Some(v) = self.address.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(4, v)?; - } - if let Some(v) = self.type_ { - os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.sequence { - os.write_uint32(6, v)?; - } - if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerUtxoTxInput { - MintlayerUtxoTxInput::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.address = ::std::option::Option::None; - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.type_ = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.value.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerUtxoTxInput { - static instance: MintlayerUtxoTxInput = MintlayerUtxoTxInput { - address_n: ::std::vec::Vec::new(), - address: ::std::option::Option::None, - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - type_: ::std::option::Option::None, - sequence: ::std::option::Option::None, - value: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerUtxoTxInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUtxoTxInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerUtxoTxInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerUtxoTxInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAccountTxInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerAccountTxInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.value) - pub value: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.nonce) - pub nonce: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.delegation_id) - pub delegation_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerAccountTxInput { - fn default() -> &'a MintlayerAccountTxInput { - ::default_instance() - } -} - -impl MintlayerAccountTxInput { - pub fn new() -> MintlayerAccountTxInput { - ::std::default::Default::default() - } - - // required string address = 2; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 sequence = 3; - - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(4294967295u32) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); - } - - // required uint64 nonce = 5; - - pub fn nonce(&self) -> u64 { - self.nonce.unwrap_or(0) - } - - pub fn clear_nonce(&mut self) { - self.nonce = ::std::option::Option::None; - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: u64) { - self.nonce = ::std::option::Option::Some(v); - } - - // required bytes delegation_id = 6; - - pub fn delegation_id(&self) -> &[u8] { - match self.delegation_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_delegation_id(&mut self) { - self.delegation_id = ::std::option::Option::None; - } - - pub fn has_delegation_id(&self) -> bool { - self.delegation_id.is_some() - } - - // Param is passed by value, moved - pub fn set_delegation_id(&mut self, v: ::std::vec::Vec) { - self.delegation_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delegation_id(&mut self) -> &mut ::std::vec::Vec { - if self.delegation_id.is_none() { - self.delegation_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.delegation_id.as_mut().unwrap() - } - - // Take field - pub fn take_delegation_id(&mut self) -> ::std::vec::Vec { - self.delegation_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerAccountTxInput| { &m.address_n }, - |m: &mut MintlayerAccountTxInput| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerAccountTxInput| { &m.address }, - |m: &mut MintlayerAccountTxInput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &MintlayerAccountTxInput| { &m.sequence }, - |m: &mut MintlayerAccountTxInput| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerAccountTxInput| { &m.value }, - |m: &mut MintlayerAccountTxInput| { &mut m.value }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "nonce", - |m: &MintlayerAccountTxInput| { &m.nonce }, - |m: &mut MintlayerAccountTxInput| { &mut m.nonce }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "delegation_id", - |m: &MintlayerAccountTxInput| { &m.delegation_id }, - |m: &mut MintlayerAccountTxInput| { &mut m.delegation_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerAccountTxInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerAccountTxInput { - const NAME: &'static str = "MintlayerAccountTxInput"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.value.is_none() { - return false; - } - if self.nonce.is_none() { - return false; - } - if self.delegation_id.is_none() { - return false; - } - for v in &self.address_n { - if !v.is_initialized() { - return false; - } - }; - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address_n.push(is.read_message()?); - }, - 18 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, - 40 => { - self.nonce = ::std::option::Option::Some(is.read_uint64()?); - }, - 50 => { - self.delegation_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.nonce { - my_size += ::protobuf::rt::uint64_size(5, v); - } - if let Some(v) = self.delegation_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - if let Some(v) = self.address.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.sequence { - os.write_uint32(3, v)?; - } - if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.nonce { - os.write_uint64(5, v)?; - } - if let Some(v) = self.delegation_id.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerAccountTxInput { - MintlayerAccountTxInput::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.address = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.value.clear(); - self.nonce = ::std::option::Option::None; - self.delegation_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerAccountTxInput { - static instance: MintlayerAccountTxInput = MintlayerAccountTxInput { - address_n: ::std::vec::Vec::new(), - address: ::std::option::Option::None, - sequence: ::std::option::Option::None, - value: ::protobuf::MessageField::none(), - nonce: ::std::option::Option::None, - delegation_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerAccountTxInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAccountTxInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerAccountTxInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerAccountTxInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerAccountCommandTxInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.nonce) - pub nonce: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.mint) - pub mint: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.unmint) - pub unmint: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.lock_token_supply) - pub lock_token_supply: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.freeze_token) - pub freeze_token: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.unfreeze_token) - pub unfreeze_token: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.change_token_authority) - pub change_token_authority: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerAccountCommandTxInput { - fn default() -> &'a MintlayerAccountCommandTxInput { - ::default_instance() - } -} - -impl MintlayerAccountCommandTxInput { - pub fn new() -> MintlayerAccountCommandTxInput { - ::std::default::Default::default() - } - - // required string address = 2; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 sequence = 3; - - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(4294967295u32) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); - } - - // required uint64 nonce = 4; - - pub fn nonce(&self) -> u64 { - self.nonce.unwrap_or(0) - } - - pub fn clear_nonce(&mut self) { - self.nonce = ::std::option::Option::None; - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: u64) { - self.nonce = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(10); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MintlayerAccountCommandTxInput| { &m.address_n }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerAccountCommandTxInput| { &m.address }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &MintlayerAccountCommandTxInput| { &m.sequence }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "nonce", - |m: &MintlayerAccountCommandTxInput| { &m.nonce }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.nonce }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerMintTokens>( - "mint", - |m: &MintlayerAccountCommandTxInput| { &m.mint }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.mint }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerUnmintTokens>( - "unmint", - |m: &MintlayerAccountCommandTxInput| { &m.unmint }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.unmint }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerLockTokenSupply>( - "lock_token_supply", - |m: &MintlayerAccountCommandTxInput| { &m.lock_token_supply }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.lock_token_supply }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerFreezeToken>( - "freeze_token", - |m: &MintlayerAccountCommandTxInput| { &m.freeze_token }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.freeze_token }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerUnfreezeToken>( - "unfreeze_token", - |m: &MintlayerAccountCommandTxInput| { &m.unfreeze_token }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.unfreeze_token }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerChangeTokenAuhtority>( - "change_token_authority", - |m: &MintlayerAccountCommandTxInput| { &m.change_token_authority }, - |m: &mut MintlayerAccountCommandTxInput| { &mut m.change_token_authority }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerAccountCommandTxInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerAccountCommandTxInput { - const NAME: &'static str = "MintlayerAccountCommandTxInput"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - if self.nonce.is_none() { - return false; - } - for v in &self.address_n { - if !v.is_initialized() { - return false; - } - }; - for v in &self.mint { - if !v.is_initialized() { - return false; - } - }; - for v in &self.unmint { - if !v.is_initialized() { - return false; - } - }; - for v in &self.lock_token_supply { - if !v.is_initialized() { - return false; - } - }; - for v in &self.freeze_token { - if !v.is_initialized() { - return false; - } - }; - for v in &self.unfreeze_token { - if !v.is_initialized() { - return false; - } - }; - for v in &self.change_token_authority { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address_n.push(is.read_message()?); - }, - 18 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.nonce = ::std::option::Option::Some(is.read_uint64()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.mint)?; - }, - 50 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.unmint)?; - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.lock_token_supply)?; - }, - 66 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.freeze_token)?; - }, - 74 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.unfreeze_token)?; - }, - 82 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.change_token_authority)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.nonce { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.mint.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.unmint.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.lock_token_supply.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.freeze_token.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.unfreeze_token.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.change_token_authority.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - if let Some(v) = self.address.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.sequence { - os.write_uint32(3, v)?; - } - if let Some(v) = self.nonce { - os.write_uint64(4, v)?; - } - if let Some(v) = self.mint.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.unmint.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - } - if let Some(v) = self.lock_token_supply.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.freeze_token.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; - } - if let Some(v) = self.unfreeze_token.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; - } - if let Some(v) = self.change_token_authority.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerAccountCommandTxInput { - MintlayerAccountCommandTxInput::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.address = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.nonce = ::std::option::Option::None; - self.mint.clear(); - self.unmint.clear(); - self.lock_token_supply.clear(); - self.freeze_token.clear(); - self.unfreeze_token.clear(); - self.change_token_authority.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerAccountCommandTxInput { - static instance: MintlayerAccountCommandTxInput = MintlayerAccountCommandTxInput { - address_n: ::std::vec::Vec::new(), - address: ::std::option::Option::None, - sequence: ::std::option::Option::None, - nonce: ::std::option::Option::None, - mint: ::protobuf::MessageField::none(), - unmint: ::protobuf::MessageField::none(), - lock_token_supply: ::protobuf::MessageField::none(), - freeze_token: ::protobuf::MessageField::none(), - unfreeze_token: ::protobuf::MessageField::none(), - change_token_authority: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerAccountCommandTxInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAccountCommandTxInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerAccountCommandTxInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerAccountCommandTxInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerMintTokens) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerMintTokens { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerMintTokens.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerMintTokens.amount) - pub amount: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerMintTokens.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerMintTokens { - fn default() -> &'a MintlayerMintTokens { - ::default_instance() - } -} - -impl MintlayerMintTokens { - pub fn new() -> MintlayerMintTokens { - ::std::default::Default::default() - } - - // required bytes token_id = 1; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes amount = 2; - - pub fn amount(&self) -> &[u8] { - match self.amount.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: ::std::vec::Vec) { - self.amount = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { - if self.amount.is_none() { - self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.amount.as_mut().unwrap() - } - - // Take field - pub fn take_amount(&mut self) -> ::std::vec::Vec { - self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerMintTokens| { &m.token_id }, - |m: &mut MintlayerMintTokens| { &mut m.token_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MintlayerMintTokens| { &m.amount }, - |m: &mut MintlayerMintTokens| { &mut m.amount }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerMintTokens", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerMintTokens { - const NAME: &'static str = "MintlayerMintTokens"; - - fn is_initialized(&self) -> bool { - if self.token_id.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.amount = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.amount.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.amount.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerMintTokens { - MintlayerMintTokens::new() - } - - fn clear(&mut self) { - self.token_id = ::std::option::Option::None; - self.amount = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerMintTokens { - static instance: MintlayerMintTokens = MintlayerMintTokens { - token_id: ::std::option::Option::None, - amount: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerMintTokens { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerMintTokens").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerMintTokens { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerMintTokens { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUnmintTokens) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerUnmintTokens { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUnmintTokens.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUnmintTokens.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerUnmintTokens { - fn default() -> &'a MintlayerUnmintTokens { - ::default_instance() - } -} - -impl MintlayerUnmintTokens { - pub fn new() -> MintlayerUnmintTokens { - ::std::default::Default::default() - } - - // required bytes token_id = 1; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerUnmintTokens| { &m.token_id }, - |m: &mut MintlayerUnmintTokens| { &mut m.token_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerUnmintTokens", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerUnmintTokens { - const NAME: &'static str = "MintlayerUnmintTokens"; - - fn is_initialized(&self) -> bool { - if self.token_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerUnmintTokens { - MintlayerUnmintTokens::new() - } - - fn clear(&mut self) { - self.token_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerUnmintTokens { - static instance: MintlayerUnmintTokens = MintlayerUnmintTokens { - token_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerUnmintTokens { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUnmintTokens").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerUnmintTokens { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerUnmintTokens { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerLockTokenSupply) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerLockTokenSupply { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockTokenSupply.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerLockTokenSupply.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerLockTokenSupply { - fn default() -> &'a MintlayerLockTokenSupply { - ::default_instance() - } -} - -impl MintlayerLockTokenSupply { - pub fn new() -> MintlayerLockTokenSupply { - ::std::default::Default::default() - } - - // required bytes token_id = 1; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerLockTokenSupply| { &m.token_id }, - |m: &mut MintlayerLockTokenSupply| { &mut m.token_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerLockTokenSupply", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerLockTokenSupply { - const NAME: &'static str = "MintlayerLockTokenSupply"; - - fn is_initialized(&self) -> bool { - if self.token_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerLockTokenSupply { - MintlayerLockTokenSupply::new() - } - - fn clear(&mut self) { - self.token_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerLockTokenSupply { - static instance: MintlayerLockTokenSupply = MintlayerLockTokenSupply { - token_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerLockTokenSupply { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerLockTokenSupply").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerLockTokenSupply { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerLockTokenSupply { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerFreezeToken) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerFreezeToken { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFreezeToken.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFreezeToken.is_token_unfreezabe) - pub is_token_unfreezabe: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerFreezeToken.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerFreezeToken { - fn default() -> &'a MintlayerFreezeToken { - ::default_instance() - } -} - -impl MintlayerFreezeToken { - pub fn new() -> MintlayerFreezeToken { - ::std::default::Default::default() - } - - // required bytes token_id = 1; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bool is_token_unfreezabe = 2; - - pub fn is_token_unfreezabe(&self) -> bool { - self.is_token_unfreezabe.unwrap_or(false) - } - - pub fn clear_is_token_unfreezabe(&mut self) { - self.is_token_unfreezabe = ::std::option::Option::None; - } - - pub fn has_is_token_unfreezabe(&self) -> bool { - self.is_token_unfreezabe.is_some() - } - - // Param is passed by value, moved - pub fn set_is_token_unfreezabe(&mut self, v: bool) { - self.is_token_unfreezabe = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerFreezeToken| { &m.token_id }, - |m: &mut MintlayerFreezeToken| { &mut m.token_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "is_token_unfreezabe", - |m: &MintlayerFreezeToken| { &m.is_token_unfreezabe }, - |m: &mut MintlayerFreezeToken| { &mut m.is_token_unfreezabe }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerFreezeToken", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerFreezeToken { - const NAME: &'static str = "MintlayerFreezeToken"; - - fn is_initialized(&self) -> bool { - if self.token_id.is_none() { - return false; - } - if self.is_token_unfreezabe.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.is_token_unfreezabe = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.is_token_unfreezabe { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.is_token_unfreezabe { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerFreezeToken { - MintlayerFreezeToken::new() - } - - fn clear(&mut self) { - self.token_id = ::std::option::Option::None; - self.is_token_unfreezabe = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerFreezeToken { - static instance: MintlayerFreezeToken = MintlayerFreezeToken { - token_id: ::std::option::Option::None, - is_token_unfreezabe: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerFreezeToken { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerFreezeToken").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerFreezeToken { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerFreezeToken { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerUnfreezeToken) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerUnfreezeToken { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUnfreezeToken.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUnfreezeToken.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerUnfreezeToken { - fn default() -> &'a MintlayerUnfreezeToken { - ::default_instance() - } -} - -impl MintlayerUnfreezeToken { - pub fn new() -> MintlayerUnfreezeToken { - ::std::default::Default::default() - } - - // required bytes token_id = 1; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerUnfreezeToken| { &m.token_id }, - |m: &mut MintlayerUnfreezeToken| { &mut m.token_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerUnfreezeToken", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerUnfreezeToken { - const NAME: &'static str = "MintlayerUnfreezeToken"; - - fn is_initialized(&self) -> bool { - if self.token_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerUnfreezeToken { - MintlayerUnfreezeToken::new() - } - - fn clear(&mut self) { - self.token_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerUnfreezeToken { - static instance: MintlayerUnfreezeToken = MintlayerUnfreezeToken { - token_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerUnfreezeToken { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerUnfreezeToken").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerUnfreezeToken { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerUnfreezeToken { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerChangeTokenAuhtority { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority.destination) - pub destination: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerChangeTokenAuhtority { - fn default() -> &'a MintlayerChangeTokenAuhtority { - ::default_instance() - } -} - -impl MintlayerChangeTokenAuhtority { - pub fn new() -> MintlayerChangeTokenAuhtority { - ::std::default::Default::default() - } - - // required bytes token_id = 1; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string destination = 2; - - pub fn destination(&self) -> &str { - match self.destination.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination(&mut self) { - self.destination = ::std::option::Option::None; - } - - pub fn has_destination(&self) -> bool { - self.destination.is_some() - } - - // Param is passed by value, moved - pub fn set_destination(&mut self, v: ::std::string::String) { - self.destination = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination(&mut self) -> &mut ::std::string::String { - if self.destination.is_none() { - self.destination = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination.as_mut().unwrap() - } - - // Take field - pub fn take_destination(&mut self) -> ::std::string::String { - self.destination.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerChangeTokenAuhtority| { &m.token_id }, - |m: &mut MintlayerChangeTokenAuhtority| { &mut m.token_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination", - |m: &MintlayerChangeTokenAuhtority| { &m.destination }, - |m: &mut MintlayerChangeTokenAuhtority| { &mut m.destination }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerChangeTokenAuhtority", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerChangeTokenAuhtority { - const NAME: &'static str = "MintlayerChangeTokenAuhtority"; - - fn is_initialized(&self) -> bool { - if self.token_id.is_none() { - return false; - } - if self.destination.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.destination = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.destination.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.destination.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerChangeTokenAuhtority { - MintlayerChangeTokenAuhtority::new() - } - - fn clear(&mut self) { - self.token_id = ::std::option::Option::None; - self.destination = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerChangeTokenAuhtority { - static instance: MintlayerChangeTokenAuhtority = MintlayerChangeTokenAuhtority { - token_id: ::std::option::Option::None, - destination: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerChangeTokenAuhtority { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerChangeTokenAuhtority").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerChangeTokenAuhtority { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerChangeTokenAuhtority { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.transfer) - pub transfer: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.lock_then_transfer) - pub lock_then_transfer: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.burn) - pub burn: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.create_stake_pool) - pub create_stake_pool: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.produce_block_from_stake) - pub produce_block_from_stake: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.create_delegation_id) - pub create_delegation_id: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.delegate_staking) - pub delegate_staking: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.issue_fungible_token) - pub issue_fungible_token: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.issue_nft) - pub issue_nft: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.data_deposit) - pub data_deposit: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTxOutput { - fn default() -> &'a MintlayerTxOutput { - ::default_instance() - } -} - -impl MintlayerTxOutput { - pub fn new() -> MintlayerTxOutput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(10); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerTransferTxOutput>( - "transfer", - |m: &MintlayerTxOutput| { &m.transfer }, - |m: &mut MintlayerTxOutput| { &mut m.transfer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerLockThenTransferTxOutput>( - "lock_then_transfer", - |m: &MintlayerTxOutput| { &m.lock_then_transfer }, - |m: &mut MintlayerTxOutput| { &mut m.lock_then_transfer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerBurnTxOutput>( - "burn", - |m: &MintlayerTxOutput| { &m.burn }, - |m: &mut MintlayerTxOutput| { &mut m.burn }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerCreateStakePoolTxOutput>( - "create_stake_pool", - |m: &MintlayerTxOutput| { &m.create_stake_pool }, - |m: &mut MintlayerTxOutput| { &mut m.create_stake_pool }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerProduceBlockFromStakeTxOutput>( - "produce_block_from_stake", - |m: &MintlayerTxOutput| { &m.produce_block_from_stake }, - |m: &mut MintlayerTxOutput| { &mut m.produce_block_from_stake }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerCreateDelegationIdTxOutput>( - "create_delegation_id", - |m: &MintlayerTxOutput| { &m.create_delegation_id }, - |m: &mut MintlayerTxOutput| { &mut m.create_delegation_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerDelegateStakingTxOutput>( - "delegate_staking", - |m: &MintlayerTxOutput| { &m.delegate_staking }, - |m: &mut MintlayerTxOutput| { &mut m.delegate_staking }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerIssueFungibleTokenTxOutput>( - "issue_fungible_token", - |m: &MintlayerTxOutput| { &m.issue_fungible_token }, - |m: &mut MintlayerTxOutput| { &mut m.issue_fungible_token }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerIssueNftTxOutput>( - "issue_nft", - |m: &MintlayerTxOutput| { &m.issue_nft }, - |m: &mut MintlayerTxOutput| { &mut m.issue_nft }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerDataDepositTxOutput>( - "data_deposit", - |m: &MintlayerTxOutput| { &m.data_deposit }, - |m: &mut MintlayerTxOutput| { &mut m.data_deposit }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTxOutput { - const NAME: &'static str = "MintlayerTxOutput"; - - fn is_initialized(&self) -> bool { - for v in &self.transfer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.lock_then_transfer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.burn { - if !v.is_initialized() { - return false; - } - }; - for v in &self.create_stake_pool { - if !v.is_initialized() { - return false; - } - }; - for v in &self.produce_block_from_stake { - if !v.is_initialized() { - return false; - } - }; - for v in &self.create_delegation_id { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delegate_staking { - if !v.is_initialized() { - return false; - } - }; - for v in &self.issue_fungible_token { - if !v.is_initialized() { - return false; - } - }; - for v in &self.issue_nft { - if !v.is_initialized() { - return false; - } - }; - for v in &self.data_deposit { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.lock_then_transfer)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.burn)?; - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.create_stake_pool)?; - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.produce_block_from_stake)?; - }, - 50 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.create_delegation_id)?; - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.delegate_staking)?; - }, - 66 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.issue_fungible_token)?; - }, - 74 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.issue_nft)?; - }, - 82 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.data_deposit)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.transfer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.lock_then_transfer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.burn.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.create_stake_pool.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.produce_block_from_stake.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.create_delegation_id.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.delegate_staking.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.issue_fungible_token.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.issue_nft.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.data_deposit.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.transfer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.lock_then_transfer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.burn.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.create_stake_pool.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.produce_block_from_stake.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.create_delegation_id.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - } - if let Some(v) = self.delegate_staking.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.issue_fungible_token.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; - } - if let Some(v) = self.issue_nft.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; - } - if let Some(v) = self.data_deposit.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxOutput { - MintlayerTxOutput::new() - } - - fn clear(&mut self) { - self.transfer.clear(); - self.lock_then_transfer.clear(); - self.burn.clear(); - self.create_stake_pool.clear(); - self.produce_block_from_stake.clear(); - self.create_delegation_id.clear(); - self.delegate_staking.clear(); - self.issue_fungible_token.clear(); - self.issue_nft.clear(); - self.data_deposit.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxOutput { - static instance: MintlayerTxOutput = MintlayerTxOutput { - transfer: ::protobuf::MessageField::none(), - lock_then_transfer: ::protobuf::MessageField::none(), - burn: ::protobuf::MessageField::none(), - create_stake_pool: ::protobuf::MessageField::none(), - produce_block_from_stake: ::protobuf::MessageField::none(), - create_delegation_id: ::protobuf::MessageField::none(), - delegate_staking: ::protobuf::MessageField::none(), - issue_fungible_token: ::protobuf::MessageField::none(), - issue_nft: ::protobuf::MessageField::none(), - data_deposit: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerOutputValue) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerOutputValue { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputValue.amount) - pub amount: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputValue.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerOutputValue.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerOutputValue { - fn default() -> &'a MintlayerOutputValue { - ::default_instance() - } -} - -impl MintlayerOutputValue { - pub fn new() -> MintlayerOutputValue { - ::std::default::Default::default() - } - - // required bytes amount = 1; - - pub fn amount(&self) -> &[u8] { - match self.amount.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: ::std::vec::Vec) { - self.amount = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { - if self.amount.is_none() { - self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.amount.as_mut().unwrap() - } - - // Take field - pub fn take_amount(&mut self) -> ::std::vec::Vec { - self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes token_id = 2; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MintlayerOutputValue| { &m.amount }, - |m: &mut MintlayerOutputValue| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerOutputValue| { &m.token_id }, - |m: &mut MintlayerOutputValue| { &mut m.token_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerOutputValue", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerOutputValue { - const NAME: &'static str = "MintlayerOutputValue"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.amount = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerOutputValue { - MintlayerOutputValue::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.token_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerOutputValue { - static instance: MintlayerOutputValue = MintlayerOutputValue { - amount: ::std::option::Option::None, - token_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerOutputValue { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerOutputValue").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerOutputValue { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerOutputValue { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTransferTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.value) - pub value: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTransferTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTransferTxOutput { - fn default() -> &'a MintlayerTransferTxOutput { - ::default_instance() - } -} - -impl MintlayerTransferTxOutput { - pub fn new() -> MintlayerTransferTxOutput { - ::std::default::Default::default() - } - - // optional string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerTransferTxOutput| { &m.address }, - |m: &mut MintlayerTransferTxOutput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerTransferTxOutput| { &m.value }, - |m: &mut MintlayerTransferTxOutput| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTransferTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTransferTxOutput { - const NAME: &'static str = "MintlayerTransferTxOutput"; - - fn is_initialized(&self) -> bool { - if self.value.is_none() { - return false; - } - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTransferTxOutput { - MintlayerTransferTxOutput::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.value.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTransferTxOutput { - static instance: MintlayerTransferTxOutput = MintlayerTransferTxOutput { - address: ::std::option::Option::None, - value: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerTransferTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTransferTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerTransferTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerTransferTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerOutputTimeLock { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.until_height) - pub until_height: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.until_time) - pub until_time: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.for_block_count) - pub for_block_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.for_seconds) - pub for_seconds: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerOutputTimeLock.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerOutputTimeLock { - fn default() -> &'a MintlayerOutputTimeLock { - ::default_instance() - } -} - -impl MintlayerOutputTimeLock { - pub fn new() -> MintlayerOutputTimeLock { - ::std::default::Default::default() - } - - // optional uint64 until_height = 1; - - pub fn until_height(&self) -> u64 { - self.until_height.unwrap_or(0) - } - - pub fn clear_until_height(&mut self) { - self.until_height = ::std::option::Option::None; - } - - pub fn has_until_height(&self) -> bool { - self.until_height.is_some() - } - - // Param is passed by value, moved - pub fn set_until_height(&mut self, v: u64) { - self.until_height = ::std::option::Option::Some(v); - } - - // optional uint64 until_time = 2; - - pub fn until_time(&self) -> u64 { - self.until_time.unwrap_or(0) - } - - pub fn clear_until_time(&mut self) { - self.until_time = ::std::option::Option::None; - } - - pub fn has_until_time(&self) -> bool { - self.until_time.is_some() - } - - // Param is passed by value, moved - pub fn set_until_time(&mut self, v: u64) { - self.until_time = ::std::option::Option::Some(v); - } - - // optional uint64 for_block_count = 3; - - pub fn for_block_count(&self) -> u64 { - self.for_block_count.unwrap_or(0) - } - - pub fn clear_for_block_count(&mut self) { - self.for_block_count = ::std::option::Option::None; - } - - pub fn has_for_block_count(&self) -> bool { - self.for_block_count.is_some() - } - - // Param is passed by value, moved - pub fn set_for_block_count(&mut self, v: u64) { - self.for_block_count = ::std::option::Option::Some(v); - } - - // optional uint64 for_seconds = 4; - - pub fn for_seconds(&self) -> u64 { - self.for_seconds.unwrap_or(0) - } - - pub fn clear_for_seconds(&mut self) { - self.for_seconds = ::std::option::Option::None; - } - - pub fn has_for_seconds(&self) -> bool { - self.for_seconds.is_some() - } - - // Param is passed by value, moved - pub fn set_for_seconds(&mut self, v: u64) { - self.for_seconds = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "until_height", - |m: &MintlayerOutputTimeLock| { &m.until_height }, - |m: &mut MintlayerOutputTimeLock| { &mut m.until_height }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "until_time", - |m: &MintlayerOutputTimeLock| { &m.until_time }, - |m: &mut MintlayerOutputTimeLock| { &mut m.until_time }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "for_block_count", - |m: &MintlayerOutputTimeLock| { &m.for_block_count }, - |m: &mut MintlayerOutputTimeLock| { &mut m.for_block_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "for_seconds", - |m: &MintlayerOutputTimeLock| { &m.for_seconds }, - |m: &mut MintlayerOutputTimeLock| { &mut m.for_seconds }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerOutputTimeLock", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerOutputTimeLock { - const NAME: &'static str = "MintlayerOutputTimeLock"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.until_height = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.until_time = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.for_block_count = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.for_seconds = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.until_height { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.until_time { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.for_block_count { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.for_seconds { - my_size += ::protobuf::rt::uint64_size(4, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.until_height { - os.write_uint64(1, v)?; - } - if let Some(v) = self.until_time { - os.write_uint64(2, v)?; - } - if let Some(v) = self.for_block_count { - os.write_uint64(3, v)?; - } - if let Some(v) = self.for_seconds { - os.write_uint64(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerOutputTimeLock { - MintlayerOutputTimeLock::new() - } - - fn clear(&mut self) { - self.until_height = ::std::option::Option::None; - self.until_time = ::std::option::Option::None; - self.for_block_count = ::std::option::Option::None; - self.for_seconds = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerOutputTimeLock { - static instance: MintlayerOutputTimeLock = MintlayerOutputTimeLock { - until_height: ::std::option::Option::None, - until_time: ::std::option::Option::None, - for_block_count: ::std::option::Option::None, - for_seconds: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerOutputTimeLock { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerOutputTimeLock").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerOutputTimeLock { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerOutputTimeLock { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerLockThenTransferTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.address) - pub address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.value) - pub value: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.lock) - pub lock: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerLockThenTransferTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerLockThenTransferTxOutput { - fn default() -> &'a MintlayerLockThenTransferTxOutput { - ::default_instance() - } -} - -impl MintlayerLockThenTransferTxOutput { - pub fn new() -> MintlayerLockThenTransferTxOutput { - ::std::default::Default::default() - } - - // optional string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MintlayerLockThenTransferTxOutput| { &m.address }, - |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerLockThenTransferTxOutput| { &m.value }, - |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.value }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputTimeLock>( - "lock", - |m: &MintlayerLockThenTransferTxOutput| { &m.lock }, - |m: &mut MintlayerLockThenTransferTxOutput| { &mut m.lock }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerLockThenTransferTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { - const NAME: &'static str = "MintlayerLockThenTransferTxOutput"; - - fn is_initialized(&self) -> bool { - if self.value.is_none() { - return false; - } - if self.lock.is_none() { - return false; - } - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; - for v in &self.lock { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.lock)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.lock.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.lock.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerLockThenTransferTxOutput { - MintlayerLockThenTransferTxOutput::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.value.clear(); - self.lock.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerLockThenTransferTxOutput { - static instance: MintlayerLockThenTransferTxOutput = MintlayerLockThenTransferTxOutput { - address: ::std::option::Option::None, - value: ::protobuf::MessageField::none(), - lock: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerLockThenTransferTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerLockThenTransferTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerLockThenTransferTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerLockThenTransferTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerBurnTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerBurnTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerBurnTxOutput.value) - pub value: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerBurnTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerBurnTxOutput { - fn default() -> &'a MintlayerBurnTxOutput { - ::default_instance() - } -} - -impl MintlayerBurnTxOutput { - pub fn new() -> MintlayerBurnTxOutput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerBurnTxOutput| { &m.value }, - |m: &mut MintlayerBurnTxOutput| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerBurnTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerBurnTxOutput { - const NAME: &'static str = "MintlayerBurnTxOutput"; - - fn is_initialized(&self) -> bool { - if self.value.is_none() { - return false; - } - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerBurnTxOutput { - MintlayerBurnTxOutput::new() - } - - fn clear(&mut self) { - self.value.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerBurnTxOutput { - static instance: MintlayerBurnTxOutput = MintlayerBurnTxOutput { - value: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerBurnTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerBurnTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerBurnTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerBurnTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerCreateStakePoolTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.pool_id) - pub pool_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.pledge) - pub pledge: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.staker) - pub staker: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.vrf_public_key) - pub vrf_public_key: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.decommission_key) - pub decommission_key: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.margin_ratio_per_thousand) - pub margin_ratio_per_thousand: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.cost_per_block) - pub cost_per_block: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerCreateStakePoolTxOutput { - fn default() -> &'a MintlayerCreateStakePoolTxOutput { - ::default_instance() - } -} - -impl MintlayerCreateStakePoolTxOutput { - pub fn new() -> MintlayerCreateStakePoolTxOutput { - ::std::default::Default::default() - } - - // required bytes pool_id = 1; - - pub fn pool_id(&self) -> &[u8] { - match self.pool_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pool_id(&mut self) { - self.pool_id = ::std::option::Option::None; - } - - pub fn has_pool_id(&self) -> bool { - self.pool_id.is_some() - } - - // Param is passed by value, moved - pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { - self.pool_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { - if self.pool_id.is_none() { - self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pool_id.as_mut().unwrap() - } - - // Take field - pub fn take_pool_id(&mut self) -> ::std::vec::Vec { - self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes pledge = 2; - - pub fn pledge(&self) -> &[u8] { - match self.pledge.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pledge(&mut self) { - self.pledge = ::std::option::Option::None; - } - - pub fn has_pledge(&self) -> bool { - self.pledge.is_some() - } - - // Param is passed by value, moved - pub fn set_pledge(&mut self, v: ::std::vec::Vec) { - self.pledge = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pledge(&mut self) -> &mut ::std::vec::Vec { - if self.pledge.is_none() { - self.pledge = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pledge.as_mut().unwrap() - } - - // Take field - pub fn take_pledge(&mut self) -> ::std::vec::Vec { - self.pledge.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string staker = 3; - - pub fn staker(&self) -> &str { - match self.staker.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_staker(&mut self) { - self.staker = ::std::option::Option::None; - } - - pub fn has_staker(&self) -> bool { - self.staker.is_some() - } - - // Param is passed by value, moved - pub fn set_staker(&mut self, v: ::std::string::String) { - self.staker = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_staker(&mut self) -> &mut ::std::string::String { - if self.staker.is_none() { - self.staker = ::std::option::Option::Some(::std::string::String::new()); - } - self.staker.as_mut().unwrap() - } - - // Take field - pub fn take_staker(&mut self) -> ::std::string::String { - self.staker.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string vrf_public_key = 4; - - pub fn vrf_public_key(&self) -> &str { - match self.vrf_public_key.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_vrf_public_key(&mut self) { - self.vrf_public_key = ::std::option::Option::None; - } - - pub fn has_vrf_public_key(&self) -> bool { - self.vrf_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_vrf_public_key(&mut self, v: ::std::string::String) { - self.vrf_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vrf_public_key(&mut self) -> &mut ::std::string::String { - if self.vrf_public_key.is_none() { - self.vrf_public_key = ::std::option::Option::Some(::std::string::String::new()); - } - self.vrf_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_vrf_public_key(&mut self) -> ::std::string::String { - self.vrf_public_key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string decommission_key = 5; - - pub fn decommission_key(&self) -> &str { - match self.decommission_key.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_decommission_key(&mut self) { - self.decommission_key = ::std::option::Option::None; - } - - pub fn has_decommission_key(&self) -> bool { - self.decommission_key.is_some() - } - - // Param is passed by value, moved - pub fn set_decommission_key(&mut self, v: ::std::string::String) { - self.decommission_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_decommission_key(&mut self) -> &mut ::std::string::String { - if self.decommission_key.is_none() { - self.decommission_key = ::std::option::Option::Some(::std::string::String::new()); - } - self.decommission_key.as_mut().unwrap() - } - - // Take field - pub fn take_decommission_key(&mut self) -> ::std::string::String { - self.decommission_key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint32 margin_ratio_per_thousand = 6; - - pub fn margin_ratio_per_thousand(&self) -> u32 { - self.margin_ratio_per_thousand.unwrap_or(0) - } - - pub fn clear_margin_ratio_per_thousand(&mut self) { - self.margin_ratio_per_thousand = ::std::option::Option::None; - } - - pub fn has_margin_ratio_per_thousand(&self) -> bool { - self.margin_ratio_per_thousand.is_some() - } - - // Param is passed by value, moved - pub fn set_margin_ratio_per_thousand(&mut self, v: u32) { - self.margin_ratio_per_thousand = ::std::option::Option::Some(v); - } - - // required bytes cost_per_block = 7; - - pub fn cost_per_block(&self) -> &[u8] { - match self.cost_per_block.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_cost_per_block(&mut self) { - self.cost_per_block = ::std::option::Option::None; - } - - pub fn has_cost_per_block(&self) -> bool { - self.cost_per_block.is_some() - } - - // Param is passed by value, moved - pub fn set_cost_per_block(&mut self, v: ::std::vec::Vec) { - self.cost_per_block = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cost_per_block(&mut self) -> &mut ::std::vec::Vec { - if self.cost_per_block.is_none() { - self.cost_per_block = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.cost_per_block.as_mut().unwrap() - } - - // Take field - pub fn take_cost_per_block(&mut self) -> ::std::vec::Vec { - self.cost_per_block.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pool_id", - |m: &MintlayerCreateStakePoolTxOutput| { &m.pool_id }, - |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.pool_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pledge", - |m: &MintlayerCreateStakePoolTxOutput| { &m.pledge }, - |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.pledge }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "staker", - |m: &MintlayerCreateStakePoolTxOutput| { &m.staker }, - |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.staker }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vrf_public_key", - |m: &MintlayerCreateStakePoolTxOutput| { &m.vrf_public_key }, - |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.vrf_public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "decommission_key", - |m: &MintlayerCreateStakePoolTxOutput| { &m.decommission_key }, - |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.decommission_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "margin_ratio_per_thousand", - |m: &MintlayerCreateStakePoolTxOutput| { &m.margin_ratio_per_thousand }, - |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.margin_ratio_per_thousand }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "cost_per_block", - |m: &MintlayerCreateStakePoolTxOutput| { &m.cost_per_block }, - |m: &mut MintlayerCreateStakePoolTxOutput| { &mut m.cost_per_block }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerCreateStakePoolTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerCreateStakePoolTxOutput { - const NAME: &'static str = "MintlayerCreateStakePoolTxOutput"; - - fn is_initialized(&self) -> bool { - if self.pool_id.is_none() { - return false; - } - if self.pledge.is_none() { - return false; - } - if self.staker.is_none() { - return false; - } - if self.vrf_public_key.is_none() { - return false; - } - if self.decommission_key.is_none() { - return false; - } - if self.margin_ratio_per_thousand.is_none() { - return false; - } - if self.cost_per_block.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.pool_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.pledge = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.staker = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.vrf_public_key = ::std::option::Option::Some(is.read_string()?); - }, - 42 => { - self.decommission_key = ::std::option::Option::Some(is.read_string()?); - }, - 48 => { - self.margin_ratio_per_thousand = ::std::option::Option::Some(is.read_uint32()?); - }, - 58 => { - self.cost_per_block = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.pool_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.pledge.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.staker.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.vrf_public_key.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.decommission_key.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.margin_ratio_per_thousand { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.cost_per_block.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.pool_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.pledge.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.staker.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.vrf_public_key.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.decommission_key.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.margin_ratio_per_thousand { - os.write_uint32(6, v)?; - } - if let Some(v) = self.cost_per_block.as_ref() { - os.write_bytes(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerCreateStakePoolTxOutput { - MintlayerCreateStakePoolTxOutput::new() - } - - fn clear(&mut self) { - self.pool_id = ::std::option::Option::None; - self.pledge = ::std::option::Option::None; - self.staker = ::std::option::Option::None; - self.vrf_public_key = ::std::option::Option::None; - self.decommission_key = ::std::option::Option::None; - self.margin_ratio_per_thousand = ::std::option::Option::None; - self.cost_per_block = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerCreateStakePoolTxOutput { - static instance: MintlayerCreateStakePoolTxOutput = MintlayerCreateStakePoolTxOutput { - pool_id: ::std::option::Option::None, - pledge: ::std::option::Option::None, - staker: ::std::option::Option::None, - vrf_public_key: ::std::option::Option::None, - decommission_key: ::std::option::Option::None, - margin_ratio_per_thousand: ::std::option::Option::None, - cost_per_block: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerCreateStakePoolTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerCreateStakePoolTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerCreateStakePoolTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerCreateStakePoolTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerProduceBlockFromStakeTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput.destination) - pub destination: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput.pool_id) - pub pool_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerProduceBlockFromStakeTxOutput { - fn default() -> &'a MintlayerProduceBlockFromStakeTxOutput { - ::default_instance() - } -} - -impl MintlayerProduceBlockFromStakeTxOutput { - pub fn new() -> MintlayerProduceBlockFromStakeTxOutput { - ::std::default::Default::default() - } - - // required string destination = 1; - - pub fn destination(&self) -> &str { - match self.destination.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination(&mut self) { - self.destination = ::std::option::Option::None; - } - - pub fn has_destination(&self) -> bool { - self.destination.is_some() - } - - // Param is passed by value, moved - pub fn set_destination(&mut self, v: ::std::string::String) { - self.destination = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination(&mut self) -> &mut ::std::string::String { - if self.destination.is_none() { - self.destination = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination.as_mut().unwrap() - } - - // Take field - pub fn take_destination(&mut self) -> ::std::string::String { - self.destination.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes pool_id = 2; - - pub fn pool_id(&self) -> &[u8] { - match self.pool_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pool_id(&mut self) { - self.pool_id = ::std::option::Option::None; - } - - pub fn has_pool_id(&self) -> bool { - self.pool_id.is_some() - } - - // Param is passed by value, moved - pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { - self.pool_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { - if self.pool_id.is_none() { - self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pool_id.as_mut().unwrap() - } - - // Take field - pub fn take_pool_id(&mut self) -> ::std::vec::Vec { - self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination", - |m: &MintlayerProduceBlockFromStakeTxOutput| { &m.destination }, - |m: &mut MintlayerProduceBlockFromStakeTxOutput| { &mut m.destination }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pool_id", - |m: &MintlayerProduceBlockFromStakeTxOutput| { &m.pool_id }, - |m: &mut MintlayerProduceBlockFromStakeTxOutput| { &mut m.pool_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerProduceBlockFromStakeTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerProduceBlockFromStakeTxOutput { - const NAME: &'static str = "MintlayerProduceBlockFromStakeTxOutput"; - - fn is_initialized(&self) -> bool { - if self.destination.is_none() { - return false; - } - if self.pool_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.destination = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.pool_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.destination.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.pool_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.destination.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.pool_id.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerProduceBlockFromStakeTxOutput { - MintlayerProduceBlockFromStakeTxOutput::new() - } - - fn clear(&mut self) { - self.destination = ::std::option::Option::None; - self.pool_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerProduceBlockFromStakeTxOutput { - static instance: MintlayerProduceBlockFromStakeTxOutput = MintlayerProduceBlockFromStakeTxOutput { - destination: ::std::option::Option::None, - pool_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerProduceBlockFromStakeTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerProduceBlockFromStakeTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerProduceBlockFromStakeTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerProduceBlockFromStakeTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerCreateDelegationIdTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput.destination) - pub destination: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput.pool_id) - pub pool_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerCreateDelegationIdTxOutput { - fn default() -> &'a MintlayerCreateDelegationIdTxOutput { - ::default_instance() - } -} - -impl MintlayerCreateDelegationIdTxOutput { - pub fn new() -> MintlayerCreateDelegationIdTxOutput { - ::std::default::Default::default() - } - - // required string destination = 1; - - pub fn destination(&self) -> &str { - match self.destination.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination(&mut self) { - self.destination = ::std::option::Option::None; - } - - pub fn has_destination(&self) -> bool { - self.destination.is_some() - } - - // Param is passed by value, moved - pub fn set_destination(&mut self, v: ::std::string::String) { - self.destination = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination(&mut self) -> &mut ::std::string::String { - if self.destination.is_none() { - self.destination = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination.as_mut().unwrap() - } - - // Take field - pub fn take_destination(&mut self) -> ::std::string::String { - self.destination.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes pool_id = 2; - - pub fn pool_id(&self) -> &[u8] { - match self.pool_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pool_id(&mut self) { - self.pool_id = ::std::option::Option::None; - } - - pub fn has_pool_id(&self) -> bool { - self.pool_id.is_some() - } - - // Param is passed by value, moved - pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { - self.pool_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pool_id(&mut self) -> &mut ::std::vec::Vec { - if self.pool_id.is_none() { - self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pool_id.as_mut().unwrap() - } - - // Take field - pub fn take_pool_id(&mut self) -> ::std::vec::Vec { - self.pool_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination", - |m: &MintlayerCreateDelegationIdTxOutput| { &m.destination }, - |m: &mut MintlayerCreateDelegationIdTxOutput| { &mut m.destination }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pool_id", - |m: &MintlayerCreateDelegationIdTxOutput| { &m.pool_id }, - |m: &mut MintlayerCreateDelegationIdTxOutput| { &mut m.pool_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerCreateDelegationIdTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerCreateDelegationIdTxOutput { - const NAME: &'static str = "MintlayerCreateDelegationIdTxOutput"; - - fn is_initialized(&self) -> bool { - if self.destination.is_none() { - return false; - } - if self.pool_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.destination = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.pool_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.destination.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.pool_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.destination.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.pool_id.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerCreateDelegationIdTxOutput { - MintlayerCreateDelegationIdTxOutput::new() - } - - fn clear(&mut self) { - self.destination = ::std::option::Option::None; - self.pool_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerCreateDelegationIdTxOutput { - static instance: MintlayerCreateDelegationIdTxOutput = MintlayerCreateDelegationIdTxOutput { - destination: ::std::option::Option::None, - pool_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerCreateDelegationIdTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerCreateDelegationIdTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerCreateDelegationIdTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerCreateDelegationIdTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerDelegateStakingTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput.amount) - pub amount: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput.delegation_id) - pub delegation_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerDelegateStakingTxOutput { - fn default() -> &'a MintlayerDelegateStakingTxOutput { - ::default_instance() - } -} - -impl MintlayerDelegateStakingTxOutput { - pub fn new() -> MintlayerDelegateStakingTxOutput { - ::std::default::Default::default() - } - - // required bytes amount = 1; - - pub fn amount(&self) -> &[u8] { - match self.amount.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: ::std::vec::Vec) { - self.amount = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_amount(&mut self) -> &mut ::std::vec::Vec { - if self.amount.is_none() { - self.amount = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.amount.as_mut().unwrap() - } - - // Take field - pub fn take_amount(&mut self) -> ::std::vec::Vec { - self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes delegation_id = 2; - - pub fn delegation_id(&self) -> &[u8] { - match self.delegation_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_delegation_id(&mut self) { - self.delegation_id = ::std::option::Option::None; - } - - pub fn has_delegation_id(&self) -> bool { - self.delegation_id.is_some() - } - - // Param is passed by value, moved - pub fn set_delegation_id(&mut self, v: ::std::vec::Vec) { - self.delegation_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delegation_id(&mut self) -> &mut ::std::vec::Vec { - if self.delegation_id.is_none() { - self.delegation_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.delegation_id.as_mut().unwrap() - } - - // Take field - pub fn take_delegation_id(&mut self) -> ::std::vec::Vec { - self.delegation_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MintlayerDelegateStakingTxOutput| { &m.amount }, - |m: &mut MintlayerDelegateStakingTxOutput| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "delegation_id", - |m: &MintlayerDelegateStakingTxOutput| { &m.delegation_id }, - |m: &mut MintlayerDelegateStakingTxOutput| { &mut m.delegation_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerDelegateStakingTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerDelegateStakingTxOutput { - const NAME: &'static str = "MintlayerDelegateStakingTxOutput"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - if self.delegation_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.amount = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.delegation_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.delegation_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.delegation_id.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerDelegateStakingTxOutput { - MintlayerDelegateStakingTxOutput::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.delegation_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerDelegateStakingTxOutput { - static instance: MintlayerDelegateStakingTxOutput = MintlayerDelegateStakingTxOutput { - amount: ::std::option::Option::None, - delegation_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerDelegateStakingTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerDelegateStakingTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerDelegateStakingTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerDelegateStakingTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTokenTotalSupply { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply.fixed_amount) - pub fixed_amount: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupply.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTokenTotalSupply { - fn default() -> &'a MintlayerTokenTotalSupply { - ::default_instance() - } -} - -impl MintlayerTokenTotalSupply { - pub fn new() -> MintlayerTokenTotalSupply { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType type = 1; - - pub fn type_(&self) -> MintlayerTokenTotalSupplyType { - match self.type_ { - Some(e) => e.enum_value_or(MintlayerTokenTotalSupplyType::FIXED), - None => MintlayerTokenTotalSupplyType::FIXED, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: MintlayerTokenTotalSupplyType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes fixed_amount = 2; - - pub fn fixed_amount(&self) -> &[u8] { - match self.fixed_amount.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_fixed_amount(&mut self) { - self.fixed_amount = ::std::option::Option::None; - } - - pub fn has_fixed_amount(&self) -> bool { - self.fixed_amount.is_some() - } - - // Param is passed by value, moved - pub fn set_fixed_amount(&mut self, v: ::std::vec::Vec) { - self.fixed_amount = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_fixed_amount(&mut self) -> &mut ::std::vec::Vec { - if self.fixed_amount.is_none() { - self.fixed_amount = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.fixed_amount.as_mut().unwrap() - } - - // Take field - pub fn take_fixed_amount(&mut self) -> ::std::vec::Vec { - self.fixed_amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &MintlayerTokenTotalSupply| { &m.type_ }, - |m: &mut MintlayerTokenTotalSupply| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fixed_amount", - |m: &MintlayerTokenTotalSupply| { &m.fixed_amount }, - |m: &mut MintlayerTokenTotalSupply| { &mut m.fixed_amount }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTokenTotalSupply", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTokenTotalSupply { - const NAME: &'static str = "MintlayerTokenTotalSupply"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.fixed_amount = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.fixed_amount.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.fixed_amount.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTokenTotalSupply { - MintlayerTokenTotalSupply::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.fixed_amount = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTokenTotalSupply { - static instance: MintlayerTokenTotalSupply = MintlayerTokenTotalSupply { - type_: ::std::option::Option::None, - fixed_amount: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerTokenTotalSupply { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTokenTotalSupply").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerTokenTotalSupply { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerTokenTotalSupply { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerIssueFungibleTokenTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.token_ticker) - pub token_ticker: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.number_of_decimals) - pub number_of_decimals: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.metadata_uri) - pub metadata_uri: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.total_supply) - pub total_supply: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.authority) - pub authority: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.is_freezable) - pub is_freezable: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerIssueFungibleTokenTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerIssueFungibleTokenTxOutput { - fn default() -> &'a MintlayerIssueFungibleTokenTxOutput { - ::default_instance() - } -} - -impl MintlayerIssueFungibleTokenTxOutput { - pub fn new() -> MintlayerIssueFungibleTokenTxOutput { - ::std::default::Default::default() - } - - // required bytes token_ticker = 1; - - pub fn token_ticker(&self) -> &[u8] { - match self.token_ticker.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_ticker(&mut self) { - self.token_ticker = ::std::option::Option::None; - } - - pub fn has_token_ticker(&self) -> bool { - self.token_ticker.is_some() - } - - // Param is passed by value, moved - pub fn set_token_ticker(&mut self, v: ::std::vec::Vec) { - self.token_ticker = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_ticker(&mut self) -> &mut ::std::vec::Vec { - if self.token_ticker.is_none() { - self.token_ticker = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_ticker.as_mut().unwrap() - } - - // Take field - pub fn take_token_ticker(&mut self) -> ::std::vec::Vec { - self.token_ticker.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 number_of_decimals = 2; - - pub fn number_of_decimals(&self) -> u32 { - self.number_of_decimals.unwrap_or(0) - } - - pub fn clear_number_of_decimals(&mut self) { - self.number_of_decimals = ::std::option::Option::None; - } - - pub fn has_number_of_decimals(&self) -> bool { - self.number_of_decimals.is_some() - } - - // Param is passed by value, moved - pub fn set_number_of_decimals(&mut self, v: u32) { - self.number_of_decimals = ::std::option::Option::Some(v); - } - - // required bytes metadata_uri = 3; - - pub fn metadata_uri(&self) -> &[u8] { - match self.metadata_uri.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_metadata_uri(&mut self) { - self.metadata_uri = ::std::option::Option::None; - } - - pub fn has_metadata_uri(&self) -> bool { - self.metadata_uri.is_some() - } - - // Param is passed by value, moved - pub fn set_metadata_uri(&mut self, v: ::std::vec::Vec) { - self.metadata_uri = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_metadata_uri(&mut self) -> &mut ::std::vec::Vec { - if self.metadata_uri.is_none() { - self.metadata_uri = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.metadata_uri.as_mut().unwrap() - } - - // Take field - pub fn take_metadata_uri(&mut self) -> ::std::vec::Vec { - self.metadata_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string authority = 5; - - pub fn authority(&self) -> &str { - match self.authority.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_authority(&mut self) { - self.authority = ::std::option::Option::None; - } - - pub fn has_authority(&self) -> bool { - self.authority.is_some() - } - - // Param is passed by value, moved - pub fn set_authority(&mut self, v: ::std::string::String) { - self.authority = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_authority(&mut self) -> &mut ::std::string::String { - if self.authority.is_none() { - self.authority = ::std::option::Option::Some(::std::string::String::new()); - } - self.authority.as_mut().unwrap() - } - - // Take field - pub fn take_authority(&mut self) -> ::std::string::String { - self.authority.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bool is_freezable = 6; - - pub fn is_freezable(&self) -> bool { - self.is_freezable.unwrap_or(false) - } - - pub fn clear_is_freezable(&mut self) { - self.is_freezable = ::std::option::Option::None; - } - - pub fn has_is_freezable(&self) -> bool { - self.is_freezable.is_some() - } - - // Param is passed by value, moved - pub fn set_is_freezable(&mut self, v: bool) { - self.is_freezable = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_ticker", - |m: &MintlayerIssueFungibleTokenTxOutput| { &m.token_ticker }, - |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.token_ticker }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "number_of_decimals", - |m: &MintlayerIssueFungibleTokenTxOutput| { &m.number_of_decimals }, - |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.number_of_decimals }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "metadata_uri", - |m: &MintlayerIssueFungibleTokenTxOutput| { &m.metadata_uri }, - |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.metadata_uri }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerTokenTotalSupply>( - "total_supply", - |m: &MintlayerIssueFungibleTokenTxOutput| { &m.total_supply }, - |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.total_supply }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "authority", - |m: &MintlayerIssueFungibleTokenTxOutput| { &m.authority }, - |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.authority }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "is_freezable", - |m: &MintlayerIssueFungibleTokenTxOutput| { &m.is_freezable }, - |m: &mut MintlayerIssueFungibleTokenTxOutput| { &mut m.is_freezable }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerIssueFungibleTokenTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerIssueFungibleTokenTxOutput { - const NAME: &'static str = "MintlayerIssueFungibleTokenTxOutput"; - - fn is_initialized(&self) -> bool { - if self.token_ticker.is_none() { - return false; - } - if self.number_of_decimals.is_none() { - return false; - } - if self.metadata_uri.is_none() { - return false; - } - if self.total_supply.is_none() { - return false; - } - if self.authority.is_none() { - return false; - } - if self.is_freezable.is_none() { - return false; - } - for v in &self.total_supply { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_ticker = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.number_of_decimals = ::std::option::Option::Some(is.read_uint32()?); - }, - 26 => { - self.metadata_uri = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.total_supply)?; - }, - 42 => { - self.authority = ::std::option::Option::Some(is.read_string()?); - }, - 48 => { - self.is_freezable = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_ticker.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.number_of_decimals { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.metadata_uri.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.total_supply.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.authority.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - if let Some(v) = self.is_freezable { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_ticker.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.number_of_decimals { - os.write_uint32(2, v)?; - } - if let Some(v) = self.metadata_uri.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.total_supply.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.authority.as_ref() { - os.write_string(5, v)?; - } - if let Some(v) = self.is_freezable { - os.write_bool(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerIssueFungibleTokenTxOutput { - MintlayerIssueFungibleTokenTxOutput::new() - } - - fn clear(&mut self) { - self.token_ticker = ::std::option::Option::None; - self.number_of_decimals = ::std::option::Option::None; - self.metadata_uri = ::std::option::Option::None; - self.total_supply.clear(); - self.authority = ::std::option::Option::None; - self.is_freezable = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerIssueFungibleTokenTxOutput { - static instance: MintlayerIssueFungibleTokenTxOutput = MintlayerIssueFungibleTokenTxOutput { - token_ticker: ::std::option::Option::None, - number_of_decimals: ::std::option::Option::None, - metadata_uri: ::std::option::Option::None, - total_supply: ::protobuf::MessageField::none(), - authority: ::std::option::Option::None, - is_freezable: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerIssueFungibleTokenTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerIssueFungibleTokenTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerIssueFungibleTokenTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerIssueFungibleTokenTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerIssueNftTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.destination) - pub destination: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.creator) - pub creator: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.name) - pub name: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.description) - pub description: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.ticker) - pub ticker: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.icon_uri) - pub icon_uri: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.additional_metadata_uri) - pub additional_metadata_uri: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.media_uri) - pub media_uri: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.media_hash) - pub media_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerIssueNftTxOutput { - fn default() -> &'a MintlayerIssueNftTxOutput { - ::default_instance() - } -} - -impl MintlayerIssueNftTxOutput { - pub fn new() -> MintlayerIssueNftTxOutput { - ::std::default::Default::default() - } - - // required bytes token_id = 1; - - pub fn token_id(&self) -> &[u8] { - match self.token_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_token_id(&mut self) { - self.token_id = ::std::option::Option::None; - } - - pub fn has_token_id(&self) -> bool { - self.token_id.is_some() - } - - // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { - self.token_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_id(&mut self) -> &mut ::std::vec::Vec { - if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.token_id.as_mut().unwrap() - } - - // Take field - pub fn take_token_id(&mut self) -> ::std::vec::Vec { - self.token_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string destination = 2; - - pub fn destination(&self) -> &str { - match self.destination.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination(&mut self) { - self.destination = ::std::option::Option::None; - } - - pub fn has_destination(&self) -> bool { - self.destination.is_some() - } - - // Param is passed by value, moved - pub fn set_destination(&mut self, v: ::std::string::String) { - self.destination = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination(&mut self) -> &mut ::std::string::String { - if self.destination.is_none() { - self.destination = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination.as_mut().unwrap() - } - - // Take field - pub fn take_destination(&mut self) -> ::std::string::String { - self.destination.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string creator = 3; - - pub fn creator(&self) -> &str { - match self.creator.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_creator(&mut self) { - self.creator = ::std::option::Option::None; - } - - pub fn has_creator(&self) -> bool { - self.creator.is_some() - } - - // Param is passed by value, moved - pub fn set_creator(&mut self, v: ::std::string::String) { - self.creator = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_creator(&mut self) -> &mut ::std::string::String { - if self.creator.is_none() { - self.creator = ::std::option::Option::Some(::std::string::String::new()); - } - self.creator.as_mut().unwrap() - } - - // Take field - pub fn take_creator(&mut self) -> ::std::string::String { - self.creator.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes name = 4; - - pub fn name(&self) -> &[u8] { - match self.name.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::vec::Vec) { - self.name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::vec::Vec { - if self.name.is_none() { - self.name = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::vec::Vec { - self.name.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes description = 5; - - pub fn description(&self) -> &[u8] { - match self.description.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_description(&mut self) { - self.description = ::std::option::Option::None; - } - - pub fn has_description(&self) -> bool { - self.description.is_some() - } - - // Param is passed by value, moved - pub fn set_description(&mut self, v: ::std::vec::Vec) { - self.description = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_description(&mut self) -> &mut ::std::vec::Vec { - if self.description.is_none() { - self.description = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.description.as_mut().unwrap() - } - - // Take field - pub fn take_description(&mut self) -> ::std::vec::Vec { - self.description.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes ticker = 6; - - pub fn ticker(&self) -> &[u8] { - match self.ticker.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ticker(&mut self) { - self.ticker = ::std::option::Option::None; - } - - pub fn has_ticker(&self) -> bool { - self.ticker.is_some() - } - - // Param is passed by value, moved - pub fn set_ticker(&mut self, v: ::std::vec::Vec) { - self.ticker = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ticker(&mut self) -> &mut ::std::vec::Vec { - if self.ticker.is_none() { - self.ticker = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ticker.as_mut().unwrap() - } - - // Take field - pub fn take_ticker(&mut self) -> ::std::vec::Vec { - self.ticker.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes icon_uri = 7; - - pub fn icon_uri(&self) -> &[u8] { - match self.icon_uri.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_icon_uri(&mut self) { - self.icon_uri = ::std::option::Option::None; - } - - pub fn has_icon_uri(&self) -> bool { - self.icon_uri.is_some() - } - - // Param is passed by value, moved - pub fn set_icon_uri(&mut self, v: ::std::vec::Vec) { - self.icon_uri = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_icon_uri(&mut self) -> &mut ::std::vec::Vec { - if self.icon_uri.is_none() { - self.icon_uri = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.icon_uri.as_mut().unwrap() - } - - // Take field - pub fn take_icon_uri(&mut self) -> ::std::vec::Vec { - self.icon_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes additional_metadata_uri = 8; - - pub fn additional_metadata_uri(&self) -> &[u8] { - match self.additional_metadata_uri.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_additional_metadata_uri(&mut self) { - self.additional_metadata_uri = ::std::option::Option::None; - } - - pub fn has_additional_metadata_uri(&self) -> bool { - self.additional_metadata_uri.is_some() - } - - // Param is passed by value, moved - pub fn set_additional_metadata_uri(&mut self, v: ::std::vec::Vec) { - self.additional_metadata_uri = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_additional_metadata_uri(&mut self) -> &mut ::std::vec::Vec { - if self.additional_metadata_uri.is_none() { - self.additional_metadata_uri = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.additional_metadata_uri.as_mut().unwrap() - } - - // Take field - pub fn take_additional_metadata_uri(&mut self) -> ::std::vec::Vec { - self.additional_metadata_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes media_uri = 9; - - pub fn media_uri(&self) -> &[u8] { - match self.media_uri.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_media_uri(&mut self) { - self.media_uri = ::std::option::Option::None; - } - - pub fn has_media_uri(&self) -> bool { - self.media_uri.is_some() - } - - // Param is passed by value, moved - pub fn set_media_uri(&mut self, v: ::std::vec::Vec) { - self.media_uri = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_media_uri(&mut self) -> &mut ::std::vec::Vec { - if self.media_uri.is_none() { - self.media_uri = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.media_uri.as_mut().unwrap() - } - - // Take field - pub fn take_media_uri(&mut self) -> ::std::vec::Vec { - self.media_uri.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes media_hash = 10; - - pub fn media_hash(&self) -> &[u8] { - match self.media_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_media_hash(&mut self) { - self.media_hash = ::std::option::Option::None; - } - - pub fn has_media_hash(&self) -> bool { - self.media_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_media_hash(&mut self, v: ::std::vec::Vec) { - self.media_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_media_hash(&mut self) -> &mut ::std::vec::Vec { - if self.media_hash.is_none() { - self.media_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.media_hash.as_mut().unwrap() - } - - // Take field - pub fn take_media_hash(&mut self) -> ::std::vec::Vec { - self.media_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(10); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_id", - |m: &MintlayerIssueNftTxOutput| { &m.token_id }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.token_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination", - |m: &MintlayerIssueNftTxOutput| { &m.destination }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.destination }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "creator", - |m: &MintlayerIssueNftTxOutput| { &m.creator }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.creator }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &MintlayerIssueNftTxOutput| { &m.name }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "description", - |m: &MintlayerIssueNftTxOutput| { &m.description }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.description }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ticker", - |m: &MintlayerIssueNftTxOutput| { &m.ticker }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.ticker }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "icon_uri", - |m: &MintlayerIssueNftTxOutput| { &m.icon_uri }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.icon_uri }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "additional_metadata_uri", - |m: &MintlayerIssueNftTxOutput| { &m.additional_metadata_uri }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.additional_metadata_uri }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "media_uri", - |m: &MintlayerIssueNftTxOutput| { &m.media_uri }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.media_uri }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "media_hash", - |m: &MintlayerIssueNftTxOutput| { &m.media_hash }, - |m: &mut MintlayerIssueNftTxOutput| { &mut m.media_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerIssueNftTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerIssueNftTxOutput { - const NAME: &'static str = "MintlayerIssueNftTxOutput"; - - fn is_initialized(&self) -> bool { - if self.token_id.is_none() { - return false; - } - if self.destination.is_none() { - return false; - } - if self.name.is_none() { - return false; - } - if self.description.is_none() { - return false; - } - if self.ticker.is_none() { - return false; - } - if self.media_hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.destination = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.creator = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.name = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.description = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.ticker = ::std::option::Option::Some(is.read_bytes()?); - }, - 58 => { - self.icon_uri = ::std::option::Option::Some(is.read_bytes()?); - }, - 66 => { - self.additional_metadata_uri = ::std::option::Option::Some(is.read_bytes()?); - }, - 74 => { - self.media_uri = ::std::option::Option::Some(is.read_bytes()?); - }, - 82 => { - self.media_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.token_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.destination.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.creator.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.name.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.description.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.ticker.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.icon_uri.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - if let Some(v) = self.additional_metadata_uri.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - if let Some(v) = self.media_uri.as_ref() { - my_size += ::protobuf::rt::bytes_size(9, &v); - } - if let Some(v) = self.media_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(10, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.token_id.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.destination.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.creator.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.name.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.description.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.ticker.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.icon_uri.as_ref() { - os.write_bytes(7, v)?; - } - if let Some(v) = self.additional_metadata_uri.as_ref() { - os.write_bytes(8, v)?; - } - if let Some(v) = self.media_uri.as_ref() { - os.write_bytes(9, v)?; - } - if let Some(v) = self.media_hash.as_ref() { - os.write_bytes(10, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerIssueNftTxOutput { - MintlayerIssueNftTxOutput::new() - } - - fn clear(&mut self) { - self.token_id = ::std::option::Option::None; - self.destination = ::std::option::Option::None; - self.creator = ::std::option::Option::None; - self.name = ::std::option::Option::None; - self.description = ::std::option::Option::None; - self.ticker = ::std::option::Option::None; - self.icon_uri = ::std::option::Option::None; - self.additional_metadata_uri = ::std::option::Option::None; - self.media_uri = ::std::option::Option::None; - self.media_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerIssueNftTxOutput { - static instance: MintlayerIssueNftTxOutput = MintlayerIssueNftTxOutput { - token_id: ::std::option::Option::None, - destination: ::std::option::Option::None, - creator: ::std::option::Option::None, - name: ::std::option::Option::None, - description: ::std::option::Option::None, - ticker: ::std::option::Option::None, - icon_uri: ::std::option::Option::None, - additional_metadata_uri: ::std::option::Option::None, - media_uri: ::std::option::Option::None, - media_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerIssueNftTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerIssueNftTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerIssueNftTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerIssueNftTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerDataDepositTxOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerDataDepositTxOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerDataDepositTxOutput.data) - pub data: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerDataDepositTxOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerDataDepositTxOutput { - fn default() -> &'a MintlayerDataDepositTxOutput { - ::default_instance() - } -} - -impl MintlayerDataDepositTxOutput { - pub fn new() -> MintlayerDataDepositTxOutput { - ::std::default::Default::default() - } - - // required bytes data = 1; - - pub fn data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data", - |m: &MintlayerDataDepositTxOutput| { &m.data }, - |m: &mut MintlayerDataDepositTxOutput| { &mut m.data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerDataDepositTxOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerDataDepositTxOutput { - const NAME: &'static str = "MintlayerDataDepositTxOutput"; - - fn is_initialized(&self) -> bool { - if self.data.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.data = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerDataDepositTxOutput { - MintlayerDataDepositTxOutput::new() - } - - fn clear(&mut self) { - self.data = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerDataDepositTxOutput { - static instance: MintlayerDataDepositTxOutput = MintlayerDataDepositTxOutput { - data: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerDataDepositTxOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerDataDepositTxOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerDataDepositTxOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerDataDepositTxOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerPrevTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.inputs_count) - pub inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.outputs_count) - pub outputs_count: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerPrevTx { - fn default() -> &'a MintlayerPrevTx { - ::default_instance() - } -} - -impl MintlayerPrevTx { - pub fn new() -> MintlayerPrevTx { - ::std::default::Default::default() - } - - // required uint32 version = 1; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(0) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // required uint32 inputs_count = 6; - - pub fn inputs_count(&self) -> u32 { - self.inputs_count.unwrap_or(0) - } - - pub fn clear_inputs_count(&mut self) { - self.inputs_count = ::std::option::Option::None; - } - - pub fn has_inputs_count(&self) -> bool { - self.inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_inputs_count(&mut self, v: u32) { - self.inputs_count = ::std::option::Option::Some(v); - } - - // required uint32 outputs_count = 7; - - pub fn outputs_count(&self) -> u32 { - self.outputs_count.unwrap_or(0) - } - - pub fn clear_outputs_count(&mut self) { - self.outputs_count = ::std::option::Option::None; - } - - pub fn has_outputs_count(&self) -> bool { - self.outputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_outputs_count(&mut self, v: u32) { - self.outputs_count = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version", - |m: &MintlayerPrevTx| { &m.version }, - |m: &mut MintlayerPrevTx| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inputs_count", - |m: &MintlayerPrevTx| { &m.inputs_count }, - |m: &mut MintlayerPrevTx| { &mut m.inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "outputs_count", - |m: &MintlayerPrevTx| { &m.outputs_count }, - |m: &mut MintlayerPrevTx| { &mut m.outputs_count }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerPrevTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerPrevTx { - const NAME: &'static str = "MintlayerPrevTx"; - - fn is_initialized(&self) -> bool { - if self.version.is_none() { - return false; - } - if self.inputs_count.is_none() { - return false; - } - if self.outputs_count.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.inputs_count { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.outputs_count { - my_size += ::protobuf::rt::uint32_size(7, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.version { - os.write_uint32(1, v)?; - } - if let Some(v) = self.inputs_count { - os.write_uint32(6, v)?; - } - if let Some(v) = self.outputs_count { - os.write_uint32(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerPrevTx { - MintlayerPrevTx::new() - } - - fn clear(&mut self) { - self.version = ::std::option::Option::None; - self.inputs_count = ::std::option::Option::None; - self.outputs_count = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerPrevTx { - static instance: MintlayerPrevTx = MintlayerPrevTx { - version: ::std::option::Option::None, - inputs_count: ::std::option::Option::None, - outputs_count: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerPrevTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerPrevTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerPrevTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerPrevInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevInput.prev_index) - pub prev_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerPrevInput { - fn default() -> &'a MintlayerPrevInput { - ::default_instance() - } -} - -impl MintlayerPrevInput { - pub fn new() -> MintlayerPrevInput { - ::std::default::Default::default() - } - - // required bytes prev_hash = 2; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 3; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &MintlayerPrevInput| { &m.prev_hash }, - |m: &mut MintlayerPrevInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &MintlayerPrevInput| { &m.prev_index }, - |m: &mut MintlayerPrevInput| { &mut m.prev_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerPrevInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerPrevInput { - const NAME: &'static str = "MintlayerPrevInput"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerPrevInput { - MintlayerPrevInput::new() - } - - fn clear(&mut self) { - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerPrevInput { - static instance: MintlayerPrevInput = MintlayerPrevInput { - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerPrevInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerPrevInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerPrevInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerPrevTransferOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.value) - pub value: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerPrevTransferOutput { - fn default() -> &'a MintlayerPrevTransferOutput { - ::default_instance() - } -} - -impl MintlayerPrevTransferOutput { - pub fn new() -> MintlayerPrevTransferOutput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerPrevTransferOutput| { &m.value }, - |m: &mut MintlayerPrevTransferOutput| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerPrevTransferOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerPrevTransferOutput { - const NAME: &'static str = "MintlayerPrevTransferOutput"; - - fn is_initialized(&self) -> bool { - if self.value.is_none() { - return false; - } - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerPrevTransferOutput { - MintlayerPrevTransferOutput::new() - } - - fn clear(&mut self) { - self.value.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerPrevTransferOutput { - static instance: MintlayerPrevTransferOutput = MintlayerPrevTransferOutput { - value: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerPrevTransferOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevTransferOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerPrevTransferOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerPrevTransferOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTxAckUtxoInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTxAckUtxoInput { - fn default() -> &'a MintlayerTxAckUtxoInput { - ::default_instance() - } -} - -impl MintlayerTxAckUtxoInput { - pub fn new() -> MintlayerTxAckUtxoInput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper>( - "tx", - |m: &MintlayerTxAckUtxoInput| { &m.tx }, - |m: &mut MintlayerTxAckUtxoInput| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxAckUtxoInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTxAckUtxoInput { - const NAME: &'static str = "MintlayerTxAckUtxoInput"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxAckUtxoInput { - MintlayerTxAckUtxoInput::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxAckUtxoInput { - static instance: MintlayerTxAckUtxoInput = MintlayerTxAckUtxoInput { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerTxAckUtxoInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxAckUtxoInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerTxAckUtxoInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckUtxoInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MintlayerTxAckUtxoInput` -pub mod mintlayer_tx_ack_utxo_input { - // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MintlayerTxAckInputWrapper { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper.input) - pub input: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MintlayerTxAckInputWrapper { - fn default() -> &'a MintlayerTxAckInputWrapper { - ::default_instance() - } - } - - impl MintlayerTxAckInputWrapper { - pub fn new() -> MintlayerTxAckInputWrapper { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerTxInput>( - "input", - |m: &MintlayerTxAckInputWrapper| { &m.input }, - |m: &mut MintlayerTxAckInputWrapper| { &mut m.input }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MintlayerTxAckInputWrapper { - const NAME: &'static str = "MintlayerTxAckInputWrapper"; - - fn is_initialized(&self) -> bool { - if self.input.is_none() { - return false; - } - for v in &self.input { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.input)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.input.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.input.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxAckInputWrapper { - MintlayerTxAckInputWrapper::new() - } - - fn clear(&mut self) { - self.input.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxAckInputWrapper { - static instance: MintlayerTxAckInputWrapper = MintlayerTxAckInputWrapper { - input: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MintlayerTxAckInputWrapper { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapper").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MintlayerTxAckInputWrapper { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckInputWrapper { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTxAckOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTxAckOutput { - fn default() -> &'a MintlayerTxAckOutput { - ::default_instance() - } -} - -impl MintlayerTxAckOutput { - pub fn new() -> MintlayerTxAckOutput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper>( - "tx", - |m: &MintlayerTxAckOutput| { &m.tx }, - |m: &mut MintlayerTxAckOutput| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxAckOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTxAckOutput { - const NAME: &'static str = "MintlayerTxAckOutput"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxAckOutput { - MintlayerTxAckOutput::new() - } - - fn clear(&mut self) { - self.tx.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxAckOutput { - static instance: MintlayerTxAckOutput = MintlayerTxAckOutput { - tx: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerTxAckOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerTxAckOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerTxAckOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MintlayerTxAckOutput` -pub mod mintlayer_tx_ack_output { - // @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MintlayerTxAckOutputWrapper { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper.output) - pub output: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapper.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MintlayerTxAckOutputWrapper { - fn default() -> &'a MintlayerTxAckOutputWrapper { - ::default_instance() - } - } - - impl MintlayerTxAckOutputWrapper { - pub fn new() -> MintlayerTxAckOutputWrapper { - ::std::default::Default::default() - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MintlayerTxOutput>( - "output", - |m: &MintlayerTxAckOutputWrapper| { &m.output }, - |m: &mut MintlayerTxAckOutputWrapper| { &mut m.output }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxAckOutput.MintlayerTxAckOutputWrapper", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MintlayerTxAckOutputWrapper { - const NAME: &'static str = "MintlayerTxAckOutputWrapper"; - - fn is_initialized(&self) -> bool { - if self.output.is_none() { - return false; - } - for v in &self.output { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.output)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.output.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.output.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxAckOutputWrapper { - MintlayerTxAckOutputWrapper::new() - } - - fn clear(&mut self) { - self.output.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerTxAckOutputWrapper { - static instance: MintlayerTxAckOutputWrapper = MintlayerTxAckOutputWrapper { - output: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MintlayerTxAckOutputWrapper { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MintlayerTxAckOutput.MintlayerTxAckOutputWrapper").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MintlayerTxAckOutputWrapper { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MintlayerTxAckOutputWrapper { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.mintlayer.MintlayerUtxoType) -pub enum MintlayerUtxoType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerUtxoType.TRANSACTION) - TRANSACTION = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerUtxoType.BLOCK) - BLOCK = 1, -} - -impl ::protobuf::Enum for MintlayerUtxoType { - const NAME: &'static str = "MintlayerUtxoType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(MintlayerUtxoType::TRANSACTION), - 1 => ::std::option::Option::Some(MintlayerUtxoType::BLOCK), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "TRANSACTION" => ::std::option::Option::Some(MintlayerUtxoType::TRANSACTION), - "BLOCK" => ::std::option::Option::Some(MintlayerUtxoType::BLOCK), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [MintlayerUtxoType] = &[ - MintlayerUtxoType::TRANSACTION, - MintlayerUtxoType::BLOCK, - ]; -} - -impl ::protobuf::EnumFull for MintlayerUtxoType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("MintlayerUtxoType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for MintlayerUtxoType { - fn default() -> Self { - MintlayerUtxoType::TRANSACTION - } -} - -impl MintlayerUtxoType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MintlayerUtxoType") - } -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType) -pub enum MintlayerTokenTotalSupplyType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType.FIXED) - FIXED = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType.LOCKABLE) - LOCKABLE = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyType.UNLIMITED) - UNLIMITED = 2, -} - -impl ::protobuf::Enum for MintlayerTokenTotalSupplyType { - const NAME: &'static str = "MintlayerTokenTotalSupplyType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::FIXED), - 1 => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::LOCKABLE), - 2 => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::UNLIMITED), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "FIXED" => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::FIXED), - "LOCKABLE" => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::LOCKABLE), - "UNLIMITED" => ::std::option::Option::Some(MintlayerTokenTotalSupplyType::UNLIMITED), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [MintlayerTokenTotalSupplyType] = &[ - MintlayerTokenTotalSupplyType::FIXED, - MintlayerTokenTotalSupplyType::LOCKABLE, - MintlayerTokenTotalSupplyType::UNLIMITED, - ]; -} - -impl ::protobuf::EnumFull for MintlayerTokenTotalSupplyType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("MintlayerTokenTotalSupplyType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for MintlayerTokenTotalSupplyType { - fn default() -> Self { - MintlayerTokenTotalSupplyType::FIXED - } -} - -impl MintlayerTokenTotalSupplyType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MintlayerTokenTotalSupplyType") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x18messages-mintlayer.proto\x12\x1chw.trezor.messages.mintlayer\"q\n\ - \x13MintlayerGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addr\ - essN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\ - \n\x08chunkify\x18\x03\x20\x01(\x08R\x08chunkify\",\n\x10MintlayerAddres\ - s\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"W\n\x15MintlayerG\ - etPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ - \x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"R\n\x12MintlayerP\ - ublicKey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\x12\x1d\ - \n\nchain_code\x18\x02\x20\x02(\x0cR\tchainCode\"g\n\x14MintlayerSignMes\ - sage\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07a\ - ddress\x18\x02\x20\x02(\tR\x07address\x12\x18\n\x07message\x18\x03\x20\ - \x02(\x0cR\x07message\"\xb6\x01\n\x0fMintlayerSignTx\x12#\n\routputs_cou\ - nt\x18\x01\x20\x02(\rR\x0coutputsCount\x12!\n\x0cinputs_count\x18\x02\ - \x20\x02(\rR\x0binputsCount\x12\x1b\n\x07version\x18\x03\x20\x01(\r:\x01\ - 1R\x07version\x12\"\n\tserialize\x18\x04\x20\x01(\x08:\x04trueR\tseriali\ - ze\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\xb8\x06\n\ - \x12MintlayerTxRequest\x12h\n\x0crequest_type\x18\x01\x20\x01(\x0e2E.hw.\ - trezor.messages.mintlayer.MintlayerTxRequest.MintlayerRequestTypeR\x0bre\ - questType\x12h\n\x07details\x18\x02\x20\x01(\x0b2N.hw.trezor.messages.mi\ - ntlayer.MintlayerTxRequest.MintlayerTxRequestDetailsTypeR\x07details\x12\ - q\n\nserialized\x18\x03\x20\x03(\x0b2Q.hw.trezor.messages.mintlayer.Mint\ - layerTxRequest.MintlayerTxRequestSerializedTypeR\nserialized\x1a]\n\x1dM\ - intlayerTxRequestDetailsType\x12#\n\rrequest_index\x18\x01\x20\x01(\rR\ - \x0crequestIndex\x12\x17\n\x07tx_hash\x18\x02\x20\x01(\x0cR\x06txHash\ - \x1aU\n\x12MintlayerSignature\x12\x1c\n\tsignature\x18\x01\x20\x02(\x0cR\ - \tsignature\x12!\n\x0cmultisig_idx\x18\x02\x20\x01(\rR\x0bmultisigIdx\ - \x1a\xd5\x01\n\x20MintlayerTxRequestSerializedType\x12'\n\x0fsignature_i\ - ndex\x18\x01\x20\x01(\rR\x0esignatureIndex\x12c\n\nsignatures\x18\x02\ - \x20\x03(\x0b2C.hw.trezor.messages.mintlayer.MintlayerTxRequest.Mintlaye\ - rSignatureR\nsignatures\x12#\n\rserialized_tx\x18\x03\x20\x01(\x0cR\x0cs\ - erializedTx\"M\n\x14MintlayerRequestType\x12\x0b\n\x07TXINPUT\x10\0\x12\ - \x0c\n\x08TXOUTPUT\x10\x01\x12\n\n\x06TXMETA\x10\x02\x12\x0e\n\nTXFINISH\ - ED\x10\x03\"\x92\x02\n\x10MintlayerTxInput\x12F\n\x04utxo\x18\x01\x20\ - \x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerUtxoTxInputR\x04utxo\ - \x12O\n\x07account\x18\x02\x20\x01(\x0b25.hw.trezor.messages.mintlayer.M\ - intlayerAccountTxInputR\x07account\x12e\n\x0faccount_command\x18\x03\x20\ - \x01(\x0b2<.hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInputR\ - \x0eaccountCommand\"V\n\x14MintlayerAddressPath\x12\x1b\n\taddress_n\x18\ - \x01\x20\x03(\rR\x08addressN\x12!\n\x0cmultisig_idx\x18\x02\x20\x01(\rR\ - \x0bmultisigIdx\"\xf4\x02\n\x14MintlayerUtxoTxInput\x12O\n\taddress_n\ - \x18\x01\x20\x03(\x0b22.hw.trezor.messages.mintlayer.MintlayerAddressPat\ - hR\x08addressN\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07address\x12\ - \x1b\n\tprev_hash\x18\x03\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_inde\ - x\x18\x04\x20\x02(\rR\tprevIndex\x12C\n\x04type\x18\x05\x20\x02(\x0e2/.h\ - w.trezor.messages.mintlayer.MintlayerUtxoTypeR\x04type\x12&\n\x08sequenc\ - e\x18\x06\x20\x01(\r:\n4294967295R\x08sequence\x12H\n\x05value\x18\x07\ - \x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05va\ - lue\"\xb1\x02\n\x17MintlayerAccountTxInput\x12O\n\taddress_n\x18\x01\x20\ - \x03(\x0b22.hw.trezor.messages.mintlayer.MintlayerAddressPathR\x08addres\ - sN\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07address\x12&\n\x08sequenc\ - e\x18\x03\x20\x01(\r:\n4294967295R\x08sequence\x12H\n\x05value\x18\x04\ - \x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05va\ - lue\x12\x14\n\x05nonce\x18\x05\x20\x02(\x04R\x05nonce\x12#\n\rdelegation\ - _id\x18\x06\x20\x02(\x0cR\x0cdelegationId\"\xe8\x05\n\x1eMintlayerAccoun\ - tCommandTxInput\x12O\n\taddress_n\x18\x01\x20\x03(\x0b22.hw.trezor.messa\ - ges.mintlayer.MintlayerAddressPathR\x08addressN\x12\x18\n\x07address\x18\ - \x02\x20\x02(\tR\x07address\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n4294\ - 967295R\x08sequence\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\ - \x12E\n\x04mint\x18\x05\x20\x01(\x0b21.hw.trezor.messages.mintlayer.Mint\ - layerMintTokensR\x04mint\x12K\n\x06unmint\x18\x06\x20\x01(\x0b23.hw.trez\ - or.messages.mintlayer.MintlayerUnmintTokensR\x06unmint\x12b\n\x11lock_to\ - ken_supply\x18\x07\x20\x01(\x0b26.hw.trezor.messages.mintlayer.Mintlayer\ - LockTokenSupplyR\x0flockTokenSupply\x12U\n\x0cfreeze_token\x18\x08\x20\ - \x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerFreezeTokenR\x0bfreeze\ - Token\x12[\n\x0eunfreeze_token\x18\t\x20\x01(\x0b24.hw.trezor.messages.m\ - intlayer.MintlayerUnfreezeTokenR\runfreezeToken\x12q\n\x16change_token_a\ - uthority\x18\n\x20\x01(\x0b2;.hw.trezor.messages.mintlayer.MintlayerChan\ - geTokenAuhtorityR\x14changeTokenAuthority\"H\n\x13MintlayerMintTokens\ - \x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x16\n\x06amo\ - unt\x18\x02\x20\x02(\x0cR\x06amount\"2\n\x15MintlayerUnmintTokens\x12\ - \x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\"5\n\x18MintlayerLoc\ - kTokenSupply\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\"a\n\ - \x14MintlayerFreezeToken\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07\ - tokenId\x12.\n\x13is_token_unfreezabe\x18\x02\x20\x02(\x08R\x11isTokenUn\ - freezabe\"3\n\x16MintlayerUnfreezeToken\x12\x19\n\x08token_id\x18\x01\ - \x20\x02(\x0cR\x07tokenId\"\\\n\x1dMintlayerChangeTokenAuhtority\x12\x19\ - \n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x20\n\x0bdestination\ - \x18\x02\x20\x02(\tR\x0bdestination\"\x95\x08\n\x11MintlayerTxOutput\x12\ - S\n\x08transfer\x18\x01\x20\x01(\x0b27.hw.trezor.messages.mintlayer.Mint\ - layerTransferTxOutputR\x08transfer\x12m\n\x12lock_then_transfer\x18\x02\ - \x20\x01(\x0b2?.hw.trezor.messages.mintlayer.MintlayerLockThenTransferTx\ - OutputR\x10lockThenTransfer\x12G\n\x04burn\x18\x03\x20\x01(\x0b23.hw.tre\ - zor.messages.mintlayer.MintlayerBurnTxOutputR\x04burn\x12j\n\x11create_s\ - take_pool\x18\x04\x20\x01(\x0b2>.hw.trezor.messages.mintlayer.MintlayerC\ - reateStakePoolTxOutputR\x0fcreateStakePool\x12}\n\x18produce_block_from_\ - stake\x18\x05\x20\x01(\x0b2D.hw.trezor.messages.mintlayer.MintlayerProdu\ - ceBlockFromStakeTxOutputR\x15produceBlockFromStake\x12s\n\x14create_dele\ - gation_id\x18\x06\x20\x01(\x0b2A.hw.trezor.messages.mintlayer.MintlayerC\ - reateDelegationIdTxOutputR\x12createDelegationId\x12i\n\x10delegate_stak\ - ing\x18\x07\x20\x01(\x0b2>.hw.trezor.messages.mintlayer.MintlayerDelegat\ - eStakingTxOutputR\x0fdelegateStaking\x12s\n\x14issue_fungible_token\x18\ - \x08\x20\x01(\x0b2A.hw.trezor.messages.mintlayer.MintlayerIssueFungibleT\ - okenTxOutputR\x12issueFungibleToken\x12T\n\tissue_nft\x18\t\x20\x01(\x0b\ - 27.hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutputR\x08issueNft\ - \x12]\n\x0cdata_deposit\x18\n\x20\x01(\x0b2:.hw.trezor.messages.mintlaye\ - r.MintlayerDataDepositTxOutputR\x0bdataDeposit\"I\n\x14MintlayerOutputVa\ - lue\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\x06amount\x12\x19\n\x08tok\ - en_id\x18\x02\x20\x01(\x0cR\x07tokenId\"\x7f\n\x19MintlayerTransferTxOut\ - put\x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x12H\n\x05value\ - \x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValu\ - eR\x05value\"\xa4\x01\n\x17MintlayerOutputTimeLock\x12!\n\x0cuntil_heigh\ - t\x18\x01\x20\x01(\x04R\x0buntilHeight\x12\x1d\n\nuntil_time\x18\x02\x20\ - \x01(\x04R\tuntilTime\x12&\n\x0ffor_block_count\x18\x03\x20\x01(\x04R\rf\ - orBlockCount\x12\x1f\n\x0bfor_seconds\x18\x04\x20\x01(\x04R\nforSeconds\ - \"\xd2\x01\n!MintlayerLockThenTransferTxOutput\x12\x18\n\x07address\x18\ - \x01\x20\x01(\tR\x07address\x12H\n\x05value\x18\x02\x20\x02(\x0b22.hw.tr\ - ezor.messages.mintlayer.MintlayerOutputValueR\x05value\x12I\n\x04lock\ - \x18\x03\x20\x02(\x0b25.hw.trezor.messages.mintlayer.MintlayerOutputTime\ - LockR\x04lock\"a\n\x15MintlayerBurnTxOutput\x12H\n\x05value\x18\x01\x20\ - \x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05value\ - \"\x9d\x02\n\x20MintlayerCreateStakePoolTxOutput\x12\x17\n\x07pool_id\ - \x18\x01\x20\x02(\x0cR\x06poolId\x12\x16\n\x06pledge\x18\x02\x20\x02(\ - \x0cR\x06pledge\x12\x16\n\x06staker\x18\x03\x20\x02(\tR\x06staker\x12$\n\ - \x0evrf_public_key\x18\x04\x20\x02(\tR\x0cvrfPublicKey\x12)\n\x10decommi\ - ssion_key\x18\x05\x20\x02(\tR\x0fdecommissionKey\x129\n\x19margin_ratio_\ - per_thousand\x18\x06\x20\x02(\rR\x16marginRatioPerThousand\x12$\n\x0ecos\ - t_per_block\x18\x07\x20\x02(\x0cR\x0ccostPerBlock\"c\n&MintlayerProduceB\ - lockFromStakeTxOutput\x12\x20\n\x0bdestination\x18\x01\x20\x02(\tR\x0bde\ - stination\x12\x17\n\x07pool_id\x18\x02\x20\x02(\x0cR\x06poolId\"`\n#Mint\ - layerCreateDelegationIdTxOutput\x12\x20\n\x0bdestination\x18\x01\x20\x02\ - (\tR\x0bdestination\x12\x17\n\x07pool_id\x18\x02\x20\x02(\x0cR\x06poolId\ - \"_\n\x20MintlayerDelegateStakingTxOutput\x12\x16\n\x06amount\x18\x01\ - \x20\x02(\x0cR\x06amount\x12#\n\rdelegation_id\x18\x02\x20\x02(\x0cR\x0c\ - delegationId\"\x8f\x01\n\x19MintlayerTokenTotalSupply\x12O\n\x04type\x18\ - \x01\x20\x02(\x0e2;.hw.trezor.messages.mintlayer.MintlayerTokenTotalSupp\ - lyTypeR\x04type\x12!\n\x0cfixed_amount\x18\x02\x20\x01(\x0cR\x0bfixedAmo\ - unt\"\xb6\x02\n#MintlayerIssueFungibleTokenTxOutput\x12!\n\x0ctoken_tick\ - er\x18\x01\x20\x02(\x0cR\x0btokenTicker\x12,\n\x12number_of_decimals\x18\ - \x02\x20\x02(\rR\x10numberOfDecimals\x12!\n\x0cmetadata_uri\x18\x03\x20\ - \x02(\x0cR\x0bmetadataUri\x12Z\n\x0ctotal_supply\x18\x04\x20\x02(\x0b27.\ - hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyR\x0btotalSupply\ - \x12\x1c\n\tauthority\x18\x05\x20\x02(\tR\tauthority\x12!\n\x0cis_freeza\ - ble\x18\x06\x20\x02(\x08R\x0bisFreezable\"\xcf\x02\n\x19MintlayerIssueNf\ - tTxOutput\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x20\ - \n\x0bdestination\x18\x02\x20\x02(\tR\x0bdestination\x12\x18\n\x07creato\ - r\x18\x03\x20\x01(\tR\x07creator\x12\x12\n\x04name\x18\x04\x20\x02(\x0cR\ - \x04name\x12\x20\n\x0bdescription\x18\x05\x20\x02(\x0cR\x0bdescription\ - \x12\x16\n\x06ticker\x18\x06\x20\x02(\x0cR\x06ticker\x12\x19\n\x08icon_u\ - ri\x18\x07\x20\x01(\x0cR\x07iconUri\x126\n\x17additional_metadata_uri\ - \x18\x08\x20\x01(\x0cR\x15additionalMetadataUri\x12\x1b\n\tmedia_uri\x18\ - \t\x20\x01(\x0cR\x08mediaUri\x12\x1d\n\nmedia_hash\x18\n\x20\x02(\x0cR\t\ - mediaHash\"2\n\x1cMintlayerDataDepositTxOutput\x12\x12\n\x04data\x18\x01\ - \x20\x02(\x0cR\x04data\"s\n\x0fMintlayerPrevTx\x12\x18\n\x07version\x18\ - \x01\x20\x02(\rR\x07version\x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\ - \x0binputsCount\x12#\n\routputs_count\x18\x07\x20\x02(\rR\x0coutputsCoun\ - t\"b\n\x12MintlayerPrevInput\x12\x1b\n\tprev_hash\x18\x02\x20\x02(\x0cR\ - \x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIndexJ\x04\ - \x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06\"g\n\x1bMintl\ - ayerPrevTransferOutput\x12H\n\x05value\x18\x01\x20\x02(\x0b22.hw.trezor.\ - messages.mintlayer.MintlayerOutputValueR\x05value\"\xdf\x01\n\x17Mintlay\ - erTxAckUtxoInput\x12`\n\x02tx\x18\x01\x20\x02(\x0b2P.hw.trezor.messages.\ - mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapperR\x02tx\x1ab\ - \n\x1aMintlayerTxAckInputWrapper\x12D\n\x05input\x18\x02\x20\x02(\x0b2..\ - hw.trezor.messages.mintlayer.MintlayerTxInputR\x05input\"\xde\x01\n\x14M\ - intlayerTxAckOutput\x12^\n\x02tx\x18\x01\x20\x02(\x0b2N.hw.trezor.messag\ - es.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapperR\x02tx\x1a\ - f\n\x1bMintlayerTxAckOutputWrapper\x12G\n\x06output\x18\x05\x20\x02(\x0b\ - 2/.hw.trezor.messages.mintlayer.MintlayerTxOutputR\x06output*/\n\x11Mint\ - layerUtxoType\x12\x0f\n\x0bTRANSACTION\x10\0\x12\t\n\x05BLOCK\x10\x01*G\ - \n\x1dMintlayerTokenTotalSupplyType\x12\t\n\x05FIXED\x10\0\x12\x0c\n\x08\ - LOCKABLE\x10\x01\x12\r\n\tUNLIMITED\x10\x02B=\n#com.satoshilabs.trezor.l\ - ib.protobufB\x16TrezorMessageMintlayer\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(42); - messages.push(MintlayerGetAddress::generated_message_descriptor_data()); - messages.push(MintlayerAddress::generated_message_descriptor_data()); - messages.push(MintlayerGetPublicKey::generated_message_descriptor_data()); - messages.push(MintlayerPublicKey::generated_message_descriptor_data()); - messages.push(MintlayerSignMessage::generated_message_descriptor_data()); - messages.push(MintlayerSignTx::generated_message_descriptor_data()); - messages.push(MintlayerTxRequest::generated_message_descriptor_data()); - messages.push(MintlayerTxInput::generated_message_descriptor_data()); - messages.push(MintlayerAddressPath::generated_message_descriptor_data()); - messages.push(MintlayerUtxoTxInput::generated_message_descriptor_data()); - messages.push(MintlayerAccountTxInput::generated_message_descriptor_data()); - messages.push(MintlayerAccountCommandTxInput::generated_message_descriptor_data()); - messages.push(MintlayerMintTokens::generated_message_descriptor_data()); - messages.push(MintlayerUnmintTokens::generated_message_descriptor_data()); - messages.push(MintlayerLockTokenSupply::generated_message_descriptor_data()); - messages.push(MintlayerFreezeToken::generated_message_descriptor_data()); - messages.push(MintlayerUnfreezeToken::generated_message_descriptor_data()); - messages.push(MintlayerChangeTokenAuhtority::generated_message_descriptor_data()); - messages.push(MintlayerTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerOutputValue::generated_message_descriptor_data()); - messages.push(MintlayerTransferTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerOutputTimeLock::generated_message_descriptor_data()); - messages.push(MintlayerLockThenTransferTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerBurnTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerCreateStakePoolTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerProduceBlockFromStakeTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerCreateDelegationIdTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerDelegateStakingTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerTokenTotalSupply::generated_message_descriptor_data()); - messages.push(MintlayerIssueFungibleTokenTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerIssueNftTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerDataDepositTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerPrevTx::generated_message_descriptor_data()); - messages.push(MintlayerPrevInput::generated_message_descriptor_data()); - messages.push(MintlayerPrevTransferOutput::generated_message_descriptor_data()); - messages.push(MintlayerTxAckUtxoInput::generated_message_descriptor_data()); - messages.push(MintlayerTxAckOutput::generated_message_descriptor_data()); - messages.push(mintlayer_tx_request::MintlayerTxRequestDetailsType::generated_message_descriptor_data()); - messages.push(mintlayer_tx_request::MintlayerSignature::generated_message_descriptor_data()); - messages.push(mintlayer_tx_request::MintlayerTxRequestSerializedType::generated_message_descriptor_data()); - messages.push(mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper::generated_message_descriptor_data()); - messages.push(mintlayer_tx_ack_output::MintlayerTxAckOutputWrapper::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(3); - enums.push(MintlayerUtxoType::generated_enum_descriptor_data()); - enums.push(MintlayerTokenTotalSupplyType::generated_enum_descriptor_data()); - enums.push(mintlayer_tx_request::MintlayerRequestType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_monero.rs b/wallet/trezor-client/src/protos/generated/messages_monero.rs deleted file mode 100644 index e3827e178d..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_monero.rs +++ /dev/null @@ -1,12061 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-monero.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionSourceEntry { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.outputs) - pub outputs: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_output) - pub real_output: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_out_tx_key) - pub real_out_tx_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_out_additional_tx_keys) - pub real_out_additional_tx_keys: ::std::vec::Vec<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.real_output_in_tx_index) - pub real_output_in_tx_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.rct) - pub rct: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.mask) - pub mask: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.multisig_kLRki) - pub multisig_kLRki: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.subaddr_minor) - pub subaddr_minor: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionSourceEntry { - fn default() -> &'a MoneroTransactionSourceEntry { - ::default_instance() - } -} - -impl MoneroTransactionSourceEntry { - pub fn new() -> MoneroTransactionSourceEntry { - ::std::default::Default::default() - } - - // optional uint64 real_output = 2; - - pub fn real_output(&self) -> u64 { - self.real_output.unwrap_or(0) - } - - pub fn clear_real_output(&mut self) { - self.real_output = ::std::option::Option::None; - } - - pub fn has_real_output(&self) -> bool { - self.real_output.is_some() - } - - // Param is passed by value, moved - pub fn set_real_output(&mut self, v: u64) { - self.real_output = ::std::option::Option::Some(v); - } - - // optional bytes real_out_tx_key = 3; - - pub fn real_out_tx_key(&self) -> &[u8] { - match self.real_out_tx_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_real_out_tx_key(&mut self) { - self.real_out_tx_key = ::std::option::Option::None; - } - - pub fn has_real_out_tx_key(&self) -> bool { - self.real_out_tx_key.is_some() - } - - // Param is passed by value, moved - pub fn set_real_out_tx_key(&mut self, v: ::std::vec::Vec) { - self.real_out_tx_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_real_out_tx_key(&mut self) -> &mut ::std::vec::Vec { - if self.real_out_tx_key.is_none() { - self.real_out_tx_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.real_out_tx_key.as_mut().unwrap() - } - - // Take field - pub fn take_real_out_tx_key(&mut self) -> ::std::vec::Vec { - self.real_out_tx_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint64 real_output_in_tx_index = 5; - - pub fn real_output_in_tx_index(&self) -> u64 { - self.real_output_in_tx_index.unwrap_or(0) - } - - pub fn clear_real_output_in_tx_index(&mut self) { - self.real_output_in_tx_index = ::std::option::Option::None; - } - - pub fn has_real_output_in_tx_index(&self) -> bool { - self.real_output_in_tx_index.is_some() - } - - // Param is passed by value, moved - pub fn set_real_output_in_tx_index(&mut self, v: u64) { - self.real_output_in_tx_index = ::std::option::Option::Some(v); - } - - // optional uint64 amount = 6; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional bool rct = 7; - - pub fn rct(&self) -> bool { - self.rct.unwrap_or(false) - } - - pub fn clear_rct(&mut self) { - self.rct = ::std::option::Option::None; - } - - pub fn has_rct(&self) -> bool { - self.rct.is_some() - } - - // Param is passed by value, moved - pub fn set_rct(&mut self, v: bool) { - self.rct = ::std::option::Option::Some(v); - } - - // optional bytes mask = 8; - - pub fn mask(&self) -> &[u8] { - match self.mask.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mask(&mut self) { - self.mask = ::std::option::Option::None; - } - - pub fn has_mask(&self) -> bool { - self.mask.is_some() - } - - // Param is passed by value, moved - pub fn set_mask(&mut self, v: ::std::vec::Vec) { - self.mask = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mask(&mut self) -> &mut ::std::vec::Vec { - if self.mask.is_none() { - self.mask = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mask.as_mut().unwrap() - } - - // Take field - pub fn take_mask(&mut self) -> ::std::vec::Vec { - self.mask.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 subaddr_minor = 10; - - pub fn subaddr_minor(&self) -> u32 { - self.subaddr_minor.unwrap_or(0) - } - - pub fn clear_subaddr_minor(&mut self) { - self.subaddr_minor = ::std::option::Option::None; - } - - pub fn has_subaddr_minor(&self) -> bool { - self.subaddr_minor.is_some() - } - - // Param is passed by value, moved - pub fn set_subaddr_minor(&mut self, v: u32) { - self.subaddr_minor = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(10); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "outputs", - |m: &MoneroTransactionSourceEntry| { &m.outputs }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.outputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "real_output", - |m: &MoneroTransactionSourceEntry| { &m.real_output }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.real_output }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "real_out_tx_key", - |m: &MoneroTransactionSourceEntry| { &m.real_out_tx_key }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.real_out_tx_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "real_out_additional_tx_keys", - |m: &MoneroTransactionSourceEntry| { &m.real_out_additional_tx_keys }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.real_out_additional_tx_keys }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "real_output_in_tx_index", - |m: &MoneroTransactionSourceEntry| { &m.real_output_in_tx_index }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.real_output_in_tx_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MoneroTransactionSourceEntry| { &m.amount }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "rct", - |m: &MoneroTransactionSourceEntry| { &m.rct }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.rct }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mask", - |m: &MoneroTransactionSourceEntry| { &m.mask }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.mask }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_source_entry::MoneroMultisigKLRki>( - "multisig_kLRki", - |m: &MoneroTransactionSourceEntry| { &m.multisig_kLRki }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.multisig_kLRki }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "subaddr_minor", - |m: &MoneroTransactionSourceEntry| { &m.subaddr_minor }, - |m: &mut MoneroTransactionSourceEntry| { &mut m.subaddr_minor }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSourceEntry", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionSourceEntry { - const NAME: &'static str = "MoneroTransactionSourceEntry"; - - fn is_initialized(&self) -> bool { - for v in &self.outputs { - if !v.is_initialized() { - return false; - } - }; - for v in &self.multisig_kLRki { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.outputs.push(is.read_message()?); - }, - 16 => { - self.real_output = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - self.real_out_tx_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.real_out_additional_tx_keys.push(is.read_bytes()?); - }, - 40 => { - self.real_output_in_tx_index = ::std::option::Option::Some(is.read_uint64()?); - }, - 48 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 56 => { - self.rct = ::std::option::Option::Some(is.read_bool()?); - }, - 66 => { - self.mask = ::std::option::Option::Some(is.read_bytes()?); - }, - 74 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig_kLRki)?; - }, - 80 => { - self.subaddr_minor = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.outputs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.real_output { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.real_out_tx_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - for value in &self.real_out_additional_tx_keys { - my_size += ::protobuf::rt::bytes_size(4, &value); - }; - if let Some(v) = self.real_output_in_tx_index { - my_size += ::protobuf::rt::uint64_size(5, v); - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(6, v); - } - if let Some(v) = self.rct { - my_size += 1 + 1; - } - if let Some(v) = self.mask.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - if let Some(v) = self.multisig_kLRki.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.subaddr_minor { - my_size += ::protobuf::rt::uint32_size(10, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.outputs { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - if let Some(v) = self.real_output { - os.write_uint64(2, v)?; - } - if let Some(v) = self.real_out_tx_key.as_ref() { - os.write_bytes(3, v)?; - } - for v in &self.real_out_additional_tx_keys { - os.write_bytes(4, &v)?; - }; - if let Some(v) = self.real_output_in_tx_index { - os.write_uint64(5, v)?; - } - if let Some(v) = self.amount { - os.write_uint64(6, v)?; - } - if let Some(v) = self.rct { - os.write_bool(7, v)?; - } - if let Some(v) = self.mask.as_ref() { - os.write_bytes(8, v)?; - } - if let Some(v) = self.multisig_kLRki.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; - } - if let Some(v) = self.subaddr_minor { - os.write_uint32(10, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionSourceEntry { - MoneroTransactionSourceEntry::new() - } - - fn clear(&mut self) { - self.outputs.clear(); - self.real_output = ::std::option::Option::None; - self.real_out_tx_key = ::std::option::Option::None; - self.real_out_additional_tx_keys.clear(); - self.real_output_in_tx_index = ::std::option::Option::None; - self.amount = ::std::option::Option::None; - self.rct = ::std::option::Option::None; - self.mask = ::std::option::Option::None; - self.multisig_kLRki.clear(); - self.subaddr_minor = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionSourceEntry { - static instance: MoneroTransactionSourceEntry = MoneroTransactionSourceEntry { - outputs: ::std::vec::Vec::new(), - real_output: ::std::option::Option::None, - real_out_tx_key: ::std::option::Option::None, - real_out_additional_tx_keys: ::std::vec::Vec::new(), - real_output_in_tx_index: ::std::option::Option::None, - amount: ::std::option::Option::None, - rct: ::std::option::Option::None, - mask: ::std::option::Option::None, - multisig_kLRki: ::protobuf::MessageField::none(), - subaddr_minor: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionSourceEntry { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionSourceEntry { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSourceEntry { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MoneroTransactionSourceEntry` -pub mod monero_transaction_source_entry { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroOutputEntry { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.idx) - pub idx: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.key) - pub key: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroOutputEntry { - fn default() -> &'a MoneroOutputEntry { - ::default_instance() - } - } - - impl MoneroOutputEntry { - pub fn new() -> MoneroOutputEntry { - ::std::default::Default::default() - } - - // optional uint64 idx = 1; - - pub fn idx(&self) -> u64 { - self.idx.unwrap_or(0) - } - - pub fn clear_idx(&mut self) { - self.idx = ::std::option::Option::None; - } - - pub fn has_idx(&self) -> bool { - self.idx.is_some() - } - - // Param is passed by value, moved - pub fn set_idx(&mut self, v: u64) { - self.idx = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "idx", - |m: &MoneroOutputEntry| { &m.idx }, - |m: &mut MoneroOutputEntry| { &mut m.idx }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_output_entry::MoneroRctKeyPublic>( - "key", - |m: &MoneroOutputEntry| { &m.key }, - |m: &mut MoneroOutputEntry| { &mut m.key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSourceEntry.MoneroOutputEntry", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroOutputEntry { - const NAME: &'static str = "MoneroOutputEntry"; - - fn is_initialized(&self) -> bool { - for v in &self.key { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.idx = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.key)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.idx { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.key.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.idx { - os.write_uint64(1, v)?; - } - if let Some(v) = self.key.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroOutputEntry { - MoneroOutputEntry::new() - } - - fn clear(&mut self) { - self.idx = ::std::option::Option::None; - self.key.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroOutputEntry { - static instance: MoneroOutputEntry = MoneroOutputEntry { - idx: ::std::option::Option::None, - key: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroOutputEntry { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry.MoneroOutputEntry").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroOutputEntry { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroOutputEntry { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `MoneroOutputEntry` - pub mod monero_output_entry { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroRctKeyPublic { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic.dest) - pub dest: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic.commitment) - pub commitment: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroRctKeyPublic { - fn default() -> &'a MoneroRctKeyPublic { - ::default_instance() - } - } - - impl MoneroRctKeyPublic { - pub fn new() -> MoneroRctKeyPublic { - ::std::default::Default::default() - } - - // required bytes dest = 1; - - pub fn dest(&self) -> &[u8] { - match self.dest.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_dest(&mut self) { - self.dest = ::std::option::Option::None; - } - - pub fn has_dest(&self) -> bool { - self.dest.is_some() - } - - // Param is passed by value, moved - pub fn set_dest(&mut self, v: ::std::vec::Vec) { - self.dest = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_dest(&mut self) -> &mut ::std::vec::Vec { - if self.dest.is_none() { - self.dest = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.dest.as_mut().unwrap() - } - - // Take field - pub fn take_dest(&mut self) -> ::std::vec::Vec { - self.dest.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes commitment = 2; - - pub fn commitment(&self) -> &[u8] { - match self.commitment.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_commitment(&mut self) { - self.commitment = ::std::option::Option::None; - } - - pub fn has_commitment(&self) -> bool { - self.commitment.is_some() - } - - // Param is passed by value, moved - pub fn set_commitment(&mut self, v: ::std::vec::Vec) { - self.commitment = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_commitment(&mut self) -> &mut ::std::vec::Vec { - if self.commitment.is_none() { - self.commitment = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.commitment.as_mut().unwrap() - } - - // Take field - pub fn take_commitment(&mut self) -> ::std::vec::Vec { - self.commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "dest", - |m: &MoneroRctKeyPublic| { &m.dest }, - |m: &mut MoneroRctKeyPublic| { &mut m.dest }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "commitment", - |m: &MoneroRctKeyPublic| { &m.commitment }, - |m: &mut MoneroRctKeyPublic| { &mut m.commitment }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroRctKeyPublic { - const NAME: &'static str = "MoneroRctKeyPublic"; - - fn is_initialized(&self) -> bool { - if self.dest.is_none() { - return false; - } - if self.commitment.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.dest = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.commitment = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.dest.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.commitment.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.dest.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.commitment.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroRctKeyPublic { - MoneroRctKeyPublic::new() - } - - fn clear(&mut self) { - self.dest = ::std::option::Option::None; - self.commitment = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroRctKeyPublic { - static instance: MoneroRctKeyPublic = MoneroRctKeyPublic { - dest: ::std::option::Option::None, - commitment: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroRctKeyPublic { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublic").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroRctKeyPublic { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroRctKeyPublic { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - } - - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroMultisigKLRki { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.K) - pub K: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.L) - pub L: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.R) - pub R: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.ki) - pub ki: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRki.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroMultisigKLRki { - fn default() -> &'a MoneroMultisigKLRki { - ::default_instance() - } - } - - impl MoneroMultisigKLRki { - pub fn new() -> MoneroMultisigKLRki { - ::std::default::Default::default() - } - - // optional bytes K = 1; - - pub fn K(&self) -> &[u8] { - match self.K.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_K(&mut self) { - self.K = ::std::option::Option::None; - } - - pub fn has_K(&self) -> bool { - self.K.is_some() - } - - // Param is passed by value, moved - pub fn set_K(&mut self, v: ::std::vec::Vec) { - self.K = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_K(&mut self) -> &mut ::std::vec::Vec { - if self.K.is_none() { - self.K = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.K.as_mut().unwrap() - } - - // Take field - pub fn take_K(&mut self) -> ::std::vec::Vec { - self.K.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes L = 2; - - pub fn L(&self) -> &[u8] { - match self.L.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_L(&mut self) { - self.L = ::std::option::Option::None; - } - - pub fn has_L(&self) -> bool { - self.L.is_some() - } - - // Param is passed by value, moved - pub fn set_L(&mut self, v: ::std::vec::Vec) { - self.L = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_L(&mut self) -> &mut ::std::vec::Vec { - if self.L.is_none() { - self.L = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.L.as_mut().unwrap() - } - - // Take field - pub fn take_L(&mut self) -> ::std::vec::Vec { - self.L.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes R = 3; - - pub fn R(&self) -> &[u8] { - match self.R.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_R(&mut self) { - self.R = ::std::option::Option::None; - } - - pub fn has_R(&self) -> bool { - self.R.is_some() - } - - // Param is passed by value, moved - pub fn set_R(&mut self, v: ::std::vec::Vec) { - self.R = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_R(&mut self) -> &mut ::std::vec::Vec { - if self.R.is_none() { - self.R = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.R.as_mut().unwrap() - } - - // Take field - pub fn take_R(&mut self) -> ::std::vec::Vec { - self.R.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes ki = 4; - - pub fn ki(&self) -> &[u8] { - match self.ki.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ki(&mut self) { - self.ki = ::std::option::Option::None; - } - - pub fn has_ki(&self) -> bool { - self.ki.is_some() - } - - // Param is passed by value, moved - pub fn set_ki(&mut self, v: ::std::vec::Vec) { - self.ki = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ki(&mut self) -> &mut ::std::vec::Vec { - if self.ki.is_none() { - self.ki = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ki.as_mut().unwrap() - } - - // Take field - pub fn take_ki(&mut self) -> ::std::vec::Vec { - self.ki.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "K", - |m: &MoneroMultisigKLRki| { &m.K }, - |m: &mut MoneroMultisigKLRki| { &mut m.K }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "L", - |m: &MoneroMultisigKLRki| { &m.L }, - |m: &mut MoneroMultisigKLRki| { &mut m.L }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "R", - |m: &MoneroMultisigKLRki| { &m.R }, - |m: &mut MoneroMultisigKLRki| { &mut m.R }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ki", - |m: &MoneroMultisigKLRki| { &m.ki }, - |m: &mut MoneroMultisigKLRki| { &mut m.ki }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSourceEntry.MoneroMultisigKLRki", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroMultisigKLRki { - const NAME: &'static str = "MoneroMultisigKLRki"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.K = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.L = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.R = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.ki = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.K.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.L.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.R.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.ki.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.K.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.L.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.R.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.ki.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroMultisigKLRki { - MoneroMultisigKLRki::new() - } - - fn clear(&mut self) { - self.K = ::std::option::Option::None; - self.L = ::std::option::Option::None; - self.R = ::std::option::Option::None; - self.ki = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroMultisigKLRki { - static instance: MoneroMultisigKLRki = MoneroMultisigKLRki { - K: ::std::option::Option::None, - L: ::std::option::Option::None, - R: ::std::option::Option::None, - ki: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroMultisigKLRki { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionSourceEntry.MoneroMultisigKLRki").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroMultisigKLRki { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroMultisigKLRki { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionDestinationEntry) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionDestinationEntry { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.addr) - pub addr: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.is_subaddress) - pub is_subaddress: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.original) - pub original: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.is_integrated) - pub is_integrated: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionDestinationEntry { - fn default() -> &'a MoneroTransactionDestinationEntry { - ::default_instance() - } -} - -impl MoneroTransactionDestinationEntry { - pub fn new() -> MoneroTransactionDestinationEntry { - ::std::default::Default::default() - } - - // optional uint64 amount = 1; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional bool is_subaddress = 3; - - pub fn is_subaddress(&self) -> bool { - self.is_subaddress.unwrap_or(false) - } - - pub fn clear_is_subaddress(&mut self) { - self.is_subaddress = ::std::option::Option::None; - } - - pub fn has_is_subaddress(&self) -> bool { - self.is_subaddress.is_some() - } - - // Param is passed by value, moved - pub fn set_is_subaddress(&mut self, v: bool) { - self.is_subaddress = ::std::option::Option::Some(v); - } - - // optional bytes original = 4; - - pub fn original(&self) -> &[u8] { - match self.original.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_original(&mut self) { - self.original = ::std::option::Option::None; - } - - pub fn has_original(&self) -> bool { - self.original.is_some() - } - - // Param is passed by value, moved - pub fn set_original(&mut self, v: ::std::vec::Vec) { - self.original = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_original(&mut self) -> &mut ::std::vec::Vec { - if self.original.is_none() { - self.original = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.original.as_mut().unwrap() - } - - // Take field - pub fn take_original(&mut self) -> ::std::vec::Vec { - self.original.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool is_integrated = 5; - - pub fn is_integrated(&self) -> bool { - self.is_integrated.unwrap_or(false) - } - - pub fn clear_is_integrated(&mut self) { - self.is_integrated = ::std::option::Option::None; - } - - pub fn has_is_integrated(&self) -> bool { - self.is_integrated.is_some() - } - - // Param is passed by value, moved - pub fn set_is_integrated(&mut self, v: bool) { - self.is_integrated = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MoneroTransactionDestinationEntry| { &m.amount }, - |m: &mut MoneroTransactionDestinationEntry| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_destination_entry::MoneroAccountPublicAddress>( - "addr", - |m: &MoneroTransactionDestinationEntry| { &m.addr }, - |m: &mut MoneroTransactionDestinationEntry| { &mut m.addr }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "is_subaddress", - |m: &MoneroTransactionDestinationEntry| { &m.is_subaddress }, - |m: &mut MoneroTransactionDestinationEntry| { &mut m.is_subaddress }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "original", - |m: &MoneroTransactionDestinationEntry| { &m.original }, - |m: &mut MoneroTransactionDestinationEntry| { &mut m.original }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "is_integrated", - |m: &MoneroTransactionDestinationEntry| { &m.is_integrated }, - |m: &mut MoneroTransactionDestinationEntry| { &mut m.is_integrated }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionDestinationEntry", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionDestinationEntry { - const NAME: &'static str = "MoneroTransactionDestinationEntry"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.addr)?; - }, - 24 => { - self.is_subaddress = ::std::option::Option::Some(is.read_bool()?); - }, - 34 => { - self.original = ::std::option::Option::Some(is.read_bytes()?); - }, - 40 => { - self.is_integrated = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.addr.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.is_subaddress { - my_size += 1 + 1; - } - if let Some(v) = self.original.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.is_integrated { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount { - os.write_uint64(1, v)?; - } - if let Some(v) = self.addr.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.is_subaddress { - os.write_bool(3, v)?; - } - if let Some(v) = self.original.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.is_integrated { - os.write_bool(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionDestinationEntry { - MoneroTransactionDestinationEntry::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.addr.clear(); - self.is_subaddress = ::std::option::Option::None; - self.original = ::std::option::Option::None; - self.is_integrated = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionDestinationEntry { - static instance: MoneroTransactionDestinationEntry = MoneroTransactionDestinationEntry { - amount: ::std::option::Option::None, - addr: ::protobuf::MessageField::none(), - is_subaddress: ::std::option::Option::None, - original: ::std::option::Option::None, - is_integrated: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionDestinationEntry { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionDestinationEntry").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionDestinationEntry { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionDestinationEntry { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MoneroTransactionDestinationEntry` -pub mod monero_transaction_destination_entry { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroAccountPublicAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress.spend_public_key) - pub spend_public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress.view_public_key) - pub view_public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionDestinationEntry.MoneroAccountPublicAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroAccountPublicAddress { - fn default() -> &'a MoneroAccountPublicAddress { - ::default_instance() - } - } - - impl MoneroAccountPublicAddress { - pub fn new() -> MoneroAccountPublicAddress { - ::std::default::Default::default() - } - - // optional bytes spend_public_key = 1; - - pub fn spend_public_key(&self) -> &[u8] { - match self.spend_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_spend_public_key(&mut self) { - self.spend_public_key = ::std::option::Option::None; - } - - pub fn has_spend_public_key(&self) -> bool { - self.spend_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_spend_public_key(&mut self, v: ::std::vec::Vec) { - self.spend_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_spend_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.spend_public_key.is_none() { - self.spend_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.spend_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_spend_public_key(&mut self) -> ::std::vec::Vec { - self.spend_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes view_public_key = 2; - - pub fn view_public_key(&self) -> &[u8] { - match self.view_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_view_public_key(&mut self) { - self.view_public_key = ::std::option::Option::None; - } - - pub fn has_view_public_key(&self) -> bool { - self.view_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_view_public_key(&mut self, v: ::std::vec::Vec) { - self.view_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_view_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.view_public_key.is_none() { - self.view_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.view_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_view_public_key(&mut self) -> ::std::vec::Vec { - self.view_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "spend_public_key", - |m: &MoneroAccountPublicAddress| { &m.spend_public_key }, - |m: &mut MoneroAccountPublicAddress| { &mut m.spend_public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "view_public_key", - |m: &MoneroAccountPublicAddress| { &m.view_public_key }, - |m: &mut MoneroAccountPublicAddress| { &mut m.view_public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionDestinationEntry.MoneroAccountPublicAddress", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroAccountPublicAddress { - const NAME: &'static str = "MoneroAccountPublicAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.spend_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.view_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.spend_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.view_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.spend_public_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.view_public_key.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroAccountPublicAddress { - MoneroAccountPublicAddress::new() - } - - fn clear(&mut self) { - self.spend_public_key = ::std::option::Option::None; - self.view_public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroAccountPublicAddress { - static instance: MoneroAccountPublicAddress = MoneroAccountPublicAddress { - spend_public_key: ::std::option::Option::None, - view_public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroAccountPublicAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionDestinationEntry.MoneroAccountPublicAddress").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroAccountPublicAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroAccountPublicAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionRsigData) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionRsigData { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.rsig_type) - pub rsig_type: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.offload_type) - pub offload_type: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.grouping) - pub grouping: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.mask) - pub mask: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.rsig) - pub rsig: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.rsig_parts) - pub rsig_parts: ::std::vec::Vec<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionRsigData.bp_version) - pub bp_version: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionRsigData.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionRsigData { - fn default() -> &'a MoneroTransactionRsigData { - ::default_instance() - } -} - -impl MoneroTransactionRsigData { - pub fn new() -> MoneroTransactionRsigData { - ::std::default::Default::default() - } - - // optional uint32 rsig_type = 1; - - pub fn rsig_type(&self) -> u32 { - self.rsig_type.unwrap_or(0) - } - - pub fn clear_rsig_type(&mut self) { - self.rsig_type = ::std::option::Option::None; - } - - pub fn has_rsig_type(&self) -> bool { - self.rsig_type.is_some() - } - - // Param is passed by value, moved - pub fn set_rsig_type(&mut self, v: u32) { - self.rsig_type = ::std::option::Option::Some(v); - } - - // optional uint32 offload_type = 2; - - pub fn offload_type(&self) -> u32 { - self.offload_type.unwrap_or(0) - } - - pub fn clear_offload_type(&mut self) { - self.offload_type = ::std::option::Option::None; - } - - pub fn has_offload_type(&self) -> bool { - self.offload_type.is_some() - } - - // Param is passed by value, moved - pub fn set_offload_type(&mut self, v: u32) { - self.offload_type = ::std::option::Option::Some(v); - } - - // optional bytes mask = 4; - - pub fn mask(&self) -> &[u8] { - match self.mask.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_mask(&mut self) { - self.mask = ::std::option::Option::None; - } - - pub fn has_mask(&self) -> bool { - self.mask.is_some() - } - - // Param is passed by value, moved - pub fn set_mask(&mut self, v: ::std::vec::Vec) { - self.mask = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mask(&mut self) -> &mut ::std::vec::Vec { - if self.mask.is_none() { - self.mask = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.mask.as_mut().unwrap() - } - - // Take field - pub fn take_mask(&mut self) -> ::std::vec::Vec { - self.mask.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes rsig = 5; - - pub fn rsig(&self) -> &[u8] { - match self.rsig.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_rsig(&mut self) { - self.rsig = ::std::option::Option::None; - } - - pub fn has_rsig(&self) -> bool { - self.rsig.is_some() - } - - // Param is passed by value, moved - pub fn set_rsig(&mut self, v: ::std::vec::Vec) { - self.rsig = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_rsig(&mut self) -> &mut ::std::vec::Vec { - if self.rsig.is_none() { - self.rsig = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.rsig.as_mut().unwrap() - } - - // Take field - pub fn take_rsig(&mut self) -> ::std::vec::Vec { - self.rsig.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 bp_version = 7; - - pub fn bp_version(&self) -> u32 { - self.bp_version.unwrap_or(0) - } - - pub fn clear_bp_version(&mut self) { - self.bp_version = ::std::option::Option::None; - } - - pub fn has_bp_version(&self) -> bool { - self.bp_version.is_some() - } - - // Param is passed by value, moved - pub fn set_bp_version(&mut self, v: u32) { - self.bp_version = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "rsig_type", - |m: &MoneroTransactionRsigData| { &m.rsig_type }, - |m: &mut MoneroTransactionRsigData| { &mut m.rsig_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "offload_type", - |m: &MoneroTransactionRsigData| { &m.offload_type }, - |m: &mut MoneroTransactionRsigData| { &mut m.offload_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "grouping", - |m: &MoneroTransactionRsigData| { &m.grouping }, - |m: &mut MoneroTransactionRsigData| { &mut m.grouping }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mask", - |m: &MoneroTransactionRsigData| { &m.mask }, - |m: &mut MoneroTransactionRsigData| { &mut m.mask }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "rsig", - |m: &MoneroTransactionRsigData| { &m.rsig }, - |m: &mut MoneroTransactionRsigData| { &mut m.rsig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "rsig_parts", - |m: &MoneroTransactionRsigData| { &m.rsig_parts }, - |m: &mut MoneroTransactionRsigData| { &mut m.rsig_parts }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bp_version", - |m: &MoneroTransactionRsigData| { &m.bp_version }, - |m: &mut MoneroTransactionRsigData| { &mut m.bp_version }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionRsigData", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionRsigData { - const NAME: &'static str = "MoneroTransactionRsigData"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.rsig_type = ::std::option::Option::Some(is.read_uint32()?); - }, - 16 => { - self.offload_type = ::std::option::Option::Some(is.read_uint32()?); - }, - 26 => { - is.read_repeated_packed_uint64_into(&mut self.grouping)?; - }, - 24 => { - self.grouping.push(is.read_uint64()?); - }, - 34 => { - self.mask = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.rsig = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.rsig_parts.push(is.read_bytes()?); - }, - 56 => { - self.bp_version = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.rsig_type { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.offload_type { - my_size += ::protobuf::rt::uint32_size(2, v); - } - for value in &self.grouping { - my_size += ::protobuf::rt::uint64_size(3, *value); - }; - if let Some(v) = self.mask.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.rsig.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - for value in &self.rsig_parts { - my_size += ::protobuf::rt::bytes_size(6, &value); - }; - if let Some(v) = self.bp_version { - my_size += ::protobuf::rt::uint32_size(7, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.rsig_type { - os.write_uint32(1, v)?; - } - if let Some(v) = self.offload_type { - os.write_uint32(2, v)?; - } - for v in &self.grouping { - os.write_uint64(3, *v)?; - }; - if let Some(v) = self.mask.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.rsig.as_ref() { - os.write_bytes(5, v)?; - } - for v in &self.rsig_parts { - os.write_bytes(6, &v)?; - }; - if let Some(v) = self.bp_version { - os.write_uint32(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionRsigData { - MoneroTransactionRsigData::new() - } - - fn clear(&mut self) { - self.rsig_type = ::std::option::Option::None; - self.offload_type = ::std::option::Option::None; - self.grouping.clear(); - self.mask = ::std::option::Option::None; - self.rsig = ::std::option::Option::None; - self.rsig_parts.clear(); - self.bp_version = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionRsigData { - static instance: MoneroTransactionRsigData = MoneroTransactionRsigData { - rsig_type: ::std::option::Option::None, - offload_type: ::std::option::Option::None, - grouping: ::std::vec::Vec::new(), - mask: ::std::option::Option::None, - rsig: ::std::option::Option::None, - rsig_parts: ::std::vec::Vec::new(), - bp_version: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionRsigData { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionRsigData").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionRsigData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionRsigData { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.network_type) - pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.minor) - pub minor: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.payment_id) - pub payment_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroGetAddress { - fn default() -> &'a MoneroGetAddress { - ::default_instance() - } -} - -impl MoneroGetAddress { - pub fn new() -> MoneroGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 3; - - pub fn network_type(&self) -> MoneroNetworkType { - match self.network_type { - Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), - None => MoneroNetworkType::MAINNET, - } - } - - pub fn clear_network_type(&mut self) { - self.network_type = ::std::option::Option::None; - } - - pub fn has_network_type(&self) -> bool { - self.network_type.is_some() - } - - // Param is passed by value, moved - pub fn set_network_type(&mut self, v: MoneroNetworkType) { - self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint32 account = 4; - - pub fn account(&self) -> u32 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u32) { - self.account = ::std::option::Option::Some(v); - } - - // optional uint32 minor = 5; - - pub fn minor(&self) -> u32 { - self.minor.unwrap_or(0) - } - - pub fn clear_minor(&mut self) { - self.minor = ::std::option::Option::None; - } - - pub fn has_minor(&self) -> bool { - self.minor.is_some() - } - - // Param is passed by value, moved - pub fn set_minor(&mut self, v: u32) { - self.minor = ::std::option::Option::Some(v); - } - - // optional bytes payment_id = 6; - - pub fn payment_id(&self) -> &[u8] { - match self.payment_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_payment_id(&mut self) { - self.payment_id = ::std::option::Option::None; - } - - pub fn has_payment_id(&self) -> bool { - self.payment_id.is_some() - } - - // Param is passed by value, moved - pub fn set_payment_id(&mut self, v: ::std::vec::Vec) { - self.payment_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payment_id(&mut self) -> &mut ::std::vec::Vec { - if self.payment_id.is_none() { - self.payment_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.payment_id.as_mut().unwrap() - } - - // Take field - pub fn take_payment_id(&mut self) -> ::std::vec::Vec { - self.payment_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool chunkify = 7; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MoneroGetAddress| { &m.address_n }, - |m: &mut MoneroGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &MoneroGetAddress| { &m.show_display }, - |m: &mut MoneroGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_type", - |m: &MoneroGetAddress| { &m.network_type }, - |m: &mut MoneroGetAddress| { &mut m.network_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &MoneroGetAddress| { &m.account }, - |m: &mut MoneroGetAddress| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "minor", - |m: &MoneroGetAddress| { &m.minor }, - |m: &mut MoneroGetAddress| { &mut m.minor }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payment_id", - |m: &MoneroGetAddress| { &m.payment_id }, - |m: &mut MoneroGetAddress| { &mut m.payment_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &MoneroGetAddress| { &m.chunkify }, - |m: &mut MoneroGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroGetAddress { - const NAME: &'static str = "MoneroGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 32 => { - self.account = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.minor = ::std::option::Option::Some(is.read_uint32()?); - }, - 50 => { - self.payment_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 56 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.network_type { - my_size += ::protobuf::rt::int32_size(3, v.value()); - } - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.minor { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.payment_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.network_type { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.account { - os.write_uint32(4, v)?; - } - if let Some(v) = self.minor { - os.write_uint32(5, v)?; - } - if let Some(v) = self.payment_id.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroGetAddress { - MoneroGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.network_type = ::std::option::Option::None; - self.account = ::std::option::Option::None; - self.minor = ::std::option::Option::None; - self.payment_id = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroGetAddress { - static instance: MoneroGetAddress = MoneroGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - network_type: ::std::option::Option::None, - account: ::std::option::Option::None, - minor: ::std::option::Option::None, - payment_id: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroAddress.address) - pub address: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroAddress { - fn default() -> &'a MoneroAddress { - ::default_instance() - } -} - -impl MoneroAddress { - pub fn new() -> MoneroAddress { - ::std::default::Default::default() - } - - // optional bytes address = 1; - - pub fn address(&self) -> &[u8] { - match self.address.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::vec::Vec) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::vec::Vec { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::vec::Vec { - self.address.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MoneroAddress| { &m.address }, - |m: &mut MoneroAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroAddress { - const NAME: &'static str = "MoneroAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroAddress { - MoneroAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroAddress { - static instance: MoneroAddress = MoneroAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetWatchKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroGetWatchKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetWatchKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetWatchKey.network_type) - pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetWatchKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroGetWatchKey { - fn default() -> &'a MoneroGetWatchKey { - ::default_instance() - } -} - -impl MoneroGetWatchKey { - pub fn new() -> MoneroGetWatchKey { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 2; - - pub fn network_type(&self) -> MoneroNetworkType { - match self.network_type { - Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), - None => MoneroNetworkType::MAINNET, - } - } - - pub fn clear_network_type(&mut self) { - self.network_type = ::std::option::Option::None; - } - - pub fn has_network_type(&self) -> bool { - self.network_type.is_some() - } - - // Param is passed by value, moved - pub fn set_network_type(&mut self, v: MoneroNetworkType) { - self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MoneroGetWatchKey| { &m.address_n }, - |m: &mut MoneroGetWatchKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_type", - |m: &MoneroGetWatchKey| { &m.network_type }, - |m: &mut MoneroGetWatchKey| { &mut m.network_type }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroGetWatchKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroGetWatchKey { - const NAME: &'static str = "MoneroGetWatchKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.network_type { - my_size += ::protobuf::rt::int32_size(2, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.network_type { - os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroGetWatchKey { - MoneroGetWatchKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.network_type = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroGetWatchKey { - static instance: MoneroGetWatchKey = MoneroGetWatchKey { - address_n: ::std::vec::Vec::new(), - network_type: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroGetWatchKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetWatchKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroGetWatchKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroGetWatchKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroWatchKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroWatchKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroWatchKey.watch_key) - pub watch_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroWatchKey.address) - pub address: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroWatchKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroWatchKey { - fn default() -> &'a MoneroWatchKey { - ::default_instance() - } -} - -impl MoneroWatchKey { - pub fn new() -> MoneroWatchKey { - ::std::default::Default::default() - } - - // optional bytes watch_key = 1; - - pub fn watch_key(&self) -> &[u8] { - match self.watch_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_watch_key(&mut self) { - self.watch_key = ::std::option::Option::None; - } - - pub fn has_watch_key(&self) -> bool { - self.watch_key.is_some() - } - - // Param is passed by value, moved - pub fn set_watch_key(&mut self, v: ::std::vec::Vec) { - self.watch_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_watch_key(&mut self) -> &mut ::std::vec::Vec { - if self.watch_key.is_none() { - self.watch_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.watch_key.as_mut().unwrap() - } - - // Take field - pub fn take_watch_key(&mut self) -> ::std::vec::Vec { - self.watch_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes address = 2; - - pub fn address(&self) -> &[u8] { - match self.address.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::vec::Vec) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::vec::Vec { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::vec::Vec { - self.address.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "watch_key", - |m: &MoneroWatchKey| { &m.watch_key }, - |m: &mut MoneroWatchKey| { &mut m.watch_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &MoneroWatchKey| { &m.address }, - |m: &mut MoneroWatchKey| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroWatchKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroWatchKey { - const NAME: &'static str = "MoneroWatchKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.watch_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.address = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.watch_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.watch_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.address.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroWatchKey { - MoneroWatchKey::new() - } - - fn clear(&mut self) { - self.watch_key = ::std::option::Option::None; - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroWatchKey { - static instance: MoneroWatchKey = MoneroWatchKey { - watch_key: ::std::option::Option::None, - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroWatchKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroWatchKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroWatchKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroWatchKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInitRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionInitRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.network_type) - pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.tsx_data) - pub tsx_data: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInitRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionInitRequest { - fn default() -> &'a MoneroTransactionInitRequest { - ::default_instance() - } -} - -impl MoneroTransactionInitRequest { - pub fn new() -> MoneroTransactionInitRequest { - ::std::default::Default::default() - } - - // optional uint32 version = 1; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(0) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 3; - - pub fn network_type(&self) -> MoneroNetworkType { - match self.network_type { - Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), - None => MoneroNetworkType::MAINNET, - } - } - - pub fn clear_network_type(&mut self) { - self.network_type = ::std::option::Option::None; - } - - pub fn has_network_type(&self) -> bool { - self.network_type.is_some() - } - - // Param is passed by value, moved - pub fn set_network_type(&mut self, v: MoneroNetworkType) { - self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version", - |m: &MoneroTransactionInitRequest| { &m.version }, - |m: &mut MoneroTransactionInitRequest| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MoneroTransactionInitRequest| { &m.address_n }, - |m: &mut MoneroTransactionInitRequest| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_type", - |m: &MoneroTransactionInitRequest| { &m.network_type }, - |m: &mut MoneroTransactionInitRequest| { &mut m.network_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_init_request::MoneroTransactionData>( - "tsx_data", - |m: &MoneroTransactionInitRequest| { &m.tsx_data }, - |m: &mut MoneroTransactionInitRequest| { &mut m.tsx_data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionInitRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionInitRequest { - const NAME: &'static str = "MoneroTransactionInitRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 24 => { - self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tsx_data)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(1, v); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - if let Some(v) = self.network_type { - my_size += ::protobuf::rt::int32_size(3, v.value()); - } - if let Some(v) = self.tsx_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.version { - os.write_uint32(1, v)?; - } - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; - if let Some(v) = self.network_type { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.tsx_data.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionInitRequest { - MoneroTransactionInitRequest::new() - } - - fn clear(&mut self) { - self.version = ::std::option::Option::None; - self.address_n.clear(); - self.network_type = ::std::option::Option::None; - self.tsx_data.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionInitRequest { - static instance: MoneroTransactionInitRequest = MoneroTransactionInitRequest { - version: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - network_type: ::std::option::Option::None, - tsx_data: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionInitRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInitRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionInitRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInitRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MoneroTransactionInitRequest` -pub mod monero_transaction_init_request { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroTransactionData { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.payment_id) - pub payment_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.unlock_time) - pub unlock_time: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.outputs) - pub outputs: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.change_dts) - pub change_dts: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.num_inputs) - pub num_inputs: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.mixin) - pub mixin: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.minor_indices) - pub minor_indices: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.rsig_data) - pub rsig_data: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.integrated_indices) - pub integrated_indices: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.client_version) - pub client_version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.hard_fork) - pub hard_fork: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.monero_version) - pub monero_version: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInitRequest.MoneroTransactionData.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroTransactionData { - fn default() -> &'a MoneroTransactionData { - ::default_instance() - } - } - - impl MoneroTransactionData { - pub fn new() -> MoneroTransactionData { - ::std::default::Default::default() - } - - // optional uint32 version = 1; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(0) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // optional bytes payment_id = 2; - - pub fn payment_id(&self) -> &[u8] { - match self.payment_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_payment_id(&mut self) { - self.payment_id = ::std::option::Option::None; - } - - pub fn has_payment_id(&self) -> bool { - self.payment_id.is_some() - } - - // Param is passed by value, moved - pub fn set_payment_id(&mut self, v: ::std::vec::Vec) { - self.payment_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payment_id(&mut self) -> &mut ::std::vec::Vec { - if self.payment_id.is_none() { - self.payment_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.payment_id.as_mut().unwrap() - } - - // Take field - pub fn take_payment_id(&mut self) -> ::std::vec::Vec { - self.payment_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint64 unlock_time = 3; - - pub fn unlock_time(&self) -> u64 { - self.unlock_time.unwrap_or(0) - } - - pub fn clear_unlock_time(&mut self) { - self.unlock_time = ::std::option::Option::None; - } - - pub fn has_unlock_time(&self) -> bool { - self.unlock_time.is_some() - } - - // Param is passed by value, moved - pub fn set_unlock_time(&mut self, v: u64) { - self.unlock_time = ::std::option::Option::Some(v); - } - - // optional uint32 num_inputs = 6; - - pub fn num_inputs(&self) -> u32 { - self.num_inputs.unwrap_or(0) - } - - pub fn clear_num_inputs(&mut self) { - self.num_inputs = ::std::option::Option::None; - } - - pub fn has_num_inputs(&self) -> bool { - self.num_inputs.is_some() - } - - // Param is passed by value, moved - pub fn set_num_inputs(&mut self, v: u32) { - self.num_inputs = ::std::option::Option::Some(v); - } - - // optional uint32 mixin = 7; - - pub fn mixin(&self) -> u32 { - self.mixin.unwrap_or(0) - } - - pub fn clear_mixin(&mut self) { - self.mixin = ::std::option::Option::None; - } - - pub fn has_mixin(&self) -> bool { - self.mixin.is_some() - } - - // Param is passed by value, moved - pub fn set_mixin(&mut self, v: u32) { - self.mixin = ::std::option::Option::Some(v); - } - - // optional uint64 fee = 8; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // optional uint32 account = 9; - - pub fn account(&self) -> u32 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u32) { - self.account = ::std::option::Option::Some(v); - } - - // optional uint32 client_version = 13; - - pub fn client_version(&self) -> u32 { - self.client_version.unwrap_or(0) - } - - pub fn clear_client_version(&mut self) { - self.client_version = ::std::option::Option::None; - } - - pub fn has_client_version(&self) -> bool { - self.client_version.is_some() - } - - // Param is passed by value, moved - pub fn set_client_version(&mut self, v: u32) { - self.client_version = ::std::option::Option::Some(v); - } - - // optional uint32 hard_fork = 14; - - pub fn hard_fork(&self) -> u32 { - self.hard_fork.unwrap_or(0) - } - - pub fn clear_hard_fork(&mut self) { - self.hard_fork = ::std::option::Option::None; - } - - pub fn has_hard_fork(&self) -> bool { - self.hard_fork.is_some() - } - - // Param is passed by value, moved - pub fn set_hard_fork(&mut self, v: u32) { - self.hard_fork = ::std::option::Option::Some(v); - } - - // optional bytes monero_version = 15; - - pub fn monero_version(&self) -> &[u8] { - match self.monero_version.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_monero_version(&mut self) { - self.monero_version = ::std::option::Option::None; - } - - pub fn has_monero_version(&self) -> bool { - self.monero_version.is_some() - } - - // Param is passed by value, moved - pub fn set_monero_version(&mut self, v: ::std::vec::Vec) { - self.monero_version = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_monero_version(&mut self) -> &mut ::std::vec::Vec { - if self.monero_version.is_none() { - self.monero_version = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.monero_version.as_mut().unwrap() - } - - // Take field - pub fn take_monero_version(&mut self) -> ::std::vec::Vec { - self.monero_version.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool chunkify = 16; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(16); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "version", - |m: &MoneroTransactionData| { &m.version }, - |m: &mut MoneroTransactionData| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payment_id", - |m: &MoneroTransactionData| { &m.payment_id }, - |m: &mut MoneroTransactionData| { &mut m.payment_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "unlock_time", - |m: &MoneroTransactionData| { &m.unlock_time }, - |m: &mut MoneroTransactionData| { &mut m.unlock_time }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "outputs", - |m: &MoneroTransactionData| { &m.outputs }, - |m: &mut MoneroTransactionData| { &mut m.outputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MoneroTransactionDestinationEntry>( - "change_dts", - |m: &MoneroTransactionData| { &m.change_dts }, - |m: &mut MoneroTransactionData| { &mut m.change_dts }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "num_inputs", - |m: &MoneroTransactionData| { &m.num_inputs }, - |m: &mut MoneroTransactionData| { &mut m.num_inputs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mixin", - |m: &MoneroTransactionData| { &m.mixin }, - |m: &mut MoneroTransactionData| { &mut m.mixin }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &MoneroTransactionData| { &m.fee }, - |m: &mut MoneroTransactionData| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &MoneroTransactionData| { &m.account }, - |m: &mut MoneroTransactionData| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "minor_indices", - |m: &MoneroTransactionData| { &m.minor_indices }, - |m: &mut MoneroTransactionData| { &mut m.minor_indices }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::MoneroTransactionRsigData>( - "rsig_data", - |m: &MoneroTransactionData| { &m.rsig_data }, - |m: &mut MoneroTransactionData| { &mut m.rsig_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "integrated_indices", - |m: &MoneroTransactionData| { &m.integrated_indices }, - |m: &mut MoneroTransactionData| { &mut m.integrated_indices }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "client_version", - |m: &MoneroTransactionData| { &m.client_version }, - |m: &mut MoneroTransactionData| { &mut m.client_version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hard_fork", - |m: &MoneroTransactionData| { &m.hard_fork }, - |m: &mut MoneroTransactionData| { &mut m.hard_fork }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "monero_version", - |m: &MoneroTransactionData| { &m.monero_version }, - |m: &mut MoneroTransactionData| { &mut m.monero_version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &MoneroTransactionData| { &m.chunkify }, - |m: &mut MoneroTransactionData| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionInitRequest.MoneroTransactionData", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroTransactionData { - const NAME: &'static str = "MoneroTransactionData"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.payment_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.unlock_time = ::std::option::Option::Some(is.read_uint64()?); - }, - 34 => { - self.outputs.push(is.read_message()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.change_dts)?; - }, - 48 => { - self.num_inputs = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.mixin = ::std::option::Option::Some(is.read_uint32()?); - }, - 64 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 72 => { - self.account = ::std::option::Option::Some(is.read_uint32()?); - }, - 82 => { - is.read_repeated_packed_uint32_into(&mut self.minor_indices)?; - }, - 80 => { - self.minor_indices.push(is.read_uint32()?); - }, - 90 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; - }, - 98 => { - is.read_repeated_packed_uint32_into(&mut self.integrated_indices)?; - }, - 96 => { - self.integrated_indices.push(is.read_uint32()?); - }, - 104 => { - self.client_version = ::std::option::Option::Some(is.read_uint32()?); - }, - 112 => { - self.hard_fork = ::std::option::Option::Some(is.read_uint32()?); - }, - 122 => { - self.monero_version = ::std::option::Option::Some(is.read_bytes()?); - }, - 128 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.payment_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.unlock_time { - my_size += ::protobuf::rt::uint64_size(3, v); - } - for value in &self.outputs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.change_dts.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.num_inputs { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.mixin { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(8, v); - } - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint32_size(9, v); - } - for value in &self.minor_indices { - my_size += ::protobuf::rt::uint32_size(10, *value); - }; - if let Some(v) = self.rsig_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - for value in &self.integrated_indices { - my_size += ::protobuf::rt::uint32_size(12, *value); - }; - if let Some(v) = self.client_version { - my_size += ::protobuf::rt::uint32_size(13, v); - } - if let Some(v) = self.hard_fork { - my_size += ::protobuf::rt::uint32_size(14, v); - } - if let Some(v) = self.monero_version.as_ref() { - my_size += ::protobuf::rt::bytes_size(15, &v); - } - if let Some(v) = self.chunkify { - my_size += 2 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.version { - os.write_uint32(1, v)?; - } - if let Some(v) = self.payment_id.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.unlock_time { - os.write_uint64(3, v)?; - } - for v in &self.outputs { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - }; - if let Some(v) = self.change_dts.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.num_inputs { - os.write_uint32(6, v)?; - } - if let Some(v) = self.mixin { - os.write_uint32(7, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(8, v)?; - } - if let Some(v) = self.account { - os.write_uint32(9, v)?; - } - for v in &self.minor_indices { - os.write_uint32(10, *v)?; - }; - if let Some(v) = self.rsig_data.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; - } - for v in &self.integrated_indices { - os.write_uint32(12, *v)?; - }; - if let Some(v) = self.client_version { - os.write_uint32(13, v)?; - } - if let Some(v) = self.hard_fork { - os.write_uint32(14, v)?; - } - if let Some(v) = self.monero_version.as_ref() { - os.write_bytes(15, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(16, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionData { - MoneroTransactionData::new() - } - - fn clear(&mut self) { - self.version = ::std::option::Option::None; - self.payment_id = ::std::option::Option::None; - self.unlock_time = ::std::option::Option::None; - self.outputs.clear(); - self.change_dts.clear(); - self.num_inputs = ::std::option::Option::None; - self.mixin = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.account = ::std::option::Option::None; - self.minor_indices.clear(); - self.rsig_data.clear(); - self.integrated_indices.clear(); - self.client_version = ::std::option::Option::None; - self.hard_fork = ::std::option::Option::None; - self.monero_version = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionData { - static instance: MoneroTransactionData = MoneroTransactionData { - version: ::std::option::Option::None, - payment_id: ::std::option::Option::None, - unlock_time: ::std::option::Option::None, - outputs: ::std::vec::Vec::new(), - change_dts: ::protobuf::MessageField::none(), - num_inputs: ::std::option::Option::None, - mixin: ::std::option::Option::None, - fee: ::std::option::Option::None, - account: ::std::option::Option::None, - minor_indices: ::std::vec::Vec::new(), - rsig_data: ::protobuf::MessageField::none(), - integrated_indices: ::std::vec::Vec::new(), - client_version: ::std::option::Option::None, - hard_fork: ::std::option::Option::None, - monero_version: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroTransactionData { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionInitRequest.MoneroTransactionData").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroTransactionData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroTransactionData { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInitAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionInitAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitAck.hmacs) - pub hmacs: ::std::vec::Vec<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInitAck.rsig_data) - pub rsig_data: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInitAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionInitAck { - fn default() -> &'a MoneroTransactionInitAck { - ::default_instance() - } -} - -impl MoneroTransactionInitAck { - pub fn new() -> MoneroTransactionInitAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "hmacs", - |m: &MoneroTransactionInitAck| { &m.hmacs }, - |m: &mut MoneroTransactionInitAck| { &mut m.hmacs }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( - "rsig_data", - |m: &MoneroTransactionInitAck| { &m.rsig_data }, - |m: &mut MoneroTransactionInitAck| { &mut m.rsig_data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionInitAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionInitAck { - const NAME: &'static str = "MoneroTransactionInitAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.hmacs.push(is.read_bytes()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.hmacs { - my_size += ::protobuf::rt::bytes_size(1, &value); - }; - if let Some(v) = self.rsig_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.hmacs { - os.write_bytes(1, &v)?; - }; - if let Some(v) = self.rsig_data.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionInitAck { - MoneroTransactionInitAck::new() - } - - fn clear(&mut self) { - self.hmacs.clear(); - self.rsig_data.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionInitAck { - static instance: MoneroTransactionInitAck = MoneroTransactionInitAck { - hmacs: ::std::vec::Vec::new(), - rsig_data: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionInitAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInitAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionInitAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInitAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetInputRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionSetInputRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputRequest.src_entr) - pub src_entr: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetInputRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionSetInputRequest { - fn default() -> &'a MoneroTransactionSetInputRequest { - ::default_instance() - } -} - -impl MoneroTransactionSetInputRequest { - pub fn new() -> MoneroTransactionSetInputRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionSourceEntry>( - "src_entr", - |m: &MoneroTransactionSetInputRequest| { &m.src_entr }, - |m: &mut MoneroTransactionSetInputRequest| { &mut m.src_entr }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSetInputRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionSetInputRequest { - const NAME: &'static str = "MoneroTransactionSetInputRequest"; - - fn is_initialized(&self) -> bool { - for v in &self.src_entr { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.src_entr)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.src_entr.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.src_entr.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionSetInputRequest { - MoneroTransactionSetInputRequest::new() - } - - fn clear(&mut self) { - self.src_entr.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionSetInputRequest { - static instance: MoneroTransactionSetInputRequest = MoneroTransactionSetInputRequest { - src_entr: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionSetInputRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetInputRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionSetInputRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetInputRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetInputAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionSetInputAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.vini) - pub vini: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.vini_hmac) - pub vini_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.pseudo_out) - pub pseudo_out: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.pseudo_out_hmac) - pub pseudo_out_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.pseudo_out_alpha) - pub pseudo_out_alpha: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.spend_key) - pub spend_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetInputAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionSetInputAck { - fn default() -> &'a MoneroTransactionSetInputAck { - ::default_instance() - } -} - -impl MoneroTransactionSetInputAck { - pub fn new() -> MoneroTransactionSetInputAck { - ::std::default::Default::default() - } - - // optional bytes vini = 1; - - pub fn vini(&self) -> &[u8] { - match self.vini.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vini(&mut self) { - self.vini = ::std::option::Option::None; - } - - pub fn has_vini(&self) -> bool { - self.vini.is_some() - } - - // Param is passed by value, moved - pub fn set_vini(&mut self, v: ::std::vec::Vec) { - self.vini = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vini(&mut self) -> &mut ::std::vec::Vec { - if self.vini.is_none() { - self.vini = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vini.as_mut().unwrap() - } - - // Take field - pub fn take_vini(&mut self) -> ::std::vec::Vec { - self.vini.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes vini_hmac = 2; - - pub fn vini_hmac(&self) -> &[u8] { - match self.vini_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vini_hmac(&mut self) { - self.vini_hmac = ::std::option::Option::None; - } - - pub fn has_vini_hmac(&self) -> bool { - self.vini_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_vini_hmac(&mut self, v: ::std::vec::Vec) { - self.vini_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vini_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.vini_hmac.is_none() { - self.vini_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vini_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_vini_hmac(&mut self) -> ::std::vec::Vec { - self.vini_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out = 3; - - pub fn pseudo_out(&self) -> &[u8] { - match self.pseudo_out.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out(&mut self) { - self.pseudo_out = ::std::option::Option::None; - } - - pub fn has_pseudo_out(&self) -> bool { - self.pseudo_out.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { - self.pseudo_out = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out.is_none() { - self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { - self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out_hmac = 4; - - pub fn pseudo_out_hmac(&self) -> &[u8] { - match self.pseudo_out_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out_hmac(&mut self) { - self.pseudo_out_hmac = ::std::option::Option::None; - } - - pub fn has_pseudo_out_hmac(&self) -> bool { - self.pseudo_out_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out_hmac(&mut self, v: ::std::vec::Vec) { - self.pseudo_out_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out_hmac.is_none() { - self.pseudo_out_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out_hmac(&mut self) -> ::std::vec::Vec { - self.pseudo_out_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out_alpha = 5; - - pub fn pseudo_out_alpha(&self) -> &[u8] { - match self.pseudo_out_alpha.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out_alpha(&mut self) { - self.pseudo_out_alpha = ::std::option::Option::None; - } - - pub fn has_pseudo_out_alpha(&self) -> bool { - self.pseudo_out_alpha.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out_alpha(&mut self, v: ::std::vec::Vec) { - self.pseudo_out_alpha = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out_alpha(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out_alpha.is_none() { - self.pseudo_out_alpha = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out_alpha.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out_alpha(&mut self) -> ::std::vec::Vec { - self.pseudo_out_alpha.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes spend_key = 6; - - pub fn spend_key(&self) -> &[u8] { - match self.spend_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_spend_key(&mut self) { - self.spend_key = ::std::option::Option::None; - } - - pub fn has_spend_key(&self) -> bool { - self.spend_key.is_some() - } - - // Param is passed by value, moved - pub fn set_spend_key(&mut self, v: ::std::vec::Vec) { - self.spend_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_spend_key(&mut self) -> &mut ::std::vec::Vec { - if self.spend_key.is_none() { - self.spend_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.spend_key.as_mut().unwrap() - } - - // Take field - pub fn take_spend_key(&mut self) -> ::std::vec::Vec { - self.spend_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vini", - |m: &MoneroTransactionSetInputAck| { &m.vini }, - |m: &mut MoneroTransactionSetInputAck| { &mut m.vini }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vini_hmac", - |m: &MoneroTransactionSetInputAck| { &m.vini_hmac }, - |m: &mut MoneroTransactionSetInputAck| { &mut m.vini_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out", - |m: &MoneroTransactionSetInputAck| { &m.pseudo_out }, - |m: &mut MoneroTransactionSetInputAck| { &mut m.pseudo_out }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out_hmac", - |m: &MoneroTransactionSetInputAck| { &m.pseudo_out_hmac }, - |m: &mut MoneroTransactionSetInputAck| { &mut m.pseudo_out_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out_alpha", - |m: &MoneroTransactionSetInputAck| { &m.pseudo_out_alpha }, - |m: &mut MoneroTransactionSetInputAck| { &mut m.pseudo_out_alpha }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "spend_key", - |m: &MoneroTransactionSetInputAck| { &m.spend_key }, - |m: &mut MoneroTransactionSetInputAck| { &mut m.spend_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSetInputAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionSetInputAck { - const NAME: &'static str = "MoneroTransactionSetInputAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.vini = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.vini_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.pseudo_out_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.pseudo_out_alpha = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.spend_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.vini.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.vini_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.pseudo_out.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.pseudo_out_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.pseudo_out_alpha.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.spend_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.vini.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.vini_hmac.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.pseudo_out.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.pseudo_out_hmac.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.pseudo_out_alpha.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.spend_key.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionSetInputAck { - MoneroTransactionSetInputAck::new() - } - - fn clear(&mut self) { - self.vini = ::std::option::Option::None; - self.vini_hmac = ::std::option::Option::None; - self.pseudo_out = ::std::option::Option::None; - self.pseudo_out_hmac = ::std::option::Option::None; - self.pseudo_out_alpha = ::std::option::Option::None; - self.spend_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionSetInputAck { - static instance: MoneroTransactionSetInputAck = MoneroTransactionSetInputAck { - vini: ::std::option::Option::None, - vini_hmac: ::std::option::Option::None, - pseudo_out: ::std::option::Option::None, - pseudo_out_hmac: ::std::option::Option::None, - pseudo_out_alpha: ::std::option::Option::None, - spend_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionSetInputAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetInputAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionSetInputAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetInputAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInputViniRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionInputViniRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.src_entr) - pub src_entr: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.vini) - pub vini: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.vini_hmac) - pub vini_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.pseudo_out) - pub pseudo_out: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.pseudo_out_hmac) - pub pseudo_out_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.orig_idx) - pub orig_idx: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInputViniRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionInputViniRequest { - fn default() -> &'a MoneroTransactionInputViniRequest { - ::default_instance() - } -} - -impl MoneroTransactionInputViniRequest { - pub fn new() -> MoneroTransactionInputViniRequest { - ::std::default::Default::default() - } - - // optional bytes vini = 2; - - pub fn vini(&self) -> &[u8] { - match self.vini.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vini(&mut self) { - self.vini = ::std::option::Option::None; - } - - pub fn has_vini(&self) -> bool { - self.vini.is_some() - } - - // Param is passed by value, moved - pub fn set_vini(&mut self, v: ::std::vec::Vec) { - self.vini = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vini(&mut self) -> &mut ::std::vec::Vec { - if self.vini.is_none() { - self.vini = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vini.as_mut().unwrap() - } - - // Take field - pub fn take_vini(&mut self) -> ::std::vec::Vec { - self.vini.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes vini_hmac = 3; - - pub fn vini_hmac(&self) -> &[u8] { - match self.vini_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vini_hmac(&mut self) { - self.vini_hmac = ::std::option::Option::None; - } - - pub fn has_vini_hmac(&self) -> bool { - self.vini_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_vini_hmac(&mut self, v: ::std::vec::Vec) { - self.vini_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vini_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.vini_hmac.is_none() { - self.vini_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vini_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_vini_hmac(&mut self) -> ::std::vec::Vec { - self.vini_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out = 4; - - pub fn pseudo_out(&self) -> &[u8] { - match self.pseudo_out.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out(&mut self) { - self.pseudo_out = ::std::option::Option::None; - } - - pub fn has_pseudo_out(&self) -> bool { - self.pseudo_out.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { - self.pseudo_out = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out.is_none() { - self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { - self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out_hmac = 5; - - pub fn pseudo_out_hmac(&self) -> &[u8] { - match self.pseudo_out_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out_hmac(&mut self) { - self.pseudo_out_hmac = ::std::option::Option::None; - } - - pub fn has_pseudo_out_hmac(&self) -> bool { - self.pseudo_out_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out_hmac(&mut self, v: ::std::vec::Vec) { - self.pseudo_out_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out_hmac.is_none() { - self.pseudo_out_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out_hmac(&mut self) -> ::std::vec::Vec { - self.pseudo_out_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 orig_idx = 6; - - pub fn orig_idx(&self) -> u32 { - self.orig_idx.unwrap_or(0) - } - - pub fn clear_orig_idx(&mut self) { - self.orig_idx = ::std::option::Option::None; - } - - pub fn has_orig_idx(&self) -> bool { - self.orig_idx.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_idx(&mut self, v: u32) { - self.orig_idx = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionSourceEntry>( - "src_entr", - |m: &MoneroTransactionInputViniRequest| { &m.src_entr }, - |m: &mut MoneroTransactionInputViniRequest| { &mut m.src_entr }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vini", - |m: &MoneroTransactionInputViniRequest| { &m.vini }, - |m: &mut MoneroTransactionInputViniRequest| { &mut m.vini }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vini_hmac", - |m: &MoneroTransactionInputViniRequest| { &m.vini_hmac }, - |m: &mut MoneroTransactionInputViniRequest| { &mut m.vini_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out", - |m: &MoneroTransactionInputViniRequest| { &m.pseudo_out }, - |m: &mut MoneroTransactionInputViniRequest| { &mut m.pseudo_out }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out_hmac", - |m: &MoneroTransactionInputViniRequest| { &m.pseudo_out_hmac }, - |m: &mut MoneroTransactionInputViniRequest| { &mut m.pseudo_out_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_idx", - |m: &MoneroTransactionInputViniRequest| { &m.orig_idx }, - |m: &mut MoneroTransactionInputViniRequest| { &mut m.orig_idx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionInputViniRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionInputViniRequest { - const NAME: &'static str = "MoneroTransactionInputViniRequest"; - - fn is_initialized(&self) -> bool { - for v in &self.src_entr { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.src_entr)?; - }, - 18 => { - self.vini = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.vini_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.pseudo_out_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 48 => { - self.orig_idx = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.src_entr.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.vini.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.vini_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.pseudo_out.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.pseudo_out_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.orig_idx { - my_size += ::protobuf::rt::uint32_size(6, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.src_entr.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.vini.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.vini_hmac.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.pseudo_out.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.pseudo_out_hmac.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.orig_idx { - os.write_uint32(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionInputViniRequest { - MoneroTransactionInputViniRequest::new() - } - - fn clear(&mut self) { - self.src_entr.clear(); - self.vini = ::std::option::Option::None; - self.vini_hmac = ::std::option::Option::None; - self.pseudo_out = ::std::option::Option::None; - self.pseudo_out_hmac = ::std::option::Option::None; - self.orig_idx = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionInputViniRequest { - static instance: MoneroTransactionInputViniRequest = MoneroTransactionInputViniRequest { - src_entr: ::protobuf::MessageField::none(), - vini: ::std::option::Option::None, - vini_hmac: ::std::option::Option::None, - pseudo_out: ::std::option::Option::None, - pseudo_out_hmac: ::std::option::Option::None, - orig_idx: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionInputViniRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInputViniRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionInputViniRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInputViniRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionInputViniAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionInputViniAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionInputViniAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionInputViniAck { - fn default() -> &'a MoneroTransactionInputViniAck { - ::default_instance() - } -} - -impl MoneroTransactionInputViniAck { - pub fn new() -> MoneroTransactionInputViniAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionInputViniAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionInputViniAck { - const NAME: &'static str = "MoneroTransactionInputViniAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionInputViniAck { - MoneroTransactionInputViniAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionInputViniAck { - static instance: MoneroTransactionInputViniAck = MoneroTransactionInputViniAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionInputViniAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionInputViniAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionInputViniAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionInputViniAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllInputsSetRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionAllInputsSetRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllInputsSetRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionAllInputsSetRequest { - fn default() -> &'a MoneroTransactionAllInputsSetRequest { - ::default_instance() - } -} - -impl MoneroTransactionAllInputsSetRequest { - pub fn new() -> MoneroTransactionAllInputsSetRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionAllInputsSetRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionAllInputsSetRequest { - const NAME: &'static str = "MoneroTransactionAllInputsSetRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionAllInputsSetRequest { - MoneroTransactionAllInputsSetRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionAllInputsSetRequest { - static instance: MoneroTransactionAllInputsSetRequest = MoneroTransactionAllInputsSetRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionAllInputsSetRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllInputsSetRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionAllInputsSetRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllInputsSetRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllInputsSetAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionAllInputsSetAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllInputsSetAck.rsig_data) - pub rsig_data: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllInputsSetAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionAllInputsSetAck { - fn default() -> &'a MoneroTransactionAllInputsSetAck { - ::default_instance() - } -} - -impl MoneroTransactionAllInputsSetAck { - pub fn new() -> MoneroTransactionAllInputsSetAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( - "rsig_data", - |m: &MoneroTransactionAllInputsSetAck| { &m.rsig_data }, - |m: &mut MoneroTransactionAllInputsSetAck| { &mut m.rsig_data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionAllInputsSetAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionAllInputsSetAck { - const NAME: &'static str = "MoneroTransactionAllInputsSetAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.rsig_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.rsig_data.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionAllInputsSetAck { - MoneroTransactionAllInputsSetAck::new() - } - - fn clear(&mut self) { - self.rsig_data.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionAllInputsSetAck { - static instance: MoneroTransactionAllInputsSetAck = MoneroTransactionAllInputsSetAck { - rsig_data: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionAllInputsSetAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllInputsSetAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionAllInputsSetAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllInputsSetAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionSetOutputRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.dst_entr) - pub dst_entr: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.dst_entr_hmac) - pub dst_entr_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.rsig_data) - pub rsig_data: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.is_offloaded_bp) - pub is_offloaded_bp: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetOutputRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionSetOutputRequest { - fn default() -> &'a MoneroTransactionSetOutputRequest { - ::default_instance() - } -} - -impl MoneroTransactionSetOutputRequest { - pub fn new() -> MoneroTransactionSetOutputRequest { - ::std::default::Default::default() - } - - // optional bytes dst_entr_hmac = 2; - - pub fn dst_entr_hmac(&self) -> &[u8] { - match self.dst_entr_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_dst_entr_hmac(&mut self) { - self.dst_entr_hmac = ::std::option::Option::None; - } - - pub fn has_dst_entr_hmac(&self) -> bool { - self.dst_entr_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_dst_entr_hmac(&mut self, v: ::std::vec::Vec) { - self.dst_entr_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_dst_entr_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.dst_entr_hmac.is_none() { - self.dst_entr_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.dst_entr_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_dst_entr_hmac(&mut self) -> ::std::vec::Vec { - self.dst_entr_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool is_offloaded_bp = 4; - - pub fn is_offloaded_bp(&self) -> bool { - self.is_offloaded_bp.unwrap_or(false) - } - - pub fn clear_is_offloaded_bp(&mut self) { - self.is_offloaded_bp = ::std::option::Option::None; - } - - pub fn has_is_offloaded_bp(&self) -> bool { - self.is_offloaded_bp.is_some() - } - - // Param is passed by value, moved - pub fn set_is_offloaded_bp(&mut self, v: bool) { - self.is_offloaded_bp = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionDestinationEntry>( - "dst_entr", - |m: &MoneroTransactionSetOutputRequest| { &m.dst_entr }, - |m: &mut MoneroTransactionSetOutputRequest| { &mut m.dst_entr }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "dst_entr_hmac", - |m: &MoneroTransactionSetOutputRequest| { &m.dst_entr_hmac }, - |m: &mut MoneroTransactionSetOutputRequest| { &mut m.dst_entr_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( - "rsig_data", - |m: &MoneroTransactionSetOutputRequest| { &m.rsig_data }, - |m: &mut MoneroTransactionSetOutputRequest| { &mut m.rsig_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "is_offloaded_bp", - |m: &MoneroTransactionSetOutputRequest| { &m.is_offloaded_bp }, - |m: &mut MoneroTransactionSetOutputRequest| { &mut m.is_offloaded_bp }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSetOutputRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionSetOutputRequest { - const NAME: &'static str = "MoneroTransactionSetOutputRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.dst_entr)?; - }, - 18 => { - self.dst_entr_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; - }, - 32 => { - self.is_offloaded_bp = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.dst_entr.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.dst_entr_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.rsig_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.is_offloaded_bp { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.dst_entr.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.dst_entr_hmac.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.rsig_data.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.is_offloaded_bp { - os.write_bool(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionSetOutputRequest { - MoneroTransactionSetOutputRequest::new() - } - - fn clear(&mut self) { - self.dst_entr.clear(); - self.dst_entr_hmac = ::std::option::Option::None; - self.rsig_data.clear(); - self.is_offloaded_bp = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionSetOutputRequest { - static instance: MoneroTransactionSetOutputRequest = MoneroTransactionSetOutputRequest { - dst_entr: ::protobuf::MessageField::none(), - dst_entr_hmac: ::std::option::Option::None, - rsig_data: ::protobuf::MessageField::none(), - is_offloaded_bp: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionSetOutputRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetOutputRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionSetOutputRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetOutputRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSetOutputAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionSetOutputAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.tx_out) - pub tx_out: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.vouti_hmac) - pub vouti_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.rsig_data) - pub rsig_data: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.out_pk) - pub out_pk: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.ecdh_info) - pub ecdh_info: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSetOutputAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionSetOutputAck { - fn default() -> &'a MoneroTransactionSetOutputAck { - ::default_instance() - } -} - -impl MoneroTransactionSetOutputAck { - pub fn new() -> MoneroTransactionSetOutputAck { - ::std::default::Default::default() - } - - // optional bytes tx_out = 1; - - pub fn tx_out(&self) -> &[u8] { - match self.tx_out.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_out(&mut self) { - self.tx_out = ::std::option::Option::None; - } - - pub fn has_tx_out(&self) -> bool { - self.tx_out.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_out(&mut self, v: ::std::vec::Vec) { - self.tx_out = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_out(&mut self) -> &mut ::std::vec::Vec { - if self.tx_out.is_none() { - self.tx_out = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_out.as_mut().unwrap() - } - - // Take field - pub fn take_tx_out(&mut self) -> ::std::vec::Vec { - self.tx_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes vouti_hmac = 2; - - pub fn vouti_hmac(&self) -> &[u8] { - match self.vouti_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vouti_hmac(&mut self) { - self.vouti_hmac = ::std::option::Option::None; - } - - pub fn has_vouti_hmac(&self) -> bool { - self.vouti_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_vouti_hmac(&mut self, v: ::std::vec::Vec) { - self.vouti_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vouti_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.vouti_hmac.is_none() { - self.vouti_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vouti_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_vouti_hmac(&mut self) -> ::std::vec::Vec { - self.vouti_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes out_pk = 4; - - pub fn out_pk(&self) -> &[u8] { - match self.out_pk.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_out_pk(&mut self) { - self.out_pk = ::std::option::Option::None; - } - - pub fn has_out_pk(&self) -> bool { - self.out_pk.is_some() - } - - // Param is passed by value, moved - pub fn set_out_pk(&mut self, v: ::std::vec::Vec) { - self.out_pk = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_out_pk(&mut self) -> &mut ::std::vec::Vec { - if self.out_pk.is_none() { - self.out_pk = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.out_pk.as_mut().unwrap() - } - - // Take field - pub fn take_out_pk(&mut self) -> ::std::vec::Vec { - self.out_pk.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes ecdh_info = 5; - - pub fn ecdh_info(&self) -> &[u8] { - match self.ecdh_info.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_ecdh_info(&mut self) { - self.ecdh_info = ::std::option::Option::None; - } - - pub fn has_ecdh_info(&self) -> bool { - self.ecdh_info.is_some() - } - - // Param is passed by value, moved - pub fn set_ecdh_info(&mut self, v: ::std::vec::Vec) { - self.ecdh_info = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ecdh_info(&mut self) -> &mut ::std::vec::Vec { - if self.ecdh_info.is_none() { - self.ecdh_info = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.ecdh_info.as_mut().unwrap() - } - - // Take field - pub fn take_ecdh_info(&mut self) -> ::std::vec::Vec { - self.ecdh_info.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_out", - |m: &MoneroTransactionSetOutputAck| { &m.tx_out }, - |m: &mut MoneroTransactionSetOutputAck| { &mut m.tx_out }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vouti_hmac", - |m: &MoneroTransactionSetOutputAck| { &m.vouti_hmac }, - |m: &mut MoneroTransactionSetOutputAck| { &mut m.vouti_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( - "rsig_data", - |m: &MoneroTransactionSetOutputAck| { &m.rsig_data }, - |m: &mut MoneroTransactionSetOutputAck| { &mut m.rsig_data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "out_pk", - |m: &MoneroTransactionSetOutputAck| { &m.out_pk }, - |m: &mut MoneroTransactionSetOutputAck| { &mut m.out_pk }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ecdh_info", - |m: &MoneroTransactionSetOutputAck| { &m.ecdh_info }, - |m: &mut MoneroTransactionSetOutputAck| { &mut m.ecdh_info }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSetOutputAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionSetOutputAck { - const NAME: &'static str = "MoneroTransactionSetOutputAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.tx_out = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.vouti_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; - }, - 34 => { - self.out_pk = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.ecdh_info = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx_out.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.vouti_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.rsig_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.out_pk.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.ecdh_info.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx_out.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.vouti_hmac.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.rsig_data.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.out_pk.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.ecdh_info.as_ref() { - os.write_bytes(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionSetOutputAck { - MoneroTransactionSetOutputAck::new() - } - - fn clear(&mut self) { - self.tx_out = ::std::option::Option::None; - self.vouti_hmac = ::std::option::Option::None; - self.rsig_data.clear(); - self.out_pk = ::std::option::Option::None; - self.ecdh_info = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionSetOutputAck { - static instance: MoneroTransactionSetOutputAck = MoneroTransactionSetOutputAck { - tx_out: ::std::option::Option::None, - vouti_hmac: ::std::option::Option::None, - rsig_data: ::protobuf::MessageField::none(), - out_pk: ::std::option::Option::None, - ecdh_info: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionSetOutputAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSetOutputAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionSetOutputAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSetOutputAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllOutSetRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionAllOutSetRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetRequest.rsig_data) - pub rsig_data: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllOutSetRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionAllOutSetRequest { - fn default() -> &'a MoneroTransactionAllOutSetRequest { - ::default_instance() - } -} - -impl MoneroTransactionAllOutSetRequest { - pub fn new() -> MoneroTransactionAllOutSetRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionRsigData>( - "rsig_data", - |m: &MoneroTransactionAllOutSetRequest| { &m.rsig_data }, - |m: &mut MoneroTransactionAllOutSetRequest| { &mut m.rsig_data }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionAllOutSetRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionAllOutSetRequest { - const NAME: &'static str = "MoneroTransactionAllOutSetRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsig_data)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.rsig_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.rsig_data.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionAllOutSetRequest { - MoneroTransactionAllOutSetRequest::new() - } - - fn clear(&mut self) { - self.rsig_data.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionAllOutSetRequest { - static instance: MoneroTransactionAllOutSetRequest = MoneroTransactionAllOutSetRequest { - rsig_data: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionAllOutSetRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllOutSetRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionAllOutSetRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllOutSetRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionAllOutSetAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.extra) - pub extra: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.tx_prefix_hash) - pub tx_prefix_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.rv) - pub rv: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.full_message_hash) - pub full_message_hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionAllOutSetAck { - fn default() -> &'a MoneroTransactionAllOutSetAck { - ::default_instance() - } -} - -impl MoneroTransactionAllOutSetAck { - pub fn new() -> MoneroTransactionAllOutSetAck { - ::std::default::Default::default() - } - - // optional bytes extra = 1; - - pub fn extra(&self) -> &[u8] { - match self.extra.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_extra(&mut self) { - self.extra = ::std::option::Option::None; - } - - pub fn has_extra(&self) -> bool { - self.extra.is_some() - } - - // Param is passed by value, moved - pub fn set_extra(&mut self, v: ::std::vec::Vec) { - self.extra = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_extra(&mut self) -> &mut ::std::vec::Vec { - if self.extra.is_none() { - self.extra = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.extra.as_mut().unwrap() - } - - // Take field - pub fn take_extra(&mut self) -> ::std::vec::Vec { - self.extra.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes tx_prefix_hash = 2; - - pub fn tx_prefix_hash(&self) -> &[u8] { - match self.tx_prefix_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_prefix_hash(&mut self) { - self.tx_prefix_hash = ::std::option::Option::None; - } - - pub fn has_tx_prefix_hash(&self) -> bool { - self.tx_prefix_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_prefix_hash(&mut self, v: ::std::vec::Vec) { - self.tx_prefix_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_prefix_hash(&mut self) -> &mut ::std::vec::Vec { - if self.tx_prefix_hash.is_none() { - self.tx_prefix_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_prefix_hash.as_mut().unwrap() - } - - // Take field - pub fn take_tx_prefix_hash(&mut self) -> ::std::vec::Vec { - self.tx_prefix_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes full_message_hash = 5; - - pub fn full_message_hash(&self) -> &[u8] { - match self.full_message_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_full_message_hash(&mut self) { - self.full_message_hash = ::std::option::Option::None; - } - - pub fn has_full_message_hash(&self) -> bool { - self.full_message_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_full_message_hash(&mut self, v: ::std::vec::Vec) { - self.full_message_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_full_message_hash(&mut self) -> &mut ::std::vec::Vec { - if self.full_message_hash.is_none() { - self.full_message_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.full_message_hash.as_mut().unwrap() - } - - // Take field - pub fn take_full_message_hash(&mut self) -> ::std::vec::Vec { - self.full_message_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "extra", - |m: &MoneroTransactionAllOutSetAck| { &m.extra }, - |m: &mut MoneroTransactionAllOutSetAck| { &mut m.extra }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_prefix_hash", - |m: &MoneroTransactionAllOutSetAck| { &m.tx_prefix_hash }, - |m: &mut MoneroTransactionAllOutSetAck| { &mut m.tx_prefix_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, monero_transaction_all_out_set_ack::MoneroRingCtSig>( - "rv", - |m: &MoneroTransactionAllOutSetAck| { &m.rv }, - |m: &mut MoneroTransactionAllOutSetAck| { &mut m.rv }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "full_message_hash", - |m: &MoneroTransactionAllOutSetAck| { &m.full_message_hash }, - |m: &mut MoneroTransactionAllOutSetAck| { &mut m.full_message_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionAllOutSetAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionAllOutSetAck { - const NAME: &'static str = "MoneroTransactionAllOutSetAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.extra = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.tx_prefix_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.rv)?; - }, - 42 => { - self.full_message_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.extra.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.tx_prefix_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.rv.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.full_message_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.extra.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.tx_prefix_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.rv.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.full_message_hash.as_ref() { - os.write_bytes(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionAllOutSetAck { - MoneroTransactionAllOutSetAck::new() - } - - fn clear(&mut self) { - self.extra = ::std::option::Option::None; - self.tx_prefix_hash = ::std::option::Option::None; - self.rv.clear(); - self.full_message_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionAllOutSetAck { - static instance: MoneroTransactionAllOutSetAck = MoneroTransactionAllOutSetAck { - extra: ::std::option::Option::None, - tx_prefix_hash: ::std::option::Option::None, - rv: ::protobuf::MessageField::none(), - full_message_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionAllOutSetAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionAllOutSetAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionAllOutSetAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionAllOutSetAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MoneroTransactionAllOutSetAck` -pub mod monero_transaction_all_out_set_ack { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroRingCtSig { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.txn_fee) - pub txn_fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.message) - pub message: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.rv_type) - pub rv_type: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionAllOutSetAck.MoneroRingCtSig.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroRingCtSig { - fn default() -> &'a MoneroRingCtSig { - ::default_instance() - } - } - - impl MoneroRingCtSig { - pub fn new() -> MoneroRingCtSig { - ::std::default::Default::default() - } - - // optional uint64 txn_fee = 1; - - pub fn txn_fee(&self) -> u64 { - self.txn_fee.unwrap_or(0) - } - - pub fn clear_txn_fee(&mut self) { - self.txn_fee = ::std::option::Option::None; - } - - pub fn has_txn_fee(&self) -> bool { - self.txn_fee.is_some() - } - - // Param is passed by value, moved - pub fn set_txn_fee(&mut self, v: u64) { - self.txn_fee = ::std::option::Option::Some(v); - } - - // optional bytes message = 2; - - pub fn message(&self) -> &[u8] { - match self.message.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_message(&mut self) { - self.message = ::std::option::Option::None; - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::vec::Vec) { - self.message = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::vec::Vec { - if self.message.is_none() { - self.message = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::vec::Vec { - self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 rv_type = 3; - - pub fn rv_type(&self) -> u32 { - self.rv_type.unwrap_or(0) - } - - pub fn clear_rv_type(&mut self) { - self.rv_type = ::std::option::Option::None; - } - - pub fn has_rv_type(&self) -> bool { - self.rv_type.is_some() - } - - // Param is passed by value, moved - pub fn set_rv_type(&mut self, v: u32) { - self.rv_type = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "txn_fee", - |m: &MoneroRingCtSig| { &m.txn_fee }, - |m: &mut MoneroRingCtSig| { &mut m.txn_fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "message", - |m: &MoneroRingCtSig| { &m.message }, - |m: &mut MoneroRingCtSig| { &mut m.message }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "rv_type", - |m: &MoneroRingCtSig| { &m.rv_type }, - |m: &mut MoneroRingCtSig| { &mut m.rv_type }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionAllOutSetAck.MoneroRingCtSig", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroRingCtSig { - const NAME: &'static str = "MoneroRingCtSig"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.txn_fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - self.message = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.rv_type = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.txn_fee { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.message.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.rv_type { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.txn_fee { - os.write_uint64(1, v)?; - } - if let Some(v) = self.message.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.rv_type { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroRingCtSig { - MoneroRingCtSig::new() - } - - fn clear(&mut self) { - self.txn_fee = ::std::option::Option::None; - self.message = ::std::option::Option::None; - self.rv_type = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroRingCtSig { - static instance: MoneroRingCtSig = MoneroRingCtSig { - txn_fee: ::std::option::Option::None, - message: ::std::option::Option::None, - rv_type: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroRingCtSig { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroTransactionAllOutSetAck.MoneroRingCtSig").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroRingCtSig { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroRingCtSig { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSignInputRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionSignInputRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.src_entr) - pub src_entr: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.vini) - pub vini: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.vini_hmac) - pub vini_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.pseudo_out) - pub pseudo_out: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.pseudo_out_hmac) - pub pseudo_out_hmac: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.pseudo_out_alpha) - pub pseudo_out_alpha: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.spend_key) - pub spend_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.orig_idx) - pub orig_idx: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSignInputRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionSignInputRequest { - fn default() -> &'a MoneroTransactionSignInputRequest { - ::default_instance() - } -} - -impl MoneroTransactionSignInputRequest { - pub fn new() -> MoneroTransactionSignInputRequest { - ::std::default::Default::default() - } - - // optional bytes vini = 2; - - pub fn vini(&self) -> &[u8] { - match self.vini.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vini(&mut self) { - self.vini = ::std::option::Option::None; - } - - pub fn has_vini(&self) -> bool { - self.vini.is_some() - } - - // Param is passed by value, moved - pub fn set_vini(&mut self, v: ::std::vec::Vec) { - self.vini = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vini(&mut self) -> &mut ::std::vec::Vec { - if self.vini.is_none() { - self.vini = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vini.as_mut().unwrap() - } - - // Take field - pub fn take_vini(&mut self) -> ::std::vec::Vec { - self.vini.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes vini_hmac = 3; - - pub fn vini_hmac(&self) -> &[u8] { - match self.vini_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_vini_hmac(&mut self) { - self.vini_hmac = ::std::option::Option::None; - } - - pub fn has_vini_hmac(&self) -> bool { - self.vini_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_vini_hmac(&mut self, v: ::std::vec::Vec) { - self.vini_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_vini_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.vini_hmac.is_none() { - self.vini_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.vini_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_vini_hmac(&mut self) -> ::std::vec::Vec { - self.vini_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out = 4; - - pub fn pseudo_out(&self) -> &[u8] { - match self.pseudo_out.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out(&mut self) { - self.pseudo_out = ::std::option::Option::None; - } - - pub fn has_pseudo_out(&self) -> bool { - self.pseudo_out.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { - self.pseudo_out = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out.is_none() { - self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { - self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out_hmac = 5; - - pub fn pseudo_out_hmac(&self) -> &[u8] { - match self.pseudo_out_hmac.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out_hmac(&mut self) { - self.pseudo_out_hmac = ::std::option::Option::None; - } - - pub fn has_pseudo_out_hmac(&self) -> bool { - self.pseudo_out_hmac.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out_hmac(&mut self, v: ::std::vec::Vec) { - self.pseudo_out_hmac = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out_hmac(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out_hmac.is_none() { - self.pseudo_out_hmac = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out_hmac.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out_hmac(&mut self) -> ::std::vec::Vec { - self.pseudo_out_hmac.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out_alpha = 6; - - pub fn pseudo_out_alpha(&self) -> &[u8] { - match self.pseudo_out_alpha.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out_alpha(&mut self) { - self.pseudo_out_alpha = ::std::option::Option::None; - } - - pub fn has_pseudo_out_alpha(&self) -> bool { - self.pseudo_out_alpha.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out_alpha(&mut self, v: ::std::vec::Vec) { - self.pseudo_out_alpha = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out_alpha(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out_alpha.is_none() { - self.pseudo_out_alpha = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out_alpha.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out_alpha(&mut self) -> ::std::vec::Vec { - self.pseudo_out_alpha.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes spend_key = 7; - - pub fn spend_key(&self) -> &[u8] { - match self.spend_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_spend_key(&mut self) { - self.spend_key = ::std::option::Option::None; - } - - pub fn has_spend_key(&self) -> bool { - self.spend_key.is_some() - } - - // Param is passed by value, moved - pub fn set_spend_key(&mut self, v: ::std::vec::Vec) { - self.spend_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_spend_key(&mut self) -> &mut ::std::vec::Vec { - if self.spend_key.is_none() { - self.spend_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.spend_key.as_mut().unwrap() - } - - // Take field - pub fn take_spend_key(&mut self) -> ::std::vec::Vec { - self.spend_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 orig_idx = 8; - - pub fn orig_idx(&self) -> u32 { - self.orig_idx.unwrap_or(0) - } - - pub fn clear_orig_idx(&mut self) { - self.orig_idx = ::std::option::Option::None; - } - - pub fn has_orig_idx(&self) -> bool { - self.orig_idx.is_some() - } - - // Param is passed by value, moved - pub fn set_orig_idx(&mut self, v: u32) { - self.orig_idx = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MoneroTransactionSourceEntry>( - "src_entr", - |m: &MoneroTransactionSignInputRequest| { &m.src_entr }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.src_entr }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vini", - |m: &MoneroTransactionSignInputRequest| { &m.vini }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.vini }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "vini_hmac", - |m: &MoneroTransactionSignInputRequest| { &m.vini_hmac }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.vini_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out", - |m: &MoneroTransactionSignInputRequest| { &m.pseudo_out }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.pseudo_out }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out_hmac", - |m: &MoneroTransactionSignInputRequest| { &m.pseudo_out_hmac }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.pseudo_out_hmac }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out_alpha", - |m: &MoneroTransactionSignInputRequest| { &m.pseudo_out_alpha }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.pseudo_out_alpha }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "spend_key", - |m: &MoneroTransactionSignInputRequest| { &m.spend_key }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.spend_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "orig_idx", - |m: &MoneroTransactionSignInputRequest| { &m.orig_idx }, - |m: &mut MoneroTransactionSignInputRequest| { &mut m.orig_idx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSignInputRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionSignInputRequest { - const NAME: &'static str = "MoneroTransactionSignInputRequest"; - - fn is_initialized(&self) -> bool { - for v in &self.src_entr { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.src_entr)?; - }, - 18 => { - self.vini = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.vini_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.pseudo_out_hmac = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.pseudo_out_alpha = ::std::option::Option::Some(is.read_bytes()?); - }, - 58 => { - self.spend_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 64 => { - self.orig_idx = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.src_entr.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.vini.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.vini_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.pseudo_out.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.pseudo_out_hmac.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.pseudo_out_alpha.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.spend_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - if let Some(v) = self.orig_idx { - my_size += ::protobuf::rt::uint32_size(8, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.src_entr.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.vini.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.vini_hmac.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.pseudo_out.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.pseudo_out_hmac.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.pseudo_out_alpha.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.spend_key.as_ref() { - os.write_bytes(7, v)?; - } - if let Some(v) = self.orig_idx { - os.write_uint32(8, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionSignInputRequest { - MoneroTransactionSignInputRequest::new() - } - - fn clear(&mut self) { - self.src_entr.clear(); - self.vini = ::std::option::Option::None; - self.vini_hmac = ::std::option::Option::None; - self.pseudo_out = ::std::option::Option::None; - self.pseudo_out_hmac = ::std::option::Option::None; - self.pseudo_out_alpha = ::std::option::Option::None; - self.spend_key = ::std::option::Option::None; - self.orig_idx = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionSignInputRequest { - static instance: MoneroTransactionSignInputRequest = MoneroTransactionSignInputRequest { - src_entr: ::protobuf::MessageField::none(), - vini: ::std::option::Option::None, - vini_hmac: ::std::option::Option::None, - pseudo_out: ::std::option::Option::None, - pseudo_out_hmac: ::std::option::Option::None, - pseudo_out_alpha: ::std::option::Option::None, - spend_key: ::std::option::Option::None, - orig_idx: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionSignInputRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSignInputRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionSignInputRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSignInputRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionSignInputAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionSignInputAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputAck.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionSignInputAck.pseudo_out) - pub pseudo_out: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionSignInputAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionSignInputAck { - fn default() -> &'a MoneroTransactionSignInputAck { - ::default_instance() - } -} - -impl MoneroTransactionSignInputAck { - pub fn new() -> MoneroTransactionSignInputAck { - ::std::default::Default::default() - } - - // optional bytes signature = 1; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes pseudo_out = 2; - - pub fn pseudo_out(&self) -> &[u8] { - match self.pseudo_out.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_pseudo_out(&mut self) { - self.pseudo_out = ::std::option::Option::None; - } - - pub fn has_pseudo_out(&self) -> bool { - self.pseudo_out.is_some() - } - - // Param is passed by value, moved - pub fn set_pseudo_out(&mut self, v: ::std::vec::Vec) { - self.pseudo_out = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_pseudo_out(&mut self) -> &mut ::std::vec::Vec { - if self.pseudo_out.is_none() { - self.pseudo_out = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.pseudo_out.as_mut().unwrap() - } - - // Take field - pub fn take_pseudo_out(&mut self) -> ::std::vec::Vec { - self.pseudo_out.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &MoneroTransactionSignInputAck| { &m.signature }, - |m: &mut MoneroTransactionSignInputAck| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "pseudo_out", - |m: &MoneroTransactionSignInputAck| { &m.pseudo_out }, - |m: &mut MoneroTransactionSignInputAck| { &mut m.pseudo_out }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionSignInputAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionSignInputAck { - const NAME: &'static str = "MoneroTransactionSignInputAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.pseudo_out = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.pseudo_out.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.pseudo_out.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionSignInputAck { - MoneroTransactionSignInputAck::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.pseudo_out = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionSignInputAck { - static instance: MoneroTransactionSignInputAck = MoneroTransactionSignInputAck { - signature: ::std::option::Option::None, - pseudo_out: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionSignInputAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionSignInputAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionSignInputAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionSignInputAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionFinalRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionFinalRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionFinalRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionFinalRequest { - fn default() -> &'a MoneroTransactionFinalRequest { - ::default_instance() - } -} - -impl MoneroTransactionFinalRequest { - pub fn new() -> MoneroTransactionFinalRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionFinalRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionFinalRequest { - const NAME: &'static str = "MoneroTransactionFinalRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionFinalRequest { - MoneroTransactionFinalRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionFinalRequest { - static instance: MoneroTransactionFinalRequest = MoneroTransactionFinalRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionFinalRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionFinalRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionFinalRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionFinalRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroTransactionFinalAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroTransactionFinalAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.cout_key) - pub cout_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.salt) - pub salt: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.rand_mult) - pub rand_mult: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.tx_enc_keys) - pub tx_enc_keys: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroTransactionFinalAck.opening_key) - pub opening_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroTransactionFinalAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroTransactionFinalAck { - fn default() -> &'a MoneroTransactionFinalAck { - ::default_instance() - } -} - -impl MoneroTransactionFinalAck { - pub fn new() -> MoneroTransactionFinalAck { - ::std::default::Default::default() - } - - // optional bytes cout_key = 1; - - pub fn cout_key(&self) -> &[u8] { - match self.cout_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_cout_key(&mut self) { - self.cout_key = ::std::option::Option::None; - } - - pub fn has_cout_key(&self) -> bool { - self.cout_key.is_some() - } - - // Param is passed by value, moved - pub fn set_cout_key(&mut self, v: ::std::vec::Vec) { - self.cout_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cout_key(&mut self) -> &mut ::std::vec::Vec { - if self.cout_key.is_none() { - self.cout_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.cout_key.as_mut().unwrap() - } - - // Take field - pub fn take_cout_key(&mut self) -> ::std::vec::Vec { - self.cout_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes salt = 2; - - pub fn salt(&self) -> &[u8] { - match self.salt.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_salt(&mut self) { - self.salt = ::std::option::Option::None; - } - - pub fn has_salt(&self) -> bool { - self.salt.is_some() - } - - // Param is passed by value, moved - pub fn set_salt(&mut self, v: ::std::vec::Vec) { - self.salt = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_salt(&mut self) -> &mut ::std::vec::Vec { - if self.salt.is_none() { - self.salt = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.salt.as_mut().unwrap() - } - - // Take field - pub fn take_salt(&mut self) -> ::std::vec::Vec { - self.salt.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes rand_mult = 3; - - pub fn rand_mult(&self) -> &[u8] { - match self.rand_mult.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_rand_mult(&mut self) { - self.rand_mult = ::std::option::Option::None; - } - - pub fn has_rand_mult(&self) -> bool { - self.rand_mult.is_some() - } - - // Param is passed by value, moved - pub fn set_rand_mult(&mut self, v: ::std::vec::Vec) { - self.rand_mult = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_rand_mult(&mut self) -> &mut ::std::vec::Vec { - if self.rand_mult.is_none() { - self.rand_mult = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.rand_mult.as_mut().unwrap() - } - - // Take field - pub fn take_rand_mult(&mut self) -> ::std::vec::Vec { - self.rand_mult.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes tx_enc_keys = 4; - - pub fn tx_enc_keys(&self) -> &[u8] { - match self.tx_enc_keys.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_enc_keys(&mut self) { - self.tx_enc_keys = ::std::option::Option::None; - } - - pub fn has_tx_enc_keys(&self) -> bool { - self.tx_enc_keys.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_enc_keys(&mut self, v: ::std::vec::Vec) { - self.tx_enc_keys = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_enc_keys(&mut self) -> &mut ::std::vec::Vec { - if self.tx_enc_keys.is_none() { - self.tx_enc_keys = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_enc_keys.as_mut().unwrap() - } - - // Take field - pub fn take_tx_enc_keys(&mut self) -> ::std::vec::Vec { - self.tx_enc_keys.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes opening_key = 5; - - pub fn opening_key(&self) -> &[u8] { - match self.opening_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_opening_key(&mut self) { - self.opening_key = ::std::option::Option::None; - } - - pub fn has_opening_key(&self) -> bool { - self.opening_key.is_some() - } - - // Param is passed by value, moved - pub fn set_opening_key(&mut self, v: ::std::vec::Vec) { - self.opening_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_opening_key(&mut self) -> &mut ::std::vec::Vec { - if self.opening_key.is_none() { - self.opening_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.opening_key.as_mut().unwrap() - } - - // Take field - pub fn take_opening_key(&mut self) -> ::std::vec::Vec { - self.opening_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "cout_key", - |m: &MoneroTransactionFinalAck| { &m.cout_key }, - |m: &mut MoneroTransactionFinalAck| { &mut m.cout_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "salt", - |m: &MoneroTransactionFinalAck| { &m.salt }, - |m: &mut MoneroTransactionFinalAck| { &mut m.salt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "rand_mult", - |m: &MoneroTransactionFinalAck| { &m.rand_mult }, - |m: &mut MoneroTransactionFinalAck| { &mut m.rand_mult }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_enc_keys", - |m: &MoneroTransactionFinalAck| { &m.tx_enc_keys }, - |m: &mut MoneroTransactionFinalAck| { &mut m.tx_enc_keys }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "opening_key", - |m: &MoneroTransactionFinalAck| { &m.opening_key }, - |m: &mut MoneroTransactionFinalAck| { &mut m.opening_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroTransactionFinalAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroTransactionFinalAck { - const NAME: &'static str = "MoneroTransactionFinalAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.cout_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.salt = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.rand_mult = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.tx_enc_keys = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.opening_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.cout_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.salt.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.rand_mult.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.tx_enc_keys.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.opening_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.cout_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.salt.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.rand_mult.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.tx_enc_keys.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.opening_key.as_ref() { - os.write_bytes(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransactionFinalAck { - MoneroTransactionFinalAck::new() - } - - fn clear(&mut self) { - self.cout_key = ::std::option::Option::None; - self.salt = ::std::option::Option::None; - self.rand_mult = ::std::option::Option::None; - self.tx_enc_keys = ::std::option::Option::None; - self.opening_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransactionFinalAck { - static instance: MoneroTransactionFinalAck = MoneroTransactionFinalAck { - cout_key: ::std::option::Option::None, - salt: ::std::option::Option::None, - rand_mult: ::std::option::Option::None, - tx_enc_keys: ::std::option::Option::None, - opening_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroTransactionFinalAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroTransactionFinalAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroTransactionFinalAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroTransactionFinalAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroKeyImageExportInitRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.num) - pub num: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.hash) - pub hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.network_type) - pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.subs) - pub subs: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroKeyImageExportInitRequest { - fn default() -> &'a MoneroKeyImageExportInitRequest { - ::default_instance() - } -} - -impl MoneroKeyImageExportInitRequest { - pub fn new() -> MoneroKeyImageExportInitRequest { - ::std::default::Default::default() - } - - // required uint64 num = 1; - - pub fn num(&self) -> u64 { - self.num.unwrap_or(0) - } - - pub fn clear_num(&mut self) { - self.num = ::std::option::Option::None; - } - - pub fn has_num(&self) -> bool { - self.num.is_some() - } - - // Param is passed by value, moved - pub fn set_num(&mut self, v: u64) { - self.num = ::std::option::Option::Some(v); - } - - // required bytes hash = 2; - - pub fn hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 4; - - pub fn network_type(&self) -> MoneroNetworkType { - match self.network_type { - Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), - None => MoneroNetworkType::MAINNET, - } - } - - pub fn clear_network_type(&mut self) { - self.network_type = ::std::option::Option::None; - } - - pub fn has_network_type(&self) -> bool { - self.network_type.is_some() - } - - // Param is passed by value, moved - pub fn set_network_type(&mut self, v: MoneroNetworkType) { - self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "num", - |m: &MoneroKeyImageExportInitRequest| { &m.num }, - |m: &mut MoneroKeyImageExportInitRequest| { &mut m.num }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hash", - |m: &MoneroKeyImageExportInitRequest| { &m.hash }, - |m: &mut MoneroKeyImageExportInitRequest| { &mut m.hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MoneroKeyImageExportInitRequest| { &m.address_n }, - |m: &mut MoneroKeyImageExportInitRequest| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_type", - |m: &MoneroKeyImageExportInitRequest| { &m.network_type }, - |m: &mut MoneroKeyImageExportInitRequest| { &mut m.network_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "subs", - |m: &MoneroKeyImageExportInitRequest| { &m.subs }, - |m: &mut MoneroKeyImageExportInitRequest| { &mut m.subs }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageExportInitRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroKeyImageExportInitRequest { - const NAME: &'static str = "MoneroKeyImageExportInitRequest"; - - fn is_initialized(&self) -> bool { - if self.num.is_none() { - return false; - } - if self.hash.is_none() { - return false; - } - for v in &self.subs { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.num = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - self.hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 24 => { - self.address_n.push(is.read_uint32()?); - }, - 32 => { - self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 42 => { - self.subs.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.num { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(3, *value); - }; - if let Some(v) = self.network_type { - my_size += ::protobuf::rt::int32_size(4, v.value()); - } - for value in &self.subs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.num { - os.write_uint64(1, v)?; - } - if let Some(v) = self.hash.as_ref() { - os.write_bytes(2, v)?; - } - for v in &self.address_n { - os.write_uint32(3, *v)?; - }; - if let Some(v) = self.network_type { - os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; - } - for v in &self.subs { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroKeyImageExportInitRequest { - MoneroKeyImageExportInitRequest::new() - } - - fn clear(&mut self) { - self.num = ::std::option::Option::None; - self.hash = ::std::option::Option::None; - self.address_n.clear(); - self.network_type = ::std::option::Option::None; - self.subs.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroKeyImageExportInitRequest { - static instance: MoneroKeyImageExportInitRequest = MoneroKeyImageExportInitRequest { - num: ::std::option::Option::None, - hash: ::std::option::Option::None, - address_n: ::std::vec::Vec::new(), - network_type: ::std::option::Option::None, - subs: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroKeyImageExportInitRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageExportInitRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroKeyImageExportInitRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageExportInitRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MoneroKeyImageExportInitRequest` -pub mod monero_key_image_export_init_request { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroSubAddressIndicesList { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList.account) - pub account: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList.minor_indices) - pub minor_indices: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroSubAddressIndicesList { - fn default() -> &'a MoneroSubAddressIndicesList { - ::default_instance() - } - } - - impl MoneroSubAddressIndicesList { - pub fn new() -> MoneroSubAddressIndicesList { - ::std::default::Default::default() - } - - // required uint32 account = 1; - - pub fn account(&self) -> u32 { - self.account.unwrap_or(0) - } - - pub fn clear_account(&mut self) { - self.account = ::std::option::Option::None; - } - - pub fn has_account(&self) -> bool { - self.account.is_some() - } - - // Param is passed by value, moved - pub fn set_account(&mut self, v: u32) { - self.account = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "account", - |m: &MoneroSubAddressIndicesList| { &m.account }, - |m: &mut MoneroSubAddressIndicesList| { &mut m.account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "minor_indices", - |m: &MoneroSubAddressIndicesList| { &m.minor_indices }, - |m: &mut MoneroSubAddressIndicesList| { &mut m.minor_indices }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroSubAddressIndicesList { - const NAME: &'static str = "MoneroSubAddressIndicesList"; - - fn is_initialized(&self) -> bool { - if self.account.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.account = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - is.read_repeated_packed_uint32_into(&mut self.minor_indices)?; - }, - 16 => { - self.minor_indices.push(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.account { - my_size += ::protobuf::rt::uint32_size(1, v); - } - for value in &self.minor_indices { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.account { - os.write_uint32(1, v)?; - } - for v in &self.minor_indices { - os.write_uint32(2, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroSubAddressIndicesList { - MoneroSubAddressIndicesList::new() - } - - fn clear(&mut self) { - self.account = ::std::option::Option::None; - self.minor_indices.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroSubAddressIndicesList { - static instance: MoneroSubAddressIndicesList = MoneroSubAddressIndicesList { - account: ::std::option::Option::None, - minor_indices: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroSubAddressIndicesList { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesList").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroSubAddressIndicesList { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroSubAddressIndicesList { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageExportInitAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroKeyImageExportInitAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageExportInitAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroKeyImageExportInitAck { - fn default() -> &'a MoneroKeyImageExportInitAck { - ::default_instance() - } -} - -impl MoneroKeyImageExportInitAck { - pub fn new() -> MoneroKeyImageExportInitAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageExportInitAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroKeyImageExportInitAck { - const NAME: &'static str = "MoneroKeyImageExportInitAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroKeyImageExportInitAck { - MoneroKeyImageExportInitAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroKeyImageExportInitAck { - static instance: MoneroKeyImageExportInitAck = MoneroKeyImageExportInitAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroKeyImageExportInitAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageExportInitAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroKeyImageExportInitAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageExportInitAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroKeyImageSyncStepRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.tdis) - pub tdis: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncStepRequest { - fn default() -> &'a MoneroKeyImageSyncStepRequest { - ::default_instance() - } -} - -impl MoneroKeyImageSyncStepRequest { - pub fn new() -> MoneroKeyImageSyncStepRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "tdis", - |m: &MoneroKeyImageSyncStepRequest| { &m.tdis }, - |m: &mut MoneroKeyImageSyncStepRequest| { &mut m.tdis }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageSyncStepRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroKeyImageSyncStepRequest { - const NAME: &'static str = "MoneroKeyImageSyncStepRequest"; - - fn is_initialized(&self) -> bool { - for v in &self.tdis { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.tdis.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.tdis { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.tdis { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroKeyImageSyncStepRequest { - MoneroKeyImageSyncStepRequest::new() - } - - fn clear(&mut self) { - self.tdis.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroKeyImageSyncStepRequest { - static instance: MoneroKeyImageSyncStepRequest = MoneroKeyImageSyncStepRequest { - tdis: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroKeyImageSyncStepRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroKeyImageSyncStepRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncStepRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MoneroKeyImageSyncStepRequest` -pub mod monero_key_image_sync_step_request { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroTransferDetails { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.out_key) - pub out_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.tx_pub_key) - pub tx_pub_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.additional_tx_pub_keys) - pub additional_tx_pub_keys: ::std::vec::Vec<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.internal_output_index) - pub internal_output_index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.sub_addr_major) - pub sub_addr_major: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.sub_addr_minor) - pub sub_addr_minor: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetails.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroTransferDetails { - fn default() -> &'a MoneroTransferDetails { - ::default_instance() - } - } - - impl MoneroTransferDetails { - pub fn new() -> MoneroTransferDetails { - ::std::default::Default::default() - } - - // required bytes out_key = 1; - - pub fn out_key(&self) -> &[u8] { - match self.out_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_out_key(&mut self) { - self.out_key = ::std::option::Option::None; - } - - pub fn has_out_key(&self) -> bool { - self.out_key.is_some() - } - - // Param is passed by value, moved - pub fn set_out_key(&mut self, v: ::std::vec::Vec) { - self.out_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_out_key(&mut self) -> &mut ::std::vec::Vec { - if self.out_key.is_none() { - self.out_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.out_key.as_mut().unwrap() - } - - // Take field - pub fn take_out_key(&mut self) -> ::std::vec::Vec { - self.out_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes tx_pub_key = 2; - - pub fn tx_pub_key(&self) -> &[u8] { - match self.tx_pub_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_pub_key(&mut self) { - self.tx_pub_key = ::std::option::Option::None; - } - - pub fn has_tx_pub_key(&self) -> bool { - self.tx_pub_key.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_pub_key(&mut self, v: ::std::vec::Vec) { - self.tx_pub_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_pub_key(&mut self) -> &mut ::std::vec::Vec { - if self.tx_pub_key.is_none() { - self.tx_pub_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_pub_key.as_mut().unwrap() - } - - // Take field - pub fn take_tx_pub_key(&mut self) -> ::std::vec::Vec { - self.tx_pub_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 internal_output_index = 4; - - pub fn internal_output_index(&self) -> u64 { - self.internal_output_index.unwrap_or(0) - } - - pub fn clear_internal_output_index(&mut self) { - self.internal_output_index = ::std::option::Option::None; - } - - pub fn has_internal_output_index(&self) -> bool { - self.internal_output_index.is_some() - } - - // Param is passed by value, moved - pub fn set_internal_output_index(&mut self, v: u64) { - self.internal_output_index = ::std::option::Option::Some(v); - } - - // optional uint32 sub_addr_major = 5; - - pub fn sub_addr_major(&self) -> u32 { - self.sub_addr_major.unwrap_or(0) - } - - pub fn clear_sub_addr_major(&mut self) { - self.sub_addr_major = ::std::option::Option::None; - } - - pub fn has_sub_addr_major(&self) -> bool { - self.sub_addr_major.is_some() - } - - // Param is passed by value, moved - pub fn set_sub_addr_major(&mut self, v: u32) { - self.sub_addr_major = ::std::option::Option::Some(v); - } - - // optional uint32 sub_addr_minor = 6; - - pub fn sub_addr_minor(&self) -> u32 { - self.sub_addr_minor.unwrap_or(0) - } - - pub fn clear_sub_addr_minor(&mut self) { - self.sub_addr_minor = ::std::option::Option::None; - } - - pub fn has_sub_addr_minor(&self) -> bool { - self.sub_addr_minor.is_some() - } - - // Param is passed by value, moved - pub fn set_sub_addr_minor(&mut self, v: u32) { - self.sub_addr_minor = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "out_key", - |m: &MoneroTransferDetails| { &m.out_key }, - |m: &mut MoneroTransferDetails| { &mut m.out_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_pub_key", - |m: &MoneroTransferDetails| { &m.tx_pub_key }, - |m: &mut MoneroTransferDetails| { &mut m.tx_pub_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "additional_tx_pub_keys", - |m: &MoneroTransferDetails| { &m.additional_tx_pub_keys }, - |m: &mut MoneroTransferDetails| { &mut m.additional_tx_pub_keys }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "internal_output_index", - |m: &MoneroTransferDetails| { &m.internal_output_index }, - |m: &mut MoneroTransferDetails| { &mut m.internal_output_index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sub_addr_major", - |m: &MoneroTransferDetails| { &m.sub_addr_major }, - |m: &mut MoneroTransferDetails| { &mut m.sub_addr_major }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sub_addr_minor", - |m: &MoneroTransferDetails| { &m.sub_addr_minor }, - |m: &mut MoneroTransferDetails| { &mut m.sub_addr_minor }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageSyncStepRequest.MoneroTransferDetails", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroTransferDetails { - const NAME: &'static str = "MoneroTransferDetails"; - - fn is_initialized(&self) -> bool { - if self.out_key.is_none() { - return false; - } - if self.tx_pub_key.is_none() { - return false; - } - if self.internal_output_index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.out_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.tx_pub_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.additional_tx_pub_keys.push(is.read_bytes()?); - }, - 32 => { - self.internal_output_index = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.sub_addr_major = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.sub_addr_minor = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.out_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.tx_pub_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - for value in &self.additional_tx_pub_keys { - my_size += ::protobuf::rt::bytes_size(3, &value); - }; - if let Some(v) = self.internal_output_index { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.sub_addr_major { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.sub_addr_minor { - my_size += ::protobuf::rt::uint32_size(6, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.out_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.tx_pub_key.as_ref() { - os.write_bytes(2, v)?; - } - for v in &self.additional_tx_pub_keys { - os.write_bytes(3, &v)?; - }; - if let Some(v) = self.internal_output_index { - os.write_uint64(4, v)?; - } - if let Some(v) = self.sub_addr_major { - os.write_uint32(5, v)?; - } - if let Some(v) = self.sub_addr_minor { - os.write_uint32(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroTransferDetails { - MoneroTransferDetails::new() - } - - fn clear(&mut self) { - self.out_key = ::std::option::Option::None; - self.tx_pub_key = ::std::option::Option::None; - self.additional_tx_pub_keys.clear(); - self.internal_output_index = ::std::option::Option::None; - self.sub_addr_major = ::std::option::Option::None; - self.sub_addr_minor = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroTransferDetails { - static instance: MoneroTransferDetails = MoneroTransferDetails { - out_key: ::std::option::Option::None, - tx_pub_key: ::std::option::Option::None, - additional_tx_pub_keys: ::std::vec::Vec::new(), - internal_output_index: ::std::option::Option::None, - sub_addr_major: ::std::option::Option::None, - sub_addr_minor: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroTransferDetails { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepRequest.MoneroTransferDetails").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroTransferDetails { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroTransferDetails { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroKeyImageSyncStepAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.kis) - pub kis: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncStepAck { - fn default() -> &'a MoneroKeyImageSyncStepAck { - ::default_instance() - } -} - -impl MoneroKeyImageSyncStepAck { - pub fn new() -> MoneroKeyImageSyncStepAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "kis", - |m: &MoneroKeyImageSyncStepAck| { &m.kis }, - |m: &mut MoneroKeyImageSyncStepAck| { &mut m.kis }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageSyncStepAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroKeyImageSyncStepAck { - const NAME: &'static str = "MoneroKeyImageSyncStepAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.kis.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.kis { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.kis { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroKeyImageSyncStepAck { - MoneroKeyImageSyncStepAck::new() - } - - fn clear(&mut self) { - self.kis.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroKeyImageSyncStepAck { - static instance: MoneroKeyImageSyncStepAck = MoneroKeyImageSyncStepAck { - kis: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroKeyImageSyncStepAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroKeyImageSyncStepAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncStepAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `MoneroKeyImageSyncStepAck` -pub mod monero_key_image_sync_step_ack { - // @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MoneroExportedKeyImage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage.iv) - pub iv: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage.blob) - pub blob: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExportedKeyImage.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MoneroExportedKeyImage { - fn default() -> &'a MoneroExportedKeyImage { - ::default_instance() - } - } - - impl MoneroExportedKeyImage { - pub fn new() -> MoneroExportedKeyImage { - ::std::default::Default::default() - } - - // optional bytes iv = 1; - - pub fn iv(&self) -> &[u8] { - match self.iv.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_iv(&mut self) { - self.iv = ::std::option::Option::None; - } - - pub fn has_iv(&self) -> bool { - self.iv.is_some() - } - - // Param is passed by value, moved - pub fn set_iv(&mut self, v: ::std::vec::Vec) { - self.iv = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_iv(&mut self) -> &mut ::std::vec::Vec { - if self.iv.is_none() { - self.iv = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.iv.as_mut().unwrap() - } - - // Take field - pub fn take_iv(&mut self) -> ::std::vec::Vec { - self.iv.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes blob = 3; - - pub fn blob(&self) -> &[u8] { - match self.blob.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_blob(&mut self) { - self.blob = ::std::option::Option::None; - } - - pub fn has_blob(&self) -> bool { - self.blob.is_some() - } - - // Param is passed by value, moved - pub fn set_blob(&mut self, v: ::std::vec::Vec) { - self.blob = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_blob(&mut self) -> &mut ::std::vec::Vec { - if self.blob.is_none() { - self.blob = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.blob.as_mut().unwrap() - } - - // Take field - pub fn take_blob(&mut self) -> ::std::vec::Vec { - self.blob.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "iv", - |m: &MoneroExportedKeyImage| { &m.iv }, - |m: &mut MoneroExportedKeyImage| { &mut m.iv }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "blob", - |m: &MoneroExportedKeyImage| { &m.blob }, - |m: &mut MoneroExportedKeyImage| { &mut m.blob }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageSyncStepAck.MoneroExportedKeyImage", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MoneroExportedKeyImage { - const NAME: &'static str = "MoneroExportedKeyImage"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.iv = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.blob = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.iv.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.blob.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.iv.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.blob.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroExportedKeyImage { - MoneroExportedKeyImage::new() - } - - fn clear(&mut self) { - self.iv = ::std::option::Option::None; - self.blob = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroExportedKeyImage { - static instance: MoneroExportedKeyImage = MoneroExportedKeyImage { - iv: ::std::option::Option::None, - blob: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MoneroExportedKeyImage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncStepAck.MoneroExportedKeyImage").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MoneroExportedKeyImage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MoneroExportedKeyImage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncFinalRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroKeyImageSyncFinalRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncFinalRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncFinalRequest { - fn default() -> &'a MoneroKeyImageSyncFinalRequest { - ::default_instance() - } -} - -impl MoneroKeyImageSyncFinalRequest { - pub fn new() -> MoneroKeyImageSyncFinalRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageSyncFinalRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroKeyImageSyncFinalRequest { - const NAME: &'static str = "MoneroKeyImageSyncFinalRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroKeyImageSyncFinalRequest { - MoneroKeyImageSyncFinalRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroKeyImageSyncFinalRequest { - static instance: MoneroKeyImageSyncFinalRequest = MoneroKeyImageSyncFinalRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroKeyImageSyncFinalRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncFinalRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroKeyImageSyncFinalRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncFinalRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroKeyImageSyncFinalAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroKeyImageSyncFinalAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroKeyImageSyncFinalAck.enc_key) - pub enc_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroKeyImageSyncFinalAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroKeyImageSyncFinalAck { - fn default() -> &'a MoneroKeyImageSyncFinalAck { - ::default_instance() - } -} - -impl MoneroKeyImageSyncFinalAck { - pub fn new() -> MoneroKeyImageSyncFinalAck { - ::std::default::Default::default() - } - - // optional bytes enc_key = 1; - - pub fn enc_key(&self) -> &[u8] { - match self.enc_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_enc_key(&mut self) { - self.enc_key = ::std::option::Option::None; - } - - pub fn has_enc_key(&self) -> bool { - self.enc_key.is_some() - } - - // Param is passed by value, moved - pub fn set_enc_key(&mut self, v: ::std::vec::Vec) { - self.enc_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_enc_key(&mut self) -> &mut ::std::vec::Vec { - if self.enc_key.is_none() { - self.enc_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.enc_key.as_mut().unwrap() - } - - // Take field - pub fn take_enc_key(&mut self) -> ::std::vec::Vec { - self.enc_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "enc_key", - |m: &MoneroKeyImageSyncFinalAck| { &m.enc_key }, - |m: &mut MoneroKeyImageSyncFinalAck| { &mut m.enc_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroKeyImageSyncFinalAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroKeyImageSyncFinalAck { - const NAME: &'static str = "MoneroKeyImageSyncFinalAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.enc_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.enc_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.enc_key.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroKeyImageSyncFinalAck { - MoneroKeyImageSyncFinalAck::new() - } - - fn clear(&mut self) { - self.enc_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroKeyImageSyncFinalAck { - static instance: MoneroKeyImageSyncFinalAck = MoneroKeyImageSyncFinalAck { - enc_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroKeyImageSyncFinalAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroKeyImageSyncFinalAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroKeyImageSyncFinalAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroKeyImageSyncFinalAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetTxKeyRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroGetTxKeyRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.network_type) - pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.salt1) - pub salt1: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.salt2) - pub salt2: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.tx_enc_keys) - pub tx_enc_keys: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.tx_prefix_hash) - pub tx_prefix_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.reason) - pub reason: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.view_public_key) - pub view_public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetTxKeyRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroGetTxKeyRequest { - fn default() -> &'a MoneroGetTxKeyRequest { - ::default_instance() - } -} - -impl MoneroGetTxKeyRequest { - pub fn new() -> MoneroGetTxKeyRequest { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 2; - - pub fn network_type(&self) -> MoneroNetworkType { - match self.network_type { - Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), - None => MoneroNetworkType::MAINNET, - } - } - - pub fn clear_network_type(&mut self) { - self.network_type = ::std::option::Option::None; - } - - pub fn has_network_type(&self) -> bool { - self.network_type.is_some() - } - - // Param is passed by value, moved - pub fn set_network_type(&mut self, v: MoneroNetworkType) { - self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required bytes salt1 = 3; - - pub fn salt1(&self) -> &[u8] { - match self.salt1.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_salt1(&mut self) { - self.salt1 = ::std::option::Option::None; - } - - pub fn has_salt1(&self) -> bool { - self.salt1.is_some() - } - - // Param is passed by value, moved - pub fn set_salt1(&mut self, v: ::std::vec::Vec) { - self.salt1 = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_salt1(&mut self) -> &mut ::std::vec::Vec { - if self.salt1.is_none() { - self.salt1 = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.salt1.as_mut().unwrap() - } - - // Take field - pub fn take_salt1(&mut self) -> ::std::vec::Vec { - self.salt1.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes salt2 = 4; - - pub fn salt2(&self) -> &[u8] { - match self.salt2.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_salt2(&mut self) { - self.salt2 = ::std::option::Option::None; - } - - pub fn has_salt2(&self) -> bool { - self.salt2.is_some() - } - - // Param is passed by value, moved - pub fn set_salt2(&mut self, v: ::std::vec::Vec) { - self.salt2 = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_salt2(&mut self) -> &mut ::std::vec::Vec { - if self.salt2.is_none() { - self.salt2 = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.salt2.as_mut().unwrap() - } - - // Take field - pub fn take_salt2(&mut self) -> ::std::vec::Vec { - self.salt2.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes tx_enc_keys = 5; - - pub fn tx_enc_keys(&self) -> &[u8] { - match self.tx_enc_keys.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_enc_keys(&mut self) { - self.tx_enc_keys = ::std::option::Option::None; - } - - pub fn has_tx_enc_keys(&self) -> bool { - self.tx_enc_keys.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_enc_keys(&mut self, v: ::std::vec::Vec) { - self.tx_enc_keys = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_enc_keys(&mut self) -> &mut ::std::vec::Vec { - if self.tx_enc_keys.is_none() { - self.tx_enc_keys = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_enc_keys.as_mut().unwrap() - } - - // Take field - pub fn take_tx_enc_keys(&mut self) -> ::std::vec::Vec { - self.tx_enc_keys.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes tx_prefix_hash = 6; - - pub fn tx_prefix_hash(&self) -> &[u8] { - match self.tx_prefix_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_prefix_hash(&mut self) { - self.tx_prefix_hash = ::std::option::Option::None; - } - - pub fn has_tx_prefix_hash(&self) -> bool { - self.tx_prefix_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_prefix_hash(&mut self, v: ::std::vec::Vec) { - self.tx_prefix_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_prefix_hash(&mut self) -> &mut ::std::vec::Vec { - if self.tx_prefix_hash.is_none() { - self.tx_prefix_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_prefix_hash.as_mut().unwrap() - } - - // Take field - pub fn take_tx_prefix_hash(&mut self) -> ::std::vec::Vec { - self.tx_prefix_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 reason = 7; - - pub fn reason(&self) -> u32 { - self.reason.unwrap_or(0) - } - - pub fn clear_reason(&mut self) { - self.reason = ::std::option::Option::None; - } - - pub fn has_reason(&self) -> bool { - self.reason.is_some() - } - - // Param is passed by value, moved - pub fn set_reason(&mut self, v: u32) { - self.reason = ::std::option::Option::Some(v); - } - - // optional bytes view_public_key = 8; - - pub fn view_public_key(&self) -> &[u8] { - match self.view_public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_view_public_key(&mut self) { - self.view_public_key = ::std::option::Option::None; - } - - pub fn has_view_public_key(&self) -> bool { - self.view_public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_view_public_key(&mut self, v: ::std::vec::Vec) { - self.view_public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_view_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.view_public_key.is_none() { - self.view_public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.view_public_key.as_mut().unwrap() - } - - // Take field - pub fn take_view_public_key(&mut self) -> ::std::vec::Vec { - self.view_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(8); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MoneroGetTxKeyRequest| { &m.address_n }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_type", - |m: &MoneroGetTxKeyRequest| { &m.network_type }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.network_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "salt1", - |m: &MoneroGetTxKeyRequest| { &m.salt1 }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.salt1 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "salt2", - |m: &MoneroGetTxKeyRequest| { &m.salt2 }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.salt2 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_enc_keys", - |m: &MoneroGetTxKeyRequest| { &m.tx_enc_keys }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.tx_enc_keys }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_prefix_hash", - |m: &MoneroGetTxKeyRequest| { &m.tx_prefix_hash }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.tx_prefix_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "reason", - |m: &MoneroGetTxKeyRequest| { &m.reason }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.reason }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "view_public_key", - |m: &MoneroGetTxKeyRequest| { &m.view_public_key }, - |m: &mut MoneroGetTxKeyRequest| { &mut m.view_public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroGetTxKeyRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroGetTxKeyRequest { - const NAME: &'static str = "MoneroGetTxKeyRequest"; - - fn is_initialized(&self) -> bool { - if self.salt1.is_none() { - return false; - } - if self.salt2.is_none() { - return false; - } - if self.tx_enc_keys.is_none() { - return false; - } - if self.tx_prefix_hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 26 => { - self.salt1 = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.salt2 = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.tx_enc_keys = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.tx_prefix_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 56 => { - self.reason = ::std::option::Option::Some(is.read_uint32()?); - }, - 66 => { - self.view_public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.network_type { - my_size += ::protobuf::rt::int32_size(2, v.value()); - } - if let Some(v) = self.salt1.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.salt2.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(v) = self.tx_enc_keys.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.tx_prefix_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.reason { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.view_public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.network_type { - os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.salt1.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.salt2.as_ref() { - os.write_bytes(4, v)?; - } - if let Some(v) = self.tx_enc_keys.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.tx_prefix_hash.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.reason { - os.write_uint32(7, v)?; - } - if let Some(v) = self.view_public_key.as_ref() { - os.write_bytes(8, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroGetTxKeyRequest { - MoneroGetTxKeyRequest::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.network_type = ::std::option::Option::None; - self.salt1 = ::std::option::Option::None; - self.salt2 = ::std::option::Option::None; - self.tx_enc_keys = ::std::option::Option::None; - self.tx_prefix_hash = ::std::option::Option::None; - self.reason = ::std::option::Option::None; - self.view_public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroGetTxKeyRequest { - static instance: MoneroGetTxKeyRequest = MoneroGetTxKeyRequest { - address_n: ::std::vec::Vec::new(), - network_type: ::std::option::Option::None, - salt1: ::std::option::Option::None, - salt2: ::std::option::Option::None, - tx_enc_keys: ::std::option::Option::None, - tx_prefix_hash: ::std::option::Option::None, - reason: ::std::option::Option::None, - view_public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroGetTxKeyRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetTxKeyRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroGetTxKeyRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroGetTxKeyRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroGetTxKeyAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroGetTxKeyAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyAck.salt) - pub salt: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyAck.tx_keys) - pub tx_keys: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroGetTxKeyAck.tx_derivations) - pub tx_derivations: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroGetTxKeyAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroGetTxKeyAck { - fn default() -> &'a MoneroGetTxKeyAck { - ::default_instance() - } -} - -impl MoneroGetTxKeyAck { - pub fn new() -> MoneroGetTxKeyAck { - ::std::default::Default::default() - } - - // optional bytes salt = 1; - - pub fn salt(&self) -> &[u8] { - match self.salt.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_salt(&mut self) { - self.salt = ::std::option::Option::None; - } - - pub fn has_salt(&self) -> bool { - self.salt.is_some() - } - - // Param is passed by value, moved - pub fn set_salt(&mut self, v: ::std::vec::Vec) { - self.salt = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_salt(&mut self) -> &mut ::std::vec::Vec { - if self.salt.is_none() { - self.salt = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.salt.as_mut().unwrap() - } - - // Take field - pub fn take_salt(&mut self) -> ::std::vec::Vec { - self.salt.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes tx_keys = 2; - - pub fn tx_keys(&self) -> &[u8] { - match self.tx_keys.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_keys(&mut self) { - self.tx_keys = ::std::option::Option::None; - } - - pub fn has_tx_keys(&self) -> bool { - self.tx_keys.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_keys(&mut self, v: ::std::vec::Vec) { - self.tx_keys = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_keys(&mut self) -> &mut ::std::vec::Vec { - if self.tx_keys.is_none() { - self.tx_keys = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_keys.as_mut().unwrap() - } - - // Take field - pub fn take_tx_keys(&mut self) -> ::std::vec::Vec { - self.tx_keys.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes tx_derivations = 3; - - pub fn tx_derivations(&self) -> &[u8] { - match self.tx_derivations.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_tx_derivations(&mut self) { - self.tx_derivations = ::std::option::Option::None; - } - - pub fn has_tx_derivations(&self) -> bool { - self.tx_derivations.is_some() - } - - // Param is passed by value, moved - pub fn set_tx_derivations(&mut self, v: ::std::vec::Vec) { - self.tx_derivations = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_tx_derivations(&mut self) -> &mut ::std::vec::Vec { - if self.tx_derivations.is_none() { - self.tx_derivations = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.tx_derivations.as_mut().unwrap() - } - - // Take field - pub fn take_tx_derivations(&mut self) -> ::std::vec::Vec { - self.tx_derivations.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "salt", - |m: &MoneroGetTxKeyAck| { &m.salt }, - |m: &mut MoneroGetTxKeyAck| { &mut m.salt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_keys", - |m: &MoneroGetTxKeyAck| { &m.tx_keys }, - |m: &mut MoneroGetTxKeyAck| { &mut m.tx_keys }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tx_derivations", - |m: &MoneroGetTxKeyAck| { &m.tx_derivations }, - |m: &mut MoneroGetTxKeyAck| { &mut m.tx_derivations }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroGetTxKeyAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroGetTxKeyAck { - const NAME: &'static str = "MoneroGetTxKeyAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.salt = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.tx_keys = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.tx_derivations = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.salt.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.tx_keys.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.tx_derivations.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.salt.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.tx_keys.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.tx_derivations.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroGetTxKeyAck { - MoneroGetTxKeyAck::new() - } - - fn clear(&mut self) { - self.salt = ::std::option::Option::None; - self.tx_keys = ::std::option::Option::None; - self.tx_derivations = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroGetTxKeyAck { - static instance: MoneroGetTxKeyAck = MoneroGetTxKeyAck { - salt: ::std::option::Option::None, - tx_keys: ::std::option::Option::None, - tx_derivations: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroGetTxKeyAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroGetTxKeyAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroGetTxKeyAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroGetTxKeyAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroLiveRefreshStartRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest.network_type) - pub network_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStartRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStartRequest { - fn default() -> &'a MoneroLiveRefreshStartRequest { - ::default_instance() - } -} - -impl MoneroLiveRefreshStartRequest { - pub fn new() -> MoneroLiveRefreshStartRequest { - ::std::default::Default::default() - } - - // optional .hw.trezor.messages.monero.MoneroNetworkType network_type = 2; - - pub fn network_type(&self) -> MoneroNetworkType { - match self.network_type { - Some(e) => e.enum_value_or(MoneroNetworkType::MAINNET), - None => MoneroNetworkType::MAINNET, - } - } - - pub fn clear_network_type(&mut self) { - self.network_type = ::std::option::Option::None; - } - - pub fn has_network_type(&self) -> bool { - self.network_type.is_some() - } - - // Param is passed by value, moved - pub fn set_network_type(&mut self, v: MoneroNetworkType) { - self.network_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &MoneroLiveRefreshStartRequest| { &m.address_n }, - |m: &mut MoneroLiveRefreshStartRequest| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_type", - |m: &MoneroLiveRefreshStartRequest| { &m.network_type }, - |m: &mut MoneroLiveRefreshStartRequest| { &mut m.network_type }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroLiveRefreshStartRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroLiveRefreshStartRequest { - const NAME: &'static str = "MoneroLiveRefreshStartRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.network_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.network_type { - my_size += ::protobuf::rt::int32_size(2, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.network_type { - os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroLiveRefreshStartRequest { - MoneroLiveRefreshStartRequest::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.network_type = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroLiveRefreshStartRequest { - static instance: MoneroLiveRefreshStartRequest = MoneroLiveRefreshStartRequest { - address_n: ::std::vec::Vec::new(), - network_type: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroLiveRefreshStartRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStartRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroLiveRefreshStartRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStartRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStartAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroLiveRefreshStartAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStartAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStartAck { - fn default() -> &'a MoneroLiveRefreshStartAck { - ::default_instance() - } -} - -impl MoneroLiveRefreshStartAck { - pub fn new() -> MoneroLiveRefreshStartAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroLiveRefreshStartAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroLiveRefreshStartAck { - const NAME: &'static str = "MoneroLiveRefreshStartAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroLiveRefreshStartAck { - MoneroLiveRefreshStartAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroLiveRefreshStartAck { - static instance: MoneroLiveRefreshStartAck = MoneroLiveRefreshStartAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroLiveRefreshStartAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStartAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroLiveRefreshStartAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStartAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroLiveRefreshStepRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.out_key) - pub out_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.recv_deriv) - pub recv_deriv: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.real_out_idx) - pub real_out_idx: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.sub_addr_major) - pub sub_addr_major: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.sub_addr_minor) - pub sub_addr_minor: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStepRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStepRequest { - fn default() -> &'a MoneroLiveRefreshStepRequest { - ::default_instance() - } -} - -impl MoneroLiveRefreshStepRequest { - pub fn new() -> MoneroLiveRefreshStepRequest { - ::std::default::Default::default() - } - - // required bytes out_key = 1; - - pub fn out_key(&self) -> &[u8] { - match self.out_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_out_key(&mut self) { - self.out_key = ::std::option::Option::None; - } - - pub fn has_out_key(&self) -> bool { - self.out_key.is_some() - } - - // Param is passed by value, moved - pub fn set_out_key(&mut self, v: ::std::vec::Vec) { - self.out_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_out_key(&mut self) -> &mut ::std::vec::Vec { - if self.out_key.is_none() { - self.out_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.out_key.as_mut().unwrap() - } - - // Take field - pub fn take_out_key(&mut self) -> ::std::vec::Vec { - self.out_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes recv_deriv = 2; - - pub fn recv_deriv(&self) -> &[u8] { - match self.recv_deriv.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_recv_deriv(&mut self) { - self.recv_deriv = ::std::option::Option::None; - } - - pub fn has_recv_deriv(&self) -> bool { - self.recv_deriv.is_some() - } - - // Param is passed by value, moved - pub fn set_recv_deriv(&mut self, v: ::std::vec::Vec) { - self.recv_deriv = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_recv_deriv(&mut self) -> &mut ::std::vec::Vec { - if self.recv_deriv.is_none() { - self.recv_deriv = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.recv_deriv.as_mut().unwrap() - } - - // Take field - pub fn take_recv_deriv(&mut self) -> ::std::vec::Vec { - self.recv_deriv.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 real_out_idx = 3; - - pub fn real_out_idx(&self) -> u64 { - self.real_out_idx.unwrap_or(0) - } - - pub fn clear_real_out_idx(&mut self) { - self.real_out_idx = ::std::option::Option::None; - } - - pub fn has_real_out_idx(&self) -> bool { - self.real_out_idx.is_some() - } - - // Param is passed by value, moved - pub fn set_real_out_idx(&mut self, v: u64) { - self.real_out_idx = ::std::option::Option::Some(v); - } - - // required uint32 sub_addr_major = 4; - - pub fn sub_addr_major(&self) -> u32 { - self.sub_addr_major.unwrap_or(0) - } - - pub fn clear_sub_addr_major(&mut self) { - self.sub_addr_major = ::std::option::Option::None; - } - - pub fn has_sub_addr_major(&self) -> bool { - self.sub_addr_major.is_some() - } - - // Param is passed by value, moved - pub fn set_sub_addr_major(&mut self, v: u32) { - self.sub_addr_major = ::std::option::Option::Some(v); - } - - // required uint32 sub_addr_minor = 5; - - pub fn sub_addr_minor(&self) -> u32 { - self.sub_addr_minor.unwrap_or(0) - } - - pub fn clear_sub_addr_minor(&mut self) { - self.sub_addr_minor = ::std::option::Option::None; - } - - pub fn has_sub_addr_minor(&self) -> bool { - self.sub_addr_minor.is_some() - } - - // Param is passed by value, moved - pub fn set_sub_addr_minor(&mut self, v: u32) { - self.sub_addr_minor = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "out_key", - |m: &MoneroLiveRefreshStepRequest| { &m.out_key }, - |m: &mut MoneroLiveRefreshStepRequest| { &mut m.out_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "recv_deriv", - |m: &MoneroLiveRefreshStepRequest| { &m.recv_deriv }, - |m: &mut MoneroLiveRefreshStepRequest| { &mut m.recv_deriv }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "real_out_idx", - |m: &MoneroLiveRefreshStepRequest| { &m.real_out_idx }, - |m: &mut MoneroLiveRefreshStepRequest| { &mut m.real_out_idx }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sub_addr_major", - |m: &MoneroLiveRefreshStepRequest| { &m.sub_addr_major }, - |m: &mut MoneroLiveRefreshStepRequest| { &mut m.sub_addr_major }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sub_addr_minor", - |m: &MoneroLiveRefreshStepRequest| { &m.sub_addr_minor }, - |m: &mut MoneroLiveRefreshStepRequest| { &mut m.sub_addr_minor }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroLiveRefreshStepRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroLiveRefreshStepRequest { - const NAME: &'static str = "MoneroLiveRefreshStepRequest"; - - fn is_initialized(&self) -> bool { - if self.out_key.is_none() { - return false; - } - if self.recv_deriv.is_none() { - return false; - } - if self.real_out_idx.is_none() { - return false; - } - if self.sub_addr_major.is_none() { - return false; - } - if self.sub_addr_minor.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.out_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.recv_deriv = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.real_out_idx = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.sub_addr_major = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.sub_addr_minor = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.out_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.recv_deriv.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.real_out_idx { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.sub_addr_major { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.sub_addr_minor { - my_size += ::protobuf::rt::uint32_size(5, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.out_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.recv_deriv.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.real_out_idx { - os.write_uint64(3, v)?; - } - if let Some(v) = self.sub_addr_major { - os.write_uint32(4, v)?; - } - if let Some(v) = self.sub_addr_minor { - os.write_uint32(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroLiveRefreshStepRequest { - MoneroLiveRefreshStepRequest::new() - } - - fn clear(&mut self) { - self.out_key = ::std::option::Option::None; - self.recv_deriv = ::std::option::Option::None; - self.real_out_idx = ::std::option::Option::None; - self.sub_addr_major = ::std::option::Option::None; - self.sub_addr_minor = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroLiveRefreshStepRequest { - static instance: MoneroLiveRefreshStepRequest = MoneroLiveRefreshStepRequest { - out_key: ::std::option::Option::None, - recv_deriv: ::std::option::Option::None, - real_out_idx: ::std::option::Option::None, - sub_addr_major: ::std::option::Option::None, - sub_addr_minor: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroLiveRefreshStepRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStepRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroLiveRefreshStepRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStepRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshStepAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroLiveRefreshStepAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepAck.salt) - pub salt: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.MoneroLiveRefreshStepAck.key_image) - pub key_image: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshStepAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroLiveRefreshStepAck { - fn default() -> &'a MoneroLiveRefreshStepAck { - ::default_instance() - } -} - -impl MoneroLiveRefreshStepAck { - pub fn new() -> MoneroLiveRefreshStepAck { - ::std::default::Default::default() - } - - // optional bytes salt = 1; - - pub fn salt(&self) -> &[u8] { - match self.salt.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_salt(&mut self) { - self.salt = ::std::option::Option::None; - } - - pub fn has_salt(&self) -> bool { - self.salt.is_some() - } - - // Param is passed by value, moved - pub fn set_salt(&mut self, v: ::std::vec::Vec) { - self.salt = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_salt(&mut self) -> &mut ::std::vec::Vec { - if self.salt.is_none() { - self.salt = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.salt.as_mut().unwrap() - } - - // Take field - pub fn take_salt(&mut self) -> ::std::vec::Vec { - self.salt.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes key_image = 2; - - pub fn key_image(&self) -> &[u8] { - match self.key_image.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_key_image(&mut self) { - self.key_image = ::std::option::Option::None; - } - - pub fn has_key_image(&self) -> bool { - self.key_image.is_some() - } - - // Param is passed by value, moved - pub fn set_key_image(&mut self, v: ::std::vec::Vec) { - self.key_image = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key_image(&mut self) -> &mut ::std::vec::Vec { - if self.key_image.is_none() { - self.key_image = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.key_image.as_mut().unwrap() - } - - // Take field - pub fn take_key_image(&mut self) -> ::std::vec::Vec { - self.key_image.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "salt", - |m: &MoneroLiveRefreshStepAck| { &m.salt }, - |m: &mut MoneroLiveRefreshStepAck| { &mut m.salt }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key_image", - |m: &MoneroLiveRefreshStepAck| { &m.key_image }, - |m: &mut MoneroLiveRefreshStepAck| { &mut m.key_image }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroLiveRefreshStepAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroLiveRefreshStepAck { - const NAME: &'static str = "MoneroLiveRefreshStepAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.salt = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.key_image = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.salt.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.key_image.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.salt.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.key_image.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroLiveRefreshStepAck { - MoneroLiveRefreshStepAck::new() - } - - fn clear(&mut self) { - self.salt = ::std::option::Option::None; - self.key_image = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroLiveRefreshStepAck { - static instance: MoneroLiveRefreshStepAck = MoneroLiveRefreshStepAck { - salt: ::std::option::Option::None, - key_image: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroLiveRefreshStepAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshStepAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroLiveRefreshStepAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshStepAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshFinalRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroLiveRefreshFinalRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshFinalRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroLiveRefreshFinalRequest { - fn default() -> &'a MoneroLiveRefreshFinalRequest { - ::default_instance() - } -} - -impl MoneroLiveRefreshFinalRequest { - pub fn new() -> MoneroLiveRefreshFinalRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroLiveRefreshFinalRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroLiveRefreshFinalRequest { - const NAME: &'static str = "MoneroLiveRefreshFinalRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroLiveRefreshFinalRequest { - MoneroLiveRefreshFinalRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroLiveRefreshFinalRequest { - static instance: MoneroLiveRefreshFinalRequest = MoneroLiveRefreshFinalRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroLiveRefreshFinalRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshFinalRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroLiveRefreshFinalRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshFinalRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.MoneroLiveRefreshFinalAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoneroLiveRefreshFinalAck { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.MoneroLiveRefreshFinalAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoneroLiveRefreshFinalAck { - fn default() -> &'a MoneroLiveRefreshFinalAck { - ::default_instance() - } -} - -impl MoneroLiveRefreshFinalAck { - pub fn new() -> MoneroLiveRefreshFinalAck { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MoneroLiveRefreshFinalAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoneroLiveRefreshFinalAck { - const NAME: &'static str = "MoneroLiveRefreshFinalAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MoneroLiveRefreshFinalAck { - MoneroLiveRefreshFinalAck::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoneroLiveRefreshFinalAck { - static instance: MoneroLiveRefreshFinalAck = MoneroLiveRefreshFinalAck { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoneroLiveRefreshFinalAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MoneroLiveRefreshFinalAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoneroLiveRefreshFinalAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoneroLiveRefreshFinalAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.DebugMoneroDiagRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugMoneroDiagRequest { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.ins) - pub ins: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.p1) - pub p1: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.p2) - pub p2: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.pd) - pub pd: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.data1) - pub data1: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagRequest.data2) - pub data2: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.DebugMoneroDiagRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugMoneroDiagRequest { - fn default() -> &'a DebugMoneroDiagRequest { - ::default_instance() - } -} - -impl DebugMoneroDiagRequest { - pub fn new() -> DebugMoneroDiagRequest { - ::std::default::Default::default() - } - - // optional uint64 ins = 1; - - pub fn ins(&self) -> u64 { - self.ins.unwrap_or(0) - } - - pub fn clear_ins(&mut self) { - self.ins = ::std::option::Option::None; - } - - pub fn has_ins(&self) -> bool { - self.ins.is_some() - } - - // Param is passed by value, moved - pub fn set_ins(&mut self, v: u64) { - self.ins = ::std::option::Option::Some(v); - } - - // optional uint64 p1 = 2; - - pub fn p1(&self) -> u64 { - self.p1.unwrap_or(0) - } - - pub fn clear_p1(&mut self) { - self.p1 = ::std::option::Option::None; - } - - pub fn has_p1(&self) -> bool { - self.p1.is_some() - } - - // Param is passed by value, moved - pub fn set_p1(&mut self, v: u64) { - self.p1 = ::std::option::Option::Some(v); - } - - // optional uint64 p2 = 3; - - pub fn p2(&self) -> u64 { - self.p2.unwrap_or(0) - } - - pub fn clear_p2(&mut self) { - self.p2 = ::std::option::Option::None; - } - - pub fn has_p2(&self) -> bool { - self.p2.is_some() - } - - // Param is passed by value, moved - pub fn set_p2(&mut self, v: u64) { - self.p2 = ::std::option::Option::Some(v); - } - - // optional bytes data1 = 5; - - pub fn data1(&self) -> &[u8] { - match self.data1.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data1(&mut self) { - self.data1 = ::std::option::Option::None; - } - - pub fn has_data1(&self) -> bool { - self.data1.is_some() - } - - // Param is passed by value, moved - pub fn set_data1(&mut self, v: ::std::vec::Vec) { - self.data1 = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data1(&mut self) -> &mut ::std::vec::Vec { - if self.data1.is_none() { - self.data1 = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data1.as_mut().unwrap() - } - - // Take field - pub fn take_data1(&mut self) -> ::std::vec::Vec { - self.data1.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes data2 = 6; - - pub fn data2(&self) -> &[u8] { - match self.data2.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data2(&mut self) { - self.data2 = ::std::option::Option::None; - } - - pub fn has_data2(&self) -> bool { - self.data2.is_some() - } - - // Param is passed by value, moved - pub fn set_data2(&mut self, v: ::std::vec::Vec) { - self.data2 = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data2(&mut self) -> &mut ::std::vec::Vec { - if self.data2.is_none() { - self.data2 = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data2.as_mut().unwrap() - } - - // Take field - pub fn take_data2(&mut self) -> ::std::vec::Vec { - self.data2.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ins", - |m: &DebugMoneroDiagRequest| { &m.ins }, - |m: &mut DebugMoneroDiagRequest| { &mut m.ins }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "p1", - |m: &DebugMoneroDiagRequest| { &m.p1 }, - |m: &mut DebugMoneroDiagRequest| { &mut m.p1 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "p2", - |m: &DebugMoneroDiagRequest| { &m.p2 }, - |m: &mut DebugMoneroDiagRequest| { &mut m.p2 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "pd", - |m: &DebugMoneroDiagRequest| { &m.pd }, - |m: &mut DebugMoneroDiagRequest| { &mut m.pd }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data1", - |m: &DebugMoneroDiagRequest| { &m.data1 }, - |m: &mut DebugMoneroDiagRequest| { &mut m.data1 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data2", - |m: &DebugMoneroDiagRequest| { &m.data2 }, - |m: &mut DebugMoneroDiagRequest| { &mut m.data2 }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugMoneroDiagRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugMoneroDiagRequest { - const NAME: &'static str = "DebugMoneroDiagRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.ins = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.p1 = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.p2 = ::std::option::Option::Some(is.read_uint64()?); - }, - 34 => { - is.read_repeated_packed_uint64_into(&mut self.pd)?; - }, - 32 => { - self.pd.push(is.read_uint64()?); - }, - 42 => { - self.data1 = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.data2 = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.ins { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.p1 { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.p2 { - my_size += ::protobuf::rt::uint64_size(3, v); - } - for value in &self.pd { - my_size += ::protobuf::rt::uint64_size(4, *value); - }; - if let Some(v) = self.data1.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.data2.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.ins { - os.write_uint64(1, v)?; - } - if let Some(v) = self.p1 { - os.write_uint64(2, v)?; - } - if let Some(v) = self.p2 { - os.write_uint64(3, v)?; - } - for v in &self.pd { - os.write_uint64(4, *v)?; - }; - if let Some(v) = self.data1.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.data2.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugMoneroDiagRequest { - DebugMoneroDiagRequest::new() - } - - fn clear(&mut self) { - self.ins = ::std::option::Option::None; - self.p1 = ::std::option::Option::None; - self.p2 = ::std::option::Option::None; - self.pd.clear(); - self.data1 = ::std::option::Option::None; - self.data2 = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugMoneroDiagRequest { - static instance: DebugMoneroDiagRequest = DebugMoneroDiagRequest { - ins: ::std::option::Option::None, - p1: ::std::option::Option::None, - p2: ::std::option::Option::None, - pd: ::std::vec::Vec::new(), - data1: ::std::option::Option::None, - data2: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugMoneroDiagRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugMoneroDiagRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugMoneroDiagRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugMoneroDiagRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.monero.DebugMoneroDiagAck) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct DebugMoneroDiagAck { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.ins) - pub ins: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.p1) - pub p1: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.p2) - pub p2: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.pd) - pub pd: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.data1) - pub data1: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.monero.DebugMoneroDiagAck.data2) - pub data2: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.monero.DebugMoneroDiagAck.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a DebugMoneroDiagAck { - fn default() -> &'a DebugMoneroDiagAck { - ::default_instance() - } -} - -impl DebugMoneroDiagAck { - pub fn new() -> DebugMoneroDiagAck { - ::std::default::Default::default() - } - - // optional uint64 ins = 1; - - pub fn ins(&self) -> u64 { - self.ins.unwrap_or(0) - } - - pub fn clear_ins(&mut self) { - self.ins = ::std::option::Option::None; - } - - pub fn has_ins(&self) -> bool { - self.ins.is_some() - } - - // Param is passed by value, moved - pub fn set_ins(&mut self, v: u64) { - self.ins = ::std::option::Option::Some(v); - } - - // optional uint64 p1 = 2; - - pub fn p1(&self) -> u64 { - self.p1.unwrap_or(0) - } - - pub fn clear_p1(&mut self) { - self.p1 = ::std::option::Option::None; - } - - pub fn has_p1(&self) -> bool { - self.p1.is_some() - } - - // Param is passed by value, moved - pub fn set_p1(&mut self, v: u64) { - self.p1 = ::std::option::Option::Some(v); - } - - // optional uint64 p2 = 3; - - pub fn p2(&self) -> u64 { - self.p2.unwrap_or(0) - } - - pub fn clear_p2(&mut self) { - self.p2 = ::std::option::Option::None; - } - - pub fn has_p2(&self) -> bool { - self.p2.is_some() - } - - // Param is passed by value, moved - pub fn set_p2(&mut self, v: u64) { - self.p2 = ::std::option::Option::Some(v); - } - - // optional bytes data1 = 5; - - pub fn data1(&self) -> &[u8] { - match self.data1.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data1(&mut self) { - self.data1 = ::std::option::Option::None; - } - - pub fn has_data1(&self) -> bool { - self.data1.is_some() - } - - // Param is passed by value, moved - pub fn set_data1(&mut self, v: ::std::vec::Vec) { - self.data1 = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data1(&mut self) -> &mut ::std::vec::Vec { - if self.data1.is_none() { - self.data1 = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data1.as_mut().unwrap() - } - - // Take field - pub fn take_data1(&mut self) -> ::std::vec::Vec { - self.data1.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes data2 = 6; - - pub fn data2(&self) -> &[u8] { - match self.data2.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data2(&mut self) { - self.data2 = ::std::option::Option::None; - } - - pub fn has_data2(&self) -> bool { - self.data2.is_some() - } - - // Param is passed by value, moved - pub fn set_data2(&mut self, v: ::std::vec::Vec) { - self.data2 = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data2(&mut self) -> &mut ::std::vec::Vec { - if self.data2.is_none() { - self.data2 = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data2.as_mut().unwrap() - } - - // Take field - pub fn take_data2(&mut self) -> ::std::vec::Vec { - self.data2.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ins", - |m: &DebugMoneroDiagAck| { &m.ins }, - |m: &mut DebugMoneroDiagAck| { &mut m.ins }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "p1", - |m: &DebugMoneroDiagAck| { &m.p1 }, - |m: &mut DebugMoneroDiagAck| { &mut m.p1 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "p2", - |m: &DebugMoneroDiagAck| { &m.p2 }, - |m: &mut DebugMoneroDiagAck| { &mut m.p2 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "pd", - |m: &DebugMoneroDiagAck| { &m.pd }, - |m: &mut DebugMoneroDiagAck| { &mut m.pd }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data1", - |m: &DebugMoneroDiagAck| { &m.data1 }, - |m: &mut DebugMoneroDiagAck| { &mut m.data1 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data2", - |m: &DebugMoneroDiagAck| { &m.data2 }, - |m: &mut DebugMoneroDiagAck| { &mut m.data2 }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "DebugMoneroDiagAck", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for DebugMoneroDiagAck { - const NAME: &'static str = "DebugMoneroDiagAck"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.ins = ::std::option::Option::Some(is.read_uint64()?); - }, - 16 => { - self.p1 = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.p2 = ::std::option::Option::Some(is.read_uint64()?); - }, - 34 => { - is.read_repeated_packed_uint64_into(&mut self.pd)?; - }, - 32 => { - self.pd.push(is.read_uint64()?); - }, - 42 => { - self.data1 = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.data2 = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.ins { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.p1 { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.p2 { - my_size += ::protobuf::rt::uint64_size(3, v); - } - for value in &self.pd { - my_size += ::protobuf::rt::uint64_size(4, *value); - }; - if let Some(v) = self.data1.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.data2.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.ins { - os.write_uint64(1, v)?; - } - if let Some(v) = self.p1 { - os.write_uint64(2, v)?; - } - if let Some(v) = self.p2 { - os.write_uint64(3, v)?; - } - for v in &self.pd { - os.write_uint64(4, *v)?; - }; - if let Some(v) = self.data1.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.data2.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> DebugMoneroDiagAck { - DebugMoneroDiagAck::new() - } - - fn clear(&mut self) { - self.ins = ::std::option::Option::None; - self.p1 = ::std::option::Option::None; - self.p2 = ::std::option::Option::None; - self.pd.clear(); - self.data1 = ::std::option::Option::None; - self.data2 = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static DebugMoneroDiagAck { - static instance: DebugMoneroDiagAck = DebugMoneroDiagAck { - ins: ::std::option::Option::None, - p1: ::std::option::Option::None, - p2: ::std::option::Option::None, - pd: ::std::vec::Vec::new(), - data1: ::std::option::Option::None, - data2: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for DebugMoneroDiagAck { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugMoneroDiagAck").unwrap()).clone() - } -} - -impl ::std::fmt::Display for DebugMoneroDiagAck { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DebugMoneroDiagAck { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.monero.MoneroNetworkType) -pub enum MoneroNetworkType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.MAINNET) - MAINNET = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.TESTNET) - TESTNET = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.STAGENET) - STAGENET = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.monero.MoneroNetworkType.FAKECHAIN) - FAKECHAIN = 3, -} - -impl ::protobuf::Enum for MoneroNetworkType { - const NAME: &'static str = "MoneroNetworkType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(MoneroNetworkType::MAINNET), - 1 => ::std::option::Option::Some(MoneroNetworkType::TESTNET), - 2 => ::std::option::Option::Some(MoneroNetworkType::STAGENET), - 3 => ::std::option::Option::Some(MoneroNetworkType::FAKECHAIN), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "MAINNET" => ::std::option::Option::Some(MoneroNetworkType::MAINNET), - "TESTNET" => ::std::option::Option::Some(MoneroNetworkType::TESTNET), - "STAGENET" => ::std::option::Option::Some(MoneroNetworkType::STAGENET), - "FAKECHAIN" => ::std::option::Option::Some(MoneroNetworkType::FAKECHAIN), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [MoneroNetworkType] = &[ - MoneroNetworkType::MAINNET, - MoneroNetworkType::TESTNET, - MoneroNetworkType::STAGENET, - MoneroNetworkType::FAKECHAIN, - ]; -} - -impl ::protobuf::EnumFull for MoneroNetworkType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("MoneroNetworkType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for MoneroNetworkType { - fn default() -> Self { - MoneroNetworkType::MAINNET - } -} - -impl MoneroNetworkType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MoneroNetworkType") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x15messages-monero.proto\x12\x19hw.trezor.messages.monero\"\xc9\x06\n\ - \x1cMoneroTransactionSourceEntry\x12c\n\x07outputs\x18\x01\x20\x03(\x0b2\ - I.hw.trezor.messages.monero.MoneroTransactionSourceEntry.MoneroOutputEnt\ - ryR\x07outputs\x12\x1f\n\x0breal_output\x18\x02\x20\x01(\x04R\nrealOutpu\ - t\x12%\n\x0freal_out_tx_key\x18\x03\x20\x01(\x0cR\x0crealOutTxKey\x12<\n\ - \x1breal_out_additional_tx_keys\x18\x04\x20\x03(\x0cR\x17realOutAddition\ - alTxKeys\x124\n\x17real_output_in_tx_index\x18\x05\x20\x01(\x04R\x13real\ - OutputInTxIndex\x12\x16\n\x06amount\x18\x06\x20\x01(\x04R\x06amount\x12\ - \x10\n\x03rct\x18\x07\x20\x01(\x08R\x03rct\x12\x12\n\x04mask\x18\x08\x20\ - \x01(\x0cR\x04mask\x12r\n\x0emultisig_kLRki\x18\t\x20\x01(\x0b2K.hw.trez\ - or.messages.monero.MoneroTransactionSourceEntry.MoneroMultisigKLRkiR\rmu\ - ltisigKLRki\x12#\n\rsubaddr_minor\x18\n\x20\x01(\rR\x0csubaddrMinor\x1a\ - \xdf\x01\n\x11MoneroOutputEntry\x12\x10\n\x03idx\x18\x01\x20\x01(\x04R\ - \x03idx\x12n\n\x03key\x18\x02\x20\x01(\x0b2\\.hw.trezor.messages.monero.\ - MoneroTransactionSourceEntry.MoneroOutputEntry.MoneroRctKeyPublicR\x03ke\ - y\x1aH\n\x12MoneroRctKeyPublic\x12\x12\n\x04dest\x18\x01\x20\x02(\x0cR\ - \x04dest\x12\x1e\n\ncommitment\x18\x02\x20\x02(\x0cR\ncommitment\x1aO\n\ - \x13MoneroMultisigKLRki\x12\x0c\n\x01K\x18\x01\x20\x01(\x0cR\x01K\x12\ - \x0c\n\x01L\x18\x02\x20\x01(\x0cR\x01L\x12\x0c\n\x01R\x18\x03\x20\x01(\ - \x0cR\x01R\x12\x0e\n\x02ki\x18\x04\x20\x01(\x0cR\x02ki\"\xfe\x02\n!Moner\ - oTransactionDestinationEntry\x12\x16\n\x06amount\x18\x01\x20\x01(\x04R\ - \x06amount\x12k\n\x04addr\x18\x02\x20\x01(\x0b2W.hw.trezor.messages.mone\ - ro.MoneroTransactionDestinationEntry.MoneroAccountPublicAddressR\x04addr\ - \x12#\n\ris_subaddress\x18\x03\x20\x01(\x08R\x0cisSubaddress\x12\x1a\n\ - \x08original\x18\x04\x20\x01(\x0cR\x08original\x12#\n\ris_integrated\x18\ - \x05\x20\x01(\x08R\x0cisIntegrated\x1an\n\x1aMoneroAccountPublicAddress\ - \x12(\n\x10spend_public_key\x18\x01\x20\x01(\x0cR\x0espendPublicKey\x12&\ - \n\x0fview_public_key\x18\x02\x20\x01(\x0cR\rviewPublicKey\"\xdd\x01\n\ - \x19MoneroTransactionRsigData\x12\x1b\n\trsig_type\x18\x01\x20\x01(\rR\ - \x08rsigType\x12!\n\x0coffload_type\x18\x02\x20\x01(\rR\x0boffloadType\ - \x12\x1a\n\x08grouping\x18\x03\x20\x03(\x04R\x08grouping\x12\x12\n\x04ma\ - sk\x18\x04\x20\x01(\x0cR\x04mask\x12\x12\n\x04rsig\x18\x05\x20\x01(\x0cR\ - \x04rsig\x12\x1d\n\nrsig_parts\x18\x06\x20\x03(\x0cR\trsigParts\x12\x1d\ - \n\nbp_version\x18\x07\x20\x01(\rR\tbpVersion\"\x97\x02\n\x10MoneroGetAd\ - dress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0csho\ - w_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12X\n\x0cnetwork_type\ - \x18\x03\x20\x01(\x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07\ - MAINNETR\x0bnetworkType\x12\x18\n\x07account\x18\x04\x20\x01(\rR\x07acco\ - unt\x12\x14\n\x05minor\x18\x05\x20\x01(\rR\x05minor\x12\x1d\n\npayment_i\ - d\x18\x06\x20\x01(\x0cR\tpaymentId\x12\x1a\n\x08chunkify\x18\x07\x20\x01\ - (\x08R\x08chunkify\")\n\rMoneroAddress\x12\x18\n\x07address\x18\x01\x20\ - \x01(\x0cR\x07address\"\x8a\x01\n\x11MoneroGetWatchKey\x12\x1b\n\taddres\ - s_n\x18\x01\x20\x03(\rR\x08addressN\x12X\n\x0cnetwork_type\x18\x02\x20\ - \x01(\x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07MAINNETR\x0b\ - networkType\"G\n\x0eMoneroWatchKey\x12\x1b\n\twatch_key\x18\x01\x20\x01(\ - \x0cR\x08watchKey\x12\x18\n\x07address\x18\x02\x20\x01(\x0cR\x07address\ - \"\xd1\x07\n\x1cMoneroTransactionInitRequest\x12\x18\n\x07version\x18\ - \x01\x20\x01(\rR\x07version\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08\ - addressN\x12X\n\x0cnetwork_type\x18\x03\x20\x01(\x0e2,.hw.trezor.message\ - s.monero.MoneroNetworkType:\x07MAINNETR\x0bnetworkType\x12h\n\x08tsx_dat\ - a\x18\x04\x20\x01(\x0b2M.hw.trezor.messages.monero.MoneroTransactionInit\ - Request.MoneroTransactionDataR\x07tsxData\x1a\xb5\x05\n\x15MoneroTransac\ - tionData\x12\x18\n\x07version\x18\x01\x20\x01(\rR\x07version\x12\x1d\n\n\ - payment_id\x18\x02\x20\x01(\x0cR\tpaymentId\x12\x1f\n\x0bunlock_time\x18\ - \x03\x20\x01(\x04R\nunlockTime\x12V\n\x07outputs\x18\x04\x20\x03(\x0b2<.\ - hw.trezor.messages.monero.MoneroTransactionDestinationEntryR\x07outputs\ - \x12[\n\nchange_dts\x18\x05\x20\x01(\x0b2<.hw.trezor.messages.monero.Mon\ - eroTransactionDestinationEntryR\tchangeDts\x12\x1d\n\nnum_inputs\x18\x06\ - \x20\x01(\rR\tnumInputs\x12\x14\n\x05mixin\x18\x07\x20\x01(\rR\x05mixin\ - \x12\x10\n\x03fee\x18\x08\x20\x01(\x04R\x03fee\x12\x18\n\x07account\x18\ - \t\x20\x01(\rR\x07account\x12#\n\rminor_indices\x18\n\x20\x03(\rR\x0cmin\ - orIndices\x12Q\n\trsig_data\x18\x0b\x20\x01(\x0b24.hw.trezor.messages.mo\ - nero.MoneroTransactionRsigDataR\x08rsigData\x12-\n\x12integrated_indices\ - \x18\x0c\x20\x03(\rR\x11integratedIndices\x12%\n\x0eclient_version\x18\r\ - \x20\x01(\rR\rclientVersion\x12\x1b\n\thard_fork\x18\x0e\x20\x01(\rR\x08\ - hardFork\x12%\n\x0emonero_version\x18\x0f\x20\x01(\x0cR\rmoneroVersion\ - \x12\x1a\n\x08chunkify\x18\x10\x20\x01(\x08R\x08chunkify\"\x83\x01\n\x18\ - MoneroTransactionInitAck\x12\x14\n\x05hmacs\x18\x01\x20\x03(\x0cR\x05hma\ - cs\x12Q\n\trsig_data\x18\x02\x20\x01(\x0b24.hw.trezor.messages.monero.Mo\ - neroTransactionRsigDataR\x08rsigData\"v\n\x20MoneroTransactionSetInputRe\ - quest\x12R\n\x08src_entr\x18\x01\x20\x01(\x0b27.hw.trezor.messages.moner\ - o.MoneroTransactionSourceEntryR\x07srcEntr\"\xdd\x01\n\x1cMoneroTransact\ - ionSetInputAck\x12\x12\n\x04vini\x18\x01\x20\x01(\x0cR\x04vini\x12\x1b\n\ - \tvini_hmac\x18\x02\x20\x01(\x0cR\x08viniHmac\x12\x1d\n\npseudo_out\x18\ - \x03\x20\x01(\x0cR\tpseudoOut\x12&\n\x0fpseudo_out_hmac\x18\x04\x20\x01(\ - \x0cR\rpseudoOutHmac\x12(\n\x10pseudo_out_alpha\x18\x05\x20\x01(\x0cR\ - \x0epseudoOutAlpha\x12\x1b\n\tspend_key\x18\x06\x20\x01(\x0cR\x08spendKe\ - y\"\x8a\x02\n!MoneroTransactionInputViniRequest\x12R\n\x08src_entr\x18\ - \x01\x20\x01(\x0b27.hw.trezor.messages.monero.MoneroTransactionSourceEnt\ - ryR\x07srcEntr\x12\x12\n\x04vini\x18\x02\x20\x01(\x0cR\x04vini\x12\x1b\n\ - \tvini_hmac\x18\x03\x20\x01(\x0cR\x08viniHmac\x12\x1d\n\npseudo_out\x18\ - \x04\x20\x01(\x0cR\tpseudoOut\x12&\n\x0fpseudo_out_hmac\x18\x05\x20\x01(\ - \x0cR\rpseudoOutHmac\x12\x19\n\x08orig_idx\x18\x06\x20\x01(\rR\x07origId\ - x\"\x1f\n\x1dMoneroTransactionInputViniAck\"&\n$MoneroTransactionAllInpu\ - tsSetRequest\"u\n\x20MoneroTransactionAllInputsSetAck\x12Q\n\trsig_data\ - \x18\x01\x20\x01(\x0b24.hw.trezor.messages.monero.MoneroTransactionRsigD\ - ataR\x08rsigData\"\x9b\x02\n!MoneroTransactionSetOutputRequest\x12W\n\ - \x08dst_entr\x18\x01\x20\x01(\x0b2<.hw.trezor.messages.monero.MoneroTran\ - sactionDestinationEntryR\x07dstEntr\x12\"\n\rdst_entr_hmac\x18\x02\x20\ - \x01(\x0cR\x0bdstEntrHmac\x12Q\n\trsig_data\x18\x03\x20\x01(\x0b24.hw.tr\ - ezor.messages.monero.MoneroTransactionRsigDataR\x08rsigData\x12&\n\x0fis\ - _offloaded_bp\x18\x04\x20\x01(\x08R\risOffloadedBp\"\xdc\x01\n\x1dMonero\ - TransactionSetOutputAck\x12\x15\n\x06tx_out\x18\x01\x20\x01(\x0cR\x05txO\ - ut\x12\x1d\n\nvouti_hmac\x18\x02\x20\x01(\x0cR\tvoutiHmac\x12Q\n\trsig_d\ - ata\x18\x03\x20\x01(\x0b24.hw.trezor.messages.monero.MoneroTransactionRs\ - igDataR\x08rsigData\x12\x15\n\x06out_pk\x18\x04\x20\x01(\x0cR\x05outPk\ - \x12\x1b\n\tecdh_info\x18\x05\x20\x01(\x0cR\x08ecdhInfo\"v\n!MoneroTrans\ - actionAllOutSetRequest\x12Q\n\trsig_data\x18\x01\x20\x01(\x0b24.hw.trezo\ - r.messages.monero.MoneroTransactionRsigDataR\x08rsigData\"\xc0\x02\n\x1d\ - MoneroTransactionAllOutSetAck\x12\x14\n\x05extra\x18\x01\x20\x01(\x0cR\ - \x05extra\x12$\n\x0etx_prefix_hash\x18\x02\x20\x01(\x0cR\x0ctxPrefixHash\ - \x12X\n\x02rv\x18\x04\x20\x01(\x0b2H.hw.trezor.messages.monero.MoneroTra\ - nsactionAllOutSetAck.MoneroRingCtSigR\x02rv\x12*\n\x11full_message_hash\ - \x18\x05\x20\x01(\x0cR\x0ffullMessageHash\x1a]\n\x0fMoneroRingCtSig\x12\ - \x17\n\x07txn_fee\x18\x01\x20\x01(\x04R\x06txnFee\x12\x18\n\x07message\ - \x18\x02\x20\x01(\x0cR\x07message\x12\x17\n\x07rv_type\x18\x03\x20\x01(\ - \rR\x06rvType\"\xd1\x02\n!MoneroTransactionSignInputRequest\x12R\n\x08sr\ - c_entr\x18\x01\x20\x01(\x0b27.hw.trezor.messages.monero.MoneroTransactio\ - nSourceEntryR\x07srcEntr\x12\x12\n\x04vini\x18\x02\x20\x01(\x0cR\x04vini\ - \x12\x1b\n\tvini_hmac\x18\x03\x20\x01(\x0cR\x08viniHmac\x12\x1d\n\npseud\ - o_out\x18\x04\x20\x01(\x0cR\tpseudoOut\x12&\n\x0fpseudo_out_hmac\x18\x05\ - \x20\x01(\x0cR\rpseudoOutHmac\x12(\n\x10pseudo_out_alpha\x18\x06\x20\x01\ - (\x0cR\x0epseudoOutAlpha\x12\x1b\n\tspend_key\x18\x07\x20\x01(\x0cR\x08s\ - pendKey\x12\x19\n\x08orig_idx\x18\x08\x20\x01(\rR\x07origIdx\"\\\n\x1dMo\ - neroTransactionSignInputAck\x12\x1c\n\tsignature\x18\x01\x20\x01(\x0cR\t\ - signature\x12\x1d\n\npseudo_out\x18\x02\x20\x01(\x0cR\tpseudoOut\"\x1f\n\ - \x1dMoneroTransactionFinalRequest\"\xa8\x01\n\x19MoneroTransactionFinalA\ - ck\x12\x19\n\x08cout_key\x18\x01\x20\x01(\x0cR\x07coutKey\x12\x12\n\x04s\ - alt\x18\x02\x20\x01(\x0cR\x04salt\x12\x1b\n\trand_mult\x18\x03\x20\x01(\ - \x0cR\x08randMult\x12\x1e\n\x0btx_enc_keys\x18\x04\x20\x01(\x0cR\ttxEncK\ - eys\x12\x1f\n\x0bopening_key\x18\x05\x20\x01(\x0cR\nopeningKey\"\x88\x03\ - \n\x1fMoneroKeyImageExportInitRequest\x12\x10\n\x03num\x18\x01\x20\x02(\ - \x04R\x03num\x12\x12\n\x04hash\x18\x02\x20\x02(\x0cR\x04hash\x12\x1b\n\t\ - address_n\x18\x03\x20\x03(\rR\x08addressN\x12X\n\x0cnetwork_type\x18\x04\ - \x20\x01(\x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07MAINNETR\ - \x0bnetworkType\x12j\n\x04subs\x18\x05\x20\x03(\x0b2V.hw.trezor.messages\ - .monero.MoneroKeyImageExportInitRequest.MoneroSubAddressIndicesListR\x04\ - subs\x1a\\\n\x1bMoneroSubAddressIndicesList\x12\x18\n\x07account\x18\x01\ - \x20\x02(\rR\x07account\x12#\n\rminor_indices\x18\x02\x20\x03(\rR\x0cmin\ - orIndices\"\x1d\n\x1bMoneroKeyImageExportInitAck\"\x89\x03\n\x1dMoneroKe\ - yImageSyncStepRequest\x12b\n\x04tdis\x18\x01\x20\x03(\x0b2N.hw.trezor.me\ - ssages.monero.MoneroKeyImageSyncStepRequest.MoneroTransferDetailsR\x04td\ - is\x1a\x83\x02\n\x15MoneroTransferDetails\x12\x17\n\x07out_key\x18\x01\ - \x20\x02(\x0cR\x06outKey\x12\x1c\n\ntx_pub_key\x18\x02\x20\x02(\x0cR\x08\ - txPubKey\x123\n\x16additional_tx_pub_keys\x18\x03\x20\x03(\x0cR\x13addit\ - ionalTxPubKeys\x122\n\x15internal_output_index\x18\x04\x20\x02(\x04R\x13\ - internalOutputIndex\x12$\n\x0esub_addr_major\x18\x05\x20\x01(\rR\x0csubA\ - ddrMajor\x12$\n\x0esub_addr_minor\x18\x06\x20\x01(\rR\x0csubAddrMinor\"\ - \xb8\x01\n\x19MoneroKeyImageSyncStepAck\x12]\n\x03kis\x18\x01\x20\x03(\ - \x0b2K.hw.trezor.messages.monero.MoneroKeyImageSyncStepAck.MoneroExporte\ - dKeyImageR\x03kis\x1a<\n\x16MoneroExportedKeyImage\x12\x0e\n\x02iv\x18\ - \x01\x20\x01(\x0cR\x02iv\x12\x12\n\x04blob\x18\x03\x20\x01(\x0cR\x04blob\ - \"\x20\n\x1eMoneroKeyImageSyncFinalRequest\"5\n\x1aMoneroKeyImageSyncFin\ - alAck\x12\x17\n\x07enc_key\x18\x01\x20\x01(\x0cR\x06encKey\"\xc0\x02\n\ - \x15MoneroGetTxKeyRequest\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08ad\ - dressN\x12X\n\x0cnetwork_type\x18\x02\x20\x01(\x0e2,.hw.trezor.messages.\ - monero.MoneroNetworkType:\x07MAINNETR\x0bnetworkType\x12\x14\n\x05salt1\ - \x18\x03\x20\x02(\x0cR\x05salt1\x12\x14\n\x05salt2\x18\x04\x20\x02(\x0cR\ - \x05salt2\x12\x1e\n\x0btx_enc_keys\x18\x05\x20\x02(\x0cR\ttxEncKeys\x12$\ - \n\x0etx_prefix_hash\x18\x06\x20\x02(\x0cR\x0ctxPrefixHash\x12\x16\n\x06\ - reason\x18\x07\x20\x01(\rR\x06reason\x12&\n\x0fview_public_key\x18\x08\ - \x20\x01(\x0cR\rviewPublicKey\"g\n\x11MoneroGetTxKeyAck\x12\x12\n\x04sal\ - t\x18\x01\x20\x01(\x0cR\x04salt\x12\x17\n\x07tx_keys\x18\x02\x20\x01(\ - \x0cR\x06txKeys\x12%\n\x0etx_derivations\x18\x03\x20\x01(\x0cR\rtxDeriva\ - tions\"\x96\x01\n\x1dMoneroLiveRefreshStartRequest\x12\x1b\n\taddress_n\ - \x18\x01\x20\x03(\rR\x08addressN\x12X\n\x0cnetwork_type\x18\x02\x20\x01(\ - \x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07MAINNETR\x0bnetwo\ - rkType\"\x1b\n\x19MoneroLiveRefreshStartAck\"\xc4\x01\n\x1cMoneroLiveRef\ - reshStepRequest\x12\x17\n\x07out_key\x18\x01\x20\x02(\x0cR\x06outKey\x12\ - \x1d\n\nrecv_deriv\x18\x02\x20\x02(\x0cR\trecvDeriv\x12\x20\n\x0creal_ou\ - t_idx\x18\x03\x20\x02(\x04R\nrealOutIdx\x12$\n\x0esub_addr_major\x18\x04\ - \x20\x02(\rR\x0csubAddrMajor\x12$\n\x0esub_addr_minor\x18\x05\x20\x02(\r\ - R\x0csubAddrMinor\"K\n\x18MoneroLiveRefreshStepAck\x12\x12\n\x04salt\x18\ - \x01\x20\x01(\x0cR\x04salt\x12\x1b\n\tkey_image\x18\x02\x20\x01(\x0cR\ - \x08keyImage\"\x1f\n\x1dMoneroLiveRefreshFinalRequest\"\x1b\n\x19MoneroL\ - iveRefreshFinalAck\"\x86\x01\n\x16DebugMoneroDiagRequest\x12\x10\n\x03in\ - s\x18\x01\x20\x01(\x04R\x03ins\x12\x0e\n\x02p1\x18\x02\x20\x01(\x04R\x02\ - p1\x12\x0e\n\x02p2\x18\x03\x20\x01(\x04R\x02p2\x12\x0e\n\x02pd\x18\x04\ - \x20\x03(\x04R\x02pd\x12\x14\n\x05data1\x18\x05\x20\x01(\x0cR\x05data1\ - \x12\x14\n\x05data2\x18\x06\x20\x01(\x0cR\x05data2\"\x82\x01\n\x12DebugM\ - oneroDiagAck\x12\x10\n\x03ins\x18\x01\x20\x01(\x04R\x03ins\x12\x0e\n\x02\ - p1\x18\x02\x20\x01(\x04R\x02p1\x12\x0e\n\x02p2\x18\x03\x20\x01(\x04R\x02\ - p2\x12\x0e\n\x02pd\x18\x04\x20\x03(\x04R\x02pd\x12\x14\n\x05data1\x18\ - \x05\x20\x01(\x0cR\x05data1\x12\x14\n\x05data2\x18\x06\x20\x01(\x0cR\x05\ - data2*J\n\x11MoneroNetworkType\x12\x0b\n\x07MAINNET\x10\0\x12\x0b\n\x07T\ - ESTNET\x10\x01\x12\x0c\n\x08STAGENET\x10\x02\x12\r\n\tFAKECHAIN\x10\x03B\ - :\n#com.satoshilabs.trezor.lib.protobufB\x13TrezorMessageMonero\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(48); - messages.push(MoneroTransactionSourceEntry::generated_message_descriptor_data()); - messages.push(MoneroTransactionDestinationEntry::generated_message_descriptor_data()); - messages.push(MoneroTransactionRsigData::generated_message_descriptor_data()); - messages.push(MoneroGetAddress::generated_message_descriptor_data()); - messages.push(MoneroAddress::generated_message_descriptor_data()); - messages.push(MoneroGetWatchKey::generated_message_descriptor_data()); - messages.push(MoneroWatchKey::generated_message_descriptor_data()); - messages.push(MoneroTransactionInitRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionInitAck::generated_message_descriptor_data()); - messages.push(MoneroTransactionSetInputRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionSetInputAck::generated_message_descriptor_data()); - messages.push(MoneroTransactionInputViniRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionInputViniAck::generated_message_descriptor_data()); - messages.push(MoneroTransactionAllInputsSetRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionAllInputsSetAck::generated_message_descriptor_data()); - messages.push(MoneroTransactionSetOutputRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionSetOutputAck::generated_message_descriptor_data()); - messages.push(MoneroTransactionAllOutSetRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionAllOutSetAck::generated_message_descriptor_data()); - messages.push(MoneroTransactionSignInputRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionSignInputAck::generated_message_descriptor_data()); - messages.push(MoneroTransactionFinalRequest::generated_message_descriptor_data()); - messages.push(MoneroTransactionFinalAck::generated_message_descriptor_data()); - messages.push(MoneroKeyImageExportInitRequest::generated_message_descriptor_data()); - messages.push(MoneroKeyImageExportInitAck::generated_message_descriptor_data()); - messages.push(MoneroKeyImageSyncStepRequest::generated_message_descriptor_data()); - messages.push(MoneroKeyImageSyncStepAck::generated_message_descriptor_data()); - messages.push(MoneroKeyImageSyncFinalRequest::generated_message_descriptor_data()); - messages.push(MoneroKeyImageSyncFinalAck::generated_message_descriptor_data()); - messages.push(MoneroGetTxKeyRequest::generated_message_descriptor_data()); - messages.push(MoneroGetTxKeyAck::generated_message_descriptor_data()); - messages.push(MoneroLiveRefreshStartRequest::generated_message_descriptor_data()); - messages.push(MoneroLiveRefreshStartAck::generated_message_descriptor_data()); - messages.push(MoneroLiveRefreshStepRequest::generated_message_descriptor_data()); - messages.push(MoneroLiveRefreshStepAck::generated_message_descriptor_data()); - messages.push(MoneroLiveRefreshFinalRequest::generated_message_descriptor_data()); - messages.push(MoneroLiveRefreshFinalAck::generated_message_descriptor_data()); - messages.push(DebugMoneroDiagRequest::generated_message_descriptor_data()); - messages.push(DebugMoneroDiagAck::generated_message_descriptor_data()); - messages.push(monero_transaction_source_entry::MoneroOutputEntry::generated_message_descriptor_data()); - messages.push(monero_transaction_source_entry::MoneroMultisigKLRki::generated_message_descriptor_data()); - messages.push(monero_transaction_source_entry::monero_output_entry::MoneroRctKeyPublic::generated_message_descriptor_data()); - messages.push(monero_transaction_destination_entry::MoneroAccountPublicAddress::generated_message_descriptor_data()); - messages.push(monero_transaction_init_request::MoneroTransactionData::generated_message_descriptor_data()); - messages.push(monero_transaction_all_out_set_ack::MoneroRingCtSig::generated_message_descriptor_data()); - messages.push(monero_key_image_export_init_request::MoneroSubAddressIndicesList::generated_message_descriptor_data()); - messages.push(monero_key_image_sync_step_request::MoneroTransferDetails::generated_message_descriptor_data()); - messages.push(monero_key_image_sync_step_ack::MoneroExportedKeyImage::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(1); - enums.push(MoneroNetworkType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_nem.rs b/wallet/trezor-client/src/protos/generated/messages_nem.rs deleted file mode 100644 index e607f49f51..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_nem.rs +++ /dev/null @@ -1,4998 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-nem.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct NEMGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.network) - pub network: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a NEMGetAddress { - fn default() -> &'a NEMGetAddress { - ::default_instance() - } -} - -impl NEMGetAddress { - pub fn new() -> NEMGetAddress { - ::std::default::Default::default() - } - - // optional uint32 network = 2; - - pub fn network(&self) -> u32 { - self.network.unwrap_or(104u32) - } - - pub fn clear_network(&mut self) { - self.network = ::std::option::Option::None; - } - - pub fn has_network(&self) -> bool { - self.network.is_some() - } - - // Param is passed by value, moved - pub fn set_network(&mut self, v: u32) { - self.network = ::std::option::Option::Some(v); - } - - // optional bool show_display = 3; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 4; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &NEMGetAddress| { &m.address_n }, - |m: &mut NEMGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network", - |m: &NEMGetAddress| { &m.network }, - |m: &mut NEMGetAddress| { &mut m.network }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &NEMGetAddress| { &m.show_display }, - |m: &mut NEMGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &NEMGetAddress| { &m.chunkify }, - |m: &mut NEMGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for NEMGetAddress { - const NAME: &'static str = "NEMGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.network = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 32 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.network { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.network { - os.write_uint32(2, v)?; - } - if let Some(v) = self.show_display { - os.write_bool(3, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMGetAddress { - NEMGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.network = ::std::option::Option::None; - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMGetAddress { - static instance: NEMGetAddress = NEMGetAddress { - address_n: ::std::vec::Vec::new(), - network: ::std::option::Option::None, - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for NEMGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for NEMGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NEMGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct NEMAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a NEMAddress { - fn default() -> &'a NEMAddress { - ::default_instance() - } -} - -impl NEMAddress { - pub fn new() -> NEMAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &NEMAddress| { &m.address }, - |m: &mut NEMAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for NEMAddress { - const NAME: &'static str = "NEMAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMAddress { - NEMAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMAddress { - static instance: NEMAddress = NEMAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for NEMAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for NEMAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NEMAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct NEMSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.transaction) - pub transaction: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.multisig) - pub multisig: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.transfer) - pub transfer: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.cosigning) - pub cosigning: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.provision_namespace) - pub provision_namespace: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.mosaic_creation) - pub mosaic_creation: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.supply_change) - pub supply_change: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.aggregate_modification) - pub aggregate_modification: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.importance_transfer) - pub importance_transfer: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a NEMSignTx { - fn default() -> &'a NEMSignTx { - ::default_instance() - } -} - -impl NEMSignTx { - pub fn new() -> NEMSignTx { - ::std::default::Default::default() - } - - // optional bool cosigning = 4; - - pub fn cosigning(&self) -> bool { - self.cosigning.unwrap_or(false) - } - - pub fn clear_cosigning(&mut self) { - self.cosigning = ::std::option::Option::None; - } - - pub fn has_cosigning(&self) -> bool { - self.cosigning.is_some() - } - - // Param is passed by value, moved - pub fn set_cosigning(&mut self, v: bool) { - self.cosigning = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 10; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(10); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMTransactionCommon>( - "transaction", - |m: &NEMSignTx| { &m.transaction }, - |m: &mut NEMSignTx| { &mut m.transaction }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMTransactionCommon>( - "multisig", - |m: &NEMSignTx| { &m.multisig }, - |m: &mut NEMSignTx| { &mut m.multisig }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMTransfer>( - "transfer", - |m: &NEMSignTx| { &m.transfer }, - |m: &mut NEMSignTx| { &mut m.transfer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "cosigning", - |m: &NEMSignTx| { &m.cosigning }, - |m: &mut NEMSignTx| { &mut m.cosigning }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMProvisionNamespace>( - "provision_namespace", - |m: &NEMSignTx| { &m.provision_namespace }, - |m: &mut NEMSignTx| { &mut m.provision_namespace }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMMosaicCreation>( - "mosaic_creation", - |m: &NEMSignTx| { &m.mosaic_creation }, - |m: &mut NEMSignTx| { &mut m.mosaic_creation }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMMosaicSupplyChange>( - "supply_change", - |m: &NEMSignTx| { &m.supply_change }, - |m: &mut NEMSignTx| { &mut m.supply_change }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMAggregateModification>( - "aggregate_modification", - |m: &NEMSignTx| { &m.aggregate_modification }, - |m: &mut NEMSignTx| { &mut m.aggregate_modification }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemsign_tx::NEMImportanceTransfer>( - "importance_transfer", - |m: &NEMSignTx| { &m.importance_transfer }, - |m: &mut NEMSignTx| { &mut m.importance_transfer }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &NEMSignTx| { &m.chunkify }, - |m: &mut NEMSignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for NEMSignTx { - const NAME: &'static str = "NEMSignTx"; - - fn is_initialized(&self) -> bool { - if self.transaction.is_none() { - return false; - } - for v in &self.transaction { - if !v.is_initialized() { - return false; - } - }; - for v in &self.multisig { - if !v.is_initialized() { - return false; - } - }; - for v in &self.transfer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.provision_namespace { - if !v.is_initialized() { - return false; - } - }; - for v in &self.mosaic_creation { - if !v.is_initialized() { - return false; - } - }; - for v in &self.supply_change { - if !v.is_initialized() { - return false; - } - }; - for v in &self.aggregate_modification { - if !v.is_initialized() { - return false; - } - }; - for v in &self.importance_transfer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.transaction)?; - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.multisig)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; - }, - 32 => { - self.cosigning = ::std::option::Option::Some(is.read_bool()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.provision_namespace)?; - }, - 50 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.mosaic_creation)?; - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.supply_change)?; - }, - 66 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.aggregate_modification)?; - }, - 74 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.importance_transfer)?; - }, - 80 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.transaction.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.multisig.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.transfer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.cosigning { - my_size += 1 + 1; - } - if let Some(v) = self.provision_namespace.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.mosaic_creation.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.supply_change.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.aggregate_modification.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.importance_transfer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.transaction.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.multisig.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.transfer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.cosigning { - os.write_bool(4, v)?; - } - if let Some(v) = self.provision_namespace.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.mosaic_creation.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - } - if let Some(v) = self.supply_change.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.aggregate_modification.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; - } - if let Some(v) = self.importance_transfer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; - } - if let Some(v) = self.chunkify { - os.write_bool(10, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMSignTx { - NEMSignTx::new() - } - - fn clear(&mut self) { - self.transaction.clear(); - self.multisig.clear(); - self.transfer.clear(); - self.cosigning = ::std::option::Option::None; - self.provision_namespace.clear(); - self.mosaic_creation.clear(); - self.supply_change.clear(); - self.aggregate_modification.clear(); - self.importance_transfer.clear(); - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMSignTx { - static instance: NEMSignTx = NEMSignTx { - transaction: ::protobuf::MessageField::none(), - multisig: ::protobuf::MessageField::none(), - transfer: ::protobuf::MessageField::none(), - cosigning: ::std::option::Option::None, - provision_namespace: ::protobuf::MessageField::none(), - mosaic_creation: ::protobuf::MessageField::none(), - supply_change: ::protobuf::MessageField::none(), - aggregate_modification: ::protobuf::MessageField::none(), - importance_transfer: ::protobuf::MessageField::none(), - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for NEMSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for NEMSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NEMSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `NEMSignTx` -pub mod nemsign_tx { - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMTransactionCommon { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.network) - pub network: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.timestamp) - pub timestamp: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.deadline) - pub deadline: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.signer) - pub signer: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommon.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMTransactionCommon { - fn default() -> &'a NEMTransactionCommon { - ::default_instance() - } - } - - impl NEMTransactionCommon { - pub fn new() -> NEMTransactionCommon { - ::std::default::Default::default() - } - - // optional uint32 network = 2; - - pub fn network(&self) -> u32 { - self.network.unwrap_or(104u32) - } - - pub fn clear_network(&mut self) { - self.network = ::std::option::Option::None; - } - - pub fn has_network(&self) -> bool { - self.network.is_some() - } - - // Param is passed by value, moved - pub fn set_network(&mut self, v: u32) { - self.network = ::std::option::Option::Some(v); - } - - // required uint32 timestamp = 3; - - pub fn timestamp(&self) -> u32 { - self.timestamp.unwrap_or(0) - } - - pub fn clear_timestamp(&mut self) { - self.timestamp = ::std::option::Option::None; - } - - pub fn has_timestamp(&self) -> bool { - self.timestamp.is_some() - } - - // Param is passed by value, moved - pub fn set_timestamp(&mut self, v: u32) { - self.timestamp = ::std::option::Option::Some(v); - } - - // required uint64 fee = 4; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // required uint32 deadline = 5; - - pub fn deadline(&self) -> u32 { - self.deadline.unwrap_or(0) - } - - pub fn clear_deadline(&mut self) { - self.deadline = ::std::option::Option::None; - } - - pub fn has_deadline(&self) -> bool { - self.deadline.is_some() - } - - // Param is passed by value, moved - pub fn set_deadline(&mut self, v: u32) { - self.deadline = ::std::option::Option::Some(v); - } - - // optional bytes signer = 6; - - pub fn signer(&self) -> &[u8] { - match self.signer.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signer(&mut self) { - self.signer = ::std::option::Option::None; - } - - pub fn has_signer(&self) -> bool { - self.signer.is_some() - } - - // Param is passed by value, moved - pub fn set_signer(&mut self, v: ::std::vec::Vec) { - self.signer = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signer(&mut self) -> &mut ::std::vec::Vec { - if self.signer.is_none() { - self.signer = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signer.as_mut().unwrap() - } - - // Take field - pub fn take_signer(&mut self) -> ::std::vec::Vec { - self.signer.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &NEMTransactionCommon| { &m.address_n }, - |m: &mut NEMTransactionCommon| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network", - |m: &NEMTransactionCommon| { &m.network }, - |m: &mut NEMTransactionCommon| { &mut m.network }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "timestamp", - |m: &NEMTransactionCommon| { &m.timestamp }, - |m: &mut NEMTransactionCommon| { &mut m.timestamp }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &NEMTransactionCommon| { &m.fee }, - |m: &mut NEMTransactionCommon| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "deadline", - |m: &NEMTransactionCommon| { &m.deadline }, - |m: &mut NEMTransactionCommon| { &mut m.deadline }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signer", - |m: &NEMTransactionCommon| { &m.signer }, - |m: &mut NEMTransactionCommon| { &mut m.signer }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMTransactionCommon", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMTransactionCommon { - const NAME: &'static str = "NEMTransactionCommon"; - - fn is_initialized(&self) -> bool { - if self.timestamp.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - if self.deadline.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.network = ::std::option::Option::Some(is.read_uint32()?); - }, - 24 => { - self.timestamp = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.deadline = ::std::option::Option::Some(is.read_uint32()?); - }, - 50 => { - self.signer = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.network { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.timestamp { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.deadline { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.signer.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.network { - os.write_uint32(2, v)?; - } - if let Some(v) = self.timestamp { - os.write_uint32(3, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(4, v)?; - } - if let Some(v) = self.deadline { - os.write_uint32(5, v)?; - } - if let Some(v) = self.signer.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMTransactionCommon { - NEMTransactionCommon::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.network = ::std::option::Option::None; - self.timestamp = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.deadline = ::std::option::Option::None; - self.signer = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMTransactionCommon { - static instance: NEMTransactionCommon = NEMTransactionCommon { - address_n: ::std::vec::Vec::new(), - network: ::std::option::Option::None, - timestamp: ::std::option::Option::None, - fee: ::std::option::Option::None, - deadline: ::std::option::Option::None, - signer: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMTransactionCommon { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMTransactionCommon").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMTransactionCommon { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMTransactionCommon { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMTransfer) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMTransfer { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.recipient) - pub recipient: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.payload) - pub payload: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.mosaics) - pub mosaics: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMTransfer { - fn default() -> &'a NEMTransfer { - ::default_instance() - } - } - - impl NEMTransfer { - pub fn new() -> NEMTransfer { - ::std::default::Default::default() - } - - // required string recipient = 1; - - pub fn recipient(&self) -> &str { - match self.recipient.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_recipient(&mut self) { - self.recipient = ::std::option::Option::None; - } - - pub fn has_recipient(&self) -> bool { - self.recipient.is_some() - } - - // Param is passed by value, moved - pub fn set_recipient(&mut self, v: ::std::string::String) { - self.recipient = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_recipient(&mut self) -> &mut ::std::string::String { - if self.recipient.is_none() { - self.recipient = ::std::option::Option::Some(::std::string::String::new()); - } - self.recipient.as_mut().unwrap() - } - - // Take field - pub fn take_recipient(&mut self) -> ::std::string::String { - self.recipient.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 amount = 2; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional bytes payload = 3; - - pub fn payload(&self) -> &[u8] { - match self.payload.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_payload(&mut self) { - self.payload = ::std::option::Option::None; - } - - pub fn has_payload(&self) -> bool { - self.payload.is_some() - } - - // Param is passed by value, moved - pub fn set_payload(&mut self, v: ::std::vec::Vec) { - self.payload = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { - if self.payload.is_none() { - self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.payload.as_mut().unwrap() - } - - // Take field - pub fn take_payload(&mut self) -> ::std::vec::Vec { - self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes public_key = 4; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "recipient", - |m: &NEMTransfer| { &m.recipient }, - |m: &mut NEMTransfer| { &mut m.recipient }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &NEMTransfer| { &m.amount }, - |m: &mut NEMTransfer| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payload", - |m: &NEMTransfer| { &m.payload }, - |m: &mut NEMTransfer| { &mut m.payload }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &NEMTransfer| { &m.public_key }, - |m: &mut NEMTransfer| { &mut m.public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "mosaics", - |m: &NEMTransfer| { &m.mosaics }, - |m: &mut NEMTransfer| { &mut m.mosaics }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMTransfer", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMTransfer { - const NAME: &'static str = "NEMTransfer"; - - fn is_initialized(&self) -> bool { - if self.recipient.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - for v in &self.mosaics { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.recipient = ::std::option::Option::Some(is.read_string()?); - }, - 16 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - self.payload = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 42 => { - self.mosaics.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.recipient.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.payload.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - for value in &self.mosaics { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.recipient.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.amount { - os.write_uint64(2, v)?; - } - if let Some(v) = self.payload.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(4, v)?; - } - for v in &self.mosaics { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMTransfer { - NEMTransfer::new() - } - - fn clear(&mut self) { - self.recipient = ::std::option::Option::None; - self.amount = ::std::option::Option::None; - self.payload = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.mosaics.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMTransfer { - static instance: NEMTransfer = NEMTransfer { - recipient: ::std::option::Option::None, - amount: ::std::option::Option::None, - payload: ::std::option::Option::None, - public_key: ::std::option::Option::None, - mosaics: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMTransfer { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMTransfer").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMTransfer { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMTransfer { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `NEMTransfer` - pub mod nemtransfer { - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMMosaic { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.namespace) - pub namespace: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.mosaic) - pub mosaic: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.quantity) - pub quantity: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMTransfer.NEMMosaic.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMMosaic { - fn default() -> &'a NEMMosaic { - ::default_instance() - } - } - - impl NEMMosaic { - pub fn new() -> NEMMosaic { - ::std::default::Default::default() - } - - // required string namespace = 1; - - pub fn namespace(&self) -> &str { - match self.namespace.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_namespace(&mut self) { - self.namespace = ::std::option::Option::None; - } - - pub fn has_namespace(&self) -> bool { - self.namespace.is_some() - } - - // Param is passed by value, moved - pub fn set_namespace(&mut self, v: ::std::string::String) { - self.namespace = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_namespace(&mut self) -> &mut ::std::string::String { - if self.namespace.is_none() { - self.namespace = ::std::option::Option::Some(::std::string::String::new()); - } - self.namespace.as_mut().unwrap() - } - - // Take field - pub fn take_namespace(&mut self) -> ::std::string::String { - self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string mosaic = 2; - - pub fn mosaic(&self) -> &str { - match self.mosaic.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_mosaic(&mut self) { - self.mosaic = ::std::option::Option::None; - } - - pub fn has_mosaic(&self) -> bool { - self.mosaic.is_some() - } - - // Param is passed by value, moved - pub fn set_mosaic(&mut self, v: ::std::string::String) { - self.mosaic = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mosaic(&mut self) -> &mut ::std::string::String { - if self.mosaic.is_none() { - self.mosaic = ::std::option::Option::Some(::std::string::String::new()); - } - self.mosaic.as_mut().unwrap() - } - - // Take field - pub fn take_mosaic(&mut self) -> ::std::string::String { - self.mosaic.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 quantity = 3; - - pub fn quantity(&self) -> u64 { - self.quantity.unwrap_or(0) - } - - pub fn clear_quantity(&mut self) { - self.quantity = ::std::option::Option::None; - } - - pub fn has_quantity(&self) -> bool { - self.quantity.is_some() - } - - // Param is passed by value, moved - pub fn set_quantity(&mut self, v: u64) { - self.quantity = ::std::option::Option::Some(v); - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "namespace", - |m: &NEMMosaic| { &m.namespace }, - |m: &mut NEMMosaic| { &mut m.namespace }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mosaic", - |m: &NEMMosaic| { &m.mosaic }, - |m: &mut NEMMosaic| { &mut m.mosaic }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "quantity", - |m: &NEMMosaic| { &m.quantity }, - |m: &mut NEMMosaic| { &mut m.quantity }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMTransfer.NEMMosaic", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMMosaic { - const NAME: &'static str = "NEMMosaic"; - - fn is_initialized(&self) -> bool { - if self.namespace.is_none() { - return false; - } - if self.mosaic.is_none() { - return false; - } - if self.quantity.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.namespace = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.mosaic = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.quantity = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.namespace.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.mosaic.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.quantity { - my_size += ::protobuf::rt::uint64_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.namespace.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.mosaic.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.quantity { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMMosaic { - NEMMosaic::new() - } - - fn clear(&mut self) { - self.namespace = ::std::option::Option::None; - self.mosaic = ::std::option::Option::None; - self.quantity = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMMosaic { - static instance: NEMMosaic = NEMMosaic { - namespace: ::std::option::Option::None, - mosaic: ::std::option::Option::None, - quantity: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMMosaic { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMTransfer.NEMMosaic").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMMosaic { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMMosaic { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - } - - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMProvisionNamespace { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.namespace) - pub namespace: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.parent) - pub parent: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.sink) - pub sink: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.fee) - pub fee: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMProvisionNamespace.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMProvisionNamespace { - fn default() -> &'a NEMProvisionNamespace { - ::default_instance() - } - } - - impl NEMProvisionNamespace { - pub fn new() -> NEMProvisionNamespace { - ::std::default::Default::default() - } - - // required string namespace = 1; - - pub fn namespace(&self) -> &str { - match self.namespace.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_namespace(&mut self) { - self.namespace = ::std::option::Option::None; - } - - pub fn has_namespace(&self) -> bool { - self.namespace.is_some() - } - - // Param is passed by value, moved - pub fn set_namespace(&mut self, v: ::std::string::String) { - self.namespace = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_namespace(&mut self) -> &mut ::std::string::String { - if self.namespace.is_none() { - self.namespace = ::std::option::Option::Some(::std::string::String::new()); - } - self.namespace.as_mut().unwrap() - } - - // Take field - pub fn take_namespace(&mut self) -> ::std::string::String { - self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string parent = 2; - - pub fn parent(&self) -> &str { - match self.parent.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_parent(&mut self) { - self.parent = ::std::option::Option::None; - } - - pub fn has_parent(&self) -> bool { - self.parent.is_some() - } - - // Param is passed by value, moved - pub fn set_parent(&mut self, v: ::std::string::String) { - self.parent = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_parent(&mut self) -> &mut ::std::string::String { - if self.parent.is_none() { - self.parent = ::std::option::Option::Some(::std::string::String::new()); - } - self.parent.as_mut().unwrap() - } - - // Take field - pub fn take_parent(&mut self) -> ::std::string::String { - self.parent.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string sink = 3; - - pub fn sink(&self) -> &str { - match self.sink.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_sink(&mut self) { - self.sink = ::std::option::Option::None; - } - - pub fn has_sink(&self) -> bool { - self.sink.is_some() - } - - // Param is passed by value, moved - pub fn set_sink(&mut self, v: ::std::string::String) { - self.sink = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sink(&mut self) -> &mut ::std::string::String { - if self.sink.is_none() { - self.sink = ::std::option::Option::Some(::std::string::String::new()); - } - self.sink.as_mut().unwrap() - } - - // Take field - pub fn take_sink(&mut self) -> ::std::string::String { - self.sink.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 fee = 4; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "namespace", - |m: &NEMProvisionNamespace| { &m.namespace }, - |m: &mut NEMProvisionNamespace| { &mut m.namespace }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "parent", - |m: &NEMProvisionNamespace| { &m.parent }, - |m: &mut NEMProvisionNamespace| { &mut m.parent }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sink", - |m: &NEMProvisionNamespace| { &m.sink }, - |m: &mut NEMProvisionNamespace| { &mut m.sink }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &NEMProvisionNamespace| { &m.fee }, - |m: &mut NEMProvisionNamespace| { &mut m.fee }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMProvisionNamespace", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMProvisionNamespace { - const NAME: &'static str = "NEMProvisionNamespace"; - - fn is_initialized(&self) -> bool { - if self.namespace.is_none() { - return false; - } - if self.sink.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.namespace = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.parent = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.sink = ::std::option::Option::Some(is.read_string()?); - }, - 32 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.namespace.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.parent.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.sink.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(4, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.namespace.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.parent.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.sink.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMProvisionNamespace { - NEMProvisionNamespace::new() - } - - fn clear(&mut self) { - self.namespace = ::std::option::Option::None; - self.parent = ::std::option::Option::None; - self.sink = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMProvisionNamespace { - static instance: NEMProvisionNamespace = NEMProvisionNamespace { - namespace: ::std::option::Option::None, - parent: ::std::option::Option::None, - sink: ::std::option::Option::None, - fee: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMProvisionNamespace { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMProvisionNamespace").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMProvisionNamespace { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMProvisionNamespace { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMMosaicCreation { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.definition) - pub definition: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.sink) - pub sink: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.fee) - pub fee: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMMosaicCreation { - fn default() -> &'a NEMMosaicCreation { - ::default_instance() - } - } - - impl NEMMosaicCreation { - pub fn new() -> NEMMosaicCreation { - ::std::default::Default::default() - } - - // required string sink = 2; - - pub fn sink(&self) -> &str { - match self.sink.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_sink(&mut self) { - self.sink = ::std::option::Option::None; - } - - pub fn has_sink(&self) -> bool { - self.sink.is_some() - } - - // Param is passed by value, moved - pub fn set_sink(&mut self, v: ::std::string::String) { - self.sink = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sink(&mut self) -> &mut ::std::string::String { - if self.sink.is_none() { - self.sink = ::std::option::Option::Some(::std::string::String::new()); - } - self.sink.as_mut().unwrap() - } - - // Take field - pub fn take_sink(&mut self) -> ::std::string::String { - self.sink.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 fee = 3; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, nemmosaic_creation::NEMMosaicDefinition>( - "definition", - |m: &NEMMosaicCreation| { &m.definition }, - |m: &mut NEMMosaicCreation| { &mut m.definition }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sink", - |m: &NEMMosaicCreation| { &m.sink }, - |m: &mut NEMMosaicCreation| { &mut m.sink }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &NEMMosaicCreation| { &m.fee }, - |m: &mut NEMMosaicCreation| { &mut m.fee }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMMosaicCreation", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMMosaicCreation { - const NAME: &'static str = "NEMMosaicCreation"; - - fn is_initialized(&self) -> bool { - if self.definition.is_none() { - return false; - } - if self.sink.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - for v in &self.definition { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.definition)?; - }, - 18 => { - self.sink = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.definition.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.sink.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.definition.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.sink.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMMosaicCreation { - NEMMosaicCreation::new() - } - - fn clear(&mut self) { - self.definition.clear(); - self.sink = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMMosaicCreation { - static instance: NEMMosaicCreation = NEMMosaicCreation { - definition: ::protobuf::MessageField::none(), - sink: ::std::option::Option::None, - fee: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMMosaicCreation { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMMosaicCreation").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMMosaicCreation { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMMosaicCreation { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `NEMMosaicCreation` - pub mod nemmosaic_creation { - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMMosaicDefinition { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.name) - pub name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.ticker) - pub ticker: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.namespace) - pub namespace: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.mosaic) - pub mosaic: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.divisibility) - pub divisibility: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy) - pub levy: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy_address) - pub levy_address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy_namespace) - pub levy_namespace: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.levy_mosaic) - pub levy_mosaic: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.supply) - pub supply: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.mutable_supply) - pub mutable_supply: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.transferable) - pub transferable: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.description) - pub description: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.networks) - pub networks: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMMosaicDefinition { - fn default() -> &'a NEMMosaicDefinition { - ::default_instance() - } - } - - impl NEMMosaicDefinition { - pub fn new() -> NEMMosaicDefinition { - ::std::default::Default::default() - } - - // optional string name = 1; - - pub fn name(&self) -> &str { - match self.name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_name(&mut self) { - self.name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if self.name.is_none() { - self.name = ::std::option::Option::Some(::std::string::String::new()); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - self.name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string ticker = 2; - - pub fn ticker(&self) -> &str { - match self.ticker.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_ticker(&mut self) { - self.ticker = ::std::option::Option::None; - } - - pub fn has_ticker(&self) -> bool { - self.ticker.is_some() - } - - // Param is passed by value, moved - pub fn set_ticker(&mut self, v: ::std::string::String) { - self.ticker = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ticker(&mut self) -> &mut ::std::string::String { - if self.ticker.is_none() { - self.ticker = ::std::option::Option::Some(::std::string::String::new()); - } - self.ticker.as_mut().unwrap() - } - - // Take field - pub fn take_ticker(&mut self) -> ::std::string::String { - self.ticker.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string namespace = 3; - - pub fn namespace(&self) -> &str { - match self.namespace.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_namespace(&mut self) { - self.namespace = ::std::option::Option::None; - } - - pub fn has_namespace(&self) -> bool { - self.namespace.is_some() - } - - // Param is passed by value, moved - pub fn set_namespace(&mut self, v: ::std::string::String) { - self.namespace = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_namespace(&mut self) -> &mut ::std::string::String { - if self.namespace.is_none() { - self.namespace = ::std::option::Option::Some(::std::string::String::new()); - } - self.namespace.as_mut().unwrap() - } - - // Take field - pub fn take_namespace(&mut self) -> ::std::string::String { - self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string mosaic = 4; - - pub fn mosaic(&self) -> &str { - match self.mosaic.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_mosaic(&mut self) { - self.mosaic = ::std::option::Option::None; - } - - pub fn has_mosaic(&self) -> bool { - self.mosaic.is_some() - } - - // Param is passed by value, moved - pub fn set_mosaic(&mut self, v: ::std::string::String) { - self.mosaic = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mosaic(&mut self) -> &mut ::std::string::String { - if self.mosaic.is_none() { - self.mosaic = ::std::option::Option::Some(::std::string::String::new()); - } - self.mosaic.as_mut().unwrap() - } - - // Take field - pub fn take_mosaic(&mut self) -> ::std::string::String { - self.mosaic.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 divisibility = 5; - - pub fn divisibility(&self) -> u32 { - self.divisibility.unwrap_or(0) - } - - pub fn clear_divisibility(&mut self) { - self.divisibility = ::std::option::Option::None; - } - - pub fn has_divisibility(&self) -> bool { - self.divisibility.is_some() - } - - // Param is passed by value, moved - pub fn set_divisibility(&mut self, v: u32) { - self.divisibility = ::std::option::Option::Some(v); - } - - // optional .hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy levy = 6; - - pub fn levy(&self) -> nemmosaic_definition::NEMMosaicLevy { - match self.levy { - Some(e) => e.enum_value_or(nemmosaic_definition::NEMMosaicLevy::MosaicLevy_Absolute), - None => nemmosaic_definition::NEMMosaicLevy::MosaicLevy_Absolute, - } - } - - pub fn clear_levy(&mut self) { - self.levy = ::std::option::Option::None; - } - - pub fn has_levy(&self) -> bool { - self.levy.is_some() - } - - // Param is passed by value, moved - pub fn set_levy(&mut self, v: nemmosaic_definition::NEMMosaicLevy) { - self.levy = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional uint64 fee = 7; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // optional string levy_address = 8; - - pub fn levy_address(&self) -> &str { - match self.levy_address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_levy_address(&mut self) { - self.levy_address = ::std::option::Option::None; - } - - pub fn has_levy_address(&self) -> bool { - self.levy_address.is_some() - } - - // Param is passed by value, moved - pub fn set_levy_address(&mut self, v: ::std::string::String) { - self.levy_address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_levy_address(&mut self) -> &mut ::std::string::String { - if self.levy_address.is_none() { - self.levy_address = ::std::option::Option::Some(::std::string::String::new()); - } - self.levy_address.as_mut().unwrap() - } - - // Take field - pub fn take_levy_address(&mut self) -> ::std::string::String { - self.levy_address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string levy_namespace = 9; - - pub fn levy_namespace(&self) -> &str { - match self.levy_namespace.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_levy_namespace(&mut self) { - self.levy_namespace = ::std::option::Option::None; - } - - pub fn has_levy_namespace(&self) -> bool { - self.levy_namespace.is_some() - } - - // Param is passed by value, moved - pub fn set_levy_namespace(&mut self, v: ::std::string::String) { - self.levy_namespace = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_levy_namespace(&mut self) -> &mut ::std::string::String { - if self.levy_namespace.is_none() { - self.levy_namespace = ::std::option::Option::Some(::std::string::String::new()); - } - self.levy_namespace.as_mut().unwrap() - } - - // Take field - pub fn take_levy_namespace(&mut self) -> ::std::string::String { - self.levy_namespace.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string levy_mosaic = 10; - - pub fn levy_mosaic(&self) -> &str { - match self.levy_mosaic.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_levy_mosaic(&mut self) { - self.levy_mosaic = ::std::option::Option::None; - } - - pub fn has_levy_mosaic(&self) -> bool { - self.levy_mosaic.is_some() - } - - // Param is passed by value, moved - pub fn set_levy_mosaic(&mut self, v: ::std::string::String) { - self.levy_mosaic = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_levy_mosaic(&mut self) -> &mut ::std::string::String { - if self.levy_mosaic.is_none() { - self.levy_mosaic = ::std::option::Option::Some(::std::string::String::new()); - } - self.levy_mosaic.as_mut().unwrap() - } - - // Take field - pub fn take_levy_mosaic(&mut self) -> ::std::string::String { - self.levy_mosaic.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint64 supply = 11; - - pub fn supply(&self) -> u64 { - self.supply.unwrap_or(0) - } - - pub fn clear_supply(&mut self) { - self.supply = ::std::option::Option::None; - } - - pub fn has_supply(&self) -> bool { - self.supply.is_some() - } - - // Param is passed by value, moved - pub fn set_supply(&mut self, v: u64) { - self.supply = ::std::option::Option::Some(v); - } - - // optional bool mutable_supply = 12; - - pub fn mutable_supply(&self) -> bool { - self.mutable_supply.unwrap_or(false) - } - - pub fn clear_mutable_supply(&mut self) { - self.mutable_supply = ::std::option::Option::None; - } - - pub fn has_mutable_supply(&self) -> bool { - self.mutable_supply.is_some() - } - - // Param is passed by value, moved - pub fn set_mutable_supply(&mut self, v: bool) { - self.mutable_supply = ::std::option::Option::Some(v); - } - - // optional bool transferable = 13; - - pub fn transferable(&self) -> bool { - self.transferable.unwrap_or(false) - } - - pub fn clear_transferable(&mut self) { - self.transferable = ::std::option::Option::None; - } - - pub fn has_transferable(&self) -> bool { - self.transferable.is_some() - } - - // Param is passed by value, moved - pub fn set_transferable(&mut self, v: bool) { - self.transferable = ::std::option::Option::Some(v); - } - - // required string description = 14; - - pub fn description(&self) -> &str { - match self.description.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_description(&mut self) { - self.description = ::std::option::Option::None; - } - - pub fn has_description(&self) -> bool { - self.description.is_some() - } - - // Param is passed by value, moved - pub fn set_description(&mut self, v: ::std::string::String) { - self.description = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_description(&mut self) -> &mut ::std::string::String { - if self.description.is_none() { - self.description = ::std::option::Option::Some(::std::string::String::new()); - } - self.description.as_mut().unwrap() - } - - // Take field - pub fn take_description(&mut self) -> ::std::string::String { - self.description.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(15); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "name", - |m: &NEMMosaicDefinition| { &m.name }, - |m: &mut NEMMosaicDefinition| { &mut m.name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ticker", - |m: &NEMMosaicDefinition| { &m.ticker }, - |m: &mut NEMMosaicDefinition| { &mut m.ticker }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "namespace", - |m: &NEMMosaicDefinition| { &m.namespace }, - |m: &mut NEMMosaicDefinition| { &mut m.namespace }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mosaic", - |m: &NEMMosaicDefinition| { &m.mosaic }, - |m: &mut NEMMosaicDefinition| { &mut m.mosaic }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "divisibility", - |m: &NEMMosaicDefinition| { &m.divisibility }, - |m: &mut NEMMosaicDefinition| { &mut m.divisibility }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "levy", - |m: &NEMMosaicDefinition| { &m.levy }, - |m: &mut NEMMosaicDefinition| { &mut m.levy }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &NEMMosaicDefinition| { &m.fee }, - |m: &mut NEMMosaicDefinition| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "levy_address", - |m: &NEMMosaicDefinition| { &m.levy_address }, - |m: &mut NEMMosaicDefinition| { &mut m.levy_address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "levy_namespace", - |m: &NEMMosaicDefinition| { &m.levy_namespace }, - |m: &mut NEMMosaicDefinition| { &mut m.levy_namespace }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "levy_mosaic", - |m: &NEMMosaicDefinition| { &m.levy_mosaic }, - |m: &mut NEMMosaicDefinition| { &mut m.levy_mosaic }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "supply", - |m: &NEMMosaicDefinition| { &m.supply }, - |m: &mut NEMMosaicDefinition| { &mut m.supply }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mutable_supply", - |m: &NEMMosaicDefinition| { &m.mutable_supply }, - |m: &mut NEMMosaicDefinition| { &mut m.mutable_supply }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "transferable", - |m: &NEMMosaicDefinition| { &m.transferable }, - |m: &mut NEMMosaicDefinition| { &mut m.transferable }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "description", - |m: &NEMMosaicDefinition| { &m.description }, - |m: &mut NEMMosaicDefinition| { &mut m.description }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "networks", - |m: &NEMMosaicDefinition| { &m.networks }, - |m: &mut NEMMosaicDefinition| { &mut m.networks }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMMosaicDefinition { - const NAME: &'static str = "NEMMosaicDefinition"; - - fn is_initialized(&self) -> bool { - if self.namespace.is_none() { - return false; - } - if self.mosaic.is_none() { - return false; - } - if self.description.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.name = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.ticker = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.namespace = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.mosaic = ::std::option::Option::Some(is.read_string()?); - }, - 40 => { - self.divisibility = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.levy = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 56 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 66 => { - self.levy_address = ::std::option::Option::Some(is.read_string()?); - }, - 74 => { - self.levy_namespace = ::std::option::Option::Some(is.read_string()?); - }, - 82 => { - self.levy_mosaic = ::std::option::Option::Some(is.read_string()?); - }, - 88 => { - self.supply = ::std::option::Option::Some(is.read_uint64()?); - }, - 96 => { - self.mutable_supply = ::std::option::Option::Some(is.read_bool()?); - }, - 104 => { - self.transferable = ::std::option::Option::Some(is.read_bool()?); - }, - 114 => { - self.description = ::std::option::Option::Some(is.read_string()?); - }, - 122 => { - is.read_repeated_packed_uint32_into(&mut self.networks)?; - }, - 120 => { - self.networks.push(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.ticker.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.namespace.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.mosaic.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.divisibility { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.levy { - my_size += ::protobuf::rt::int32_size(6, v.value()); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(7, v); - } - if let Some(v) = self.levy_address.as_ref() { - my_size += ::protobuf::rt::string_size(8, &v); - } - if let Some(v) = self.levy_namespace.as_ref() { - my_size += ::protobuf::rt::string_size(9, &v); - } - if let Some(v) = self.levy_mosaic.as_ref() { - my_size += ::protobuf::rt::string_size(10, &v); - } - if let Some(v) = self.supply { - my_size += ::protobuf::rt::uint64_size(11, v); - } - if let Some(v) = self.mutable_supply { - my_size += 1 + 1; - } - if let Some(v) = self.transferable { - my_size += 1 + 1; - } - if let Some(v) = self.description.as_ref() { - my_size += ::protobuf::rt::string_size(14, &v); - } - for value in &self.networks { - my_size += ::protobuf::rt::uint32_size(15, *value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.name.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.ticker.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.namespace.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.mosaic.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.divisibility { - os.write_uint32(5, v)?; - } - if let Some(v) = self.levy { - os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.fee { - os.write_uint64(7, v)?; - } - if let Some(v) = self.levy_address.as_ref() { - os.write_string(8, v)?; - } - if let Some(v) = self.levy_namespace.as_ref() { - os.write_string(9, v)?; - } - if let Some(v) = self.levy_mosaic.as_ref() { - os.write_string(10, v)?; - } - if let Some(v) = self.supply { - os.write_uint64(11, v)?; - } - if let Some(v) = self.mutable_supply { - os.write_bool(12, v)?; - } - if let Some(v) = self.transferable { - os.write_bool(13, v)?; - } - if let Some(v) = self.description.as_ref() { - os.write_string(14, v)?; - } - for v in &self.networks { - os.write_uint32(15, *v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMMosaicDefinition { - NEMMosaicDefinition::new() - } - - fn clear(&mut self) { - self.name = ::std::option::Option::None; - self.ticker = ::std::option::Option::None; - self.namespace = ::std::option::Option::None; - self.mosaic = ::std::option::Option::None; - self.divisibility = ::std::option::Option::None; - self.levy = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.levy_address = ::std::option::Option::None; - self.levy_namespace = ::std::option::Option::None; - self.levy_mosaic = ::std::option::Option::None; - self.supply = ::std::option::Option::None; - self.mutable_supply = ::std::option::Option::None; - self.transferable = ::std::option::Option::None; - self.description = ::std::option::Option::None; - self.networks.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMMosaicDefinition { - static instance: NEMMosaicDefinition = NEMMosaicDefinition { - name: ::std::option::Option::None, - ticker: ::std::option::Option::None, - namespace: ::std::option::Option::None, - mosaic: ::std::option::Option::None, - divisibility: ::std::option::Option::None, - levy: ::std::option::Option::None, - fee: ::std::option::Option::None, - levy_address: ::std::option::Option::None, - levy_namespace: ::std::option::Option::None, - levy_mosaic: ::std::option::Option::None, - supply: ::std::option::Option::None, - mutable_supply: ::std::option::Option::None, - transferable: ::std::option::Option::None, - description: ::std::option::Option::None, - networks: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMMosaicDefinition { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMMosaicDefinition { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMMosaicDefinition { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `NEMMosaicDefinition` - pub mod nemmosaic_definition { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy) - pub enum NEMMosaicLevy { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy.MosaicLevy_Absolute) - MosaicLevy_Absolute = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy.MosaicLevy_Percentile) - MosaicLevy_Percentile = 2, - } - - impl ::protobuf::Enum for NEMMosaicLevy { - const NAME: &'static str = "NEMMosaicLevy"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Absolute), - 2 => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Percentile), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "MosaicLevy_Absolute" => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Absolute), - "MosaicLevy_Percentile" => ::std::option::Option::Some(NEMMosaicLevy::MosaicLevy_Percentile), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [NEMMosaicLevy] = &[ - NEMMosaicLevy::MosaicLevy_Absolute, - NEMMosaicLevy::MosaicLevy_Percentile, - ]; - } - - impl ::protobuf::EnumFull for NEMMosaicLevy { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - NEMMosaicLevy::MosaicLevy_Absolute => 0, - NEMMosaicLevy::MosaicLevy_Percentile => 1, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for NEMMosaicLevy { - fn default() -> Self { - NEMMosaicLevy::MosaicLevy_Absolute - } - } - - impl NEMMosaicLevy { - pub(in super::super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMMosaicCreation.NEMMosaicDefinition.NEMMosaicLevy") - } - } - } - } - - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMMosaicSupplyChange { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.namespace) - pub namespace: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.mosaic) - pub mosaic: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.delta) - pub delta: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMMosaicSupplyChange { - fn default() -> &'a NEMMosaicSupplyChange { - ::default_instance() - } - } - - impl NEMMosaicSupplyChange { - pub fn new() -> NEMMosaicSupplyChange { - ::std::default::Default::default() - } - - // required string namespace = 1; - - pub fn namespace(&self) -> &str { - match self.namespace.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_namespace(&mut self) { - self.namespace = ::std::option::Option::None; - } - - pub fn has_namespace(&self) -> bool { - self.namespace.is_some() - } - - // Param is passed by value, moved - pub fn set_namespace(&mut self, v: ::std::string::String) { - self.namespace = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_namespace(&mut self) -> &mut ::std::string::String { - if self.namespace.is_none() { - self.namespace = ::std::option::Option::Some(::std::string::String::new()); - } - self.namespace.as_mut().unwrap() - } - - // Take field - pub fn take_namespace(&mut self) -> ::std::string::String { - self.namespace.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string mosaic = 2; - - pub fn mosaic(&self) -> &str { - match self.mosaic.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_mosaic(&mut self) { - self.mosaic = ::std::option::Option::None; - } - - pub fn has_mosaic(&self) -> bool { - self.mosaic.is_some() - } - - // Param is passed by value, moved - pub fn set_mosaic(&mut self, v: ::std::string::String) { - self.mosaic = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_mosaic(&mut self) -> &mut ::std::string::String { - if self.mosaic.is_none() { - self.mosaic = ::std::option::Option::Some(::std::string::String::new()); - } - self.mosaic.as_mut().unwrap() - } - - // Take field - pub fn take_mosaic(&mut self) -> ::std::string::String { - self.mosaic.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required .hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType type = 3; - - pub fn type_(&self) -> nemmosaic_supply_change::NEMSupplyChangeType { - match self.type_ { - Some(e) => e.enum_value_or(nemmosaic_supply_change::NEMSupplyChangeType::SupplyChange_Increase), - None => nemmosaic_supply_change::NEMSupplyChangeType::SupplyChange_Increase, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: nemmosaic_supply_change::NEMSupplyChangeType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required uint64 delta = 4; - - pub fn delta(&self) -> u64 { - self.delta.unwrap_or(0) - } - - pub fn clear_delta(&mut self) { - self.delta = ::std::option::Option::None; - } - - pub fn has_delta(&self) -> bool { - self.delta.is_some() - } - - // Param is passed by value, moved - pub fn set_delta(&mut self, v: u64) { - self.delta = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "namespace", - |m: &NEMMosaicSupplyChange| { &m.namespace }, - |m: &mut NEMMosaicSupplyChange| { &mut m.namespace }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mosaic", - |m: &NEMMosaicSupplyChange| { &m.mosaic }, - |m: &mut NEMMosaicSupplyChange| { &mut m.mosaic }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &NEMMosaicSupplyChange| { &m.type_ }, - |m: &mut NEMMosaicSupplyChange| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "delta", - |m: &NEMMosaicSupplyChange| { &m.delta }, - |m: &mut NEMMosaicSupplyChange| { &mut m.delta }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMMosaicSupplyChange", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMMosaicSupplyChange { - const NAME: &'static str = "NEMMosaicSupplyChange"; - - fn is_initialized(&self) -> bool { - if self.namespace.is_none() { - return false; - } - if self.mosaic.is_none() { - return false; - } - if self.type_.is_none() { - return false; - } - if self.delta.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.namespace = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.mosaic = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 32 => { - self.delta = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.namespace.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.mosaic.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(3, v.value()); - } - if let Some(v) = self.delta { - my_size += ::protobuf::rt::uint64_size(4, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.namespace.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.mosaic.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.type_ { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.delta { - os.write_uint64(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMMosaicSupplyChange { - NEMMosaicSupplyChange::new() - } - - fn clear(&mut self) { - self.namespace = ::std::option::Option::None; - self.mosaic = ::std::option::Option::None; - self.type_ = ::std::option::Option::None; - self.delta = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMMosaicSupplyChange { - static instance: NEMMosaicSupplyChange = NEMMosaicSupplyChange { - namespace: ::std::option::Option::None, - mosaic: ::std::option::Option::None, - type_: ::std::option::Option::None, - delta: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMMosaicSupplyChange { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMMosaicSupplyChange").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMMosaicSupplyChange { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMMosaicSupplyChange { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `NEMMosaicSupplyChange` - pub mod nemmosaic_supply_change { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType) - pub enum NEMSupplyChangeType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType.SupplyChange_Increase) - SupplyChange_Increase = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType.SupplyChange_Decrease) - SupplyChange_Decrease = 2, - } - - impl ::protobuf::Enum for NEMSupplyChangeType { - const NAME: &'static str = "NEMSupplyChangeType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Increase), - 2 => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Decrease), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "SupplyChange_Increase" => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Increase), - "SupplyChange_Decrease" => ::std::option::Option::Some(NEMSupplyChangeType::SupplyChange_Decrease), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [NEMSupplyChangeType] = &[ - NEMSupplyChangeType::SupplyChange_Increase, - NEMSupplyChangeType::SupplyChange_Decrease, - ]; - } - - impl ::protobuf::EnumFull for NEMSupplyChangeType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - NEMSupplyChangeType::SupplyChange_Increase => 0, - NEMSupplyChangeType::SupplyChange_Decrease => 1, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for NEMSupplyChangeType { - fn default() -> Self { - NEMSupplyChangeType::SupplyChange_Increase - } - } - - impl NEMSupplyChangeType { - pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeType") - } - } - } - - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMAggregateModification { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.modifications) - pub modifications: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.relative_change) - pub relative_change: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMAggregateModification { - fn default() -> &'a NEMAggregateModification { - ::default_instance() - } - } - - impl NEMAggregateModification { - pub fn new() -> NEMAggregateModification { - ::std::default::Default::default() - } - - // optional sint32 relative_change = 2; - - pub fn relative_change(&self) -> i32 { - self.relative_change.unwrap_or(0) - } - - pub fn clear_relative_change(&mut self) { - self.relative_change = ::std::option::Option::None; - } - - pub fn has_relative_change(&self) -> bool { - self.relative_change.is_some() - } - - // Param is passed by value, moved - pub fn set_relative_change(&mut self, v: i32) { - self.relative_change = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "modifications", - |m: &NEMAggregateModification| { &m.modifications }, - |m: &mut NEMAggregateModification| { &mut m.modifications }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "relative_change", - |m: &NEMAggregateModification| { &m.relative_change }, - |m: &mut NEMAggregateModification| { &mut m.relative_change }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMAggregateModification", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMAggregateModification { - const NAME: &'static str = "NEMAggregateModification"; - - fn is_initialized(&self) -> bool { - for v in &self.modifications { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.modifications.push(is.read_message()?); - }, - 16 => { - self.relative_change = ::std::option::Option::Some(is.read_sint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.modifications { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.relative_change { - my_size += ::protobuf::rt::sint32_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.modifications { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - if let Some(v) = self.relative_change { - os.write_sint32(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMAggregateModification { - NEMAggregateModification::new() - } - - fn clear(&mut self) { - self.modifications.clear(); - self.relative_change = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMAggregateModification { - static instance: NEMAggregateModification = NEMAggregateModification { - modifications: ::std::vec::Vec::new(), - relative_change: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMAggregateModification { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMAggregateModification").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMAggregateModification { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMAggregateModification { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `NEMAggregateModification` - pub mod nemaggregate_modification { - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMCosignatoryModification { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMCosignatoryModification { - fn default() -> &'a NEMCosignatoryModification { - ::default_instance() - } - } - - impl NEMCosignatoryModification { - pub fn new() -> NEMCosignatoryModification { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType type = 1; - - pub fn type_(&self) -> nemcosignatory_modification::NEMModificationType { - match self.type_ { - Some(e) => e.enum_value_or(nemcosignatory_modification::NEMModificationType::CosignatoryModification_Add), - None => nemcosignatory_modification::NEMModificationType::CosignatoryModification_Add, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: nemcosignatory_modification::NEMModificationType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required bytes public_key = 2; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &NEMCosignatoryModification| { &m.type_ }, - |m: &mut NEMCosignatoryModification| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &NEMCosignatoryModification| { &m.public_key }, - |m: &mut NEMCosignatoryModification| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMAggregateModification.NEMCosignatoryModification", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMCosignatoryModification { - const NAME: &'static str = "NEMCosignatoryModification"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMCosignatoryModification { - NEMCosignatoryModification::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMCosignatoryModification { - static instance: NEMCosignatoryModification = NEMCosignatoryModification { - type_: ::std::option::Option::None, - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMCosignatoryModification { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMAggregateModification.NEMCosignatoryModification").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMCosignatoryModification { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMCosignatoryModification { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `NEMCosignatoryModification` - pub mod nemcosignatory_modification { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType) - pub enum NEMModificationType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType.CosignatoryModification_Add) - CosignatoryModification_Add = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType.CosignatoryModification_Delete) - CosignatoryModification_Delete = 2, - } - - impl ::protobuf::Enum for NEMModificationType { - const NAME: &'static str = "NEMModificationType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Add), - 2 => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Delete), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "CosignatoryModification_Add" => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Add), - "CosignatoryModification_Delete" => ::std::option::Option::Some(NEMModificationType::CosignatoryModification_Delete), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [NEMModificationType] = &[ - NEMModificationType::CosignatoryModification_Add, - NEMModificationType::CosignatoryModification_Delete, - ]; - } - - impl ::protobuf::EnumFull for NEMModificationType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - NEMModificationType::CosignatoryModification_Add => 0, - NEMModificationType::CosignatoryModification_Delete => 1, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for NEMModificationType { - fn default() -> Self { - NEMModificationType::CosignatoryModification_Add - } - } - - impl NEMModificationType { - pub(in super::super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMAggregateModification.NEMCosignatoryModification.NEMModificationType") - } - } - } - } - - // @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct NEMImportanceTransfer { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.mode) - pub mode: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a NEMImportanceTransfer { - fn default() -> &'a NEMImportanceTransfer { - ::default_instance() - } - } - - impl NEMImportanceTransfer { - pub fn new() -> NEMImportanceTransfer { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode mode = 1; - - pub fn mode(&self) -> nemimportance_transfer::NEMImportanceTransferMode { - match self.mode { - Some(e) => e.enum_value_or(nemimportance_transfer::NEMImportanceTransferMode::ImportanceTransfer_Activate), - None => nemimportance_transfer::NEMImportanceTransferMode::ImportanceTransfer_Activate, - } - } - - pub fn clear_mode(&mut self) { - self.mode = ::std::option::Option::None; - } - - pub fn has_mode(&self) -> bool { - self.mode.is_some() - } - - // Param is passed by value, moved - pub fn set_mode(&mut self, v: nemimportance_transfer::NEMImportanceTransferMode) { - self.mode = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required bytes public_key = 2; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "mode", - |m: &NEMImportanceTransfer| { &m.mode }, - |m: &mut NEMImportanceTransfer| { &mut m.mode }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &NEMImportanceTransfer| { &m.public_key }, - |m: &mut NEMImportanceTransfer| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignTx.NEMImportanceTransfer", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for NEMImportanceTransfer { - const NAME: &'static str = "NEMImportanceTransfer"; - - fn is_initialized(&self) -> bool { - if self.mode.is_none() { - return false; - } - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.mode = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.mode { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.mode { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMImportanceTransfer { - NEMImportanceTransfer::new() - } - - fn clear(&mut self) { - self.mode = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMImportanceTransfer { - static instance: NEMImportanceTransfer = NEMImportanceTransfer { - mode: ::std::option::Option::None, - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for NEMImportanceTransfer { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NEMSignTx.NEMImportanceTransfer").unwrap()).clone() - } - } - - impl ::std::fmt::Display for NEMImportanceTransfer { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for NEMImportanceTransfer { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `NEMImportanceTransfer` - pub mod nemimportance_transfer { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode) - pub enum NEMImportanceTransferMode { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode.ImportanceTransfer_Activate) - ImportanceTransfer_Activate = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode.ImportanceTransfer_Deactivate) - ImportanceTransfer_Deactivate = 2, - } - - impl ::protobuf::Enum for NEMImportanceTransferMode { - const NAME: &'static str = "NEMImportanceTransferMode"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 1 => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Activate), - 2 => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Deactivate), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "ImportanceTransfer_Activate" => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Activate), - "ImportanceTransfer_Deactivate" => ::std::option::Option::Some(NEMImportanceTransferMode::ImportanceTransfer_Deactivate), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [NEMImportanceTransferMode] = &[ - NEMImportanceTransferMode::ImportanceTransfer_Activate, - NEMImportanceTransferMode::ImportanceTransfer_Deactivate, - ]; - } - - impl ::protobuf::EnumFull for NEMImportanceTransferMode { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = match self { - NEMImportanceTransferMode::ImportanceTransfer_Activate => 0, - NEMImportanceTransferMode::ImportanceTransfer_Deactivate => 1, - }; - Self::enum_descriptor().value_by_index(index) - } - } - - // Note, `Default` is implemented although default value is not 0 - impl ::std::default::Default for NEMImportanceTransferMode { - fn default() -> Self { - NEMImportanceTransferMode::ImportanceTransfer_Activate - } - } - - impl NEMImportanceTransferMode { - pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("NEMSignTx.NEMImportanceTransfer.NEMImportanceTransferMode") - } - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMSignedTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct NEMSignedTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignedTx.data) - pub data: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMSignedTx.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMSignedTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a NEMSignedTx { - fn default() -> &'a NEMSignedTx { - ::default_instance() - } -} - -impl NEMSignedTx { - pub fn new() -> NEMSignedTx { - ::std::default::Default::default() - } - - // required bytes data = 1; - - pub fn data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_data(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "data", - |m: &NEMSignedTx| { &m.data }, - |m: &mut NEMSignedTx| { &mut m.data }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &NEMSignedTx| { &m.signature }, - |m: &mut NEMSignedTx| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMSignedTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for NEMSignedTx { - const NAME: &'static str = "NEMSignedTx"; - - fn is_initialized(&self) -> bool { - if self.data.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.data = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.data.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMSignedTx { - NEMSignedTx::new() - } - - fn clear(&mut self) { - self.data = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMSignedTx { - static instance: NEMSignedTx = NEMSignedTx { - data: ::std::option::Option::None, - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for NEMSignedTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMSignedTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for NEMSignedTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NEMSignedTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMDecryptMessage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct NEMDecryptMessage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.network) - pub network: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptMessage.payload) - pub payload: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMDecryptMessage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a NEMDecryptMessage { - fn default() -> &'a NEMDecryptMessage { - ::default_instance() - } -} - -impl NEMDecryptMessage { - pub fn new() -> NEMDecryptMessage { - ::std::default::Default::default() - } - - // optional uint32 network = 2; - - pub fn network(&self) -> u32 { - self.network.unwrap_or(0) - } - - pub fn clear_network(&mut self) { - self.network = ::std::option::Option::None; - } - - pub fn has_network(&self) -> bool { - self.network.is_some() - } - - // Param is passed by value, moved - pub fn set_network(&mut self, v: u32) { - self.network = ::std::option::Option::Some(v); - } - - // optional bytes public_key = 3; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes payload = 4; - - pub fn payload(&self) -> &[u8] { - match self.payload.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_payload(&mut self) { - self.payload = ::std::option::Option::None; - } - - pub fn has_payload(&self) -> bool { - self.payload.is_some() - } - - // Param is passed by value, moved - pub fn set_payload(&mut self, v: ::std::vec::Vec) { - self.payload = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { - if self.payload.is_none() { - self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.payload.as_mut().unwrap() - } - - // Take field - pub fn take_payload(&mut self) -> ::std::vec::Vec { - self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &NEMDecryptMessage| { &m.address_n }, - |m: &mut NEMDecryptMessage| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network", - |m: &NEMDecryptMessage| { &m.network }, - |m: &mut NEMDecryptMessage| { &mut m.network }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &NEMDecryptMessage| { &m.public_key }, - |m: &mut NEMDecryptMessage| { &mut m.public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payload", - |m: &NEMDecryptMessage| { &m.payload }, - |m: &mut NEMDecryptMessage| { &mut m.payload }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMDecryptMessage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for NEMDecryptMessage { - const NAME: &'static str = "NEMDecryptMessage"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.network = ::std::option::Option::Some(is.read_uint32()?); - }, - 26 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 34 => { - self.payload = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.network { - my_size += ::protobuf::rt::uint32_size(2, v); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.payload.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.network { - os.write_uint32(2, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.payload.as_ref() { - os.write_bytes(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMDecryptMessage { - NEMDecryptMessage::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.network = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.payload = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMDecryptMessage { - static instance: NEMDecryptMessage = NEMDecryptMessage { - address_n: ::std::vec::Vec::new(), - network: ::std::option::Option::None, - public_key: ::std::option::Option::None, - payload: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for NEMDecryptMessage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMDecryptMessage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for NEMDecryptMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NEMDecryptMessage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.nem.NEMDecryptedMessage) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct NEMDecryptedMessage { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.nem.NEMDecryptedMessage.payload) - pub payload: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.nem.NEMDecryptedMessage.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a NEMDecryptedMessage { - fn default() -> &'a NEMDecryptedMessage { - ::default_instance() - } -} - -impl NEMDecryptedMessage { - pub fn new() -> NEMDecryptedMessage { - ::std::default::Default::default() - } - - // required bytes payload = 1; - - pub fn payload(&self) -> &[u8] { - match self.payload.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_payload(&mut self) { - self.payload = ::std::option::Option::None; - } - - pub fn has_payload(&self) -> bool { - self.payload.is_some() - } - - // Param is passed by value, moved - pub fn set_payload(&mut self, v: ::std::vec::Vec) { - self.payload = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec { - if self.payload.is_none() { - self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.payload.as_mut().unwrap() - } - - // Take field - pub fn take_payload(&mut self) -> ::std::vec::Vec { - self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "payload", - |m: &NEMDecryptedMessage| { &m.payload }, - |m: &mut NEMDecryptedMessage| { &mut m.payload }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "NEMDecryptedMessage", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for NEMDecryptedMessage { - const NAME: &'static str = "NEMDecryptedMessage"; - - fn is_initialized(&self) -> bool { - if self.payload.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.payload = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.payload.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.payload.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> NEMDecryptedMessage { - NEMDecryptedMessage::new() - } - - fn clear(&mut self) { - self.payload = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static NEMDecryptedMessage { - static instance: NEMDecryptedMessage = NEMDecryptedMessage { - payload: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for NEMDecryptedMessage { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("NEMDecryptedMessage").unwrap()).clone() - } -} - -impl ::std::fmt::Display for NEMDecryptedMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NEMDecryptedMessage { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x12messages-nem.proto\x12\x16hw.trezor.messages.nem\"\x8a\x01\n\rNEMG\ - etAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1d\n\ - \x07network\x18\x02\x20\x01(\r:\x03104R\x07network\x12!\n\x0cshow_displa\ - y\x18\x03\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\x18\x04\x20\ - \x01(\x08R\x08chunkify\"&\n\nNEMAddress\x12\x18\n\x07address\x18\x01\x20\ - \x02(\tR\x07address\"\xa2\x19\n\tNEMSignTx\x12X\n\x0btransaction\x18\x01\ - \x20\x02(\x0b26.hw.trezor.messages.nem.NEMSignTx.NEMTransactionCommonR\ - \x0btransaction\x12R\n\x08multisig\x18\x02\x20\x01(\x0b26.hw.trezor.mess\ - ages.nem.NEMSignTx.NEMTransactionCommonR\x08multisig\x12I\n\x08transfer\ - \x18\x03\x20\x01(\x0b2-.hw.trezor.messages.nem.NEMSignTx.NEMTransferR\ - \x08transfer\x12\x1c\n\tcosigning\x18\x04\x20\x01(\x08R\tcosigning\x12h\ - \n\x13provision_namespace\x18\x05\x20\x01(\x0b27.hw.trezor.messages.nem.\ - NEMSignTx.NEMProvisionNamespaceR\x12provisionNamespace\x12\\\n\x0fmosaic\ - _creation\x18\x06\x20\x01(\x0b23.hw.trezor.messages.nem.NEMSignTx.NEMMos\ - aicCreationR\x0emosaicCreation\x12\\\n\rsupply_change\x18\x07\x20\x01(\ - \x0b27.hw.trezor.messages.nem.NEMSignTx.NEMMosaicSupplyChangeR\x0csupply\ - Change\x12q\n\x16aggregate_modification\x18\x08\x20\x01(\x0b2:.hw.trezor\ - .messages.nem.NEMSignTx.NEMAggregateModificationR\x15aggregateModificati\ - on\x12h\n\x13importance_transfer\x18\t\x20\x01(\x0b27.hw.trezor.messages\ - .nem.NEMSignTx.NEMImportanceTransferR\x12importanceTransfer\x12\x1a\n\ - \x08chunkify\x18\n\x20\x01(\x08R\x08chunkify\x1a\xb6\x01\n\x14NEMTransac\ - tionCommon\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x1d\ - \n\x07network\x18\x02\x20\x01(\r:\x03104R\x07network\x12\x1c\n\ttimestam\ - p\x18\x03\x20\x02(\rR\ttimestamp\x12\x10\n\x03fee\x18\x04\x20\x02(\x04R\ - \x03fee\x12\x1a\n\x08deadline\x18\x05\x20\x02(\rR\x08deadline\x12\x16\n\ - \x06signer\x18\x06\x20\x01(\x0cR\x06signer\x1a\xae\x02\n\x0bNEMTransfer\ - \x12\x1c\n\trecipient\x18\x01\x20\x02(\tR\trecipient\x12\x16\n\x06amount\ - \x18\x02\x20\x02(\x04R\x06amount\x12\x18\n\x07payload\x18\x03\x20\x01(\ - \x0cR\x07payload\x12\x1d\n\npublic_key\x18\x04\x20\x01(\x0cR\tpublicKey\ - \x12Q\n\x07mosaics\x18\x05\x20\x03(\x0b27.hw.trezor.messages.nem.NEMSign\ - Tx.NEMTransfer.NEMMosaicR\x07mosaics\x1a]\n\tNEMMosaic\x12\x1c\n\tnamesp\ - ace\x18\x01\x20\x02(\tR\tnamespace\x12\x16\n\x06mosaic\x18\x02\x20\x02(\ - \tR\x06mosaic\x12\x1a\n\x08quantity\x18\x03\x20\x02(\x04R\x08quantity\ - \x1as\n\x15NEMProvisionNamespace\x12\x1c\n\tnamespace\x18\x01\x20\x02(\t\ - R\tnamespace\x12\x16\n\x06parent\x18\x02\x20\x01(\tR\x06parent\x12\x12\n\ - \x04sink\x18\x03\x20\x02(\tR\x04sink\x12\x10\n\x03fee\x18\x04\x20\x02(\ - \x04R\x03fee\x1a\x8e\x06\n\x11NEMMosaicCreation\x12g\n\ndefinition\x18\ - \x01\x20\x02(\x0b2G.hw.trezor.messages.nem.NEMSignTx.NEMMosaicCreation.N\ - EMMosaicDefinitionR\ndefinition\x12\x12\n\x04sink\x18\x02\x20\x02(\tR\ - \x04sink\x12\x10\n\x03fee\x18\x03\x20\x02(\x04R\x03fee\x1a\xe9\x04\n\x13\ - NEMMosaicDefinition\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\ - \x16\n\x06ticker\x18\x02\x20\x01(\tR\x06ticker\x12\x1c\n\tnamespace\x18\ - \x03\x20\x02(\tR\tnamespace\x12\x16\n\x06mosaic\x18\x04\x20\x02(\tR\x06m\ - osaic\x12\"\n\x0cdivisibility\x18\x05\x20\x01(\rR\x0cdivisibility\x12i\n\ - \x04levy\x18\x06\x20\x01(\x0e2U.hw.trezor.messages.nem.NEMSignTx.NEMMosa\ - icCreation.NEMMosaicDefinition.NEMMosaicLevyR\x04levy\x12\x10\n\x03fee\ - \x18\x07\x20\x01(\x04R\x03fee\x12!\n\x0clevy_address\x18\x08\x20\x01(\tR\ - \x0blevyAddress\x12%\n\x0elevy_namespace\x18\t\x20\x01(\tR\rlevyNamespac\ - e\x12\x1f\n\x0blevy_mosaic\x18\n\x20\x01(\tR\nlevyMosaic\x12\x16\n\x06su\ - pply\x18\x0b\x20\x01(\x04R\x06supply\x12%\n\x0emutable_supply\x18\x0c\ - \x20\x01(\x08R\rmutableSupply\x12\"\n\x0ctransferable\x18\r\x20\x01(\x08\ - R\x0ctransferable\x12\x20\n\x0bdescription\x18\x0e\x20\x02(\tR\x0bdescri\ - ption\x12\x1a\n\x08networks\x18\x0f\x20\x03(\rR\x08networks\"C\n\rNEMMos\ - aicLevy\x12\x17\n\x13MosaicLevy_Absolute\x10\x01\x12\x19\n\x15MosaicLevy\ - _Percentile\x10\x02\x1a\x91\x02\n\x15NEMMosaicSupplyChange\x12\x1c\n\tna\ - mespace\x18\x01\x20\x02(\tR\tnamespace\x12\x16\n\x06mosaic\x18\x02\x20\ - \x02(\tR\x06mosaic\x12_\n\x04type\x18\x03\x20\x02(\x0e2K.hw.trezor.messa\ - ges.nem.NEMSignTx.NEMMosaicSupplyChange.NEMSupplyChangeTypeR\x04type\x12\ - \x14\n\x05delta\x18\x04\x20\x02(\x04R\x05delta\"K\n\x13NEMSupplyChangeTy\ - pe\x12\x19\n\x15SupplyChange_Increase\x10\x01\x12\x19\n\x15SupplyChange_\ - Decrease\x10\x02\x1a\xd9\x03\n\x18NEMAggregateModification\x12{\n\rmodif\ - ications\x18\x01\x20\x03(\x0b2U.hw.trezor.messages.nem.NEMSignTx.NEMAggr\ - egateModification.NEMCosignatoryModificationR\rmodifications\x12'\n\x0fr\ - elative_change\x18\x02\x20\x01(\x11R\x0erelativeChange\x1a\x96\x02\n\x1a\ - NEMCosignatoryModification\x12}\n\x04type\x18\x01\x20\x02(\x0e2i.hw.trez\ - or.messages.nem.NEMSignTx.NEMAggregateModification.NEMCosignatoryModific\ - ation.NEMModificationTypeR\x04type\x12\x1d\n\npublic_key\x18\x02\x20\x02\ - (\x0cR\tpublicKey\"Z\n\x13NEMModificationType\x12\x1f\n\x1bCosignatoryMo\ - dification_Add\x10\x01\x12\"\n\x1eCosignatoryModification_Delete\x10\x02\ - \x1a\xfe\x01\n\x15NEMImportanceTransfer\x12e\n\x04mode\x18\x01\x20\x02(\ - \x0e2Q.hw.trezor.messages.nem.NEMSignTx.NEMImportanceTransfer.NEMImporta\ - nceTransferModeR\x04mode\x12\x1d\n\npublic_key\x18\x02\x20\x02(\x0cR\tpu\ - blicKey\"_\n\x19NEMImportanceTransferMode\x12\x1f\n\x1bImportanceTransfe\ - r_Activate\x10\x01\x12!\n\x1dImportanceTransfer_Deactivate\x10\x02\"?\n\ - \x0bNEMSignedTx\x12\x12\n\x04data\x18\x01\x20\x02(\x0cR\x04data\x12\x1c\ - \n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\"\x83\x01\n\x11NEMDecrypt\ - Message\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\ - \x07network\x18\x02\x20\x01(\rR\x07network\x12\x1d\n\npublic_key\x18\x03\ - \x20\x01(\x0cR\tpublicKey\x12\x18\n\x07payload\x18\x04\x20\x01(\x0cR\x07\ - payload\"/\n\x13NEMDecryptedMessage\x12\x18\n\x07payload\x18\x01\x20\x02\ - (\x0cR\x07payloadB7\n#com.satoshilabs.trezor.lib.protobufB\x10TrezorMess\ - ageNem\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(16); - messages.push(NEMGetAddress::generated_message_descriptor_data()); - messages.push(NEMAddress::generated_message_descriptor_data()); - messages.push(NEMSignTx::generated_message_descriptor_data()); - messages.push(NEMSignedTx::generated_message_descriptor_data()); - messages.push(NEMDecryptMessage::generated_message_descriptor_data()); - messages.push(NEMDecryptedMessage::generated_message_descriptor_data()); - messages.push(nemsign_tx::NEMTransactionCommon::generated_message_descriptor_data()); - messages.push(nemsign_tx::NEMTransfer::generated_message_descriptor_data()); - messages.push(nemsign_tx::NEMProvisionNamespace::generated_message_descriptor_data()); - messages.push(nemsign_tx::NEMMosaicCreation::generated_message_descriptor_data()); - messages.push(nemsign_tx::NEMMosaicSupplyChange::generated_message_descriptor_data()); - messages.push(nemsign_tx::NEMAggregateModification::generated_message_descriptor_data()); - messages.push(nemsign_tx::NEMImportanceTransfer::generated_message_descriptor_data()); - messages.push(nemsign_tx::nemtransfer::NEMMosaic::generated_message_descriptor_data()); - messages.push(nemsign_tx::nemmosaic_creation::NEMMosaicDefinition::generated_message_descriptor_data()); - messages.push(nemsign_tx::nemaggregate_modification::NEMCosignatoryModification::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(4); - enums.push(nemsign_tx::nemmosaic_creation::nemmosaic_definition::NEMMosaicLevy::generated_enum_descriptor_data()); - enums.push(nemsign_tx::nemmosaic_supply_change::NEMSupplyChangeType::generated_enum_descriptor_data()); - enums.push(nemsign_tx::nemaggregate_modification::nemcosignatory_modification::NEMModificationType::generated_enum_descriptor_data()); - enums.push(nemsign_tx::nemimportance_transfer::NEMImportanceTransferMode::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_ripple.rs b/wallet/trezor-client/src/protos/generated/messages_ripple.rs deleted file mode 100644 index ab9a5487fe..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_ripple.rs +++ /dev/null @@ -1,1241 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-ripple.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RippleGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RippleGetAddress { - fn default() -> &'a RippleGetAddress { - ::default_instance() - } -} - -impl RippleGetAddress { - pub fn new() -> RippleGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &RippleGetAddress| { &m.address_n }, - |m: &mut RippleGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &RippleGetAddress| { &m.show_display }, - |m: &mut RippleGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &RippleGetAddress| { &m.chunkify }, - |m: &mut RippleGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "RippleGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RippleGetAddress { - const NAME: &'static str = "RippleGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RippleGetAddress { - RippleGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RippleGetAddress { - static instance: RippleGetAddress = RippleGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RippleGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RippleGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RippleGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RippleAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RippleAddress { - fn default() -> &'a RippleAddress { - ::default_instance() - } -} - -impl RippleAddress { - pub fn new() -> RippleAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &RippleAddress| { &m.address }, - |m: &mut RippleAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "RippleAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RippleAddress { - const NAME: &'static str = "RippleAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RippleAddress { - RippleAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RippleAddress { - static instance: RippleAddress = RippleAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RippleAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RippleAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RippleAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RippleSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.flags) - pub flags: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.sequence) - pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.last_ledger_sequence) - pub last_ledger_sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.payment) - pub payment: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RippleSignTx { - fn default() -> &'a RippleSignTx { - ::default_instance() - } -} - -impl RippleSignTx { - pub fn new() -> RippleSignTx { - ::std::default::Default::default() - } - - // required uint64 fee = 2; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // optional uint32 flags = 3; - - pub fn flags(&self) -> u32 { - self.flags.unwrap_or(0u32) - } - - pub fn clear_flags(&mut self) { - self.flags = ::std::option::Option::None; - } - - pub fn has_flags(&self) -> bool { - self.flags.is_some() - } - - // Param is passed by value, moved - pub fn set_flags(&mut self, v: u32) { - self.flags = ::std::option::Option::Some(v); - } - - // required uint32 sequence = 4; - - pub fn sequence(&self) -> u32 { - self.sequence.unwrap_or(0) - } - - pub fn clear_sequence(&mut self) { - self.sequence = ::std::option::Option::None; - } - - pub fn has_sequence(&self) -> bool { - self.sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence(&mut self, v: u32) { - self.sequence = ::std::option::Option::Some(v); - } - - // optional uint32 last_ledger_sequence = 5; - - pub fn last_ledger_sequence(&self) -> u32 { - self.last_ledger_sequence.unwrap_or(0) - } - - pub fn clear_last_ledger_sequence(&mut self) { - self.last_ledger_sequence = ::std::option::Option::None; - } - - pub fn has_last_ledger_sequence(&self) -> bool { - self.last_ledger_sequence.is_some() - } - - // Param is passed by value, moved - pub fn set_last_ledger_sequence(&mut self, v: u32) { - self.last_ledger_sequence = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 7; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &RippleSignTx| { &m.address_n }, - |m: &mut RippleSignTx| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &RippleSignTx| { &m.fee }, - |m: &mut RippleSignTx| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "flags", - |m: &RippleSignTx| { &m.flags }, - |m: &mut RippleSignTx| { &mut m.flags }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence", - |m: &RippleSignTx| { &m.sequence }, - |m: &mut RippleSignTx| { &mut m.sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "last_ledger_sequence", - |m: &RippleSignTx| { &m.last_ledger_sequence }, - |m: &mut RippleSignTx| { &mut m.last_ledger_sequence }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ripple_sign_tx::RipplePayment>( - "payment", - |m: &RippleSignTx| { &m.payment }, - |m: &mut RippleSignTx| { &mut m.payment }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &RippleSignTx| { &m.chunkify }, - |m: &mut RippleSignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "RippleSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RippleSignTx { - const NAME: &'static str = "RippleSignTx"; - - fn is_initialized(&self) -> bool { - if self.fee.is_none() { - return false; - } - if self.sequence.is_none() { - return false; - } - if self.payment.is_none() { - return false; - } - for v in &self.payment { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.flags = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.last_ledger_sequence = ::std::option::Option::Some(is.read_uint32()?); - }, - 50 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.payment)?; - }, - 56 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.flags { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.sequence { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.last_ledger_sequence { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.payment.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.fee { - os.write_uint64(2, v)?; - } - if let Some(v) = self.flags { - os.write_uint32(3, v)?; - } - if let Some(v) = self.sequence { - os.write_uint32(4, v)?; - } - if let Some(v) = self.last_ledger_sequence { - os.write_uint32(5, v)?; - } - if let Some(v) = self.payment.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - } - if let Some(v) = self.chunkify { - os.write_bool(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RippleSignTx { - RippleSignTx::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.fee = ::std::option::Option::None; - self.flags = ::std::option::Option::None; - self.sequence = ::std::option::Option::None; - self.last_ledger_sequence = ::std::option::Option::None; - self.payment.clear(); - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RippleSignTx { - static instance: RippleSignTx = RippleSignTx { - address_n: ::std::vec::Vec::new(), - fee: ::std::option::Option::None, - flags: ::std::option::Option::None, - sequence: ::std::option::Option::None, - last_ledger_sequence: ::std::option::Option::None, - payment: ::protobuf::MessageField::none(), - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RippleSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RippleSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RippleSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `RippleSignTx` -pub mod ripple_sign_tx { - // @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleSignTx.RipplePayment) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct RipplePayment { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.destination) - pub destination: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.destination_tag) - pub destination_tag: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleSignTx.RipplePayment.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a RipplePayment { - fn default() -> &'a RipplePayment { - ::default_instance() - } - } - - impl RipplePayment { - pub fn new() -> RipplePayment { - ::std::default::Default::default() - } - - // required uint64 amount = 1; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // required string destination = 2; - - pub fn destination(&self) -> &str { - match self.destination.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination(&mut self) { - self.destination = ::std::option::Option::None; - } - - pub fn has_destination(&self) -> bool { - self.destination.is_some() - } - - // Param is passed by value, moved - pub fn set_destination(&mut self, v: ::std::string::String) { - self.destination = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination(&mut self) -> &mut ::std::string::String { - if self.destination.is_none() { - self.destination = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination.as_mut().unwrap() - } - - // Take field - pub fn take_destination(&mut self) -> ::std::string::String { - self.destination.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 destination_tag = 3; - - pub fn destination_tag(&self) -> u32 { - self.destination_tag.unwrap_or(0) - } - - pub fn clear_destination_tag(&mut self) { - self.destination_tag = ::std::option::Option::None; - } - - pub fn has_destination_tag(&self) -> bool { - self.destination_tag.is_some() - } - - // Param is passed by value, moved - pub fn set_destination_tag(&mut self, v: u32) { - self.destination_tag = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &RipplePayment| { &m.amount }, - |m: &mut RipplePayment| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination", - |m: &RipplePayment| { &m.destination }, - |m: &mut RipplePayment| { &mut m.destination }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination_tag", - |m: &RipplePayment| { &m.destination_tag }, - |m: &mut RipplePayment| { &mut m.destination_tag }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "RippleSignTx.RipplePayment", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for RipplePayment { - const NAME: &'static str = "RipplePayment"; - - fn is_initialized(&self) -> bool { - if self.amount.is_none() { - return false; - } - if self.destination.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 18 => { - self.destination = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.destination_tag = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(1, v); - } - if let Some(v) = self.destination.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.destination_tag { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.amount { - os.write_uint64(1, v)?; - } - if let Some(v) = self.destination.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.destination_tag { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RipplePayment { - RipplePayment::new() - } - - fn clear(&mut self) { - self.amount = ::std::option::Option::None; - self.destination = ::std::option::Option::None; - self.destination_tag = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RipplePayment { - static instance: RipplePayment = RipplePayment { - amount: ::std::option::Option::None, - destination: ::std::option::Option::None, - destination_tag: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for RipplePayment { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("RippleSignTx.RipplePayment").unwrap()).clone() - } - } - - impl ::std::fmt::Display for RipplePayment { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for RipplePayment { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.ripple.RippleSignedTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RippleSignedTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignedTx.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.ripple.RippleSignedTx.serialized_tx) - pub serialized_tx: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.ripple.RippleSignedTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RippleSignedTx { - fn default() -> &'a RippleSignedTx { - ::default_instance() - } -} - -impl RippleSignedTx { - pub fn new() -> RippleSignedTx { - ::std::default::Default::default() - } - - // required bytes signature = 1; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes serialized_tx = 2; - - pub fn serialized_tx(&self) -> &[u8] { - match self.serialized_tx.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_serialized_tx(&mut self) { - self.serialized_tx = ::std::option::Option::None; - } - - pub fn has_serialized_tx(&self) -> bool { - self.serialized_tx.is_some() - } - - // Param is passed by value, moved - pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { - self.serialized_tx = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { - if self.serialized_tx.is_none() { - self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.serialized_tx.as_mut().unwrap() - } - - // Take field - pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { - self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &RippleSignedTx| { &m.signature }, - |m: &mut RippleSignedTx| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "serialized_tx", - |m: &RippleSignedTx| { &m.serialized_tx }, - |m: &mut RippleSignedTx| { &mut m.serialized_tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "RippleSignedTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RippleSignedTx { - const NAME: &'static str = "RippleSignedTx"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - if self.serialized_tx.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.serialized_tx.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.serialized_tx.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> RippleSignedTx { - RippleSignedTx::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.serialized_tx = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RippleSignedTx { - static instance: RippleSignedTx = RippleSignedTx { - signature: ::std::option::Option::None, - serialized_tx: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RippleSignedTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("RippleSignedTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RippleSignedTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RippleSignedTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x15messages-ripple.proto\x12\x19hw.trezor.messages.ripple\"n\n\x10Rip\ - pleGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\ - \n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chu\ - nkify\x18\x03\x20\x01(\x08R\x08chunkify\")\n\rRippleAddress\x12\x18\n\ - \x07address\x18\x01\x20\x02(\tR\x07address\"\x85\x03\n\x0cRippleSignTx\ - \x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x10\n\x03fee\ - \x18\x02\x20\x02(\x04R\x03fee\x12\x17\n\x05flags\x18\x03\x20\x01(\r:\x01\ - 0R\x05flags\x12\x1a\n\x08sequence\x18\x04\x20\x02(\rR\x08sequence\x120\n\ - \x14last_ledger_sequence\x18\x05\x20\x01(\rR\x12lastLedgerSequence\x12O\ - \n\x07payment\x18\x06\x20\x02(\x0b25.hw.trezor.messages.ripple.RippleSig\ - nTx.RipplePaymentR\x07payment\x12\x1a\n\x08chunkify\x18\x07\x20\x01(\x08\ - R\x08chunkify\x1ar\n\rRipplePayment\x12\x16\n\x06amount\x18\x01\x20\x02(\ - \x04R\x06amount\x12\x20\n\x0bdestination\x18\x02\x20\x02(\tR\x0bdestinat\ - ion\x12'\n\x0fdestination_tag\x18\x03\x20\x01(\rR\x0edestinationTag\"S\n\ - \x0eRippleSignedTx\x12\x1c\n\tsignature\x18\x01\x20\x02(\x0cR\tsignature\ - \x12#\n\rserialized_tx\x18\x02\x20\x02(\x0cR\x0cserializedTxB:\n#com.sat\ - oshilabs.trezor.lib.protobufB\x13TrezorMessageRipple\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(5); - messages.push(RippleGetAddress::generated_message_descriptor_data()); - messages.push(RippleAddress::generated_message_descriptor_data()); - messages.push(RippleSignTx::generated_message_descriptor_data()); - messages.push(RippleSignedTx::generated_message_descriptor_data()); - messages.push(ripple_sign_tx::RipplePayment::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_solana.rs b/wallet/trezor-client/src/protos/generated/messages_solana.rs deleted file mode 100644 index 38d4ba81aa..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_solana.rs +++ /dev/null @@ -1,1594 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-solana.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaGetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaGetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetPublicKey.show_display) - pub show_display: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaGetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaGetPublicKey { - fn default() -> &'a SolanaGetPublicKey { - ::default_instance() - } -} - -impl SolanaGetPublicKey { - pub fn new() -> SolanaGetPublicKey { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &SolanaGetPublicKey| { &m.address_n }, - |m: &mut SolanaGetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &SolanaGetPublicKey| { &m.show_display }, - |m: &mut SolanaGetPublicKey| { &mut m.show_display }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaGetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaGetPublicKey { - const NAME: &'static str = "SolanaGetPublicKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaGetPublicKey { - SolanaGetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaGetPublicKey { - static instance: SolanaGetPublicKey = SolanaGetPublicKey { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaGetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaGetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaGetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaGetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaPublicKey.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaPublicKey { - fn default() -> &'a SolanaPublicKey { - ::default_instance() - } -} - -impl SolanaPublicKey { - pub fn new() -> SolanaPublicKey { - ::std::default::Default::default() - } - - // required bytes public_key = 1; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &SolanaPublicKey| { &m.public_key }, - |m: &mut SolanaPublicKey| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaPublicKey { - const NAME: &'static str = "SolanaPublicKey"; - - fn is_initialized(&self) -> bool { - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaPublicKey { - SolanaPublicKey::new() - } - - fn clear(&mut self) { - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaPublicKey { - static instance: SolanaPublicKey = SolanaPublicKey { - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaGetAddress { - fn default() -> &'a SolanaGetAddress { - ::default_instance() - } -} - -impl SolanaGetAddress { - pub fn new() -> SolanaGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &SolanaGetAddress| { &m.address_n }, - |m: &mut SolanaGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &SolanaGetAddress| { &m.show_display }, - |m: &mut SolanaGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &SolanaGetAddress| { &m.chunkify }, - |m: &mut SolanaGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaGetAddress { - const NAME: &'static str = "SolanaGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaGetAddress { - SolanaGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaGetAddress { - static instance: SolanaGetAddress = SolanaGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaAddress { - fn default() -> &'a SolanaAddress { - ::default_instance() - } -} - -impl SolanaAddress { - pub fn new() -> SolanaAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &SolanaAddress| { &m.address }, - |m: &mut SolanaAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaAddress { - const NAME: &'static str = "SolanaAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaAddress { - SolanaAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaAddress { - static instance: SolanaAddress = SolanaAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaTxTokenAccountInfo) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaTxTokenAccountInfo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.base_address) - pub base_address: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.token_program) - pub token_program: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.token_mint) - pub token_mint: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.token_account) - pub token_account: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxTokenAccountInfo.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaTxTokenAccountInfo { - fn default() -> &'a SolanaTxTokenAccountInfo { - ::default_instance() - } -} - -impl SolanaTxTokenAccountInfo { - pub fn new() -> SolanaTxTokenAccountInfo { - ::std::default::Default::default() - } - - // required string base_address = 1; - - pub fn base_address(&self) -> &str { - match self.base_address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_base_address(&mut self) { - self.base_address = ::std::option::Option::None; - } - - pub fn has_base_address(&self) -> bool { - self.base_address.is_some() - } - - // Param is passed by value, moved - pub fn set_base_address(&mut self, v: ::std::string::String) { - self.base_address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_base_address(&mut self) -> &mut ::std::string::String { - if self.base_address.is_none() { - self.base_address = ::std::option::Option::Some(::std::string::String::new()); - } - self.base_address.as_mut().unwrap() - } - - // Take field - pub fn take_base_address(&mut self) -> ::std::string::String { - self.base_address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string token_program = 2; - - pub fn token_program(&self) -> &str { - match self.token_program.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_token_program(&mut self) { - self.token_program = ::std::option::Option::None; - } - - pub fn has_token_program(&self) -> bool { - self.token_program.is_some() - } - - // Param is passed by value, moved - pub fn set_token_program(&mut self, v: ::std::string::String) { - self.token_program = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_program(&mut self) -> &mut ::std::string::String { - if self.token_program.is_none() { - self.token_program = ::std::option::Option::Some(::std::string::String::new()); - } - self.token_program.as_mut().unwrap() - } - - // Take field - pub fn take_token_program(&mut self) -> ::std::string::String { - self.token_program.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string token_mint = 3; - - pub fn token_mint(&self) -> &str { - match self.token_mint.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_token_mint(&mut self) { - self.token_mint = ::std::option::Option::None; - } - - pub fn has_token_mint(&self) -> bool { - self.token_mint.is_some() - } - - // Param is passed by value, moved - pub fn set_token_mint(&mut self, v: ::std::string::String) { - self.token_mint = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_mint(&mut self) -> &mut ::std::string::String { - if self.token_mint.is_none() { - self.token_mint = ::std::option::Option::Some(::std::string::String::new()); - } - self.token_mint.as_mut().unwrap() - } - - // Take field - pub fn take_token_mint(&mut self) -> ::std::string::String { - self.token_mint.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string token_account = 4; - - pub fn token_account(&self) -> &str { - match self.token_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_token_account(&mut self) { - self.token_account = ::std::option::Option::None; - } - - pub fn has_token_account(&self) -> bool { - self.token_account.is_some() - } - - // Param is passed by value, moved - pub fn set_token_account(&mut self, v: ::std::string::String) { - self.token_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_token_account(&mut self) -> &mut ::std::string::String { - if self.token_account.is_none() { - self.token_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.token_account.as_mut().unwrap() - } - - // Take field - pub fn take_token_account(&mut self) -> ::std::string::String { - self.token_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "base_address", - |m: &SolanaTxTokenAccountInfo| { &m.base_address }, - |m: &mut SolanaTxTokenAccountInfo| { &mut m.base_address }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_program", - |m: &SolanaTxTokenAccountInfo| { &m.token_program }, - |m: &mut SolanaTxTokenAccountInfo| { &mut m.token_program }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_mint", - |m: &SolanaTxTokenAccountInfo| { &m.token_mint }, - |m: &mut SolanaTxTokenAccountInfo| { &mut m.token_mint }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "token_account", - |m: &SolanaTxTokenAccountInfo| { &m.token_account }, - |m: &mut SolanaTxTokenAccountInfo| { &mut m.token_account }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaTxTokenAccountInfo", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaTxTokenAccountInfo { - const NAME: &'static str = "SolanaTxTokenAccountInfo"; - - fn is_initialized(&self) -> bool { - if self.base_address.is_none() { - return false; - } - if self.token_program.is_none() { - return false; - } - if self.token_mint.is_none() { - return false; - } - if self.token_account.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.base_address = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.token_program = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.token_mint = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.token_account = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.base_address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.token_program.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.token_mint.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.token_account.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.base_address.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.token_program.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.token_mint.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.token_account.as_ref() { - os.write_string(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaTxTokenAccountInfo { - SolanaTxTokenAccountInfo::new() - } - - fn clear(&mut self) { - self.base_address = ::std::option::Option::None; - self.token_program = ::std::option::Option::None; - self.token_mint = ::std::option::Option::None; - self.token_account = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaTxTokenAccountInfo { - static instance: SolanaTxTokenAccountInfo = SolanaTxTokenAccountInfo { - base_address: ::std::option::Option::None, - token_program: ::std::option::Option::None, - token_mint: ::std::option::Option::None, - token_account: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaTxTokenAccountInfo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaTxTokenAccountInfo").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaTxTokenAccountInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaTxTokenAccountInfo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaTxAdditionalInfo) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaTxAdditionalInfo { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.token_accounts_infos) - pub token_accounts_infos: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaTxAdditionalInfo { - fn default() -> &'a SolanaTxAdditionalInfo { - ::default_instance() - } -} - -impl SolanaTxAdditionalInfo { - pub fn new() -> SolanaTxAdditionalInfo { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "token_accounts_infos", - |m: &SolanaTxAdditionalInfo| { &m.token_accounts_infos }, - |m: &mut SolanaTxAdditionalInfo| { &mut m.token_accounts_infos }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaTxAdditionalInfo", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaTxAdditionalInfo { - const NAME: &'static str = "SolanaTxAdditionalInfo"; - - fn is_initialized(&self) -> bool { - for v in &self.token_accounts_infos { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.token_accounts_infos.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.token_accounts_infos { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.token_accounts_infos { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaTxAdditionalInfo { - SolanaTxAdditionalInfo::new() - } - - fn clear(&mut self) { - self.token_accounts_infos.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaTxAdditionalInfo { - static instance: SolanaTxAdditionalInfo = SolanaTxAdditionalInfo { - token_accounts_infos: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaTxAdditionalInfo { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaTxAdditionalInfo").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaTxAdditionalInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaTxAdditionalInfo { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaSignTx.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaSignTx.serialized_tx) - pub serialized_tx: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaSignTx.additional_info) - pub additional_info: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaSignTx { - fn default() -> &'a SolanaSignTx { - ::default_instance() - } -} - -impl SolanaSignTx { - pub fn new() -> SolanaSignTx { - ::std::default::Default::default() - } - - // required bytes serialized_tx = 2; - - pub fn serialized_tx(&self) -> &[u8] { - match self.serialized_tx.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_serialized_tx(&mut self) { - self.serialized_tx = ::std::option::Option::None; - } - - pub fn has_serialized_tx(&self) -> bool { - self.serialized_tx.is_some() - } - - // Param is passed by value, moved - pub fn set_serialized_tx(&mut self, v: ::std::vec::Vec) { - self.serialized_tx = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_serialized_tx(&mut self) -> &mut ::std::vec::Vec { - if self.serialized_tx.is_none() { - self.serialized_tx = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.serialized_tx.as_mut().unwrap() - } - - // Take field - pub fn take_serialized_tx(&mut self) -> ::std::vec::Vec { - self.serialized_tx.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &SolanaSignTx| { &m.address_n }, - |m: &mut SolanaSignTx| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "serialized_tx", - |m: &SolanaSignTx| { &m.serialized_tx }, - |m: &mut SolanaSignTx| { &mut m.serialized_tx }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, SolanaTxAdditionalInfo>( - "additional_info", - |m: &SolanaSignTx| { &m.additional_info }, - |m: &mut SolanaSignTx| { &mut m.additional_info }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaSignTx { - const NAME: &'static str = "SolanaSignTx"; - - fn is_initialized(&self) -> bool { - if self.serialized_tx.is_none() { - return false; - } - for v in &self.additional_info { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.serialized_tx = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.additional_info)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.serialized_tx.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.additional_info.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.serialized_tx.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.additional_info.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaSignTx { - SolanaSignTx::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.serialized_tx = ::std::option::Option::None; - self.additional_info.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaSignTx { - static instance: SolanaSignTx = SolanaSignTx { - address_n: ::std::vec::Vec::new(), - serialized_tx: ::std::option::Option::None, - additional_info: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaTxSignature) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SolanaTxSignature { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxSignature.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxSignature.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SolanaTxSignature { - fn default() -> &'a SolanaTxSignature { - ::default_instance() - } -} - -impl SolanaTxSignature { - pub fn new() -> SolanaTxSignature { - ::std::default::Default::default() - } - - // required bytes signature = 1; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &SolanaTxSignature| { &m.signature }, - |m: &mut SolanaTxSignature| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "SolanaTxSignature", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SolanaTxSignature { - const NAME: &'static str = "SolanaTxSignature"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> SolanaTxSignature { - SolanaTxSignature::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static SolanaTxSignature { - static instance: SolanaTxSignature = SolanaTxSignature { - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SolanaTxSignature { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaTxSignature").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SolanaTxSignature { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SolanaTxSignature { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x15messages-solana.proto\x12\x19hw.trezor.messages.solana\"T\n\x12Sol\ - anaGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\ - !\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"0\n\x0fSolanaP\ - ublicKey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\"n\n\x10\ - SolanaGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\ - \x08chunkify\x18\x03\x20\x01(\x08R\x08chunkify\")\n\rSolanaAddress\x12\ - \x18\n\x07address\x18\x01\x20\x02(\tR\x07address\"\xa6\x01\n\x18SolanaTx\ - TokenAccountInfo\x12!\n\x0cbase_address\x18\x01\x20\x02(\tR\x0bbaseAddre\ - ss\x12#\n\rtoken_program\x18\x02\x20\x02(\tR\x0ctokenProgram\x12\x1d\n\n\ - token_mint\x18\x03\x20\x02(\tR\ttokenMint\x12#\n\rtoken_account\x18\x04\ - \x20\x02(\tR\x0ctokenAccount\"\x7f\n\x16SolanaTxAdditionalInfo\x12e\n\ - \x14token_accounts_infos\x18\x01\x20\x03(\x0b23.hw.trezor.messages.solan\ - a.SolanaTxTokenAccountInfoR\x12tokenAccountsInfos\"\xac\x01\n\x0cSolanaS\ - ignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12#\n\rseria\ - lized_tx\x18\x02\x20\x02(\x0cR\x0cserializedTx\x12Z\n\x0fadditional_info\ - \x18\x03\x20\x01(\x0b21.hw.trezor.messages.solana.SolanaTxAdditionalInfo\ - R\x0eadditionalInfo\"1\n\x11SolanaTxSignature\x12\x1c\n\tsignature\x18\ - \x01\x20\x02(\x0cR\tsignature\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(8); - messages.push(SolanaGetPublicKey::generated_message_descriptor_data()); - messages.push(SolanaPublicKey::generated_message_descriptor_data()); - messages.push(SolanaGetAddress::generated_message_descriptor_data()); - messages.push(SolanaAddress::generated_message_descriptor_data()); - messages.push(SolanaTxTokenAccountInfo::generated_message_descriptor_data()); - messages.push(SolanaTxAdditionalInfo::generated_message_descriptor_data()); - messages.push(SolanaSignTx::generated_message_descriptor_data()); - messages.push(SolanaTxSignature::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_stellar.rs b/wallet/trezor-client/src/protos/generated/messages_stellar.rs deleted file mode 100644 index e9fa8fa9e9..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_stellar.rs +++ /dev/null @@ -1,6413 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-stellar.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAsset) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarAsset { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAsset.type) - pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAsset.code) - pub code: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAsset.issuer) - pub issuer: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAsset.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarAsset { - fn default() -> &'a StellarAsset { - ::default_instance() - } -} - -impl StellarAsset { - pub fn new() -> StellarAsset { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.stellar.StellarAssetType type = 1; - - pub fn type_(&self) -> StellarAssetType { - match self.type_ { - Some(e) => e.enum_value_or(StellarAssetType::NATIVE), - None => StellarAssetType::NATIVE, - } - } - - pub fn clear_type_(&mut self) { - self.type_ = ::std::option::Option::None; - } - - pub fn has_type(&self) -> bool { - self.type_.is_some() - } - - // Param is passed by value, moved - pub fn set_type(&mut self, v: StellarAssetType) { - self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional string code = 2; - - pub fn code(&self) -> &str { - match self.code.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_code(&mut self) { - self.code = ::std::option::Option::None; - } - - pub fn has_code(&self) -> bool { - self.code.is_some() - } - - // Param is passed by value, moved - pub fn set_code(&mut self, v: ::std::string::String) { - self.code = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_code(&mut self) -> &mut ::std::string::String { - if self.code.is_none() { - self.code = ::std::option::Option::Some(::std::string::String::new()); - } - self.code.as_mut().unwrap() - } - - // Take field - pub fn take_code(&mut self) -> ::std::string::String { - self.code.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string issuer = 3; - - pub fn issuer(&self) -> &str { - match self.issuer.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_issuer(&mut self) { - self.issuer = ::std::option::Option::None; - } - - pub fn has_issuer(&self) -> bool { - self.issuer.is_some() - } - - // Param is passed by value, moved - pub fn set_issuer(&mut self, v: ::std::string::String) { - self.issuer = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_issuer(&mut self) -> &mut ::std::string::String { - if self.issuer.is_none() { - self.issuer = ::std::option::Option::Some(::std::string::String::new()); - } - self.issuer.as_mut().unwrap() - } - - // Take field - pub fn take_issuer(&mut self) -> ::std::string::String { - self.issuer.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "type", - |m: &StellarAsset| { &m.type_ }, - |m: &mut StellarAsset| { &mut m.type_ }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "code", - |m: &StellarAsset| { &m.code }, - |m: &mut StellarAsset| { &mut m.code }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "issuer", - |m: &StellarAsset| { &m.issuer }, - |m: &mut StellarAsset| { &mut m.issuer }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarAsset", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarAsset { - const NAME: &'static str = "StellarAsset"; - - fn is_initialized(&self) -> bool { - if self.type_.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.code = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.issuer = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.type_ { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.code.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.issuer.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.type_ { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.code.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.issuer.as_ref() { - os.write_string(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarAsset { - StellarAsset::new() - } - - fn clear(&mut self) { - self.type_ = ::std::option::Option::None; - self.code = ::std::option::Option::None; - self.issuer = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarAsset { - static instance: StellarAsset = StellarAsset { - type_: ::std::option::Option::None, - code: ::std::option::Option::None, - issuer: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarAsset { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAsset").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarAsset { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarAsset { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarGetAddress { - fn default() -> &'a StellarGetAddress { - ::default_instance() - } -} - -impl StellarGetAddress { - pub fn new() -> StellarGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &StellarGetAddress| { &m.address_n }, - |m: &mut StellarGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &StellarGetAddress| { &m.show_display }, - |m: &mut StellarGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &StellarGetAddress| { &m.chunkify }, - |m: &mut StellarGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarGetAddress { - const NAME: &'static str = "StellarGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarGetAddress { - StellarGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarGetAddress { - static instance: StellarGetAddress = StellarGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarAddress { - fn default() -> &'a StellarAddress { - ::default_instance() - } -} - -impl StellarAddress { - pub fn new() -> StellarAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &StellarAddress| { &m.address }, - |m: &mut StellarAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarAddress { - const NAME: &'static str = "StellarAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarAddress { - StellarAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarAddress { - static instance: StellarAddress = StellarAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.network_passphrase) - pub network_passphrase: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.sequence_number) - pub sequence_number: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.timebounds_start) - pub timebounds_start: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.timebounds_end) - pub timebounds_end: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_type) - pub memo_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_text) - pub memo_text: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_id) - pub memo_id: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.memo_hash) - pub memo_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignTx.num_operations) - pub num_operations: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarSignTx { - fn default() -> &'a StellarSignTx { - ::default_instance() - } -} - -impl StellarSignTx { - pub fn new() -> StellarSignTx { - ::std::default::Default::default() - } - - // required string network_passphrase = 3; - - pub fn network_passphrase(&self) -> &str { - match self.network_passphrase.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_network_passphrase(&mut self) { - self.network_passphrase = ::std::option::Option::None; - } - - pub fn has_network_passphrase(&self) -> bool { - self.network_passphrase.is_some() - } - - // Param is passed by value, moved - pub fn set_network_passphrase(&mut self, v: ::std::string::String) { - self.network_passphrase = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_network_passphrase(&mut self) -> &mut ::std::string::String { - if self.network_passphrase.is_none() { - self.network_passphrase = ::std::option::Option::Some(::std::string::String::new()); - } - self.network_passphrase.as_mut().unwrap() - } - - // Take field - pub fn take_network_passphrase(&mut self) -> ::std::string::String { - self.network_passphrase.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string source_account = 4; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint32 fee = 5; - - pub fn fee(&self) -> u32 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u32) { - self.fee = ::std::option::Option::Some(v); - } - - // required uint64 sequence_number = 6; - - pub fn sequence_number(&self) -> u64 { - self.sequence_number.unwrap_or(0) - } - - pub fn clear_sequence_number(&mut self) { - self.sequence_number = ::std::option::Option::None; - } - - pub fn has_sequence_number(&self) -> bool { - self.sequence_number.is_some() - } - - // Param is passed by value, moved - pub fn set_sequence_number(&mut self, v: u64) { - self.sequence_number = ::std::option::Option::Some(v); - } - - // required uint32 timebounds_start = 8; - - pub fn timebounds_start(&self) -> u32 { - self.timebounds_start.unwrap_or(0) - } - - pub fn clear_timebounds_start(&mut self) { - self.timebounds_start = ::std::option::Option::None; - } - - pub fn has_timebounds_start(&self) -> bool { - self.timebounds_start.is_some() - } - - // Param is passed by value, moved - pub fn set_timebounds_start(&mut self, v: u32) { - self.timebounds_start = ::std::option::Option::Some(v); - } - - // required uint32 timebounds_end = 9; - - pub fn timebounds_end(&self) -> u32 { - self.timebounds_end.unwrap_or(0) - } - - pub fn clear_timebounds_end(&mut self) { - self.timebounds_end = ::std::option::Option::None; - } - - pub fn has_timebounds_end(&self) -> bool { - self.timebounds_end.is_some() - } - - // Param is passed by value, moved - pub fn set_timebounds_end(&mut self, v: u32) { - self.timebounds_end = ::std::option::Option::Some(v); - } - - // required .hw.trezor.messages.stellar.StellarSignTx.StellarMemoType memo_type = 10; - - pub fn memo_type(&self) -> stellar_sign_tx::StellarMemoType { - match self.memo_type { - Some(e) => e.enum_value_or(stellar_sign_tx::StellarMemoType::NONE), - None => stellar_sign_tx::StellarMemoType::NONE, - } - } - - pub fn clear_memo_type(&mut self) { - self.memo_type = ::std::option::Option::None; - } - - pub fn has_memo_type(&self) -> bool { - self.memo_type.is_some() - } - - // Param is passed by value, moved - pub fn set_memo_type(&mut self, v: stellar_sign_tx::StellarMemoType) { - self.memo_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional string memo_text = 11; - - pub fn memo_text(&self) -> &str { - match self.memo_text.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_memo_text(&mut self) { - self.memo_text = ::std::option::Option::None; - } - - pub fn has_memo_text(&self) -> bool { - self.memo_text.is_some() - } - - // Param is passed by value, moved - pub fn set_memo_text(&mut self, v: ::std::string::String) { - self.memo_text = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_memo_text(&mut self) -> &mut ::std::string::String { - if self.memo_text.is_none() { - self.memo_text = ::std::option::Option::Some(::std::string::String::new()); - } - self.memo_text.as_mut().unwrap() - } - - // Take field - pub fn take_memo_text(&mut self) -> ::std::string::String { - self.memo_text.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint64 memo_id = 12; - - pub fn memo_id(&self) -> u64 { - self.memo_id.unwrap_or(0) - } - - pub fn clear_memo_id(&mut self) { - self.memo_id = ::std::option::Option::None; - } - - pub fn has_memo_id(&self) -> bool { - self.memo_id.is_some() - } - - // Param is passed by value, moved - pub fn set_memo_id(&mut self, v: u64) { - self.memo_id = ::std::option::Option::Some(v); - } - - // optional bytes memo_hash = 13; - - pub fn memo_hash(&self) -> &[u8] { - match self.memo_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_memo_hash(&mut self) { - self.memo_hash = ::std::option::Option::None; - } - - pub fn has_memo_hash(&self) -> bool { - self.memo_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_memo_hash(&mut self, v: ::std::vec::Vec) { - self.memo_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_memo_hash(&mut self) -> &mut ::std::vec::Vec { - if self.memo_hash.is_none() { - self.memo_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.memo_hash.as_mut().unwrap() - } - - // Take field - pub fn take_memo_hash(&mut self) -> ::std::vec::Vec { - self.memo_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 num_operations = 14; - - pub fn num_operations(&self) -> u32 { - self.num_operations.unwrap_or(0) - } - - pub fn clear_num_operations(&mut self) { - self.num_operations = ::std::option::Option::None; - } - - pub fn has_num_operations(&self) -> bool { - self.num_operations.is_some() - } - - // Param is passed by value, moved - pub fn set_num_operations(&mut self, v: u32) { - self.num_operations = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(12); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &StellarSignTx| { &m.address_n }, - |m: &mut StellarSignTx| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "network_passphrase", - |m: &StellarSignTx| { &m.network_passphrase }, - |m: &mut StellarSignTx| { &mut m.network_passphrase }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarSignTx| { &m.source_account }, - |m: &mut StellarSignTx| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &StellarSignTx| { &m.fee }, - |m: &mut StellarSignTx| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sequence_number", - |m: &StellarSignTx| { &m.sequence_number }, - |m: &mut StellarSignTx| { &mut m.sequence_number }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "timebounds_start", - |m: &StellarSignTx| { &m.timebounds_start }, - |m: &mut StellarSignTx| { &mut m.timebounds_start }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "timebounds_end", - |m: &StellarSignTx| { &m.timebounds_end }, - |m: &mut StellarSignTx| { &mut m.timebounds_end }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memo_type", - |m: &StellarSignTx| { &m.memo_type }, - |m: &mut StellarSignTx| { &mut m.memo_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memo_text", - |m: &StellarSignTx| { &m.memo_text }, - |m: &mut StellarSignTx| { &mut m.memo_text }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memo_id", - |m: &StellarSignTx| { &m.memo_id }, - |m: &mut StellarSignTx| { &mut m.memo_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "memo_hash", - |m: &StellarSignTx| { &m.memo_hash }, - |m: &mut StellarSignTx| { &mut m.memo_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "num_operations", - |m: &StellarSignTx| { &m.num_operations }, - |m: &mut StellarSignTx| { &mut m.num_operations }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarSignTx { - const NAME: &'static str = "StellarSignTx"; - - fn is_initialized(&self) -> bool { - if self.network_passphrase.is_none() { - return false; - } - if self.source_account.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - if self.sequence_number.is_none() { - return false; - } - if self.timebounds_start.is_none() { - return false; - } - if self.timebounds_end.is_none() { - return false; - } - if self.memo_type.is_none() { - return false; - } - if self.num_operations.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 16 => { - self.address_n.push(is.read_uint32()?); - }, - 26 => { - self.network_passphrase = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 40 => { - self.fee = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.sequence_number = ::std::option::Option::Some(is.read_uint64()?); - }, - 64 => { - self.timebounds_start = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.timebounds_end = ::std::option::Option::Some(is.read_uint32()?); - }, - 80 => { - self.memo_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 90 => { - self.memo_text = ::std::option::Option::Some(is.read_string()?); - }, - 96 => { - self.memo_id = ::std::option::Option::Some(is.read_uint64()?); - }, - 106 => { - self.memo_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 112 => { - self.num_operations = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(2, *value); - }; - if let Some(v) = self.network_passphrase.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.sequence_number { - my_size += ::protobuf::rt::uint64_size(6, v); - } - if let Some(v) = self.timebounds_start { - my_size += ::protobuf::rt::uint32_size(8, v); - } - if let Some(v) = self.timebounds_end { - my_size += ::protobuf::rt::uint32_size(9, v); - } - if let Some(v) = self.memo_type { - my_size += ::protobuf::rt::int32_size(10, v.value()); - } - if let Some(v) = self.memo_text.as_ref() { - my_size += ::protobuf::rt::string_size(11, &v); - } - if let Some(v) = self.memo_id { - my_size += ::protobuf::rt::uint64_size(12, v); - } - if let Some(v) = self.memo_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(13, &v); - } - if let Some(v) = self.num_operations { - my_size += ::protobuf::rt::uint32_size(14, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(2, *v)?; - }; - if let Some(v) = self.network_passphrase.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.source_account.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.fee { - os.write_uint32(5, v)?; - } - if let Some(v) = self.sequence_number { - os.write_uint64(6, v)?; - } - if let Some(v) = self.timebounds_start { - os.write_uint32(8, v)?; - } - if let Some(v) = self.timebounds_end { - os.write_uint32(9, v)?; - } - if let Some(v) = self.memo_type { - os.write_enum(10, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.memo_text.as_ref() { - os.write_string(11, v)?; - } - if let Some(v) = self.memo_id { - os.write_uint64(12, v)?; - } - if let Some(v) = self.memo_hash.as_ref() { - os.write_bytes(13, v)?; - } - if let Some(v) = self.num_operations { - os.write_uint32(14, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarSignTx { - StellarSignTx::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.network_passphrase = ::std::option::Option::None; - self.source_account = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.sequence_number = ::std::option::Option::None; - self.timebounds_start = ::std::option::Option::None; - self.timebounds_end = ::std::option::Option::None; - self.memo_type = ::std::option::Option::None; - self.memo_text = ::std::option::Option::None; - self.memo_id = ::std::option::Option::None; - self.memo_hash = ::std::option::Option::None; - self.num_operations = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarSignTx { - static instance: StellarSignTx = StellarSignTx { - address_n: ::std::vec::Vec::new(), - network_passphrase: ::std::option::Option::None, - source_account: ::std::option::Option::None, - fee: ::std::option::Option::None, - sequence_number: ::std::option::Option::None, - timebounds_start: ::std::option::Option::None, - timebounds_end: ::std::option::Option::None, - memo_type: ::std::option::Option::None, - memo_text: ::std::option::Option::None, - memo_id: ::std::option::Option::None, - memo_hash: ::std::option::Option::None, - num_operations: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `StellarSignTx` -pub mod stellar_sign_tx { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType) - pub enum StellarMemoType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.NONE) - NONE = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.TEXT) - TEXT = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.ID) - ID = 2, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.HASH) - HASH = 3, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSignTx.StellarMemoType.RETURN) - RETURN = 4, - } - - impl ::protobuf::Enum for StellarMemoType { - const NAME: &'static str = "StellarMemoType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(StellarMemoType::NONE), - 1 => ::std::option::Option::Some(StellarMemoType::TEXT), - 2 => ::std::option::Option::Some(StellarMemoType::ID), - 3 => ::std::option::Option::Some(StellarMemoType::HASH), - 4 => ::std::option::Option::Some(StellarMemoType::RETURN), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "NONE" => ::std::option::Option::Some(StellarMemoType::NONE), - "TEXT" => ::std::option::Option::Some(StellarMemoType::TEXT), - "ID" => ::std::option::Option::Some(StellarMemoType::ID), - "HASH" => ::std::option::Option::Some(StellarMemoType::HASH), - "RETURN" => ::std::option::Option::Some(StellarMemoType::RETURN), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [StellarMemoType] = &[ - StellarMemoType::NONE, - StellarMemoType::TEXT, - StellarMemoType::ID, - StellarMemoType::HASH, - StellarMemoType::RETURN, - ]; - } - - impl ::protobuf::EnumFull for StellarMemoType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("StellarSignTx.StellarMemoType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for StellarMemoType { - fn default() -> Self { - StellarMemoType::NONE - } - } - - impl StellarMemoType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("StellarSignTx.StellarMemoType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarTxOpRequest) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarTxOpRequest { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarTxOpRequest.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarTxOpRequest { - fn default() -> &'a StellarTxOpRequest { - ::default_instance() - } -} - -impl StellarTxOpRequest { - pub fn new() -> StellarTxOpRequest { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarTxOpRequest", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarTxOpRequest { - const NAME: &'static str = "StellarTxOpRequest"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarTxOpRequest { - StellarTxOpRequest::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarTxOpRequest { - static instance: StellarTxOpRequest = StellarTxOpRequest { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarTxOpRequest { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarTxOpRequest").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarTxOpRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarTxOpRequest { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarPaymentOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarPaymentOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.destination_account) - pub destination_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.asset) - pub asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPaymentOp.amount) - pub amount: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarPaymentOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarPaymentOp { - fn default() -> &'a StellarPaymentOp { - ::default_instance() - } -} - -impl StellarPaymentOp { - pub fn new() -> StellarPaymentOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string destination_account = 2; - - pub fn destination_account(&self) -> &str { - match self.destination_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination_account(&mut self) { - self.destination_account = ::std::option::Option::None; - } - - pub fn has_destination_account(&self) -> bool { - self.destination_account.is_some() - } - - // Param is passed by value, moved - pub fn set_destination_account(&mut self, v: ::std::string::String) { - self.destination_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { - if self.destination_account.is_none() { - self.destination_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination_account.as_mut().unwrap() - } - - // Take field - pub fn take_destination_account(&mut self) -> ::std::string::String { - self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 amount = 4; - - pub fn amount(&self) -> i64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: i64) { - self.amount = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarPaymentOp| { &m.source_account }, - |m: &mut StellarPaymentOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination_account", - |m: &StellarPaymentOp| { &m.destination_account }, - |m: &mut StellarPaymentOp| { &mut m.destination_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "asset", - |m: &StellarPaymentOp| { &m.asset }, - |m: &mut StellarPaymentOp| { &mut m.asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &StellarPaymentOp| { &m.amount }, - |m: &mut StellarPaymentOp| { &mut m.amount }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarPaymentOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarPaymentOp { - const NAME: &'static str = "StellarPaymentOp"; - - fn is_initialized(&self) -> bool { - if self.destination_account.is_none() { - return false; - } - if self.asset.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - for v in &self.asset { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.destination_account = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.asset)?; - }, - 32 => { - self.amount = ::std::option::Option::Some(is.read_sint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.destination_account.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::sint64_size(4, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.destination_account.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.amount { - os.write_sint64(4, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarPaymentOp { - StellarPaymentOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.destination_account = ::std::option::Option::None; - self.asset.clear(); - self.amount = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarPaymentOp { - static instance: StellarPaymentOp = StellarPaymentOp { - source_account: ::std::option::Option::None, - destination_account: ::std::option::Option::None, - asset: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarPaymentOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarPaymentOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarPaymentOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarPaymentOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarCreateAccountOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarCreateAccountOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreateAccountOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreateAccountOp.new_account) - pub new_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreateAccountOp.starting_balance) - pub starting_balance: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarCreateAccountOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarCreateAccountOp { - fn default() -> &'a StellarCreateAccountOp { - ::default_instance() - } -} - -impl StellarCreateAccountOp { - pub fn new() -> StellarCreateAccountOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string new_account = 2; - - pub fn new_account(&self) -> &str { - match self.new_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_new_account(&mut self) { - self.new_account = ::std::option::Option::None; - } - - pub fn has_new_account(&self) -> bool { - self.new_account.is_some() - } - - // Param is passed by value, moved - pub fn set_new_account(&mut self, v: ::std::string::String) { - self.new_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_new_account(&mut self) -> &mut ::std::string::String { - if self.new_account.is_none() { - self.new_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.new_account.as_mut().unwrap() - } - - // Take field - pub fn take_new_account(&mut self) -> ::std::string::String { - self.new_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 starting_balance = 3; - - pub fn starting_balance(&self) -> i64 { - self.starting_balance.unwrap_or(0) - } - - pub fn clear_starting_balance(&mut self) { - self.starting_balance = ::std::option::Option::None; - } - - pub fn has_starting_balance(&self) -> bool { - self.starting_balance.is_some() - } - - // Param is passed by value, moved - pub fn set_starting_balance(&mut self, v: i64) { - self.starting_balance = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarCreateAccountOp| { &m.source_account }, - |m: &mut StellarCreateAccountOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "new_account", - |m: &StellarCreateAccountOp| { &m.new_account }, - |m: &mut StellarCreateAccountOp| { &mut m.new_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "starting_balance", - |m: &StellarCreateAccountOp| { &m.starting_balance }, - |m: &mut StellarCreateAccountOp| { &mut m.starting_balance }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarCreateAccountOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarCreateAccountOp { - const NAME: &'static str = "StellarCreateAccountOp"; - - fn is_initialized(&self) -> bool { - if self.new_account.is_none() { - return false; - } - if self.starting_balance.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.new_account = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.starting_balance = ::std::option::Option::Some(is.read_sint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.new_account.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.starting_balance { - my_size += ::protobuf::rt::sint64_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.new_account.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.starting_balance { - os.write_sint64(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarCreateAccountOp { - StellarCreateAccountOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.new_account = ::std::option::Option::None; - self.starting_balance = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarCreateAccountOp { - static instance: StellarCreateAccountOp = StellarCreateAccountOp { - source_account: ::std::option::Option::None, - new_account: ::std::option::Option::None, - starting_balance: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarCreateAccountOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarCreateAccountOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarCreateAccountOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarCreateAccountOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarPathPaymentStrictReceiveOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.send_asset) - pub send_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.send_max) - pub send_max: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.destination_account) - pub destination_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.destination_asset) - pub destination_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.destination_amount) - pub destination_amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.paths) - pub paths: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarPathPaymentStrictReceiveOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarPathPaymentStrictReceiveOp { - fn default() -> &'a StellarPathPaymentStrictReceiveOp { - ::default_instance() - } -} - -impl StellarPathPaymentStrictReceiveOp { - pub fn new() -> StellarPathPaymentStrictReceiveOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 send_max = 3; - - pub fn send_max(&self) -> i64 { - self.send_max.unwrap_or(0) - } - - pub fn clear_send_max(&mut self) { - self.send_max = ::std::option::Option::None; - } - - pub fn has_send_max(&self) -> bool { - self.send_max.is_some() - } - - // Param is passed by value, moved - pub fn set_send_max(&mut self, v: i64) { - self.send_max = ::std::option::Option::Some(v); - } - - // required string destination_account = 4; - - pub fn destination_account(&self) -> &str { - match self.destination_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination_account(&mut self) { - self.destination_account = ::std::option::Option::None; - } - - pub fn has_destination_account(&self) -> bool { - self.destination_account.is_some() - } - - // Param is passed by value, moved - pub fn set_destination_account(&mut self, v: ::std::string::String) { - self.destination_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { - if self.destination_account.is_none() { - self.destination_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination_account.as_mut().unwrap() - } - - // Take field - pub fn take_destination_account(&mut self) -> ::std::string::String { - self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 destination_amount = 6; - - pub fn destination_amount(&self) -> i64 { - self.destination_amount.unwrap_or(0) - } - - pub fn clear_destination_amount(&mut self) { - self.destination_amount = ::std::option::Option::None; - } - - pub fn has_destination_amount(&self) -> bool { - self.destination_amount.is_some() - } - - // Param is passed by value, moved - pub fn set_destination_amount(&mut self, v: i64) { - self.destination_amount = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarPathPaymentStrictReceiveOp| { &m.source_account }, - |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "send_asset", - |m: &StellarPathPaymentStrictReceiveOp| { &m.send_asset }, - |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.send_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "send_max", - |m: &StellarPathPaymentStrictReceiveOp| { &m.send_max }, - |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.send_max }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination_account", - |m: &StellarPathPaymentStrictReceiveOp| { &m.destination_account }, - |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.destination_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "destination_asset", - |m: &StellarPathPaymentStrictReceiveOp| { &m.destination_asset }, - |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.destination_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination_amount", - |m: &StellarPathPaymentStrictReceiveOp| { &m.destination_amount }, - |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.destination_amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "paths", - |m: &StellarPathPaymentStrictReceiveOp| { &m.paths }, - |m: &mut StellarPathPaymentStrictReceiveOp| { &mut m.paths }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarPathPaymentStrictReceiveOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarPathPaymentStrictReceiveOp { - const NAME: &'static str = "StellarPathPaymentStrictReceiveOp"; - - fn is_initialized(&self) -> bool { - if self.send_asset.is_none() { - return false; - } - if self.send_max.is_none() { - return false; - } - if self.destination_account.is_none() { - return false; - } - if self.destination_asset.is_none() { - return false; - } - if self.destination_amount.is_none() { - return false; - } - for v in &self.send_asset { - if !v.is_initialized() { - return false; - } - }; - for v in &self.destination_asset { - if !v.is_initialized() { - return false; - } - }; - for v in &self.paths { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.send_asset)?; - }, - 24 => { - self.send_max = ::std::option::Option::Some(is.read_sint64()?); - }, - 34 => { - self.destination_account = ::std::option::Option::Some(is.read_string()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination_asset)?; - }, - 48 => { - self.destination_amount = ::std::option::Option::Some(is.read_sint64()?); - }, - 58 => { - self.paths.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.send_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.send_max { - my_size += ::protobuf::rt::sint64_size(3, v); - } - if let Some(v) = self.destination_account.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.destination_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.destination_amount { - my_size += ::protobuf::rt::sint64_size(6, v); - } - for value in &self.paths { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.send_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.send_max { - os.write_sint64(3, v)?; - } - if let Some(v) = self.destination_account.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.destination_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.destination_amount { - os.write_sint64(6, v)?; - } - for v in &self.paths { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarPathPaymentStrictReceiveOp { - StellarPathPaymentStrictReceiveOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.send_asset.clear(); - self.send_max = ::std::option::Option::None; - self.destination_account = ::std::option::Option::None; - self.destination_asset.clear(); - self.destination_amount = ::std::option::Option::None; - self.paths.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarPathPaymentStrictReceiveOp { - static instance: StellarPathPaymentStrictReceiveOp = StellarPathPaymentStrictReceiveOp { - source_account: ::std::option::Option::None, - send_asset: ::protobuf::MessageField::none(), - send_max: ::std::option::Option::None, - destination_account: ::std::option::Option::None, - destination_asset: ::protobuf::MessageField::none(), - destination_amount: ::std::option::Option::None, - paths: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarPathPaymentStrictReceiveOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarPathPaymentStrictReceiveOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarPathPaymentStrictReceiveOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarPathPaymentStrictReceiveOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarPathPaymentStrictSendOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.send_asset) - pub send_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.send_amount) - pub send_amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.destination_account) - pub destination_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.destination_asset) - pub destination_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.destination_min) - pub destination_min: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.paths) - pub paths: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarPathPaymentStrictSendOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarPathPaymentStrictSendOp { - fn default() -> &'a StellarPathPaymentStrictSendOp { - ::default_instance() - } -} - -impl StellarPathPaymentStrictSendOp { - pub fn new() -> StellarPathPaymentStrictSendOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 send_amount = 3; - - pub fn send_amount(&self) -> i64 { - self.send_amount.unwrap_or(0) - } - - pub fn clear_send_amount(&mut self) { - self.send_amount = ::std::option::Option::None; - } - - pub fn has_send_amount(&self) -> bool { - self.send_amount.is_some() - } - - // Param is passed by value, moved - pub fn set_send_amount(&mut self, v: i64) { - self.send_amount = ::std::option::Option::Some(v); - } - - // required string destination_account = 4; - - pub fn destination_account(&self) -> &str { - match self.destination_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination_account(&mut self) { - self.destination_account = ::std::option::Option::None; - } - - pub fn has_destination_account(&self) -> bool { - self.destination_account.is_some() - } - - // Param is passed by value, moved - pub fn set_destination_account(&mut self, v: ::std::string::String) { - self.destination_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { - if self.destination_account.is_none() { - self.destination_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination_account.as_mut().unwrap() - } - - // Take field - pub fn take_destination_account(&mut self) -> ::std::string::String { - self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 destination_min = 6; - - pub fn destination_min(&self) -> i64 { - self.destination_min.unwrap_or(0) - } - - pub fn clear_destination_min(&mut self) { - self.destination_min = ::std::option::Option::None; - } - - pub fn has_destination_min(&self) -> bool { - self.destination_min.is_some() - } - - // Param is passed by value, moved - pub fn set_destination_min(&mut self, v: i64) { - self.destination_min = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarPathPaymentStrictSendOp| { &m.source_account }, - |m: &mut StellarPathPaymentStrictSendOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "send_asset", - |m: &StellarPathPaymentStrictSendOp| { &m.send_asset }, - |m: &mut StellarPathPaymentStrictSendOp| { &mut m.send_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "send_amount", - |m: &StellarPathPaymentStrictSendOp| { &m.send_amount }, - |m: &mut StellarPathPaymentStrictSendOp| { &mut m.send_amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination_account", - |m: &StellarPathPaymentStrictSendOp| { &m.destination_account }, - |m: &mut StellarPathPaymentStrictSendOp| { &mut m.destination_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "destination_asset", - |m: &StellarPathPaymentStrictSendOp| { &m.destination_asset }, - |m: &mut StellarPathPaymentStrictSendOp| { &mut m.destination_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination_min", - |m: &StellarPathPaymentStrictSendOp| { &m.destination_min }, - |m: &mut StellarPathPaymentStrictSendOp| { &mut m.destination_min }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "paths", - |m: &StellarPathPaymentStrictSendOp| { &m.paths }, - |m: &mut StellarPathPaymentStrictSendOp| { &mut m.paths }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarPathPaymentStrictSendOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarPathPaymentStrictSendOp { - const NAME: &'static str = "StellarPathPaymentStrictSendOp"; - - fn is_initialized(&self) -> bool { - if self.send_asset.is_none() { - return false; - } - if self.send_amount.is_none() { - return false; - } - if self.destination_account.is_none() { - return false; - } - if self.destination_asset.is_none() { - return false; - } - if self.destination_min.is_none() { - return false; - } - for v in &self.send_asset { - if !v.is_initialized() { - return false; - } - }; - for v in &self.destination_asset { - if !v.is_initialized() { - return false; - } - }; - for v in &self.paths { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.send_asset)?; - }, - 24 => { - self.send_amount = ::std::option::Option::Some(is.read_sint64()?); - }, - 34 => { - self.destination_account = ::std::option::Option::Some(is.read_string()?); - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination_asset)?; - }, - 48 => { - self.destination_min = ::std::option::Option::Some(is.read_sint64()?); - }, - 58 => { - self.paths.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.send_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.send_amount { - my_size += ::protobuf::rt::sint64_size(3, v); - } - if let Some(v) = self.destination_account.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.destination_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.destination_min { - my_size += ::protobuf::rt::sint64_size(6, v); - } - for value in &self.paths { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.send_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.send_amount { - os.write_sint64(3, v)?; - } - if let Some(v) = self.destination_account.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.destination_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.destination_min { - os.write_sint64(6, v)?; - } - for v in &self.paths { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarPathPaymentStrictSendOp { - StellarPathPaymentStrictSendOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.send_asset.clear(); - self.send_amount = ::std::option::Option::None; - self.destination_account = ::std::option::Option::None; - self.destination_asset.clear(); - self.destination_min = ::std::option::Option::None; - self.paths.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarPathPaymentStrictSendOp { - static instance: StellarPathPaymentStrictSendOp = StellarPathPaymentStrictSendOp { - source_account: ::std::option::Option::None, - send_asset: ::protobuf::MessageField::none(), - send_amount: ::std::option::Option::None, - destination_account: ::std::option::Option::None, - destination_asset: ::protobuf::MessageField::none(), - destination_min: ::std::option::Option::None, - paths: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarPathPaymentStrictSendOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarPathPaymentStrictSendOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarPathPaymentStrictSendOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarPathPaymentStrictSendOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarManageSellOfferOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarManageSellOfferOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.selling_asset) - pub selling_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.buying_asset) - pub buying_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.price_n) - pub price_n: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.price_d) - pub price_d: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageSellOfferOp.offer_id) - pub offer_id: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarManageSellOfferOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarManageSellOfferOp { - fn default() -> &'a StellarManageSellOfferOp { - ::default_instance() - } -} - -impl StellarManageSellOfferOp { - pub fn new() -> StellarManageSellOfferOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 amount = 4; - - pub fn amount(&self) -> i64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: i64) { - self.amount = ::std::option::Option::Some(v); - } - - // required uint32 price_n = 5; - - pub fn price_n(&self) -> u32 { - self.price_n.unwrap_or(0) - } - - pub fn clear_price_n(&mut self) { - self.price_n = ::std::option::Option::None; - } - - pub fn has_price_n(&self) -> bool { - self.price_n.is_some() - } - - // Param is passed by value, moved - pub fn set_price_n(&mut self, v: u32) { - self.price_n = ::std::option::Option::Some(v); - } - - // required uint32 price_d = 6; - - pub fn price_d(&self) -> u32 { - self.price_d.unwrap_or(0) - } - - pub fn clear_price_d(&mut self) { - self.price_d = ::std::option::Option::None; - } - - pub fn has_price_d(&self) -> bool { - self.price_d.is_some() - } - - // Param is passed by value, moved - pub fn set_price_d(&mut self, v: u32) { - self.price_d = ::std::option::Option::Some(v); - } - - // required uint64 offer_id = 7; - - pub fn offer_id(&self) -> u64 { - self.offer_id.unwrap_or(0) - } - - pub fn clear_offer_id(&mut self) { - self.offer_id = ::std::option::Option::None; - } - - pub fn has_offer_id(&self) -> bool { - self.offer_id.is_some() - } - - // Param is passed by value, moved - pub fn set_offer_id(&mut self, v: u64) { - self.offer_id = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarManageSellOfferOp| { &m.source_account }, - |m: &mut StellarManageSellOfferOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "selling_asset", - |m: &StellarManageSellOfferOp| { &m.selling_asset }, - |m: &mut StellarManageSellOfferOp| { &mut m.selling_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "buying_asset", - |m: &StellarManageSellOfferOp| { &m.buying_asset }, - |m: &mut StellarManageSellOfferOp| { &mut m.buying_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &StellarManageSellOfferOp| { &m.amount }, - |m: &mut StellarManageSellOfferOp| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "price_n", - |m: &StellarManageSellOfferOp| { &m.price_n }, - |m: &mut StellarManageSellOfferOp| { &mut m.price_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "price_d", - |m: &StellarManageSellOfferOp| { &m.price_d }, - |m: &mut StellarManageSellOfferOp| { &mut m.price_d }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "offer_id", - |m: &StellarManageSellOfferOp| { &m.offer_id }, - |m: &mut StellarManageSellOfferOp| { &mut m.offer_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarManageSellOfferOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarManageSellOfferOp { - const NAME: &'static str = "StellarManageSellOfferOp"; - - fn is_initialized(&self) -> bool { - if self.selling_asset.is_none() { - return false; - } - if self.buying_asset.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - if self.price_n.is_none() { - return false; - } - if self.price_d.is_none() { - return false; - } - if self.offer_id.is_none() { - return false; - } - for v in &self.selling_asset { - if !v.is_initialized() { - return false; - } - }; - for v in &self.buying_asset { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.selling_asset)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.buying_asset)?; - }, - 32 => { - self.amount = ::std::option::Option::Some(is.read_sint64()?); - }, - 40 => { - self.price_n = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.price_d = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.offer_id = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.selling_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.buying_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::sint64_size(4, v); - } - if let Some(v) = self.price_n { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.price_d { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.offer_id { - my_size += ::protobuf::rt::uint64_size(7, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.selling_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.buying_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.amount { - os.write_sint64(4, v)?; - } - if let Some(v) = self.price_n { - os.write_uint32(5, v)?; - } - if let Some(v) = self.price_d { - os.write_uint32(6, v)?; - } - if let Some(v) = self.offer_id { - os.write_uint64(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarManageSellOfferOp { - StellarManageSellOfferOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.selling_asset.clear(); - self.buying_asset.clear(); - self.amount = ::std::option::Option::None; - self.price_n = ::std::option::Option::None; - self.price_d = ::std::option::Option::None; - self.offer_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarManageSellOfferOp { - static instance: StellarManageSellOfferOp = StellarManageSellOfferOp { - source_account: ::std::option::Option::None, - selling_asset: ::protobuf::MessageField::none(), - buying_asset: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - price_n: ::std::option::Option::None, - price_d: ::std::option::Option::None, - offer_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarManageSellOfferOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarManageSellOfferOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarManageSellOfferOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarManageSellOfferOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarManageBuyOfferOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarManageBuyOfferOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.selling_asset) - pub selling_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.buying_asset) - pub buying_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.price_n) - pub price_n: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.price_d) - pub price_d: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.offer_id) - pub offer_id: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarManageBuyOfferOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarManageBuyOfferOp { - fn default() -> &'a StellarManageBuyOfferOp { - ::default_instance() - } -} - -impl StellarManageBuyOfferOp { - pub fn new() -> StellarManageBuyOfferOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 amount = 4; - - pub fn amount(&self) -> i64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: i64) { - self.amount = ::std::option::Option::Some(v); - } - - // required uint32 price_n = 5; - - pub fn price_n(&self) -> u32 { - self.price_n.unwrap_or(0) - } - - pub fn clear_price_n(&mut self) { - self.price_n = ::std::option::Option::None; - } - - pub fn has_price_n(&self) -> bool { - self.price_n.is_some() - } - - // Param is passed by value, moved - pub fn set_price_n(&mut self, v: u32) { - self.price_n = ::std::option::Option::Some(v); - } - - // required uint32 price_d = 6; - - pub fn price_d(&self) -> u32 { - self.price_d.unwrap_or(0) - } - - pub fn clear_price_d(&mut self) { - self.price_d = ::std::option::Option::None; - } - - pub fn has_price_d(&self) -> bool { - self.price_d.is_some() - } - - // Param is passed by value, moved - pub fn set_price_d(&mut self, v: u32) { - self.price_d = ::std::option::Option::Some(v); - } - - // required uint64 offer_id = 7; - - pub fn offer_id(&self) -> u64 { - self.offer_id.unwrap_or(0) - } - - pub fn clear_offer_id(&mut self) { - self.offer_id = ::std::option::Option::None; - } - - pub fn has_offer_id(&self) -> bool { - self.offer_id.is_some() - } - - // Param is passed by value, moved - pub fn set_offer_id(&mut self, v: u64) { - self.offer_id = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarManageBuyOfferOp| { &m.source_account }, - |m: &mut StellarManageBuyOfferOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "selling_asset", - |m: &StellarManageBuyOfferOp| { &m.selling_asset }, - |m: &mut StellarManageBuyOfferOp| { &mut m.selling_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "buying_asset", - |m: &StellarManageBuyOfferOp| { &m.buying_asset }, - |m: &mut StellarManageBuyOfferOp| { &mut m.buying_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &StellarManageBuyOfferOp| { &m.amount }, - |m: &mut StellarManageBuyOfferOp| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "price_n", - |m: &StellarManageBuyOfferOp| { &m.price_n }, - |m: &mut StellarManageBuyOfferOp| { &mut m.price_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "price_d", - |m: &StellarManageBuyOfferOp| { &m.price_d }, - |m: &mut StellarManageBuyOfferOp| { &mut m.price_d }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "offer_id", - |m: &StellarManageBuyOfferOp| { &m.offer_id }, - |m: &mut StellarManageBuyOfferOp| { &mut m.offer_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarManageBuyOfferOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarManageBuyOfferOp { - const NAME: &'static str = "StellarManageBuyOfferOp"; - - fn is_initialized(&self) -> bool { - if self.selling_asset.is_none() { - return false; - } - if self.buying_asset.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - if self.price_n.is_none() { - return false; - } - if self.price_d.is_none() { - return false; - } - if self.offer_id.is_none() { - return false; - } - for v in &self.selling_asset { - if !v.is_initialized() { - return false; - } - }; - for v in &self.buying_asset { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.selling_asset)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.buying_asset)?; - }, - 32 => { - self.amount = ::std::option::Option::Some(is.read_sint64()?); - }, - 40 => { - self.price_n = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.price_d = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.offer_id = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.selling_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.buying_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::sint64_size(4, v); - } - if let Some(v) = self.price_n { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.price_d { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.offer_id { - my_size += ::protobuf::rt::uint64_size(7, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.selling_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.buying_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.amount { - os.write_sint64(4, v)?; - } - if let Some(v) = self.price_n { - os.write_uint32(5, v)?; - } - if let Some(v) = self.price_d { - os.write_uint32(6, v)?; - } - if let Some(v) = self.offer_id { - os.write_uint64(7, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarManageBuyOfferOp { - StellarManageBuyOfferOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.selling_asset.clear(); - self.buying_asset.clear(); - self.amount = ::std::option::Option::None; - self.price_n = ::std::option::Option::None; - self.price_d = ::std::option::Option::None; - self.offer_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarManageBuyOfferOp { - static instance: StellarManageBuyOfferOp = StellarManageBuyOfferOp { - source_account: ::std::option::Option::None, - selling_asset: ::protobuf::MessageField::none(), - buying_asset: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - price_n: ::std::option::Option::None, - price_d: ::std::option::Option::None, - offer_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarManageBuyOfferOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarManageBuyOfferOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarManageBuyOfferOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarManageBuyOfferOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarCreatePassiveSellOfferOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.selling_asset) - pub selling_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.buying_asset) - pub buying_asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.price_n) - pub price_n: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.price_d) - pub price_d: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarCreatePassiveSellOfferOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarCreatePassiveSellOfferOp { - fn default() -> &'a StellarCreatePassiveSellOfferOp { - ::default_instance() - } -} - -impl StellarCreatePassiveSellOfferOp { - pub fn new() -> StellarCreatePassiveSellOfferOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required sint64 amount = 4; - - pub fn amount(&self) -> i64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: i64) { - self.amount = ::std::option::Option::Some(v); - } - - // required uint32 price_n = 5; - - pub fn price_n(&self) -> u32 { - self.price_n.unwrap_or(0) - } - - pub fn clear_price_n(&mut self) { - self.price_n = ::std::option::Option::None; - } - - pub fn has_price_n(&self) -> bool { - self.price_n.is_some() - } - - // Param is passed by value, moved - pub fn set_price_n(&mut self, v: u32) { - self.price_n = ::std::option::Option::Some(v); - } - - // required uint32 price_d = 6; - - pub fn price_d(&self) -> u32 { - self.price_d.unwrap_or(0) - } - - pub fn clear_price_d(&mut self) { - self.price_d = ::std::option::Option::None; - } - - pub fn has_price_d(&self) -> bool { - self.price_d.is_some() - } - - // Param is passed by value, moved - pub fn set_price_d(&mut self, v: u32) { - self.price_d = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarCreatePassiveSellOfferOp| { &m.source_account }, - |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "selling_asset", - |m: &StellarCreatePassiveSellOfferOp| { &m.selling_asset }, - |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.selling_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "buying_asset", - |m: &StellarCreatePassiveSellOfferOp| { &m.buying_asset }, - |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.buying_asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &StellarCreatePassiveSellOfferOp| { &m.amount }, - |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "price_n", - |m: &StellarCreatePassiveSellOfferOp| { &m.price_n }, - |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.price_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "price_d", - |m: &StellarCreatePassiveSellOfferOp| { &m.price_d }, - |m: &mut StellarCreatePassiveSellOfferOp| { &mut m.price_d }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarCreatePassiveSellOfferOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarCreatePassiveSellOfferOp { - const NAME: &'static str = "StellarCreatePassiveSellOfferOp"; - - fn is_initialized(&self) -> bool { - if self.selling_asset.is_none() { - return false; - } - if self.buying_asset.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - if self.price_n.is_none() { - return false; - } - if self.price_d.is_none() { - return false; - } - for v in &self.selling_asset { - if !v.is_initialized() { - return false; - } - }; - for v in &self.buying_asset { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.selling_asset)?; - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.buying_asset)?; - }, - 32 => { - self.amount = ::std::option::Option::Some(is.read_sint64()?); - }, - 40 => { - self.price_n = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.price_d = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.selling_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.buying_asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::sint64_size(4, v); - } - if let Some(v) = self.price_n { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.price_d { - my_size += ::protobuf::rt::uint32_size(6, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.selling_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.buying_asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.amount { - os.write_sint64(4, v)?; - } - if let Some(v) = self.price_n { - os.write_uint32(5, v)?; - } - if let Some(v) = self.price_d { - os.write_uint32(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarCreatePassiveSellOfferOp { - StellarCreatePassiveSellOfferOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.selling_asset.clear(); - self.buying_asset.clear(); - self.amount = ::std::option::Option::None; - self.price_n = ::std::option::Option::None; - self.price_d = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarCreatePassiveSellOfferOp { - static instance: StellarCreatePassiveSellOfferOp = StellarCreatePassiveSellOfferOp { - source_account: ::std::option::Option::None, - selling_asset: ::protobuf::MessageField::none(), - buying_asset: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - price_n: ::std::option::Option::None, - price_d: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarCreatePassiveSellOfferOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarCreatePassiveSellOfferOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarCreatePassiveSellOfferOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarCreatePassiveSellOfferOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarSetOptionsOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarSetOptionsOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.inflation_destination_account) - pub inflation_destination_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.clear_flags) - pub clear_flags: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.set_flags) - pub set_flags: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.master_weight) - pub master_weight: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.low_threshold) - pub low_threshold: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.medium_threshold) - pub medium_threshold: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.high_threshold) - pub high_threshold: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.home_domain) - pub home_domain: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.signer_type) - pub signer_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.signer_key) - pub signer_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSetOptionsOp.signer_weight) - pub signer_weight: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarSetOptionsOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarSetOptionsOp { - fn default() -> &'a StellarSetOptionsOp { - ::default_instance() - } -} - -impl StellarSetOptionsOp { - pub fn new() -> StellarSetOptionsOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string inflation_destination_account = 2; - - pub fn inflation_destination_account(&self) -> &str { - match self.inflation_destination_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_inflation_destination_account(&mut self) { - self.inflation_destination_account = ::std::option::Option::None; - } - - pub fn has_inflation_destination_account(&self) -> bool { - self.inflation_destination_account.is_some() - } - - // Param is passed by value, moved - pub fn set_inflation_destination_account(&mut self, v: ::std::string::String) { - self.inflation_destination_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_inflation_destination_account(&mut self) -> &mut ::std::string::String { - if self.inflation_destination_account.is_none() { - self.inflation_destination_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.inflation_destination_account.as_mut().unwrap() - } - - // Take field - pub fn take_inflation_destination_account(&mut self) -> ::std::string::String { - self.inflation_destination_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 clear_flags = 3; - - pub fn clear_flags(&self) -> u32 { - self.clear_flags.unwrap_or(0) - } - - pub fn clear_clear_flags(&mut self) { - self.clear_flags = ::std::option::Option::None; - } - - pub fn has_clear_flags(&self) -> bool { - self.clear_flags.is_some() - } - - // Param is passed by value, moved - pub fn set_clear_flags(&mut self, v: u32) { - self.clear_flags = ::std::option::Option::Some(v); - } - - // optional uint32 set_flags = 4; - - pub fn set_flags(&self) -> u32 { - self.set_flags.unwrap_or(0) - } - - pub fn clear_set_flags(&mut self) { - self.set_flags = ::std::option::Option::None; - } - - pub fn has_set_flags(&self) -> bool { - self.set_flags.is_some() - } - - // Param is passed by value, moved - pub fn set_set_flags(&mut self, v: u32) { - self.set_flags = ::std::option::Option::Some(v); - } - - // optional uint32 master_weight = 5; - - pub fn master_weight(&self) -> u32 { - self.master_weight.unwrap_or(0) - } - - pub fn clear_master_weight(&mut self) { - self.master_weight = ::std::option::Option::None; - } - - pub fn has_master_weight(&self) -> bool { - self.master_weight.is_some() - } - - // Param is passed by value, moved - pub fn set_master_weight(&mut self, v: u32) { - self.master_weight = ::std::option::Option::Some(v); - } - - // optional uint32 low_threshold = 6; - - pub fn low_threshold(&self) -> u32 { - self.low_threshold.unwrap_or(0) - } - - pub fn clear_low_threshold(&mut self) { - self.low_threshold = ::std::option::Option::None; - } - - pub fn has_low_threshold(&self) -> bool { - self.low_threshold.is_some() - } - - // Param is passed by value, moved - pub fn set_low_threshold(&mut self, v: u32) { - self.low_threshold = ::std::option::Option::Some(v); - } - - // optional uint32 medium_threshold = 7; - - pub fn medium_threshold(&self) -> u32 { - self.medium_threshold.unwrap_or(0) - } - - pub fn clear_medium_threshold(&mut self) { - self.medium_threshold = ::std::option::Option::None; - } - - pub fn has_medium_threshold(&self) -> bool { - self.medium_threshold.is_some() - } - - // Param is passed by value, moved - pub fn set_medium_threshold(&mut self, v: u32) { - self.medium_threshold = ::std::option::Option::Some(v); - } - - // optional uint32 high_threshold = 8; - - pub fn high_threshold(&self) -> u32 { - self.high_threshold.unwrap_or(0) - } - - pub fn clear_high_threshold(&mut self) { - self.high_threshold = ::std::option::Option::None; - } - - pub fn has_high_threshold(&self) -> bool { - self.high_threshold.is_some() - } - - // Param is passed by value, moved - pub fn set_high_threshold(&mut self, v: u32) { - self.high_threshold = ::std::option::Option::Some(v); - } - - // optional string home_domain = 9; - - pub fn home_domain(&self) -> &str { - match self.home_domain.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_home_domain(&mut self) { - self.home_domain = ::std::option::Option::None; - } - - pub fn has_home_domain(&self) -> bool { - self.home_domain.is_some() - } - - // Param is passed by value, moved - pub fn set_home_domain(&mut self, v: ::std::string::String) { - self.home_domain = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_home_domain(&mut self) -> &mut ::std::string::String { - if self.home_domain.is_none() { - self.home_domain = ::std::option::Option::Some(::std::string::String::new()); - } - self.home_domain.as_mut().unwrap() - } - - // Take field - pub fn take_home_domain(&mut self) -> ::std::string::String { - self.home_domain.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional .hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType signer_type = 10; - - pub fn signer_type(&self) -> stellar_set_options_op::StellarSignerType { - match self.signer_type { - Some(e) => e.enum_value_or(stellar_set_options_op::StellarSignerType::ACCOUNT), - None => stellar_set_options_op::StellarSignerType::ACCOUNT, - } - } - - pub fn clear_signer_type(&mut self) { - self.signer_type = ::std::option::Option::None; - } - - pub fn has_signer_type(&self) -> bool { - self.signer_type.is_some() - } - - // Param is passed by value, moved - pub fn set_signer_type(&mut self, v: stellar_set_options_op::StellarSignerType) { - self.signer_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional bytes signer_key = 11; - - pub fn signer_key(&self) -> &[u8] { - match self.signer_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signer_key(&mut self) { - self.signer_key = ::std::option::Option::None; - } - - pub fn has_signer_key(&self) -> bool { - self.signer_key.is_some() - } - - // Param is passed by value, moved - pub fn set_signer_key(&mut self, v: ::std::vec::Vec) { - self.signer_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signer_key(&mut self) -> &mut ::std::vec::Vec { - if self.signer_key.is_none() { - self.signer_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signer_key.as_mut().unwrap() - } - - // Take field - pub fn take_signer_key(&mut self) -> ::std::vec::Vec { - self.signer_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional uint32 signer_weight = 12; - - pub fn signer_weight(&self) -> u32 { - self.signer_weight.unwrap_or(0) - } - - pub fn clear_signer_weight(&mut self) { - self.signer_weight = ::std::option::Option::None; - } - - pub fn has_signer_weight(&self) -> bool { - self.signer_weight.is_some() - } - - // Param is passed by value, moved - pub fn set_signer_weight(&mut self, v: u32) { - self.signer_weight = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(12); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarSetOptionsOp| { &m.source_account }, - |m: &mut StellarSetOptionsOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inflation_destination_account", - |m: &StellarSetOptionsOp| { &m.inflation_destination_account }, - |m: &mut StellarSetOptionsOp| { &mut m.inflation_destination_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "clear_flags", - |m: &StellarSetOptionsOp| { &m.clear_flags }, - |m: &mut StellarSetOptionsOp| { &mut m.clear_flags }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "set_flags", - |m: &StellarSetOptionsOp| { &m.set_flags }, - |m: &mut StellarSetOptionsOp| { &mut m.set_flags }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "master_weight", - |m: &StellarSetOptionsOp| { &m.master_weight }, - |m: &mut StellarSetOptionsOp| { &mut m.master_weight }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "low_threshold", - |m: &StellarSetOptionsOp| { &m.low_threshold }, - |m: &mut StellarSetOptionsOp| { &mut m.low_threshold }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "medium_threshold", - |m: &StellarSetOptionsOp| { &m.medium_threshold }, - |m: &mut StellarSetOptionsOp| { &mut m.medium_threshold }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "high_threshold", - |m: &StellarSetOptionsOp| { &m.high_threshold }, - |m: &mut StellarSetOptionsOp| { &mut m.high_threshold }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "home_domain", - |m: &StellarSetOptionsOp| { &m.home_domain }, - |m: &mut StellarSetOptionsOp| { &mut m.home_domain }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signer_type", - |m: &StellarSetOptionsOp| { &m.signer_type }, - |m: &mut StellarSetOptionsOp| { &mut m.signer_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signer_key", - |m: &StellarSetOptionsOp| { &m.signer_key }, - |m: &mut StellarSetOptionsOp| { &mut m.signer_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signer_weight", - |m: &StellarSetOptionsOp| { &m.signer_weight }, - |m: &mut StellarSetOptionsOp| { &mut m.signer_weight }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarSetOptionsOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarSetOptionsOp { - const NAME: &'static str = "StellarSetOptionsOp"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.inflation_destination_account = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.clear_flags = ::std::option::Option::Some(is.read_uint32()?); - }, - 32 => { - self.set_flags = ::std::option::Option::Some(is.read_uint32()?); - }, - 40 => { - self.master_weight = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.low_threshold = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.medium_threshold = ::std::option::Option::Some(is.read_uint32()?); - }, - 64 => { - self.high_threshold = ::std::option::Option::Some(is.read_uint32()?); - }, - 74 => { - self.home_domain = ::std::option::Option::Some(is.read_string()?); - }, - 80 => { - self.signer_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 90 => { - self.signer_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 96 => { - self.signer_weight = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.inflation_destination_account.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.clear_flags { - my_size += ::protobuf::rt::uint32_size(3, v); - } - if let Some(v) = self.set_flags { - my_size += ::protobuf::rt::uint32_size(4, v); - } - if let Some(v) = self.master_weight { - my_size += ::protobuf::rt::uint32_size(5, v); - } - if let Some(v) = self.low_threshold { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.medium_threshold { - my_size += ::protobuf::rt::uint32_size(7, v); - } - if let Some(v) = self.high_threshold { - my_size += ::protobuf::rt::uint32_size(8, v); - } - if let Some(v) = self.home_domain.as_ref() { - my_size += ::protobuf::rt::string_size(9, &v); - } - if let Some(v) = self.signer_type { - my_size += ::protobuf::rt::int32_size(10, v.value()); - } - if let Some(v) = self.signer_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(11, &v); - } - if let Some(v) = self.signer_weight { - my_size += ::protobuf::rt::uint32_size(12, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.inflation_destination_account.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.clear_flags { - os.write_uint32(3, v)?; - } - if let Some(v) = self.set_flags { - os.write_uint32(4, v)?; - } - if let Some(v) = self.master_weight { - os.write_uint32(5, v)?; - } - if let Some(v) = self.low_threshold { - os.write_uint32(6, v)?; - } - if let Some(v) = self.medium_threshold { - os.write_uint32(7, v)?; - } - if let Some(v) = self.high_threshold { - os.write_uint32(8, v)?; - } - if let Some(v) = self.home_domain.as_ref() { - os.write_string(9, v)?; - } - if let Some(v) = self.signer_type { - os.write_enum(10, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.signer_key.as_ref() { - os.write_bytes(11, v)?; - } - if let Some(v) = self.signer_weight { - os.write_uint32(12, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarSetOptionsOp { - StellarSetOptionsOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.inflation_destination_account = ::std::option::Option::None; - self.clear_flags = ::std::option::Option::None; - self.set_flags = ::std::option::Option::None; - self.master_weight = ::std::option::Option::None; - self.low_threshold = ::std::option::Option::None; - self.medium_threshold = ::std::option::Option::None; - self.high_threshold = ::std::option::Option::None; - self.home_domain = ::std::option::Option::None; - self.signer_type = ::std::option::Option::None; - self.signer_key = ::std::option::Option::None; - self.signer_weight = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarSetOptionsOp { - static instance: StellarSetOptionsOp = StellarSetOptionsOp { - source_account: ::std::option::Option::None, - inflation_destination_account: ::std::option::Option::None, - clear_flags: ::std::option::Option::None, - set_flags: ::std::option::Option::None, - master_weight: ::std::option::Option::None, - low_threshold: ::std::option::Option::None, - medium_threshold: ::std::option::Option::None, - high_threshold: ::std::option::Option::None, - home_domain: ::std::option::Option::None, - signer_type: ::std::option::Option::None, - signer_key: ::std::option::Option::None, - signer_weight: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarSetOptionsOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarSetOptionsOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarSetOptionsOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarSetOptionsOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `StellarSetOptionsOp` -pub mod stellar_set_options_op { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType) - pub enum StellarSignerType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType.ACCOUNT) - ACCOUNT = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType.PRE_AUTH) - PRE_AUTH = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarSetOptionsOp.StellarSignerType.HASH) - HASH = 2, - } - - impl ::protobuf::Enum for StellarSignerType { - const NAME: &'static str = "StellarSignerType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(StellarSignerType::ACCOUNT), - 1 => ::std::option::Option::Some(StellarSignerType::PRE_AUTH), - 2 => ::std::option::Option::Some(StellarSignerType::HASH), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "ACCOUNT" => ::std::option::Option::Some(StellarSignerType::ACCOUNT), - "PRE_AUTH" => ::std::option::Option::Some(StellarSignerType::PRE_AUTH), - "HASH" => ::std::option::Option::Some(StellarSignerType::HASH), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [StellarSignerType] = &[ - StellarSignerType::ACCOUNT, - StellarSignerType::PRE_AUTH, - StellarSignerType::HASH, - ]; - } - - impl ::protobuf::EnumFull for StellarSignerType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("StellarSetOptionsOp.StellarSignerType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for StellarSignerType { - fn default() -> Self { - StellarSignerType::ACCOUNT - } - } - - impl StellarSignerType { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("StellarSetOptionsOp.StellarSignerType") - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarChangeTrustOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarChangeTrustOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarChangeTrustOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarChangeTrustOp.asset) - pub asset: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarChangeTrustOp.limit) - pub limit: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarChangeTrustOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarChangeTrustOp { - fn default() -> &'a StellarChangeTrustOp { - ::default_instance() - } -} - -impl StellarChangeTrustOp { - pub fn new() -> StellarChangeTrustOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 limit = 3; - - pub fn limit(&self) -> u64 { - self.limit.unwrap_or(0) - } - - pub fn clear_limit(&mut self) { - self.limit = ::std::option::Option::None; - } - - pub fn has_limit(&self) -> bool { - self.limit.is_some() - } - - // Param is passed by value, moved - pub fn set_limit(&mut self, v: u64) { - self.limit = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarChangeTrustOp| { &m.source_account }, - |m: &mut StellarChangeTrustOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, StellarAsset>( - "asset", - |m: &StellarChangeTrustOp| { &m.asset }, - |m: &mut StellarChangeTrustOp| { &mut m.asset }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "limit", - |m: &StellarChangeTrustOp| { &m.limit }, - |m: &mut StellarChangeTrustOp| { &mut m.limit }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarChangeTrustOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarChangeTrustOp { - const NAME: &'static str = "StellarChangeTrustOp"; - - fn is_initialized(&self) -> bool { - if self.asset.is_none() { - return false; - } - if self.limit.is_none() { - return false; - } - for v in &self.asset { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.asset)?; - }, - 24 => { - self.limit = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.asset.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.limit { - my_size += ::protobuf::rt::uint64_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.asset.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - } - if let Some(v) = self.limit { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarChangeTrustOp { - StellarChangeTrustOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.asset.clear(); - self.limit = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarChangeTrustOp { - static instance: StellarChangeTrustOp = StellarChangeTrustOp { - source_account: ::std::option::Option::None, - asset: ::protobuf::MessageField::none(), - limit: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarChangeTrustOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarChangeTrustOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarChangeTrustOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarChangeTrustOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAllowTrustOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarAllowTrustOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.trusted_account) - pub trusted_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.asset_type) - pub asset_type: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.asset_code) - pub asset_code: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAllowTrustOp.is_authorized) - pub is_authorized: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAllowTrustOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarAllowTrustOp { - fn default() -> &'a StellarAllowTrustOp { - ::default_instance() - } -} - -impl StellarAllowTrustOp { - pub fn new() -> StellarAllowTrustOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string trusted_account = 2; - - pub fn trusted_account(&self) -> &str { - match self.trusted_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_trusted_account(&mut self) { - self.trusted_account = ::std::option::Option::None; - } - - pub fn has_trusted_account(&self) -> bool { - self.trusted_account.is_some() - } - - // Param is passed by value, moved - pub fn set_trusted_account(&mut self, v: ::std::string::String) { - self.trusted_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_trusted_account(&mut self) -> &mut ::std::string::String { - if self.trusted_account.is_none() { - self.trusted_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.trusted_account.as_mut().unwrap() - } - - // Take field - pub fn take_trusted_account(&mut self) -> ::std::string::String { - self.trusted_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required .hw.trezor.messages.stellar.StellarAssetType asset_type = 3; - - pub fn asset_type(&self) -> StellarAssetType { - match self.asset_type { - Some(e) => e.enum_value_or(StellarAssetType::NATIVE), - None => StellarAssetType::NATIVE, - } - } - - pub fn clear_asset_type(&mut self) { - self.asset_type = ::std::option::Option::None; - } - - pub fn has_asset_type(&self) -> bool { - self.asset_type.is_some() - } - - // Param is passed by value, moved - pub fn set_asset_type(&mut self, v: StellarAssetType) { - self.asset_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // optional string asset_code = 4; - - pub fn asset_code(&self) -> &str { - match self.asset_code.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_asset_code(&mut self) { - self.asset_code = ::std::option::Option::None; - } - - pub fn has_asset_code(&self) -> bool { - self.asset_code.is_some() - } - - // Param is passed by value, moved - pub fn set_asset_code(&mut self, v: ::std::string::String) { - self.asset_code = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_asset_code(&mut self) -> &mut ::std::string::String { - if self.asset_code.is_none() { - self.asset_code = ::std::option::Option::Some(::std::string::String::new()); - } - self.asset_code.as_mut().unwrap() - } - - // Take field - pub fn take_asset_code(&mut self) -> ::std::string::String { - self.asset_code.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bool is_authorized = 5; - - pub fn is_authorized(&self) -> bool { - self.is_authorized.unwrap_or(false) - } - - pub fn clear_is_authorized(&mut self) { - self.is_authorized = ::std::option::Option::None; - } - - pub fn has_is_authorized(&self) -> bool { - self.is_authorized.is_some() - } - - // Param is passed by value, moved - pub fn set_is_authorized(&mut self, v: bool) { - self.is_authorized = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(5); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarAllowTrustOp| { &m.source_account }, - |m: &mut StellarAllowTrustOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "trusted_account", - |m: &StellarAllowTrustOp| { &m.trusted_account }, - |m: &mut StellarAllowTrustOp| { &mut m.trusted_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "asset_type", - |m: &StellarAllowTrustOp| { &m.asset_type }, - |m: &mut StellarAllowTrustOp| { &mut m.asset_type }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "asset_code", - |m: &StellarAllowTrustOp| { &m.asset_code }, - |m: &mut StellarAllowTrustOp| { &mut m.asset_code }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "is_authorized", - |m: &StellarAllowTrustOp| { &m.is_authorized }, - |m: &mut StellarAllowTrustOp| { &mut m.is_authorized }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarAllowTrustOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarAllowTrustOp { - const NAME: &'static str = "StellarAllowTrustOp"; - - fn is_initialized(&self) -> bool { - if self.trusted_account.is_none() { - return false; - } - if self.asset_type.is_none() { - return false; - } - if self.is_authorized.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.trusted_account = ::std::option::Option::Some(is.read_string()?); - }, - 24 => { - self.asset_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 34 => { - self.asset_code = ::std::option::Option::Some(is.read_string()?); - }, - 40 => { - self.is_authorized = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.trusted_account.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.asset_type { - my_size += ::protobuf::rt::int32_size(3, v.value()); - } - if let Some(v) = self.asset_code.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.is_authorized { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.trusted_account.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.asset_type { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.asset_code.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.is_authorized { - os.write_bool(5, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarAllowTrustOp { - StellarAllowTrustOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.trusted_account = ::std::option::Option::None; - self.asset_type = ::std::option::Option::None; - self.asset_code = ::std::option::Option::None; - self.is_authorized = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarAllowTrustOp { - static instance: StellarAllowTrustOp = StellarAllowTrustOp { - source_account: ::std::option::Option::None, - trusted_account: ::std::option::Option::None, - asset_type: ::std::option::Option::None, - asset_code: ::std::option::Option::None, - is_authorized: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarAllowTrustOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAllowTrustOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarAllowTrustOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarAllowTrustOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarAccountMergeOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarAccountMergeOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAccountMergeOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarAccountMergeOp.destination_account) - pub destination_account: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarAccountMergeOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarAccountMergeOp { - fn default() -> &'a StellarAccountMergeOp { - ::default_instance() - } -} - -impl StellarAccountMergeOp { - pub fn new() -> StellarAccountMergeOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string destination_account = 2; - - pub fn destination_account(&self) -> &str { - match self.destination_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_destination_account(&mut self) { - self.destination_account = ::std::option::Option::None; - } - - pub fn has_destination_account(&self) -> bool { - self.destination_account.is_some() - } - - // Param is passed by value, moved - pub fn set_destination_account(&mut self, v: ::std::string::String) { - self.destination_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_destination_account(&mut self) -> &mut ::std::string::String { - if self.destination_account.is_none() { - self.destination_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.destination_account.as_mut().unwrap() - } - - // Take field - pub fn take_destination_account(&mut self) -> ::std::string::String { - self.destination_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarAccountMergeOp| { &m.source_account }, - |m: &mut StellarAccountMergeOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "destination_account", - |m: &StellarAccountMergeOp| { &m.destination_account }, - |m: &mut StellarAccountMergeOp| { &mut m.destination_account }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarAccountMergeOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarAccountMergeOp { - const NAME: &'static str = "StellarAccountMergeOp"; - - fn is_initialized(&self) -> bool { - if self.destination_account.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.destination_account = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.destination_account.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.destination_account.as_ref() { - os.write_string(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarAccountMergeOp { - StellarAccountMergeOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.destination_account = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarAccountMergeOp { - static instance: StellarAccountMergeOp = StellarAccountMergeOp { - source_account: ::std::option::Option::None, - destination_account: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarAccountMergeOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarAccountMergeOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarAccountMergeOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarAccountMergeOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarManageDataOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarManageDataOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageDataOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageDataOp.key) - pub key: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarManageDataOp.value) - pub value: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarManageDataOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarManageDataOp { - fn default() -> &'a StellarManageDataOp { - ::default_instance() - } -} - -impl StellarManageDataOp { - pub fn new() -> StellarManageDataOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required string key = 2; - - pub fn key(&self) -> &str { - match self.key.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_key(&mut self) { - self.key = ::std::option::Option::None; - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::string::String) { - self.key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::string::String { - if self.key.is_none() { - self.key = ::std::option::Option::Some(::std::string::String::new()); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::string::String { - self.key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bytes value = 3; - - pub fn value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarManageDataOp| { &m.source_account }, - |m: &mut StellarManageDataOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "key", - |m: &StellarManageDataOp| { &m.key }, - |m: &mut StellarManageDataOp| { &mut m.key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "value", - |m: &StellarManageDataOp| { &m.value }, - |m: &mut StellarManageDataOp| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarManageDataOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarManageDataOp { - const NAME: &'static str = "StellarManageDataOp"; - - fn is_initialized(&self) -> bool { - if self.key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.key = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.value = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.key.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.key.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.value.as_ref() { - os.write_bytes(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarManageDataOp { - StellarManageDataOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.key = ::std::option::Option::None; - self.value = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarManageDataOp { - static instance: StellarManageDataOp = StellarManageDataOp { - source_account: ::std::option::Option::None, - key: ::std::option::Option::None, - value: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarManageDataOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarManageDataOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarManageDataOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarManageDataOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarBumpSequenceOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarBumpSequenceOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarBumpSequenceOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarBumpSequenceOp.bump_to) - pub bump_to: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarBumpSequenceOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarBumpSequenceOp { - fn default() -> &'a StellarBumpSequenceOp { - ::default_instance() - } -} - -impl StellarBumpSequenceOp { - pub fn new() -> StellarBumpSequenceOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required uint64 bump_to = 2; - - pub fn bump_to(&self) -> u64 { - self.bump_to.unwrap_or(0) - } - - pub fn clear_bump_to(&mut self) { - self.bump_to = ::std::option::Option::None; - } - - pub fn has_bump_to(&self) -> bool { - self.bump_to.is_some() - } - - // Param is passed by value, moved - pub fn set_bump_to(&mut self, v: u64) { - self.bump_to = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarBumpSequenceOp| { &m.source_account }, - |m: &mut StellarBumpSequenceOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "bump_to", - |m: &StellarBumpSequenceOp| { &m.bump_to }, - |m: &mut StellarBumpSequenceOp| { &mut m.bump_to }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarBumpSequenceOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarBumpSequenceOp { - const NAME: &'static str = "StellarBumpSequenceOp"; - - fn is_initialized(&self) -> bool { - if self.bump_to.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 16 => { - self.bump_to = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.bump_to { - my_size += ::protobuf::rt::uint64_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.bump_to { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarBumpSequenceOp { - StellarBumpSequenceOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.bump_to = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarBumpSequenceOp { - static instance: StellarBumpSequenceOp = StellarBumpSequenceOp { - source_account: ::std::option::Option::None, - bump_to: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarBumpSequenceOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarBumpSequenceOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarBumpSequenceOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarBumpSequenceOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarClaimClaimableBalanceOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp.source_account) - pub source_account: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp.balance_id) - pub balance_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarClaimClaimableBalanceOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarClaimClaimableBalanceOp { - fn default() -> &'a StellarClaimClaimableBalanceOp { - ::default_instance() - } -} - -impl StellarClaimClaimableBalanceOp { - pub fn new() -> StellarClaimClaimableBalanceOp { - ::std::default::Default::default() - } - - // optional string source_account = 1; - - pub fn source_account(&self) -> &str { - match self.source_account.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_source_account(&mut self) { - self.source_account = ::std::option::Option::None; - } - - pub fn has_source_account(&self) -> bool { - self.source_account.is_some() - } - - // Param is passed by value, moved - pub fn set_source_account(&mut self, v: ::std::string::String) { - self.source_account = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source_account(&mut self) -> &mut ::std::string::String { - if self.source_account.is_none() { - self.source_account = ::std::option::Option::Some(::std::string::String::new()); - } - self.source_account.as_mut().unwrap() - } - - // Take field - pub fn take_source_account(&mut self) -> ::std::string::String { - self.source_account.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes balance_id = 2; - - pub fn balance_id(&self) -> &[u8] { - match self.balance_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_balance_id(&mut self) { - self.balance_id = ::std::option::Option::None; - } - - pub fn has_balance_id(&self) -> bool { - self.balance_id.is_some() - } - - // Param is passed by value, moved - pub fn set_balance_id(&mut self, v: ::std::vec::Vec) { - self.balance_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_balance_id(&mut self) -> &mut ::std::vec::Vec { - if self.balance_id.is_none() { - self.balance_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.balance_id.as_mut().unwrap() - } - - // Take field - pub fn take_balance_id(&mut self) -> ::std::vec::Vec { - self.balance_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source_account", - |m: &StellarClaimClaimableBalanceOp| { &m.source_account }, - |m: &mut StellarClaimClaimableBalanceOp| { &mut m.source_account }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "balance_id", - |m: &StellarClaimClaimableBalanceOp| { &m.balance_id }, - |m: &mut StellarClaimClaimableBalanceOp| { &mut m.balance_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarClaimClaimableBalanceOp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarClaimClaimableBalanceOp { - const NAME: &'static str = "StellarClaimClaimableBalanceOp"; - - fn is_initialized(&self) -> bool { - if self.balance_id.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source_account = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.balance_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source_account.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.balance_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source_account.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.balance_id.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarClaimClaimableBalanceOp { - StellarClaimClaimableBalanceOp::new() - } - - fn clear(&mut self) { - self.source_account = ::std::option::Option::None; - self.balance_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarClaimClaimableBalanceOp { - static instance: StellarClaimClaimableBalanceOp = StellarClaimClaimableBalanceOp { - source_account: ::std::option::Option::None, - balance_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarClaimClaimableBalanceOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarClaimClaimableBalanceOp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarClaimClaimableBalanceOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarClaimClaimableBalanceOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.stellar.StellarSignedTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StellarSignedTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignedTx.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.stellar.StellarSignedTx.signature) - pub signature: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.stellar.StellarSignedTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StellarSignedTx { - fn default() -> &'a StellarSignedTx { - ::default_instance() - } -} - -impl StellarSignedTx { - pub fn new() -> StellarSignedTx { - ::std::default::Default::default() - } - - // required bytes public_key = 1; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes signature = 2; - - pub fn signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &StellarSignedTx| { &m.public_key }, - |m: &mut StellarSignedTx| { &mut m.public_key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &StellarSignedTx| { &m.signature }, - |m: &mut StellarSignedTx| { &mut m.signature }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "StellarSignedTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StellarSignedTx { - const NAME: &'static str = "StellarSignedTx"; - - fn is_initialized(&self) -> bool { - if self.public_key.is_none() { - return false; - } - if self.signature.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - 18 => { - self.signature = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.signature.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> StellarSignedTx { - StellarSignedTx::new() - } - - fn clear(&mut self) { - self.public_key = ::std::option::Option::None; - self.signature = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StellarSignedTx { - static instance: StellarSignedTx = StellarSignedTx { - public_key: ::std::option::Option::None, - signature: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StellarSignedTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("StellarSignedTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StellarSignedTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StellarSignedTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:hw.trezor.messages.stellar.StellarAssetType) -pub enum StellarAssetType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarAssetType.NATIVE) - NATIVE = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarAssetType.ALPHANUM4) - ALPHANUM4 = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.stellar.StellarAssetType.ALPHANUM12) - ALPHANUM12 = 2, -} - -impl ::protobuf::Enum for StellarAssetType { - const NAME: &'static str = "StellarAssetType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(StellarAssetType::NATIVE), - 1 => ::std::option::Option::Some(StellarAssetType::ALPHANUM4), - 2 => ::std::option::Option::Some(StellarAssetType::ALPHANUM12), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "NATIVE" => ::std::option::Option::Some(StellarAssetType::NATIVE), - "ALPHANUM4" => ::std::option::Option::Some(StellarAssetType::ALPHANUM4), - "ALPHANUM12" => ::std::option::Option::Some(StellarAssetType::ALPHANUM12), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [StellarAssetType] = &[ - StellarAssetType::NATIVE, - StellarAssetType::ALPHANUM4, - StellarAssetType::ALPHANUM12, - ]; -} - -impl ::protobuf::EnumFull for StellarAssetType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().enum_by_package_relative_name("StellarAssetType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for StellarAssetType { - fn default() -> Self { - StellarAssetType::NATIVE - } -} - -impl StellarAssetType { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("StellarAssetType") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x16messages-stellar.proto\x12\x1ahw.trezor.messages.stellar\"|\n\x0cS\ - tellarAsset\x12@\n\x04type\x18\x01\x20\x02(\x0e2,.hw.trezor.messages.ste\ - llar.StellarAssetTypeR\x04type\x12\x12\n\x04code\x18\x02\x20\x01(\tR\x04\ - code\x12\x16\n\x06issuer\x18\x03\x20\x01(\tR\x06issuer\"o\n\x11StellarGe\ - tAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0c\ - show_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\ - \x18\x03\x20\x01(\x08R\x08chunkify\"*\n\x0eStellarAddress\x12\x18\n\x07a\ - ddress\x18\x01\x20\x02(\tR\x07address\"\xa6\x04\n\rStellarSignTx\x12\x1b\ - \n\taddress_n\x18\x02\x20\x03(\rR\x08addressN\x12-\n\x12network_passphra\ - se\x18\x03\x20\x02(\tR\x11networkPassphrase\x12%\n\x0esource_account\x18\ - \x04\x20\x02(\tR\rsourceAccount\x12\x10\n\x03fee\x18\x05\x20\x02(\rR\x03\ - fee\x12'\n\x0fsequence_number\x18\x06\x20\x02(\x04R\x0esequenceNumber\ - \x12)\n\x10timebounds_start\x18\x08\x20\x02(\rR\x0ftimeboundsStart\x12%\ - \n\x0etimebounds_end\x18\t\x20\x02(\rR\rtimeboundsEnd\x12V\n\tmemo_type\ - \x18\n\x20\x02(\x0e29.hw.trezor.messages.stellar.StellarSignTx.StellarMe\ - moTypeR\x08memoType\x12\x1b\n\tmemo_text\x18\x0b\x20\x01(\tR\x08memoText\ - \x12\x17\n\x07memo_id\x18\x0c\x20\x01(\x04R\x06memoId\x12\x1b\n\tmemo_ha\ - sh\x18\r\x20\x01(\x0cR\x08memoHash\x12%\n\x0enum_operations\x18\x0e\x20\ - \x02(\rR\rnumOperations\"C\n\x0fStellarMemoType\x12\x08\n\x04NONE\x10\0\ - \x12\x08\n\x04TEXT\x10\x01\x12\x06\n\x02ID\x10\x02\x12\x08\n\x04HASH\x10\ - \x03\x12\n\n\x06RETURN\x10\x04\"\x14\n\x12StellarTxOpRequest\"\xc2\x01\n\ - \x10StellarPaymentOp\x12%\n\x0esource_account\x18\x01\x20\x01(\tR\rsourc\ - eAccount\x12/\n\x13destination_account\x18\x02\x20\x02(\tR\x12destinatio\ - nAccount\x12>\n\x05asset\x18\x03\x20\x02(\x0b2(.hw.trezor.messages.stell\ - ar.StellarAssetR\x05asset\x12\x16\n\x06amount\x18\x04\x20\x02(\x12R\x06a\ - mount\"\x8b\x01\n\x16StellarCreateAccountOp\x12%\n\x0esource_account\x18\ - \x01\x20\x01(\tR\rsourceAccount\x12\x1f\n\x0bnew_account\x18\x02\x20\x02\ - (\tR\nnewAccount\x12)\n\x10starting_balance\x18\x03\x20\x02(\x12R\x0fsta\ - rtingBalance\"\xa5\x03\n!StellarPathPaymentStrictReceiveOp\x12%\n\x0esou\ - rce_account\x18\x01\x20\x01(\tR\rsourceAccount\x12G\n\nsend_asset\x18\ - \x02\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\tsendAsset\ - \x12\x19\n\x08send_max\x18\x03\x20\x02(\x12R\x07sendMax\x12/\n\x13destin\ - ation_account\x18\x04\x20\x02(\tR\x12destinationAccount\x12U\n\x11destin\ - ation_asset\x18\x05\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAss\ - etR\x10destinationAsset\x12-\n\x12destination_amount\x18\x06\x20\x02(\ - \x12R\x11destinationAmount\x12>\n\x05paths\x18\x07\x20\x03(\x0b2(.hw.tre\ - zor.messages.stellar.StellarAssetR\x05paths\"\xa2\x03\n\x1eStellarPathPa\ - ymentStrictSendOp\x12%\n\x0esource_account\x18\x01\x20\x01(\tR\rsourceAc\ - count\x12G\n\nsend_asset\x18\x02\x20\x02(\x0b2(.hw.trezor.messages.stell\ - ar.StellarAssetR\tsendAsset\x12\x1f\n\x0bsend_amount\x18\x03\x20\x02(\ - \x12R\nsendAmount\x12/\n\x13destination_account\x18\x04\x20\x02(\tR\x12d\ - estinationAccount\x12U\n\x11destination_asset\x18\x05\x20\x02(\x0b2(.hw.\ - trezor.messages.stellar.StellarAssetR\x10destinationAsset\x12'\n\x0fdest\ - ination_min\x18\x06\x20\x02(\x12R\x0edestinationMin\x12>\n\x05paths\x18\ - \x07\x20\x03(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\x05paths\"\ - \xc2\x02\n\x18StellarManageSellOfferOp\x12%\n\x0esource_account\x18\x01\ - \x20\x01(\tR\rsourceAccount\x12M\n\rselling_asset\x18\x02\x20\x02(\x0b2(\ - .hw.trezor.messages.stellar.StellarAssetR\x0csellingAsset\x12K\n\x0cbuyi\ - ng_asset\x18\x03\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\ - \x0bbuyingAsset\x12\x16\n\x06amount\x18\x04\x20\x02(\x12R\x06amount\x12\ - \x17\n\x07price_n\x18\x05\x20\x02(\rR\x06priceN\x12\x17\n\x07price_d\x18\ - \x06\x20\x02(\rR\x06priceD\x12\x19\n\x08offer_id\x18\x07\x20\x02(\x04R\ - \x07offerId\"\xc1\x02\n\x17StellarManageBuyOfferOp\x12%\n\x0esource_acco\ - unt\x18\x01\x20\x01(\tR\rsourceAccount\x12M\n\rselling_asset\x18\x02\x20\ - \x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\x0csellingAsset\x12\ - K\n\x0cbuying_asset\x18\x03\x20\x02(\x0b2(.hw.trezor.messages.stellar.St\ - ellarAssetR\x0bbuyingAsset\x12\x16\n\x06amount\x18\x04\x20\x02(\x12R\x06\ - amount\x12\x17\n\x07price_n\x18\x05\x20\x02(\rR\x06priceN\x12\x17\n\x07p\ - rice_d\x18\x06\x20\x02(\rR\x06priceD\x12\x19\n\x08offer_id\x18\x07\x20\ - \x02(\x04R\x07offerId\"\xae\x02\n\x1fStellarCreatePassiveSellOfferOp\x12\ - %\n\x0esource_account\x18\x01\x20\x01(\tR\rsourceAccount\x12M\n\rselling\ - _asset\x18\x02\x20\x02(\x0b2(.hw.trezor.messages.stellar.StellarAssetR\ - \x0csellingAsset\x12K\n\x0cbuying_asset\x18\x03\x20\x02(\x0b2(.hw.trezor\ - .messages.stellar.StellarAssetR\x0bbuyingAsset\x12\x16\n\x06amount\x18\ - \x04\x20\x02(\x12R\x06amount\x12\x17\n\x07price_n\x18\x05\x20\x02(\rR\ - \x06priceN\x12\x17\n\x07price_d\x18\x06\x20\x02(\rR\x06priceD\"\xdd\x04\ - \n\x13StellarSetOptionsOp\x12%\n\x0esource_account\x18\x01\x20\x01(\tR\r\ - sourceAccount\x12B\n\x1dinflation_destination_account\x18\x02\x20\x01(\t\ - R\x1binflationDestinationAccount\x12\x1f\n\x0bclear_flags\x18\x03\x20\ - \x01(\rR\nclearFlags\x12\x1b\n\tset_flags\x18\x04\x20\x01(\rR\x08setFlag\ - s\x12#\n\rmaster_weight\x18\x05\x20\x01(\rR\x0cmasterWeight\x12#\n\rlow_\ - threshold\x18\x06\x20\x01(\rR\x0clowThreshold\x12)\n\x10medium_threshold\ - \x18\x07\x20\x01(\rR\x0fmediumThreshold\x12%\n\x0ehigh_threshold\x18\x08\ - \x20\x01(\rR\rhighThreshold\x12\x1f\n\x0bhome_domain\x18\t\x20\x01(\tR\n\ - homeDomain\x12b\n\x0bsigner_type\x18\n\x20\x01(\x0e2A.hw.trezor.messages\ - .stellar.StellarSetOptionsOp.StellarSignerTypeR\nsignerType\x12\x1d\n\ns\ - igner_key\x18\x0b\x20\x01(\x0cR\tsignerKey\x12#\n\rsigner_weight\x18\x0c\ - \x20\x01(\rR\x0csignerWeight\"8\n\x11StellarSignerType\x12\x0b\n\x07ACCO\ - UNT\x10\0\x12\x0c\n\x08PRE_AUTH\x10\x01\x12\x08\n\x04HASH\x10\x02\"\x93\ - \x01\n\x14StellarChangeTrustOp\x12%\n\x0esource_account\x18\x01\x20\x01(\ - \tR\rsourceAccount\x12>\n\x05asset\x18\x02\x20\x02(\x0b2(.hw.trezor.mess\ - ages.stellar.StellarAssetR\x05asset\x12\x14\n\x05limit\x18\x03\x20\x02(\ - \x04R\x05limit\"\xf6\x01\n\x13StellarAllowTrustOp\x12%\n\x0esource_accou\ - nt\x18\x01\x20\x01(\tR\rsourceAccount\x12'\n\x0ftrusted_account\x18\x02\ - \x20\x02(\tR\x0etrustedAccount\x12K\n\nasset_type\x18\x03\x20\x02(\x0e2,\ - .hw.trezor.messages.stellar.StellarAssetTypeR\tassetType\x12\x1d\n\nasse\ - t_code\x18\x04\x20\x01(\tR\tassetCode\x12#\n\ris_authorized\x18\x05\x20\ - \x02(\x08R\x0cisAuthorized\"o\n\x15StellarAccountMergeOp\x12%\n\x0esourc\ - e_account\x18\x01\x20\x01(\tR\rsourceAccount\x12/\n\x13destination_accou\ - nt\x18\x02\x20\x02(\tR\x12destinationAccount\"d\n\x13StellarManageDataOp\ - \x12%\n\x0esource_account\x18\x01\x20\x01(\tR\rsourceAccount\x12\x10\n\ - \x03key\x18\x02\x20\x02(\tR\x03key\x12\x14\n\x05value\x18\x03\x20\x01(\ - \x0cR\x05value\"W\n\x15StellarBumpSequenceOp\x12%\n\x0esource_account\ - \x18\x01\x20\x01(\tR\rsourceAccount\x12\x17\n\x07bump_to\x18\x02\x20\x02\ - (\x04R\x06bumpTo\"f\n\x1eStellarClaimClaimableBalanceOp\x12%\n\x0esource\ - _account\x18\x01\x20\x01(\tR\rsourceAccount\x12\x1d\n\nbalance_id\x18\ - \x02\x20\x02(\x0cR\tbalanceId\"N\n\x0fStellarSignedTx\x12\x1d\n\npublic_\ - key\x18\x01\x20\x02(\x0cR\tpublicKey\x12\x1c\n\tsignature\x18\x02\x20\ - \x02(\x0cR\tsignature*=\n\x10StellarAssetType\x12\n\n\x06NATIVE\x10\0\ - \x12\r\n\tALPHANUM4\x10\x01\x12\x0e\n\nALPHANUM12\x10\x02B;\n#com.satosh\ - ilabs.trezor.lib.protobufB\x14TrezorMessageStellar\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(20); - messages.push(StellarAsset::generated_message_descriptor_data()); - messages.push(StellarGetAddress::generated_message_descriptor_data()); - messages.push(StellarAddress::generated_message_descriptor_data()); - messages.push(StellarSignTx::generated_message_descriptor_data()); - messages.push(StellarTxOpRequest::generated_message_descriptor_data()); - messages.push(StellarPaymentOp::generated_message_descriptor_data()); - messages.push(StellarCreateAccountOp::generated_message_descriptor_data()); - messages.push(StellarPathPaymentStrictReceiveOp::generated_message_descriptor_data()); - messages.push(StellarPathPaymentStrictSendOp::generated_message_descriptor_data()); - messages.push(StellarManageSellOfferOp::generated_message_descriptor_data()); - messages.push(StellarManageBuyOfferOp::generated_message_descriptor_data()); - messages.push(StellarCreatePassiveSellOfferOp::generated_message_descriptor_data()); - messages.push(StellarSetOptionsOp::generated_message_descriptor_data()); - messages.push(StellarChangeTrustOp::generated_message_descriptor_data()); - messages.push(StellarAllowTrustOp::generated_message_descriptor_data()); - messages.push(StellarAccountMergeOp::generated_message_descriptor_data()); - messages.push(StellarManageDataOp::generated_message_descriptor_data()); - messages.push(StellarBumpSequenceOp::generated_message_descriptor_data()); - messages.push(StellarClaimClaimableBalanceOp::generated_message_descriptor_data()); - messages.push(StellarSignedTx::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(3); - enums.push(StellarAssetType::generated_enum_descriptor_data()); - enums.push(stellar_sign_tx::StellarMemoType::generated_enum_descriptor_data()); - enums.push(stellar_set_options_op::StellarSignerType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_tezos.rs b/wallet/trezor-client/src/protos/generated/messages_tezos.rs deleted file mode 100644 index 772554fe5a..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_tezos.rs +++ /dev/null @@ -1,4584 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-tezos.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosGetAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TezosGetAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetAddress.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetAddress.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetAddress.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosGetAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TezosGetAddress { - fn default() -> &'a TezosGetAddress { - ::default_instance() - } -} - -impl TezosGetAddress { - pub fn new() -> TezosGetAddress { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &TezosGetAddress| { &m.address_n }, - |m: &mut TezosGetAddress| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &TezosGetAddress| { &m.show_display }, - |m: &mut TezosGetAddress| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &TezosGetAddress| { &m.chunkify }, - |m: &mut TezosGetAddress| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosGetAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TezosGetAddress { - const NAME: &'static str = "TezosGetAddress"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosGetAddress { - TezosGetAddress::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosGetAddress { - static instance: TezosGetAddress = TezosGetAddress { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TezosGetAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosGetAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TezosGetAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TezosGetAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosAddress) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TezosAddress { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosAddress.address) - pub address: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosAddress.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TezosAddress { - fn default() -> &'a TezosAddress { - ::default_instance() - } -} - -impl TezosAddress { - pub fn new() -> TezosAddress { - ::std::default::Default::default() - } - - // required string address = 1; - - pub fn address(&self) -> &str { - match self.address.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::new()); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "address", - |m: &TezosAddress| { &m.address }, - |m: &mut TezosAddress| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosAddress", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TezosAddress { - const NAME: &'static str = "TezosAddress"; - - fn is_initialized(&self) -> bool { - if self.address.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.address = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.address.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosAddress { - TezosAddress::new() - } - - fn clear(&mut self) { - self.address = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosAddress { - static instance: TezosAddress = TezosAddress { - address: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TezosAddress { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosAddress").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TezosAddress { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TezosAddress { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosGetPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TezosGetPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetPublicKey.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetPublicKey.show_display) - pub show_display: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosGetPublicKey.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosGetPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TezosGetPublicKey { - fn default() -> &'a TezosGetPublicKey { - ::default_instance() - } -} - -impl TezosGetPublicKey { - pub fn new() -> TezosGetPublicKey { - ::std::default::Default::default() - } - - // optional bool show_display = 2; - - pub fn show_display(&self) -> bool { - self.show_display.unwrap_or(false) - } - - pub fn clear_show_display(&mut self) { - self.show_display = ::std::option::Option::None; - } - - pub fn has_show_display(&self) -> bool { - self.show_display.is_some() - } - - // Param is passed by value, moved - pub fn set_show_display(&mut self, v: bool) { - self.show_display = ::std::option::Option::Some(v); - } - - // optional bool chunkify = 3; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &TezosGetPublicKey| { &m.address_n }, - |m: &mut TezosGetPublicKey| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "show_display", - |m: &TezosGetPublicKey| { &m.show_display }, - |m: &mut TezosGetPublicKey| { &mut m.show_display }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &TezosGetPublicKey| { &m.chunkify }, - |m: &mut TezosGetPublicKey| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosGetPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TezosGetPublicKey { - const NAME: &'static str = "TezosGetPublicKey"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 16 => { - self.show_display = ::std::option::Option::Some(is.read_bool()?); - }, - 24 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.show_display { - my_size += 1 + 1; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.show_display { - os.write_bool(2, v)?; - } - if let Some(v) = self.chunkify { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosGetPublicKey { - TezosGetPublicKey::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.show_display = ::std::option::Option::None; - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosGetPublicKey { - static instance: TezosGetPublicKey = TezosGetPublicKey { - address_n: ::std::vec::Vec::new(), - show_display: ::std::option::Option::None, - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TezosGetPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosGetPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TezosGetPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TezosGetPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosPublicKey) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TezosPublicKey { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosPublicKey.public_key) - pub public_key: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosPublicKey.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TezosPublicKey { - fn default() -> &'a TezosPublicKey { - ::default_instance() - } -} - -impl TezosPublicKey { - pub fn new() -> TezosPublicKey { - ::std::default::Default::default() - } - - // required string public_key = 1; - - pub fn public_key(&self) -> &str { - match self.public_key.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::string::String) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::string::String { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::string::String::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::string::String { - self.public_key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &TezosPublicKey| { &m.public_key }, - |m: &mut TezosPublicKey| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosPublicKey", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TezosPublicKey { - const NAME: &'static str = "TezosPublicKey"; - - fn is_initialized(&self) -> bool { - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.public_key = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.public_key.as_ref() { - os.write_string(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosPublicKey { - TezosPublicKey::new() - } - - fn clear(&mut self) { - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosPublicKey { - static instance: TezosPublicKey = TezosPublicKey { - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TezosPublicKey { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosPublicKey").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TezosPublicKey { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TezosPublicKey { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TezosSignTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.address_n) - pub address_n: ::std::vec::Vec, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.branch) - pub branch: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.reveal) - pub reveal: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.transaction) - pub transaction: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.origination) - pub origination: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.delegation) - pub delegation: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.proposal) - pub proposal: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.ballot) - pub ballot: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.chunkify) - pub chunkify: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TezosSignTx { - fn default() -> &'a TezosSignTx { - ::default_instance() - } -} - -impl TezosSignTx { - pub fn new() -> TezosSignTx { - ::std::default::Default::default() - } - - // required bytes branch = 2; - - pub fn branch(&self) -> &[u8] { - match self.branch.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_branch(&mut self) { - self.branch = ::std::option::Option::None; - } - - pub fn has_branch(&self) -> bool { - self.branch.is_some() - } - - // Param is passed by value, moved - pub fn set_branch(&mut self, v: ::std::vec::Vec) { - self.branch = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_branch(&mut self) -> &mut ::std::vec::Vec { - if self.branch.is_none() { - self.branch = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.branch.as_mut().unwrap() - } - - // Take field - pub fn take_branch(&mut self) -> ::std::vec::Vec { - self.branch.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool chunkify = 9; - - pub fn chunkify(&self) -> bool { - self.chunkify.unwrap_or(false) - } - - pub fn clear_chunkify(&mut self) { - self.chunkify = ::std::option::Option::None; - } - - pub fn has_chunkify(&self) -> bool { - self.chunkify.is_some() - } - - // Param is passed by value, moved - pub fn set_chunkify(&mut self, v: bool) { - self.chunkify = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(9); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "address_n", - |m: &TezosSignTx| { &m.address_n }, - |m: &mut TezosSignTx| { &mut m.address_n }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "branch", - |m: &TezosSignTx| { &m.branch }, - |m: &mut TezosSignTx| { &mut m.branch }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosRevealOp>( - "reveal", - |m: &TezosSignTx| { &m.reveal }, - |m: &mut TezosSignTx| { &mut m.reveal }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosTransactionOp>( - "transaction", - |m: &TezosSignTx| { &m.transaction }, - |m: &mut TezosSignTx| { &mut m.transaction }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosOriginationOp>( - "origination", - |m: &TezosSignTx| { &m.origination }, - |m: &mut TezosSignTx| { &mut m.origination }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosDelegationOp>( - "delegation", - |m: &TezosSignTx| { &m.delegation }, - |m: &mut TezosSignTx| { &mut m.delegation }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosProposalOp>( - "proposal", - |m: &TezosSignTx| { &m.proposal }, - |m: &mut TezosSignTx| { &mut m.proposal }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_sign_tx::TezosBallotOp>( - "ballot", - |m: &TezosSignTx| { &m.ballot }, - |m: &mut TezosSignTx| { &mut m.ballot }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "chunkify", - |m: &TezosSignTx| { &m.chunkify }, - |m: &mut TezosSignTx| { &mut m.chunkify }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TezosSignTx { - const NAME: &'static str = "TezosSignTx"; - - fn is_initialized(&self) -> bool { - if self.branch.is_none() { - return false; - } - for v in &self.reveal { - if !v.is_initialized() { - return false; - } - }; - for v in &self.transaction { - if !v.is_initialized() { - return false; - } - }; - for v in &self.origination { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delegation { - if !v.is_initialized() { - return false; - } - }; - for v in &self.proposal { - if !v.is_initialized() { - return false; - } - }; - for v in &self.ballot { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - is.read_repeated_packed_uint32_into(&mut self.address_n)?; - }, - 8 => { - self.address_n.push(is.read_uint32()?); - }, - 18 => { - self.branch = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.reveal)?; - }, - 34 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.transaction)?; - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.origination)?; - }, - 50 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.delegation)?; - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.proposal)?; - }, - 66 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.ballot)?; - }, - 72 => { - self.chunkify = ::std::option::Option::Some(is.read_bool()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.address_n { - my_size += ::protobuf::rt::uint32_size(1, *value); - }; - if let Some(v) = self.branch.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.reveal.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.transaction.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.origination.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.delegation.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.proposal.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.ballot.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.chunkify { - my_size += 1 + 1; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.address_n { - os.write_uint32(1, *v)?; - }; - if let Some(v) = self.branch.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.reveal.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - if let Some(v) = self.transaction.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - } - if let Some(v) = self.origination.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - } - if let Some(v) = self.delegation.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - } - if let Some(v) = self.proposal.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.ballot.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; - } - if let Some(v) = self.chunkify { - os.write_bool(9, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosSignTx { - TezosSignTx::new() - } - - fn clear(&mut self) { - self.address_n.clear(); - self.branch = ::std::option::Option::None; - self.reveal.clear(); - self.transaction.clear(); - self.origination.clear(); - self.delegation.clear(); - self.proposal.clear(); - self.ballot.clear(); - self.chunkify = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosSignTx { - static instance: TezosSignTx = TezosSignTx { - address_n: ::std::vec::Vec::new(), - branch: ::std::option::Option::None, - reveal: ::protobuf::MessageField::none(), - transaction: ::protobuf::MessageField::none(), - origination: ::protobuf::MessageField::none(), - delegation: ::protobuf::MessageField::none(), - proposal: ::protobuf::MessageField::none(), - ballot: ::protobuf::MessageField::none(), - chunkify: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TezosSignTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosSignTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TezosSignTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TezosSignTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `TezosSignTx` -pub mod tezos_sign_tx { - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosContractID) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosContractID { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.tag) - pub tag: ::std::option::Option<::protobuf::EnumOrUnknown>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.hash) - pub hash: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosContractID { - fn default() -> &'a TezosContractID { - ::default_instance() - } - } - - impl TezosContractID { - pub fn new() -> TezosContractID { - ::std::default::Default::default() - } - - // required .hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType tag = 1; - - pub fn tag(&self) -> tezos_contract_id::TezosContractType { - match self.tag { - Some(e) => e.enum_value_or(tezos_contract_id::TezosContractType::Implicit), - None => tezos_contract_id::TezosContractType::Implicit, - } - } - - pub fn clear_tag(&mut self) { - self.tag = ::std::option::Option::None; - } - - pub fn has_tag(&self) -> bool { - self.tag.is_some() - } - - // Param is passed by value, moved - pub fn set_tag(&mut self, v: tezos_contract_id::TezosContractType) { - self.tag = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - // required bytes hash = 2; - - pub fn hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "tag", - |m: &TezosContractID| { &m.tag }, - |m: &mut TezosContractID| { &mut m.tag }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hash", - |m: &TezosContractID| { &m.hash }, - |m: &mut TezosContractID| { &mut m.hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosContractID", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosContractID { - const NAME: &'static str = "TezosContractID"; - - fn is_initialized(&self) -> bool { - if self.tag.is_none() { - return false; - } - if self.hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.tag = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - 18 => { - self.hash = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tag { - my_size += ::protobuf::rt::int32_size(1, v.value()); - } - if let Some(v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tag { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.hash.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosContractID { - TezosContractID::new() - } - - fn clear(&mut self) { - self.tag = ::std::option::Option::None; - self.hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosContractID { - static instance: TezosContractID = TezosContractID { - tag: ::std::option::Option::None, - hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosContractID { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosContractID").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosContractID { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosContractID { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `TezosContractID` - pub mod tezos_contract_id { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType) - pub enum TezosContractType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType.Implicit) - Implicit = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContractType.Originated) - Originated = 1, - } - - impl ::protobuf::Enum for TezosContractType { - const NAME: &'static str = "TezosContractType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(TezosContractType::Implicit), - 1 => ::std::option::Option::Some(TezosContractType::Originated), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "Implicit" => ::std::option::Option::Some(TezosContractType::Implicit), - "Originated" => ::std::option::Option::Some(TezosContractType::Originated), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [TezosContractType] = &[ - TezosContractType::Implicit, - TezosContractType::Originated, - ]; - } - - impl ::protobuf::EnumFull for TezosContractType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("TezosSignTx.TezosContractID.TezosContractType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for TezosContractType { - fn default() -> Self { - TezosContractType::Implicit - } - } - - impl TezosContractType { - pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("TezosSignTx.TezosContractID.TezosContractType") - } - } - } - - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosRevealOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.source) - pub source: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.counter) - pub counter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.gas_limit) - pub gas_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.storage_limit) - pub storage_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.public_key) - pub public_key: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosRevealOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosRevealOp { - fn default() -> &'a TezosRevealOp { - ::default_instance() - } - } - - impl TezosRevealOp { - pub fn new() -> TezosRevealOp { - ::std::default::Default::default() - } - - // required bytes source = 7; - - pub fn source(&self) -> &[u8] { - match self.source.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_source(&mut self) { - self.source = ::std::option::Option::None; - } - - pub fn has_source(&self) -> bool { - self.source.is_some() - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::vec::Vec) { - self.source = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { - if self.source.is_none() { - self.source = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.source.as_mut().unwrap() - } - - // Take field - pub fn take_source(&mut self) -> ::std::vec::Vec { - self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 fee = 2; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // required uint64 counter = 3; - - pub fn counter(&self) -> u64 { - self.counter.unwrap_or(0) - } - - pub fn clear_counter(&mut self) { - self.counter = ::std::option::Option::None; - } - - pub fn has_counter(&self) -> bool { - self.counter.is_some() - } - - // Param is passed by value, moved - pub fn set_counter(&mut self, v: u64) { - self.counter = ::std::option::Option::Some(v); - } - - // required uint64 gas_limit = 4; - - pub fn gas_limit(&self) -> u64 { - self.gas_limit.unwrap_or(0) - } - - pub fn clear_gas_limit(&mut self) { - self.gas_limit = ::std::option::Option::None; - } - - pub fn has_gas_limit(&self) -> bool { - self.gas_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_gas_limit(&mut self, v: u64) { - self.gas_limit = ::std::option::Option::Some(v); - } - - // required uint64 storage_limit = 5; - - pub fn storage_limit(&self) -> u64 { - self.storage_limit.unwrap_or(0) - } - - pub fn clear_storage_limit(&mut self) { - self.storage_limit = ::std::option::Option::None; - } - - pub fn has_storage_limit(&self) -> bool { - self.storage_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_storage_limit(&mut self, v: u64) { - self.storage_limit = ::std::option::Option::Some(v); - } - - // required bytes public_key = 6; - - pub fn public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_public_key(&mut self) { - self.public_key = ::std::option::Option::None; - } - - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } - - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.public_key.as_mut().unwrap() - } - - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source", - |m: &TezosRevealOp| { &m.source }, - |m: &mut TezosRevealOp| { &mut m.source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &TezosRevealOp| { &m.fee }, - |m: &mut TezosRevealOp| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "counter", - |m: &TezosRevealOp| { &m.counter }, - |m: &mut TezosRevealOp| { &mut m.counter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "gas_limit", - |m: &TezosRevealOp| { &m.gas_limit }, - |m: &mut TezosRevealOp| { &mut m.gas_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "storage_limit", - |m: &TezosRevealOp| { &m.storage_limit }, - |m: &mut TezosRevealOp| { &mut m.storage_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "public_key", - |m: &TezosRevealOp| { &m.public_key }, - |m: &mut TezosRevealOp| { &mut m.public_key }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosRevealOp", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosRevealOp { - const NAME: &'static str = "TezosRevealOp"; - - fn is_initialized(&self) -> bool { - if self.source.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - if self.counter.is_none() { - return false; - } - if self.gas_limit.is_none() { - return false; - } - if self.storage_limit.is_none() { - return false; - } - if self.public_key.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 58 => { - self.source = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.counter = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 50 => { - self.public_key = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.counter { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.gas_limit { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.storage_limit { - my_size += ::protobuf::rt::uint64_size(5, v); - } - if let Some(v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source.as_ref() { - os.write_bytes(7, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(2, v)?; - } - if let Some(v) = self.counter { - os.write_uint64(3, v)?; - } - if let Some(v) = self.gas_limit { - os.write_uint64(4, v)?; - } - if let Some(v) = self.storage_limit { - os.write_uint64(5, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosRevealOp { - TezosRevealOp::new() - } - - fn clear(&mut self) { - self.source = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.counter = ::std::option::Option::None; - self.gas_limit = ::std::option::Option::None; - self.storage_limit = ::std::option::Option::None; - self.public_key = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosRevealOp { - static instance: TezosRevealOp = TezosRevealOp { - source: ::std::option::Option::None, - fee: ::std::option::Option::None, - counter: ::std::option::Option::None, - gas_limit: ::std::option::Option::None, - storage_limit: ::std::option::Option::None, - public_key: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosRevealOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosRevealOp").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosRevealOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosRevealOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosTransactionOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.source) - pub source: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.counter) - pub counter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.gas_limit) - pub gas_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.storage_limit) - pub storage_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.amount) - pub amount: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.destination) - pub destination: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.parameters) - pub parameters: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.parameters_manager) - pub parameters_manager: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosTransactionOp { - fn default() -> &'a TezosTransactionOp { - ::default_instance() - } - } - - impl TezosTransactionOp { - pub fn new() -> TezosTransactionOp { - ::std::default::Default::default() - } - - // required bytes source = 9; - - pub fn source(&self) -> &[u8] { - match self.source.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_source(&mut self) { - self.source = ::std::option::Option::None; - } - - pub fn has_source(&self) -> bool { - self.source.is_some() - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::vec::Vec) { - self.source = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { - if self.source.is_none() { - self.source = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.source.as_mut().unwrap() - } - - // Take field - pub fn take_source(&mut self) -> ::std::vec::Vec { - self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 fee = 2; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // required uint64 counter = 3; - - pub fn counter(&self) -> u64 { - self.counter.unwrap_or(0) - } - - pub fn clear_counter(&mut self) { - self.counter = ::std::option::Option::None; - } - - pub fn has_counter(&self) -> bool { - self.counter.is_some() - } - - // Param is passed by value, moved - pub fn set_counter(&mut self, v: u64) { - self.counter = ::std::option::Option::Some(v); - } - - // required uint64 gas_limit = 4; - - pub fn gas_limit(&self) -> u64 { - self.gas_limit.unwrap_or(0) - } - - pub fn clear_gas_limit(&mut self) { - self.gas_limit = ::std::option::Option::None; - } - - pub fn has_gas_limit(&self) -> bool { - self.gas_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_gas_limit(&mut self, v: u64) { - self.gas_limit = ::std::option::Option::Some(v); - } - - // required uint64 storage_limit = 5; - - pub fn storage_limit(&self) -> u64 { - self.storage_limit.unwrap_or(0) - } - - pub fn clear_storage_limit(&mut self) { - self.storage_limit = ::std::option::Option::None; - } - - pub fn has_storage_limit(&self) -> bool { - self.storage_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_storage_limit(&mut self, v: u64) { - self.storage_limit = ::std::option::Option::Some(v); - } - - // required uint64 amount = 6; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - // optional bytes parameters = 8; - - pub fn parameters(&self) -> &[u8] { - match self.parameters.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_parameters(&mut self) { - self.parameters = ::std::option::Option::None; - } - - pub fn has_parameters(&self) -> bool { - self.parameters.is_some() - } - - // Param is passed by value, moved - pub fn set_parameters(&mut self, v: ::std::vec::Vec) { - self.parameters = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_parameters(&mut self) -> &mut ::std::vec::Vec { - if self.parameters.is_none() { - self.parameters = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.parameters.as_mut().unwrap() - } - - // Take field - pub fn take_parameters(&mut self) -> ::std::vec::Vec { - self.parameters.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(9); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source", - |m: &TezosTransactionOp| { &m.source }, - |m: &mut TezosTransactionOp| { &mut m.source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &TezosTransactionOp| { &m.fee }, - |m: &mut TezosTransactionOp| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "counter", - |m: &TezosTransactionOp| { &m.counter }, - |m: &mut TezosTransactionOp| { &mut m.counter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "gas_limit", - |m: &TezosTransactionOp| { &m.gas_limit }, - |m: &mut TezosTransactionOp| { &mut m.gas_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "storage_limit", - |m: &TezosTransactionOp| { &m.storage_limit }, - |m: &mut TezosTransactionOp| { &mut m.storage_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TezosTransactionOp| { &m.amount }, - |m: &mut TezosTransactionOp| { &mut m.amount }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, TezosContractID>( - "destination", - |m: &TezosTransactionOp| { &m.destination }, - |m: &mut TezosTransactionOp| { &mut m.destination }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "parameters", - |m: &TezosTransactionOp| { &m.parameters }, - |m: &mut TezosTransactionOp| { &mut m.parameters }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_transaction_op::TezosParametersManager>( - "parameters_manager", - |m: &TezosTransactionOp| { &m.parameters_manager }, - |m: &mut TezosTransactionOp| { &mut m.parameters_manager }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosTransactionOp", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosTransactionOp { - const NAME: &'static str = "TezosTransactionOp"; - - fn is_initialized(&self) -> bool { - if self.source.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - if self.counter.is_none() { - return false; - } - if self.gas_limit.is_none() { - return false; - } - if self.storage_limit.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - if self.destination.is_none() { - return false; - } - for v in &self.destination { - if !v.is_initialized() { - return false; - } - }; - for v in &self.parameters_manager { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 74 => { - self.source = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.counter = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 48 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination)?; - }, - 66 => { - self.parameters = ::std::option::Option::Some(is.read_bytes()?); - }, - 82 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.parameters_manager)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source.as_ref() { - my_size += ::protobuf::rt::bytes_size(9, &v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.counter { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.gas_limit { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.storage_limit { - my_size += ::protobuf::rt::uint64_size(5, v); - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(6, v); - } - if let Some(v) = self.destination.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.parameters.as_ref() { - my_size += ::protobuf::rt::bytes_size(8, &v); - } - if let Some(v) = self.parameters_manager.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source.as_ref() { - os.write_bytes(9, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(2, v)?; - } - if let Some(v) = self.counter { - os.write_uint64(3, v)?; - } - if let Some(v) = self.gas_limit { - os.write_uint64(4, v)?; - } - if let Some(v) = self.storage_limit { - os.write_uint64(5, v)?; - } - if let Some(v) = self.amount { - os.write_uint64(6, v)?; - } - if let Some(v) = self.destination.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - } - if let Some(v) = self.parameters.as_ref() { - os.write_bytes(8, v)?; - } - if let Some(v) = self.parameters_manager.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosTransactionOp { - TezosTransactionOp::new() - } - - fn clear(&mut self) { - self.source = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.counter = ::std::option::Option::None; - self.gas_limit = ::std::option::Option::None; - self.storage_limit = ::std::option::Option::None; - self.amount = ::std::option::Option::None; - self.destination.clear(); - self.parameters = ::std::option::Option::None; - self.parameters_manager.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosTransactionOp { - static instance: TezosTransactionOp = TezosTransactionOp { - source: ::std::option::Option::None, - fee: ::std::option::Option::None, - counter: ::std::option::Option::None, - gas_limit: ::std::option::Option::None, - storage_limit: ::std::option::Option::None, - amount: ::std::option::Option::None, - destination: ::protobuf::MessageField::none(), - parameters: ::std::option::Option::None, - parameters_manager: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosTransactionOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosTransactionOp").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosTransactionOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosTransactionOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `TezosTransactionOp` - pub mod tezos_transaction_op { - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosParametersManager { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.set_delegate) - pub set_delegate: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.cancel_delegate) - pub cancel_delegate: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.transfer) - pub transfer: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosParametersManager { - fn default() -> &'a TezosParametersManager { - ::default_instance() - } - } - - impl TezosParametersManager { - pub fn new() -> TezosParametersManager { - ::std::default::Default::default() - } - - // optional bytes set_delegate = 1; - - pub fn set_delegate(&self) -> &[u8] { - match self.set_delegate.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_set_delegate(&mut self) { - self.set_delegate = ::std::option::Option::None; - } - - pub fn has_set_delegate(&self) -> bool { - self.set_delegate.is_some() - } - - // Param is passed by value, moved - pub fn set_set_delegate(&mut self, v: ::std::vec::Vec) { - self.set_delegate = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_set_delegate(&mut self) -> &mut ::std::vec::Vec { - if self.set_delegate.is_none() { - self.set_delegate = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.set_delegate.as_mut().unwrap() - } - - // Take field - pub fn take_set_delegate(&mut self) -> ::std::vec::Vec { - self.set_delegate.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool cancel_delegate = 2; - - pub fn cancel_delegate(&self) -> bool { - self.cancel_delegate.unwrap_or(false) - } - - pub fn clear_cancel_delegate(&mut self) { - self.cancel_delegate = ::std::option::Option::None; - } - - pub fn has_cancel_delegate(&self) -> bool { - self.cancel_delegate.is_some() - } - - // Param is passed by value, moved - pub fn set_cancel_delegate(&mut self, v: bool) { - self.cancel_delegate = ::std::option::Option::Some(v); - } - - pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "set_delegate", - |m: &TezosParametersManager| { &m.set_delegate }, - |m: &mut TezosParametersManager| { &mut m.set_delegate }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "cancel_delegate", - |m: &TezosParametersManager| { &m.cancel_delegate }, - |m: &mut TezosParametersManager| { &mut m.cancel_delegate }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, tezos_parameters_manager::TezosManagerTransfer>( - "transfer", - |m: &TezosParametersManager| { &m.transfer }, - |m: &mut TezosParametersManager| { &mut m.transfer }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosTransactionOp.TezosParametersManager", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosParametersManager { - const NAME: &'static str = "TezosParametersManager"; - - fn is_initialized(&self) -> bool { - for v in &self.transfer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.set_delegate = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.cancel_delegate = ::std::option::Option::Some(is.read_bool()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.transfer)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.set_delegate.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.cancel_delegate { - my_size += 1 + 1; - } - if let Some(v) = self.transfer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.set_delegate.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.cancel_delegate { - os.write_bool(2, v)?; - } - if let Some(v) = self.transfer.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosParametersManager { - TezosParametersManager::new() - } - - fn clear(&mut self) { - self.set_delegate = ::std::option::Option::None; - self.cancel_delegate = ::std::option::Option::None; - self.transfer.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosParametersManager { - static instance: TezosParametersManager = TezosParametersManager { - set_delegate: ::std::option::Option::None, - cancel_delegate: ::std::option::Option::None, - transfer: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosParametersManager { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosTransactionOp.TezosParametersManager").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosParametersManager { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosParametersManager { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `TezosParametersManager` - pub mod tezos_parameters_manager { - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosManagerTransfer { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer.destination) - pub destination: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer.amount) - pub amount: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosManagerTransfer { - fn default() -> &'a TezosManagerTransfer { - ::default_instance() - } - } - - impl TezosManagerTransfer { - pub fn new() -> TezosManagerTransfer { - ::std::default::Default::default() - } - - // required uint64 amount = 2; - - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) - } - - pub fn clear_amount(&mut self) { - self.amount = ::std::option::Option::None; - } - - pub fn has_amount(&self) -> bool { - self.amount.is_some() - } - - // Param is passed by value, moved - pub fn set_amount(&mut self, v: u64) { - self.amount = ::std::option::Option::Some(v); - } - - pub(in super::super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::TezosContractID>( - "destination", - |m: &TezosManagerTransfer| { &m.destination }, - |m: &mut TezosManagerTransfer| { &mut m.destination }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &TezosManagerTransfer| { &m.amount }, - |m: &mut TezosManagerTransfer| { &mut m.amount }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosManagerTransfer { - const NAME: &'static str = "TezosManagerTransfer"; - - fn is_initialized(&self) -> bool { - if self.destination.is_none() { - return false; - } - if self.amount.is_none() { - return false; - } - for v in &self.destination { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.destination)?; - }, - 16 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.destination.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(2, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.destination.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.amount { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosManagerTransfer { - TezosManagerTransfer::new() - } - - fn clear(&mut self) { - self.destination.clear(); - self.amount = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosManagerTransfer { - static instance: TezosManagerTransfer = TezosManagerTransfer { - destination: ::protobuf::MessageField::none(), - amount: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosManagerTransfer { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransfer").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosManagerTransfer { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosManagerTransfer { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - } - } - - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosOriginationOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.source) - pub source: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.counter) - pub counter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.gas_limit) - pub gas_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.storage_limit) - pub storage_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.manager_pubkey) - pub manager_pubkey: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.balance) - pub balance: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.spendable) - pub spendable: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.delegatable) - pub delegatable: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.delegate) - pub delegate: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.script) - pub script: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosOriginationOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosOriginationOp { - fn default() -> &'a TezosOriginationOp { - ::default_instance() - } - } - - impl TezosOriginationOp { - pub fn new() -> TezosOriginationOp { - ::std::default::Default::default() - } - - // required bytes source = 12; - - pub fn source(&self) -> &[u8] { - match self.source.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_source(&mut self) { - self.source = ::std::option::Option::None; - } - - pub fn has_source(&self) -> bool { - self.source.is_some() - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::vec::Vec) { - self.source = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { - if self.source.is_none() { - self.source = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.source.as_mut().unwrap() - } - - // Take field - pub fn take_source(&mut self) -> ::std::vec::Vec { - self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 fee = 2; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // required uint64 counter = 3; - - pub fn counter(&self) -> u64 { - self.counter.unwrap_or(0) - } - - pub fn clear_counter(&mut self) { - self.counter = ::std::option::Option::None; - } - - pub fn has_counter(&self) -> bool { - self.counter.is_some() - } - - // Param is passed by value, moved - pub fn set_counter(&mut self, v: u64) { - self.counter = ::std::option::Option::Some(v); - } - - // required uint64 gas_limit = 4; - - pub fn gas_limit(&self) -> u64 { - self.gas_limit.unwrap_or(0) - } - - pub fn clear_gas_limit(&mut self) { - self.gas_limit = ::std::option::Option::None; - } - - pub fn has_gas_limit(&self) -> bool { - self.gas_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_gas_limit(&mut self, v: u64) { - self.gas_limit = ::std::option::Option::Some(v); - } - - // required uint64 storage_limit = 5; - - pub fn storage_limit(&self) -> u64 { - self.storage_limit.unwrap_or(0) - } - - pub fn clear_storage_limit(&mut self) { - self.storage_limit = ::std::option::Option::None; - } - - pub fn has_storage_limit(&self) -> bool { - self.storage_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_storage_limit(&mut self, v: u64) { - self.storage_limit = ::std::option::Option::Some(v); - } - - // optional bytes manager_pubkey = 6; - - pub fn manager_pubkey(&self) -> &[u8] { - match self.manager_pubkey.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_manager_pubkey(&mut self) { - self.manager_pubkey = ::std::option::Option::None; - } - - pub fn has_manager_pubkey(&self) -> bool { - self.manager_pubkey.is_some() - } - - // Param is passed by value, moved - pub fn set_manager_pubkey(&mut self, v: ::std::vec::Vec) { - self.manager_pubkey = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_manager_pubkey(&mut self) -> &mut ::std::vec::Vec { - if self.manager_pubkey.is_none() { - self.manager_pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.manager_pubkey.as_mut().unwrap() - } - - // Take field - pub fn take_manager_pubkey(&mut self) -> ::std::vec::Vec { - self.manager_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 balance = 7; - - pub fn balance(&self) -> u64 { - self.balance.unwrap_or(0) - } - - pub fn clear_balance(&mut self) { - self.balance = ::std::option::Option::None; - } - - pub fn has_balance(&self) -> bool { - self.balance.is_some() - } - - // Param is passed by value, moved - pub fn set_balance(&mut self, v: u64) { - self.balance = ::std::option::Option::Some(v); - } - - // optional bool spendable = 8; - - pub fn spendable(&self) -> bool { - self.spendable.unwrap_or(false) - } - - pub fn clear_spendable(&mut self) { - self.spendable = ::std::option::Option::None; - } - - pub fn has_spendable(&self) -> bool { - self.spendable.is_some() - } - - // Param is passed by value, moved - pub fn set_spendable(&mut self, v: bool) { - self.spendable = ::std::option::Option::Some(v); - } - - // optional bool delegatable = 9; - - pub fn delegatable(&self) -> bool { - self.delegatable.unwrap_or(false) - } - - pub fn clear_delegatable(&mut self) { - self.delegatable = ::std::option::Option::None; - } - - pub fn has_delegatable(&self) -> bool { - self.delegatable.is_some() - } - - // Param is passed by value, moved - pub fn set_delegatable(&mut self, v: bool) { - self.delegatable = ::std::option::Option::Some(v); - } - - // optional bytes delegate = 10; - - pub fn delegate(&self) -> &[u8] { - match self.delegate.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_delegate(&mut self) { - self.delegate = ::std::option::Option::None; - } - - pub fn has_delegate(&self) -> bool { - self.delegate.is_some() - } - - // Param is passed by value, moved - pub fn set_delegate(&mut self, v: ::std::vec::Vec) { - self.delegate = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delegate(&mut self) -> &mut ::std::vec::Vec { - if self.delegate.is_none() { - self.delegate = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.delegate.as_mut().unwrap() - } - - // Take field - pub fn take_delegate(&mut self) -> ::std::vec::Vec { - self.delegate.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required bytes script = 11; - - pub fn script(&self) -> &[u8] { - match self.script.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_script(&mut self) { - self.script = ::std::option::Option::None; - } - - pub fn has_script(&self) -> bool { - self.script.is_some() - } - - // Param is passed by value, moved - pub fn set_script(&mut self, v: ::std::vec::Vec) { - self.script = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script(&mut self) -> &mut ::std::vec::Vec { - if self.script.is_none() { - self.script = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.script.as_mut().unwrap() - } - - // Take field - pub fn take_script(&mut self) -> ::std::vec::Vec { - self.script.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(11); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source", - |m: &TezosOriginationOp| { &m.source }, - |m: &mut TezosOriginationOp| { &mut m.source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &TezosOriginationOp| { &m.fee }, - |m: &mut TezosOriginationOp| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "counter", - |m: &TezosOriginationOp| { &m.counter }, - |m: &mut TezosOriginationOp| { &mut m.counter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "gas_limit", - |m: &TezosOriginationOp| { &m.gas_limit }, - |m: &mut TezosOriginationOp| { &mut m.gas_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "storage_limit", - |m: &TezosOriginationOp| { &m.storage_limit }, - |m: &mut TezosOriginationOp| { &mut m.storage_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "manager_pubkey", - |m: &TezosOriginationOp| { &m.manager_pubkey }, - |m: &mut TezosOriginationOp| { &mut m.manager_pubkey }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "balance", - |m: &TezosOriginationOp| { &m.balance }, - |m: &mut TezosOriginationOp| { &mut m.balance }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "spendable", - |m: &TezosOriginationOp| { &m.spendable }, - |m: &mut TezosOriginationOp| { &mut m.spendable }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "delegatable", - |m: &TezosOriginationOp| { &m.delegatable }, - |m: &mut TezosOriginationOp| { &mut m.delegatable }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "delegate", - |m: &TezosOriginationOp| { &m.delegate }, - |m: &mut TezosOriginationOp| { &mut m.delegate }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "script", - |m: &TezosOriginationOp| { &m.script }, - |m: &mut TezosOriginationOp| { &mut m.script }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosOriginationOp", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosOriginationOp { - const NAME: &'static str = "TezosOriginationOp"; - - fn is_initialized(&self) -> bool { - if self.source.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - if self.counter.is_none() { - return false; - } - if self.gas_limit.is_none() { - return false; - } - if self.storage_limit.is_none() { - return false; - } - if self.balance.is_none() { - return false; - } - if self.script.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 98 => { - self.source = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.counter = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 50 => { - self.manager_pubkey = ::std::option::Option::Some(is.read_bytes()?); - }, - 56 => { - self.balance = ::std::option::Option::Some(is.read_uint64()?); - }, - 64 => { - self.spendable = ::std::option::Option::Some(is.read_bool()?); - }, - 72 => { - self.delegatable = ::std::option::Option::Some(is.read_bool()?); - }, - 82 => { - self.delegate = ::std::option::Option::Some(is.read_bytes()?); - }, - 90 => { - self.script = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source.as_ref() { - my_size += ::protobuf::rt::bytes_size(12, &v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.counter { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.gas_limit { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.storage_limit { - my_size += ::protobuf::rt::uint64_size(5, v); - } - if let Some(v) = self.manager_pubkey.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - if let Some(v) = self.balance { - my_size += ::protobuf::rt::uint64_size(7, v); - } - if let Some(v) = self.spendable { - my_size += 1 + 1; - } - if let Some(v) = self.delegatable { - my_size += 1 + 1; - } - if let Some(v) = self.delegate.as_ref() { - my_size += ::protobuf::rt::bytes_size(10, &v); - } - if let Some(v) = self.script.as_ref() { - my_size += ::protobuf::rt::bytes_size(11, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source.as_ref() { - os.write_bytes(12, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(2, v)?; - } - if let Some(v) = self.counter { - os.write_uint64(3, v)?; - } - if let Some(v) = self.gas_limit { - os.write_uint64(4, v)?; - } - if let Some(v) = self.storage_limit { - os.write_uint64(5, v)?; - } - if let Some(v) = self.manager_pubkey.as_ref() { - os.write_bytes(6, v)?; - } - if let Some(v) = self.balance { - os.write_uint64(7, v)?; - } - if let Some(v) = self.spendable { - os.write_bool(8, v)?; - } - if let Some(v) = self.delegatable { - os.write_bool(9, v)?; - } - if let Some(v) = self.delegate.as_ref() { - os.write_bytes(10, v)?; - } - if let Some(v) = self.script.as_ref() { - os.write_bytes(11, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosOriginationOp { - TezosOriginationOp::new() - } - - fn clear(&mut self) { - self.source = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.counter = ::std::option::Option::None; - self.gas_limit = ::std::option::Option::None; - self.storage_limit = ::std::option::Option::None; - self.manager_pubkey = ::std::option::Option::None; - self.balance = ::std::option::Option::None; - self.spendable = ::std::option::Option::None; - self.delegatable = ::std::option::Option::None; - self.delegate = ::std::option::Option::None; - self.script = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosOriginationOp { - static instance: TezosOriginationOp = TezosOriginationOp { - source: ::std::option::Option::None, - fee: ::std::option::Option::None, - counter: ::std::option::Option::None, - gas_limit: ::std::option::Option::None, - storage_limit: ::std::option::Option::None, - manager_pubkey: ::std::option::Option::None, - balance: ::std::option::Option::None, - spendable: ::std::option::Option::None, - delegatable: ::std::option::Option::None, - delegate: ::std::option::Option::None, - script: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosOriginationOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosOriginationOp").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosOriginationOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosOriginationOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosDelegationOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.source) - pub source: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.fee) - pub fee: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.counter) - pub counter: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.gas_limit) - pub gas_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.storage_limit) - pub storage_limit: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.delegate) - pub delegate: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosDelegationOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosDelegationOp { - fn default() -> &'a TezosDelegationOp { - ::default_instance() - } - } - - impl TezosDelegationOp { - pub fn new() -> TezosDelegationOp { - ::std::default::Default::default() - } - - // required bytes source = 7; - - pub fn source(&self) -> &[u8] { - match self.source.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_source(&mut self) { - self.source = ::std::option::Option::None; - } - - pub fn has_source(&self) -> bool { - self.source.is_some() - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::vec::Vec) { - self.source = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { - if self.source.is_none() { - self.source = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.source.as_mut().unwrap() - } - - // Take field - pub fn take_source(&mut self) -> ::std::vec::Vec { - self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 fee = 2; - - pub fn fee(&self) -> u64 { - self.fee.unwrap_or(0) - } - - pub fn clear_fee(&mut self) { - self.fee = ::std::option::Option::None; - } - - pub fn has_fee(&self) -> bool { - self.fee.is_some() - } - - // Param is passed by value, moved - pub fn set_fee(&mut self, v: u64) { - self.fee = ::std::option::Option::Some(v); - } - - // required uint64 counter = 3; - - pub fn counter(&self) -> u64 { - self.counter.unwrap_or(0) - } - - pub fn clear_counter(&mut self) { - self.counter = ::std::option::Option::None; - } - - pub fn has_counter(&self) -> bool { - self.counter.is_some() - } - - // Param is passed by value, moved - pub fn set_counter(&mut self, v: u64) { - self.counter = ::std::option::Option::Some(v); - } - - // required uint64 gas_limit = 4; - - pub fn gas_limit(&self) -> u64 { - self.gas_limit.unwrap_or(0) - } - - pub fn clear_gas_limit(&mut self) { - self.gas_limit = ::std::option::Option::None; - } - - pub fn has_gas_limit(&self) -> bool { - self.gas_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_gas_limit(&mut self, v: u64) { - self.gas_limit = ::std::option::Option::Some(v); - } - - // required uint64 storage_limit = 5; - - pub fn storage_limit(&self) -> u64 { - self.storage_limit.unwrap_or(0) - } - - pub fn clear_storage_limit(&mut self) { - self.storage_limit = ::std::option::Option::None; - } - - pub fn has_storage_limit(&self) -> bool { - self.storage_limit.is_some() - } - - // Param is passed by value, moved - pub fn set_storage_limit(&mut self, v: u64) { - self.storage_limit = ::std::option::Option::Some(v); - } - - // required bytes delegate = 6; - - pub fn delegate(&self) -> &[u8] { - match self.delegate.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_delegate(&mut self) { - self.delegate = ::std::option::Option::None; - } - - pub fn has_delegate(&self) -> bool { - self.delegate.is_some() - } - - // Param is passed by value, moved - pub fn set_delegate(&mut self, v: ::std::vec::Vec) { - self.delegate = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delegate(&mut self) -> &mut ::std::vec::Vec { - if self.delegate.is_none() { - self.delegate = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.delegate.as_mut().unwrap() - } - - // Take field - pub fn take_delegate(&mut self) -> ::std::vec::Vec { - self.delegate.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source", - |m: &TezosDelegationOp| { &m.source }, - |m: &mut TezosDelegationOp| { &mut m.source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "fee", - |m: &TezosDelegationOp| { &m.fee }, - |m: &mut TezosDelegationOp| { &mut m.fee }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "counter", - |m: &TezosDelegationOp| { &m.counter }, - |m: &mut TezosDelegationOp| { &mut m.counter }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "gas_limit", - |m: &TezosDelegationOp| { &m.gas_limit }, - |m: &mut TezosDelegationOp| { &mut m.gas_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "storage_limit", - |m: &TezosDelegationOp| { &m.storage_limit }, - |m: &mut TezosDelegationOp| { &mut m.storage_limit }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "delegate", - |m: &TezosDelegationOp| { &m.delegate }, - |m: &mut TezosDelegationOp| { &mut m.delegate }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosDelegationOp", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosDelegationOp { - const NAME: &'static str = "TezosDelegationOp"; - - fn is_initialized(&self) -> bool { - if self.source.is_none() { - return false; - } - if self.fee.is_none() { - return false; - } - if self.counter.is_none() { - return false; - } - if self.gas_limit.is_none() { - return false; - } - if self.storage_limit.is_none() { - return false; - } - if self.delegate.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 58 => { - self.source = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.fee = ::std::option::Option::Some(is.read_uint64()?); - }, - 24 => { - self.counter = ::std::option::Option::Some(is.read_uint64()?); - }, - 32 => { - self.gas_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 40 => { - self.storage_limit = ::std::option::Option::Some(is.read_uint64()?); - }, - 50 => { - self.delegate = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source.as_ref() { - my_size += ::protobuf::rt::bytes_size(7, &v); - } - if let Some(v) = self.fee { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.counter { - my_size += ::protobuf::rt::uint64_size(3, v); - } - if let Some(v) = self.gas_limit { - my_size += ::protobuf::rt::uint64_size(4, v); - } - if let Some(v) = self.storage_limit { - my_size += ::protobuf::rt::uint64_size(5, v); - } - if let Some(v) = self.delegate.as_ref() { - my_size += ::protobuf::rt::bytes_size(6, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source.as_ref() { - os.write_bytes(7, v)?; - } - if let Some(v) = self.fee { - os.write_uint64(2, v)?; - } - if let Some(v) = self.counter { - os.write_uint64(3, v)?; - } - if let Some(v) = self.gas_limit { - os.write_uint64(4, v)?; - } - if let Some(v) = self.storage_limit { - os.write_uint64(5, v)?; - } - if let Some(v) = self.delegate.as_ref() { - os.write_bytes(6, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosDelegationOp { - TezosDelegationOp::new() - } - - fn clear(&mut self) { - self.source = ::std::option::Option::None; - self.fee = ::std::option::Option::None; - self.counter = ::std::option::Option::None; - self.gas_limit = ::std::option::Option::None; - self.storage_limit = ::std::option::Option::None; - self.delegate = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosDelegationOp { - static instance: TezosDelegationOp = TezosDelegationOp { - source: ::std::option::Option::None, - fee: ::std::option::Option::None, - counter: ::std::option::Option::None, - gas_limit: ::std::option::Option::None, - storage_limit: ::std::option::Option::None, - delegate: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosDelegationOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosDelegationOp").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosDelegationOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosDelegationOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosProposalOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.source) - pub source: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.period) - pub period: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.proposals) - pub proposals: ::std::vec::Vec<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosProposalOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosProposalOp { - fn default() -> &'a TezosProposalOp { - ::default_instance() - } - } - - impl TezosProposalOp { - pub fn new() -> TezosProposalOp { - ::std::default::Default::default() - } - - // required bytes source = 1; - - pub fn source(&self) -> &[u8] { - match self.source.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_source(&mut self) { - self.source = ::std::option::Option::None; - } - - pub fn has_source(&self) -> bool { - self.source.is_some() - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::vec::Vec) { - self.source = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { - if self.source.is_none() { - self.source = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.source.as_mut().unwrap() - } - - // Take field - pub fn take_source(&mut self) -> ::std::vec::Vec { - self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 period = 2; - - pub fn period(&self) -> u64 { - self.period.unwrap_or(0) - } - - pub fn clear_period(&mut self) { - self.period = ::std::option::Option::None; - } - - pub fn has_period(&self) -> bool { - self.period.is_some() - } - - // Param is passed by value, moved - pub fn set_period(&mut self, v: u64) { - self.period = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source", - |m: &TezosProposalOp| { &m.source }, - |m: &mut TezosProposalOp| { &mut m.source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "period", - |m: &TezosProposalOp| { &m.period }, - |m: &mut TezosProposalOp| { &mut m.period }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "proposals", - |m: &TezosProposalOp| { &m.proposals }, - |m: &mut TezosProposalOp| { &mut m.proposals }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosProposalOp", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosProposalOp { - const NAME: &'static str = "TezosProposalOp"; - - fn is_initialized(&self) -> bool { - if self.source.is_none() { - return false; - } - if self.period.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.period = ::std::option::Option::Some(is.read_uint64()?); - }, - 34 => { - self.proposals.push(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.period { - my_size += ::protobuf::rt::uint64_size(2, v); - } - for value in &self.proposals { - my_size += ::protobuf::rt::bytes_size(4, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.period { - os.write_uint64(2, v)?; - } - for v in &self.proposals { - os.write_bytes(4, &v)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosProposalOp { - TezosProposalOp::new() - } - - fn clear(&mut self) { - self.source = ::std::option::Option::None; - self.period = ::std::option::Option::None; - self.proposals.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosProposalOp { - static instance: TezosProposalOp = TezosProposalOp { - source: ::std::option::Option::None, - period: ::std::option::Option::None, - proposals: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosProposalOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosProposalOp").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosProposalOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosProposalOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - // @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct TezosBallotOp { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.source) - pub source: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.period) - pub period: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.proposal) - pub proposal: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.ballot) - pub ballot: ::std::option::Option<::protobuf::EnumOrUnknown>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a TezosBallotOp { - fn default() -> &'a TezosBallotOp { - ::default_instance() - } - } - - impl TezosBallotOp { - pub fn new() -> TezosBallotOp { - ::std::default::Default::default() - } - - // required bytes source = 1; - - pub fn source(&self) -> &[u8] { - match self.source.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_source(&mut self) { - self.source = ::std::option::Option::None; - } - - pub fn has_source(&self) -> bool { - self.source.is_some() - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::vec::Vec) { - self.source = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::vec::Vec { - if self.source.is_none() { - self.source = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.source.as_mut().unwrap() - } - - // Take field - pub fn take_source(&mut self) -> ::std::vec::Vec { - self.source.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 period = 2; - - pub fn period(&self) -> u64 { - self.period.unwrap_or(0) - } - - pub fn clear_period(&mut self) { - self.period = ::std::option::Option::None; - } - - pub fn has_period(&self) -> bool { - self.period.is_some() - } - - // Param is passed by value, moved - pub fn set_period(&mut self, v: u64) { - self.period = ::std::option::Option::Some(v); - } - - // required bytes proposal = 3; - - pub fn proposal(&self) -> &[u8] { - match self.proposal.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_proposal(&mut self) { - self.proposal = ::std::option::Option::None; - } - - pub fn has_proposal(&self) -> bool { - self.proposal.is_some() - } - - // Param is passed by value, moved - pub fn set_proposal(&mut self, v: ::std::vec::Vec) { - self.proposal = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_proposal(&mut self) -> &mut ::std::vec::Vec { - if self.proposal.is_none() { - self.proposal = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.proposal.as_mut().unwrap() - } - - // Take field - pub fn take_proposal(&mut self) -> ::std::vec::Vec { - self.proposal.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required .hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType ballot = 4; - - pub fn ballot(&self) -> tezos_ballot_op::TezosBallotType { - match self.ballot { - Some(e) => e.enum_value_or(tezos_ballot_op::TezosBallotType::Yay), - None => tezos_ballot_op::TezosBallotType::Yay, - } - } - - pub fn clear_ballot(&mut self) { - self.ballot = ::std::option::Option::None; - } - - pub fn has_ballot(&self) -> bool { - self.ballot.is_some() - } - - // Param is passed by value, moved - pub fn set_ballot(&mut self, v: tezos_ballot_op::TezosBallotType) { - self.ballot = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "source", - |m: &TezosBallotOp| { &m.source }, - |m: &mut TezosBallotOp| { &mut m.source }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "period", - |m: &TezosBallotOp| { &m.period }, - |m: &mut TezosBallotOp| { &mut m.period }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "proposal", - |m: &TezosBallotOp| { &m.proposal }, - |m: &mut TezosBallotOp| { &mut m.proposal }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "ballot", - |m: &TezosBallotOp| { &m.ballot }, - |m: &mut TezosBallotOp| { &mut m.ballot }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignTx.TezosBallotOp", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for TezosBallotOp { - const NAME: &'static str = "TezosBallotOp"; - - fn is_initialized(&self) -> bool { - if self.source.is_none() { - return false; - } - if self.period.is_none() { - return false; - } - if self.proposal.is_none() { - return false; - } - if self.ballot.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.source = ::std::option::Option::Some(is.read_bytes()?); - }, - 16 => { - self.period = ::std::option::Option::Some(is.read_uint64()?); - }, - 26 => { - self.proposal = ::std::option::Option::Some(is.read_bytes()?); - }, - 32 => { - self.ballot = ::std::option::Option::Some(is.read_enum_or_unknown()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.source.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.period { - my_size += ::protobuf::rt::uint64_size(2, v); - } - if let Some(v) = self.proposal.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(v) = self.ballot { - my_size += ::protobuf::rt::int32_size(4, v.value()); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.source.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.period { - os.write_uint64(2, v)?; - } - if let Some(v) = self.proposal.as_ref() { - os.write_bytes(3, v)?; - } - if let Some(v) = self.ballot { - os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosBallotOp { - TezosBallotOp::new() - } - - fn clear(&mut self) { - self.source = ::std::option::Option::None; - self.period = ::std::option::Option::None; - self.proposal = ::std::option::Option::None; - self.ballot = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosBallotOp { - static instance: TezosBallotOp = TezosBallotOp { - source: ::std::option::Option::None, - period: ::std::option::Option::None, - proposal: ::std::option::Option::None, - ballot: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for TezosBallotOp { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TezosSignTx.TezosBallotOp").unwrap()).clone() - } - } - - impl ::std::fmt::Display for TezosBallotOp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for TezosBallotOp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } - - /// Nested message and enums of message `TezosBallotOp` - pub mod tezos_ballot_op { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType) - pub enum TezosBallotType { - // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType.Yay) - Yay = 0, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType.Nay) - Nay = 1, - // @@protoc_insertion_point(enum_value:hw.trezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotType.Pass) - Pass = 2, - } - - impl ::protobuf::Enum for TezosBallotType { - const NAME: &'static str = "TezosBallotType"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(TezosBallotType::Yay), - 1 => ::std::option::Option::Some(TezosBallotType::Nay), - 2 => ::std::option::Option::Some(TezosBallotType::Pass), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option { - match str { - "Yay" => ::std::option::Option::Some(TezosBallotType::Yay), - "Nay" => ::std::option::Option::Some(TezosBallotType::Nay), - "Pass" => ::std::option::Option::Some(TezosBallotType::Pass), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [TezosBallotType] = &[ - TezosBallotType::Yay, - TezosBallotType::Nay, - TezosBallotType::Pass, - ]; - } - - impl ::protobuf::EnumFull for TezosBallotType { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("TezosSignTx.TezosBallotOp.TezosBallotType").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } - } - - impl ::std::default::Default for TezosBallotType { - fn default() -> Self { - TezosBallotType::Yay - } - } - - impl TezosBallotType { - pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("TezosSignTx.TezosBallotOp.TezosBallotType") - } - } - } -} - -// @@protoc_insertion_point(message:hw.trezor.messages.tezos.TezosSignedTx) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct TezosSignedTx { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignedTx.signature) - pub signature: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignedTx.sig_op_contents) - pub sig_op_contents: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.tezos.TezosSignedTx.operation_hash) - pub operation_hash: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.tezos.TezosSignedTx.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a TezosSignedTx { - fn default() -> &'a TezosSignedTx { - ::default_instance() - } -} - -impl TezosSignedTx { - pub fn new() -> TezosSignedTx { - ::std::default::Default::default() - } - - // required string signature = 1; - - pub fn signature(&self) -> &str { - match self.signature.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_signature(&mut self) { - self.signature = ::std::option::Option::None; - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::string::String) { - self.signature = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::string::String { - if self.signature.is_none() { - self.signature = ::std::option::Option::Some(::std::string::String::new()); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::string::String { - self.signature.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // required bytes sig_op_contents = 2; - - pub fn sig_op_contents(&self) -> &[u8] { - match self.sig_op_contents.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_sig_op_contents(&mut self) { - self.sig_op_contents = ::std::option::Option::None; - } - - pub fn has_sig_op_contents(&self) -> bool { - self.sig_op_contents.is_some() - } - - // Param is passed by value, moved - pub fn set_sig_op_contents(&mut self, v: ::std::vec::Vec) { - self.sig_op_contents = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sig_op_contents(&mut self) -> &mut ::std::vec::Vec { - if self.sig_op_contents.is_none() { - self.sig_op_contents = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.sig_op_contents.as_mut().unwrap() - } - - // Take field - pub fn take_sig_op_contents(&mut self) -> ::std::vec::Vec { - self.sig_op_contents.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required string operation_hash = 3; - - pub fn operation_hash(&self) -> &str { - match self.operation_hash.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_operation_hash(&mut self) { - self.operation_hash = ::std::option::Option::None; - } - - pub fn has_operation_hash(&self) -> bool { - self.operation_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_operation_hash(&mut self, v: ::std::string::String) { - self.operation_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_operation_hash(&mut self) -> &mut ::std::string::String { - if self.operation_hash.is_none() { - self.operation_hash = ::std::option::Option::Some(::std::string::String::new()); - } - self.operation_hash.as_mut().unwrap() - } - - // Take field - pub fn take_operation_hash(&mut self) -> ::std::string::String { - self.operation_hash.take().unwrap_or_else(|| ::std::string::String::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "signature", - |m: &TezosSignedTx| { &m.signature }, - |m: &mut TezosSignedTx| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "sig_op_contents", - |m: &TezosSignedTx| { &m.sig_op_contents }, - |m: &mut TezosSignedTx| { &mut m.sig_op_contents }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "operation_hash", - |m: &TezosSignedTx| { &m.operation_hash }, - |m: &mut TezosSignedTx| { &mut m.operation_hash }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "TezosSignedTx", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for TezosSignedTx { - const NAME: &'static str = "TezosSignedTx"; - - fn is_initialized(&self) -> bool { - if self.signature.is_none() { - return false; - } - if self.sig_op_contents.is_none() { - return false; - } - if self.operation_hash.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.signature = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.sig_op_contents = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.operation_hash = ::std::option::Option::Some(is.read_string()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.signature.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(v) = self.sig_op_contents.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.operation_hash.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature.as_ref() { - os.write_string(1, v)?; - } - if let Some(v) = self.sig_op_contents.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.operation_hash.as_ref() { - os.write_string(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> TezosSignedTx { - TezosSignedTx::new() - } - - fn clear(&mut self) { - self.signature = ::std::option::Option::None; - self.sig_op_contents = ::std::option::Option::None; - self.operation_hash = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static TezosSignedTx { - static instance: TezosSignedTx = TezosSignedTx { - signature: ::std::option::Option::None, - sig_op_contents: ::std::option::Option::None, - operation_hash: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for TezosSignedTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("TezosSignedTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for TezosSignedTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TezosSignedTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x14messages-tezos.proto\x12\x18hw.trezor.messages.tezos\"m\n\x0fTezos\ - GetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ - \x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunk\ - ify\x18\x03\x20\x01(\x08R\x08chunkify\"(\n\x0cTezosAddress\x12\x18\n\x07\ - address\x18\x01\x20\x02(\tR\x07address\"o\n\x11TezosGetPublicKey\x12\x1b\ - \n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cshow_display\x18\ - \x02\x20\x01(\x08R\x0bshowDisplay\x12\x1a\n\x08chunkify\x18\x03\x20\x01(\ - \x08R\x08chunkify\"/\n\x0eTezosPublicKey\x12\x1d\n\npublic_key\x18\x01\ - \x20\x02(\tR\tpublicKey\"\xc0\x14\n\x0bTezosSignTx\x12\x1b\n\taddress_n\ - \x18\x01\x20\x03(\rR\x08addressN\x12\x16\n\x06branch\x18\x02\x20\x02(\ - \x0cR\x06branch\x12K\n\x06reveal\x18\x03\x20\x01(\x0b23.hw.trezor.messag\ - es.tezos.TezosSignTx.TezosRevealOpR\x06reveal\x12Z\n\x0btransaction\x18\ - \x04\x20\x01(\x0b28.hw.trezor.messages.tezos.TezosSignTx.TezosTransactio\ - nOpR\x0btransaction\x12Z\n\x0borigination\x18\x05\x20\x01(\x0b28.hw.trez\ - or.messages.tezos.TezosSignTx.TezosOriginationOpR\x0borigination\x12W\n\ - \ndelegation\x18\x06\x20\x01(\x0b27.hw.trezor.messages.tezos.TezosSignTx\ - .TezosDelegationOpR\ndelegation\x12Q\n\x08proposal\x18\x07\x20\x01(\x0b2\ - 5.hw.trezor.messages.tezos.TezosSignTx.TezosProposalOpR\x08proposal\x12K\ - \n\x06ballot\x18\x08\x20\x01(\x0b23.hw.trezor.messages.tezos.TezosSignTx\ - .TezosBallotOpR\x06ballot\x12\x1a\n\x08chunkify\x18\t\x20\x01(\x08R\x08c\ - hunkify\x1a\xb3\x01\n\x0fTezosContractID\x12Y\n\x03tag\x18\x01\x20\x02(\ - \x0e2G.hw.trezor.messages.tezos.TezosSignTx.TezosContractID.TezosContrac\ - tTypeR\x03tag\x12\x12\n\x04hash\x18\x02\x20\x02(\x0cR\x04hash\"1\n\x11Te\ - zosContractType\x12\x0c\n\x08Implicit\x10\0\x12\x0e\n\nOriginated\x10\ - \x01\x1a\xb4\x01\n\rTezosRevealOp\x12\x16\n\x06source\x18\x07\x20\x02(\ - \x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\x18\n\ - \x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\x18\ - \x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02(\ - \x04R\x0cstorageLimit\x12\x1d\n\npublic_key\x18\x06\x20\x02(\x0cR\tpubli\ - cKey\x1a\x9f\x06\n\x12TezosTransactionOp\x12\x16\n\x06source\x18\t\x20\ - \x02(\x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\ - \x18\n\x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\ - \x18\x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02\ - (\x04R\x0cstorageLimit\x12\x16\n\x06amount\x18\x06\x20\x02(\x04R\x06amou\ - nt\x12W\n\x0bdestination\x18\x07\x20\x02(\x0b25.hw.trezor.messages.tezos\ - .TezosSignTx.TezosContractIDR\x0bdestination\x12\x1e\n\nparameters\x18\ - \x08\x20\x01(\x0cR\nparameters\x12~\n\x12parameters_manager\x18\n\x20\ - \x01(\x0b2O.hw.trezor.messages.tezos.TezosSignTx.TezosTransactionOp.Tezo\ - sParametersManagerR\x11parametersManager\x1a\xf1\x02\n\x16TezosParameter\ - sManager\x12!\n\x0cset_delegate\x18\x01\x20\x01(\x0cR\x0bsetDelegate\x12\ - '\n\x0fcancel_delegate\x18\x02\x20\x01(\x08R\x0ecancelDelegate\x12\x80\ - \x01\n\x08transfer\x18\x03\x20\x01(\x0b2d.hw.trezor.messages.tezos.Tezos\ - SignTx.TezosTransactionOp.TezosParametersManager.TezosManagerTransferR\ - \x08transfer\x1a\x87\x01\n\x14TezosManagerTransfer\x12W\n\x0bdestination\ - \x18\x01\x20\x02(\x0b25.hw.trezor.messages.tezos.TezosSignTx.TezosContra\ - ctIDR\x0bdestination\x12\x16\n\x06amount\x18\x02\x20\x02(\x04R\x06amount\ - \x1a\xcf\x02\n\x12TezosOriginationOp\x12\x16\n\x06source\x18\x0c\x20\x02\ - (\x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\x18\n\ - \x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\x18\ - \x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02(\ - \x04R\x0cstorageLimit\x12%\n\x0emanager_pubkey\x18\x06\x20\x01(\x0cR\rma\ - nagerPubkey\x12\x18\n\x07balance\x18\x07\x20\x02(\x04R\x07balance\x12\ - \x1c\n\tspendable\x18\x08\x20\x01(\x08R\tspendable\x12\x20\n\x0bdelegata\ - ble\x18\t\x20\x01(\x08R\x0bdelegatable\x12\x1a\n\x08delegate\x18\n\x20\ - \x01(\x0cR\x08delegate\x12\x16\n\x06script\x18\x0b\x20\x02(\x0cR\x06scri\ - pt\x1a\xb5\x01\n\x11TezosDelegationOp\x12\x16\n\x06source\x18\x07\x20\ - \x02(\x0cR\x06source\x12\x10\n\x03fee\x18\x02\x20\x02(\x04R\x03fee\x12\ - \x18\n\x07counter\x18\x03\x20\x02(\x04R\x07counter\x12\x1b\n\tgas_limit\ - \x18\x04\x20\x02(\x04R\x08gasLimit\x12#\n\rstorage_limit\x18\x05\x20\x02\ - (\x04R\x0cstorageLimit\x12\x1a\n\x08delegate\x18\x06\x20\x02(\x0cR\x08de\ - legate\x1a_\n\x0fTezosProposalOp\x12\x16\n\x06source\x18\x01\x20\x02(\ - \x0cR\x06source\x12\x16\n\x06period\x18\x02\x20\x02(\x04R\x06period\x12\ - \x1c\n\tproposals\x18\x04\x20\x03(\x0cR\tproposals\x1a\xe7\x01\n\rTezosB\ - allotOp\x12\x16\n\x06source\x18\x01\x20\x02(\x0cR\x06source\x12\x16\n\ - \x06period\x18\x02\x20\x02(\x04R\x06period\x12\x1a\n\x08proposal\x18\x03\ - \x20\x02(\x0cR\x08proposal\x12[\n\x06ballot\x18\x04\x20\x02(\x0e2C.hw.tr\ - ezor.messages.tezos.TezosSignTx.TezosBallotOp.TezosBallotTypeR\x06ballot\ - \"-\n\x0fTezosBallotType\x12\x07\n\x03Yay\x10\0\x12\x07\n\x03Nay\x10\x01\ - \x12\x08\n\x04Pass\x10\x02\"|\n\rTezosSignedTx\x12\x1c\n\tsignature\x18\ - \x01\x20\x02(\tR\tsignature\x12&\n\x0fsig_op_contents\x18\x02\x20\x02(\ - \x0cR\rsigOpContents\x12%\n\x0eoperation_hash\x18\x03\x20\x02(\tR\ropera\ - tionHashB9\n#com.satoshilabs.trezor.lib.protobufB\x12TrezorMessageTezos\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(15); - messages.push(TezosGetAddress::generated_message_descriptor_data()); - messages.push(TezosAddress::generated_message_descriptor_data()); - messages.push(TezosGetPublicKey::generated_message_descriptor_data()); - messages.push(TezosPublicKey::generated_message_descriptor_data()); - messages.push(TezosSignTx::generated_message_descriptor_data()); - messages.push(TezosSignedTx::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::TezosContractID::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::TezosRevealOp::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::TezosTransactionOp::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::TezosOriginationOp::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::TezosDelegationOp::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::TezosProposalOp::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::TezosBallotOp::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::tezos_transaction_op::TezosParametersManager::generated_message_descriptor_data()); - messages.push(tezos_sign_tx::tezos_transaction_op::tezos_parameters_manager::TezosManagerTransfer::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(2); - enums.push(tezos_sign_tx::tezos_contract_id::TezosContractType::generated_enum_descriptor_data()); - enums.push(tezos_sign_tx::tezos_ballot_op::TezosBallotType::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/generated/messages_webauthn.rs b/wallet/trezor-client/src/protos/generated/messages_webauthn.rs deleted file mode 100644 index 6276d730db..0000000000 --- a/wallet/trezor-client/src/protos/generated/messages_webauthn.rs +++ /dev/null @@ -1,1257 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc 3.12.4 -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `messages-webauthn.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnListResidentCredentials) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct WebAuthnListResidentCredentials { - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnListResidentCredentials.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a WebAuthnListResidentCredentials { - fn default() -> &'a WebAuthnListResidentCredentials { - ::default_instance() - } -} - -impl WebAuthnListResidentCredentials { - pub fn new() -> WebAuthnListResidentCredentials { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WebAuthnListResidentCredentials", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for WebAuthnListResidentCredentials { - const NAME: &'static str = "WebAuthnListResidentCredentials"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WebAuthnListResidentCredentials { - WebAuthnListResidentCredentials::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static WebAuthnListResidentCredentials { - static instance: WebAuthnListResidentCredentials = WebAuthnListResidentCredentials { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for WebAuthnListResidentCredentials { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnListResidentCredentials").unwrap()).clone() - } -} - -impl ::std::fmt::Display for WebAuthnListResidentCredentials { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WebAuthnListResidentCredentials { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnAddResidentCredential) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct WebAuthnAddResidentCredential { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnAddResidentCredential.credential_id) - pub credential_id: ::std::option::Option<::std::vec::Vec>, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnAddResidentCredential.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a WebAuthnAddResidentCredential { - fn default() -> &'a WebAuthnAddResidentCredential { - ::default_instance() - } -} - -impl WebAuthnAddResidentCredential { - pub fn new() -> WebAuthnAddResidentCredential { - ::std::default::Default::default() - } - - // optional bytes credential_id = 1; - - pub fn credential_id(&self) -> &[u8] { - match self.credential_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_credential_id(&mut self) { - self.credential_id = ::std::option::Option::None; - } - - pub fn has_credential_id(&self) -> bool { - self.credential_id.is_some() - } - - // Param is passed by value, moved - pub fn set_credential_id(&mut self, v: ::std::vec::Vec) { - self.credential_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_credential_id(&mut self) -> &mut ::std::vec::Vec { - if self.credential_id.is_none() { - self.credential_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.credential_id.as_mut().unwrap() - } - - // Take field - pub fn take_credential_id(&mut self) -> ::std::vec::Vec { - self.credential_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "credential_id", - |m: &WebAuthnAddResidentCredential| { &m.credential_id }, - |m: &mut WebAuthnAddResidentCredential| { &mut m.credential_id }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WebAuthnAddResidentCredential", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for WebAuthnAddResidentCredential { - const NAME: &'static str = "WebAuthnAddResidentCredential"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.credential_id = ::std::option::Option::Some(is.read_bytes()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.credential_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.credential_id.as_ref() { - os.write_bytes(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WebAuthnAddResidentCredential { - WebAuthnAddResidentCredential::new() - } - - fn clear(&mut self) { - self.credential_id = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static WebAuthnAddResidentCredential { - static instance: WebAuthnAddResidentCredential = WebAuthnAddResidentCredential { - credential_id: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for WebAuthnAddResidentCredential { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnAddResidentCredential").unwrap()).clone() - } -} - -impl ::std::fmt::Display for WebAuthnAddResidentCredential { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WebAuthnAddResidentCredential { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnRemoveResidentCredential) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct WebAuthnRemoveResidentCredential { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnRemoveResidentCredential.index) - pub index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnRemoveResidentCredential.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a WebAuthnRemoveResidentCredential { - fn default() -> &'a WebAuthnRemoveResidentCredential { - ::default_instance() - } -} - -impl WebAuthnRemoveResidentCredential { - pub fn new() -> WebAuthnRemoveResidentCredential { - ::std::default::Default::default() - } - - // optional uint32 index = 1; - - pub fn index(&self) -> u32 { - self.index.unwrap_or(0) - } - - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u32) { - self.index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "index", - |m: &WebAuthnRemoveResidentCredential| { &m.index }, - |m: &mut WebAuthnRemoveResidentCredential| { &mut m.index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WebAuthnRemoveResidentCredential", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for WebAuthnRemoveResidentCredential { - const NAME: &'static str = "WebAuthnRemoveResidentCredential"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.index { - my_size += ::protobuf::rt::uint32_size(1, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.index { - os.write_uint32(1, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WebAuthnRemoveResidentCredential { - WebAuthnRemoveResidentCredential::new() - } - - fn clear(&mut self) { - self.index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static WebAuthnRemoveResidentCredential { - static instance: WebAuthnRemoveResidentCredential = WebAuthnRemoveResidentCredential { - index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for WebAuthnRemoveResidentCredential { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnRemoveResidentCredential").unwrap()).clone() - } -} - -impl ::std::fmt::Display for WebAuthnRemoveResidentCredential { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WebAuthnRemoveResidentCredential { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnCredentials) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct WebAuthnCredentials { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.credentials) - pub credentials: ::std::vec::Vec, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnCredentials.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a WebAuthnCredentials { - fn default() -> &'a WebAuthnCredentials { - ::default_instance() - } -} - -impl WebAuthnCredentials { - pub fn new() -> WebAuthnCredentials { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "credentials", - |m: &WebAuthnCredentials| { &m.credentials }, - |m: &mut WebAuthnCredentials| { &mut m.credentials }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WebAuthnCredentials", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for WebAuthnCredentials { - const NAME: &'static str = "WebAuthnCredentials"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - self.credentials.push(is.read_message()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - for value in &self.credentials { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - for v in &self.credentials { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WebAuthnCredentials { - WebAuthnCredentials::new() - } - - fn clear(&mut self) { - self.credentials.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static WebAuthnCredentials { - static instance: WebAuthnCredentials = WebAuthnCredentials { - credentials: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for WebAuthnCredentials { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("WebAuthnCredentials").unwrap()).clone() - } -} - -impl ::std::fmt::Display for WebAuthnCredentials { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WebAuthnCredentials { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -/// Nested message and enums of message `WebAuthnCredentials` -pub mod web_authn_credentials { - // @@protoc_insertion_point(message:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct WebAuthnCredential { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.index) - pub index: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.id) - pub id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.rp_id) - pub rp_id: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.rp_name) - pub rp_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.user_id) - pub user_id: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.user_name) - pub user_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.user_display_name) - pub user_display_name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.creation_time) - pub creation_time: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.hmac_secret) - pub hmac_secret: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.use_sign_count) - pub use_sign_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.algorithm) - pub algorithm: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.curve) - pub curve: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.webauthn.WebAuthnCredentials.WebAuthnCredential.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a WebAuthnCredential { - fn default() -> &'a WebAuthnCredential { - ::default_instance() - } - } - - impl WebAuthnCredential { - pub fn new() -> WebAuthnCredential { - ::std::default::Default::default() - } - - // optional uint32 index = 1; - - pub fn index(&self) -> u32 { - self.index.unwrap_or(0) - } - - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u32) { - self.index = ::std::option::Option::Some(v); - } - - // optional bytes id = 2; - - pub fn id(&self) -> &[u8] { - match self.id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_id(&mut self) { - self.id = ::std::option::Option::None; - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::vec::Vec) { - self.id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::vec::Vec { - if self.id.is_none() { - self.id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.id.as_mut().unwrap() - } - - // Take field - pub fn take_id(&mut self) -> ::std::vec::Vec { - self.id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string rp_id = 3; - - pub fn rp_id(&self) -> &str { - match self.rp_id.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_rp_id(&mut self) { - self.rp_id = ::std::option::Option::None; - } - - pub fn has_rp_id(&self) -> bool { - self.rp_id.is_some() - } - - // Param is passed by value, moved - pub fn set_rp_id(&mut self, v: ::std::string::String) { - self.rp_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_rp_id(&mut self) -> &mut ::std::string::String { - if self.rp_id.is_none() { - self.rp_id = ::std::option::Option::Some(::std::string::String::new()); - } - self.rp_id.as_mut().unwrap() - } - - // Take field - pub fn take_rp_id(&mut self) -> ::std::string::String { - self.rp_id.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string rp_name = 4; - - pub fn rp_name(&self) -> &str { - match self.rp_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_rp_name(&mut self) { - self.rp_name = ::std::option::Option::None; - } - - pub fn has_rp_name(&self) -> bool { - self.rp_name.is_some() - } - - // Param is passed by value, moved - pub fn set_rp_name(&mut self, v: ::std::string::String) { - self.rp_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_rp_name(&mut self) -> &mut ::std::string::String { - if self.rp_name.is_none() { - self.rp_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.rp_name.as_mut().unwrap() - } - - // Take field - pub fn take_rp_name(&mut self) -> ::std::string::String { - self.rp_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional bytes user_id = 5; - - pub fn user_id(&self) -> &[u8] { - match self.user_id.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_user_id(&mut self) { - self.user_id = ::std::option::Option::None; - } - - pub fn has_user_id(&self) -> bool { - self.user_id.is_some() - } - - // Param is passed by value, moved - pub fn set_user_id(&mut self, v: ::std::vec::Vec) { - self.user_id = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_user_id(&mut self) -> &mut ::std::vec::Vec { - if self.user_id.is_none() { - self.user_id = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.user_id.as_mut().unwrap() - } - - // Take field - pub fn take_user_id(&mut self) -> ::std::vec::Vec { - self.user_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional string user_name = 6; - - pub fn user_name(&self) -> &str { - match self.user_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_user_name(&mut self) { - self.user_name = ::std::option::Option::None; - } - - pub fn has_user_name(&self) -> bool { - self.user_name.is_some() - } - - // Param is passed by value, moved - pub fn set_user_name(&mut self, v: ::std::string::String) { - self.user_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_user_name(&mut self) -> &mut ::std::string::String { - if self.user_name.is_none() { - self.user_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.user_name.as_mut().unwrap() - } - - // Take field - pub fn take_user_name(&mut self) -> ::std::string::String { - self.user_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional string user_display_name = 7; - - pub fn user_display_name(&self) -> &str { - match self.user_display_name.as_ref() { - Some(v) => v, - None => "", - } - } - - pub fn clear_user_display_name(&mut self) { - self.user_display_name = ::std::option::Option::None; - } - - pub fn has_user_display_name(&self) -> bool { - self.user_display_name.is_some() - } - - // Param is passed by value, moved - pub fn set_user_display_name(&mut self, v: ::std::string::String) { - self.user_display_name = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_user_display_name(&mut self) -> &mut ::std::string::String { - if self.user_display_name.is_none() { - self.user_display_name = ::std::option::Option::Some(::std::string::String::new()); - } - self.user_display_name.as_mut().unwrap() - } - - // Take field - pub fn take_user_display_name(&mut self) -> ::std::string::String { - self.user_display_name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - // optional uint32 creation_time = 8; - - pub fn creation_time(&self) -> u32 { - self.creation_time.unwrap_or(0) - } - - pub fn clear_creation_time(&mut self) { - self.creation_time = ::std::option::Option::None; - } - - pub fn has_creation_time(&self) -> bool { - self.creation_time.is_some() - } - - // Param is passed by value, moved - pub fn set_creation_time(&mut self, v: u32) { - self.creation_time = ::std::option::Option::Some(v); - } - - // optional bool hmac_secret = 9; - - pub fn hmac_secret(&self) -> bool { - self.hmac_secret.unwrap_or(false) - } - - pub fn clear_hmac_secret(&mut self) { - self.hmac_secret = ::std::option::Option::None; - } - - pub fn has_hmac_secret(&self) -> bool { - self.hmac_secret.is_some() - } - - // Param is passed by value, moved - pub fn set_hmac_secret(&mut self, v: bool) { - self.hmac_secret = ::std::option::Option::Some(v); - } - - // optional bool use_sign_count = 10; - - pub fn use_sign_count(&self) -> bool { - self.use_sign_count.unwrap_or(false) - } - - pub fn clear_use_sign_count(&mut self) { - self.use_sign_count = ::std::option::Option::None; - } - - pub fn has_use_sign_count(&self) -> bool { - self.use_sign_count.is_some() - } - - // Param is passed by value, moved - pub fn set_use_sign_count(&mut self, v: bool) { - self.use_sign_count = ::std::option::Option::Some(v); - } - - // optional sint32 algorithm = 11; - - pub fn algorithm(&self) -> i32 { - self.algorithm.unwrap_or(0) - } - - pub fn clear_algorithm(&mut self) { - self.algorithm = ::std::option::Option::None; - } - - pub fn has_algorithm(&self) -> bool { - self.algorithm.is_some() - } - - // Param is passed by value, moved - pub fn set_algorithm(&mut self, v: i32) { - self.algorithm = ::std::option::Option::Some(v); - } - - // optional sint32 curve = 12; - - pub fn curve(&self) -> i32 { - self.curve.unwrap_or(0) - } - - pub fn clear_curve(&mut self) { - self.curve = ::std::option::Option::None; - } - - pub fn has_curve(&self) -> bool { - self.curve.is_some() - } - - // Param is passed by value, moved - pub fn set_curve(&mut self, v: i32) { - self.curve = ::std::option::Option::Some(v); - } - - pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(12); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "index", - |m: &WebAuthnCredential| { &m.index }, - |m: &mut WebAuthnCredential| { &mut m.index }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "id", - |m: &WebAuthnCredential| { &m.id }, - |m: &mut WebAuthnCredential| { &mut m.id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "rp_id", - |m: &WebAuthnCredential| { &m.rp_id }, - |m: &mut WebAuthnCredential| { &mut m.rp_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "rp_name", - |m: &WebAuthnCredential| { &m.rp_name }, - |m: &mut WebAuthnCredential| { &mut m.rp_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "user_id", - |m: &WebAuthnCredential| { &m.user_id }, - |m: &mut WebAuthnCredential| { &mut m.user_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "user_name", - |m: &WebAuthnCredential| { &m.user_name }, - |m: &mut WebAuthnCredential| { &mut m.user_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "user_display_name", - |m: &WebAuthnCredential| { &m.user_display_name }, - |m: &mut WebAuthnCredential| { &mut m.user_display_name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "creation_time", - |m: &WebAuthnCredential| { &m.creation_time }, - |m: &mut WebAuthnCredential| { &mut m.creation_time }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "hmac_secret", - |m: &WebAuthnCredential| { &m.hmac_secret }, - |m: &mut WebAuthnCredential| { &mut m.hmac_secret }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "use_sign_count", - |m: &WebAuthnCredential| { &m.use_sign_count }, - |m: &mut WebAuthnCredential| { &mut m.use_sign_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "algorithm", - |m: &WebAuthnCredential| { &m.algorithm }, - |m: &mut WebAuthnCredential| { &mut m.algorithm }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "curve", - |m: &WebAuthnCredential| { &m.curve }, - |m: &mut WebAuthnCredential| { &mut m.curve }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "WebAuthnCredentials.WebAuthnCredential", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for WebAuthnCredential { - const NAME: &'static str = "WebAuthnCredential"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.index = ::std::option::Option::Some(is.read_uint32()?); - }, - 18 => { - self.id = ::std::option::Option::Some(is.read_bytes()?); - }, - 26 => { - self.rp_id = ::std::option::Option::Some(is.read_string()?); - }, - 34 => { - self.rp_name = ::std::option::Option::Some(is.read_string()?); - }, - 42 => { - self.user_id = ::std::option::Option::Some(is.read_bytes()?); - }, - 50 => { - self.user_name = ::std::option::Option::Some(is.read_string()?); - }, - 58 => { - self.user_display_name = ::std::option::Option::Some(is.read_string()?); - }, - 64 => { - self.creation_time = ::std::option::Option::Some(is.read_uint32()?); - }, - 72 => { - self.hmac_secret = ::std::option::Option::Some(is.read_bool()?); - }, - 80 => { - self.use_sign_count = ::std::option::Option::Some(is.read_bool()?); - }, - 88 => { - self.algorithm = ::std::option::Option::Some(is.read_sint32()?); - }, - 96 => { - self.curve = ::std::option::Option::Some(is.read_sint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.index { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.id.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.rp_id.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(v) = self.rp_name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &v); - } - if let Some(v) = self.user_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(5, &v); - } - if let Some(v) = self.user_name.as_ref() { - my_size += ::protobuf::rt::string_size(6, &v); - } - if let Some(v) = self.user_display_name.as_ref() { - my_size += ::protobuf::rt::string_size(7, &v); - } - if let Some(v) = self.creation_time { - my_size += ::protobuf::rt::uint32_size(8, v); - } - if let Some(v) = self.hmac_secret { - my_size += 1 + 1; - } - if let Some(v) = self.use_sign_count { - my_size += 1 + 1; - } - if let Some(v) = self.algorithm { - my_size += ::protobuf::rt::sint32_size(11, v); - } - if let Some(v) = self.curve { - my_size += ::protobuf::rt::sint32_size(12, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.index { - os.write_uint32(1, v)?; - } - if let Some(v) = self.id.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.rp_id.as_ref() { - os.write_string(3, v)?; - } - if let Some(v) = self.rp_name.as_ref() { - os.write_string(4, v)?; - } - if let Some(v) = self.user_id.as_ref() { - os.write_bytes(5, v)?; - } - if let Some(v) = self.user_name.as_ref() { - os.write_string(6, v)?; - } - if let Some(v) = self.user_display_name.as_ref() { - os.write_string(7, v)?; - } - if let Some(v) = self.creation_time { - os.write_uint32(8, v)?; - } - if let Some(v) = self.hmac_secret { - os.write_bool(9, v)?; - } - if let Some(v) = self.use_sign_count { - os.write_bool(10, v)?; - } - if let Some(v) = self.algorithm { - os.write_sint32(11, v)?; - } - if let Some(v) = self.curve { - os.write_sint32(12, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> WebAuthnCredential { - WebAuthnCredential::new() - } - - fn clear(&mut self) { - self.index = ::std::option::Option::None; - self.id = ::std::option::Option::None; - self.rp_id = ::std::option::Option::None; - self.rp_name = ::std::option::Option::None; - self.user_id = ::std::option::Option::None; - self.user_name = ::std::option::Option::None; - self.user_display_name = ::std::option::Option::None; - self.creation_time = ::std::option::Option::None; - self.hmac_secret = ::std::option::Option::None; - self.use_sign_count = ::std::option::Option::None; - self.algorithm = ::std::option::Option::None; - self.curve = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static WebAuthnCredential { - static instance: WebAuthnCredential = WebAuthnCredential { - index: ::std::option::Option::None, - id: ::std::option::Option::None, - rp_id: ::std::option::Option::None, - rp_name: ::std::option::Option::None, - user_id: ::std::option::Option::None, - user_name: ::std::option::Option::None, - user_display_name: ::std::option::Option::None, - creation_time: ::std::option::Option::None, - hmac_secret: ::std::option::Option::None, - use_sign_count: ::std::option::Option::None, - algorithm: ::std::option::Option::None, - curve: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for WebAuthnCredential { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("WebAuthnCredentials.WebAuthnCredential").unwrap()).clone() - } - } - - impl ::std::fmt::Display for WebAuthnCredential { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for WebAuthnCredential { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x17messages-webauthn.proto\x12\x1bhw.trezor.messages.webauthn\"!\n\ - \x1fWebAuthnListResidentCredentials\"D\n\x1dWebAuthnAddResidentCredentia\ - l\x12#\n\rcredential_id\x18\x01\x20\x01(\x0cR\x0ccredentialId\"8\n\x20We\ - bAuthnRemoveResidentCredential\x12\x14\n\x05index\x18\x01\x20\x01(\rR\ - \x05index\"\xe9\x03\n\x13WebAuthnCredentials\x12e\n\x0bcredentials\x18\ - \x01\x20\x03(\x0b2C.hw.trezor.messages.webauthn.WebAuthnCredentials.WebA\ - uthnCredentialR\x0bcredentials\x1a\xea\x02\n\x12WebAuthnCredential\x12\ - \x14\n\x05index\x18\x01\x20\x01(\rR\x05index\x12\x0e\n\x02id\x18\x02\x20\ - \x01(\x0cR\x02id\x12\x13\n\x05rp_id\x18\x03\x20\x01(\tR\x04rpId\x12\x17\ - \n\x07rp_name\x18\x04\x20\x01(\tR\x06rpName\x12\x17\n\x07user_id\x18\x05\ - \x20\x01(\x0cR\x06userId\x12\x1b\n\tuser_name\x18\x06\x20\x01(\tR\x08use\ - rName\x12*\n\x11user_display_name\x18\x07\x20\x01(\tR\x0fuserDisplayName\ - \x12#\n\rcreation_time\x18\x08\x20\x01(\rR\x0ccreationTime\x12\x1f\n\x0b\ - hmac_secret\x18\t\x20\x01(\x08R\nhmacSecret\x12$\n\x0euse_sign_count\x18\ - \n\x20\x01(\x08R\x0cuseSignCount\x12\x1c\n\talgorithm\x18\x0b\x20\x01(\ - \x11R\talgorithm\x12\x14\n\x05curve\x18\x0c\x20\x01(\x11R\x05curveB<\n#c\ - om.satoshilabs.trezor.lib.protobufB\x15TrezorMessageWebAuthn\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(5); - messages.push(WebAuthnListResidentCredentials::generated_message_descriptor_data()); - messages.push(WebAuthnAddResidentCredential::generated_message_descriptor_data()); - messages.push(WebAuthnRemoveResidentCredential::generated_message_descriptor_data()); - messages.push(WebAuthnCredentials::generated_message_descriptor_data()); - messages.push(web_authn_credentials::WebAuthnCredential::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/wallet/trezor-client/src/protos/mod.rs b/wallet/trezor-client/src/protos/mod.rs deleted file mode 100644 index 316fe5b927..0000000000 --- a/wallet/trezor-client/src/protos/mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -//! Bindings for Trezor protobufs. - -// Note: we do not use the generated `mod.rs` because we want to feature-gate some modules manually. -// This significantly improves compile times. -// See https://github.com/joshieDo/rust-trezor-api/pull/9 for more details. -#[allow(ambiguous_glob_reexports, unreachable_pub)] -mod generated { - macro_rules! modules { - ($($($feature:literal =>)? $module:ident)+) => {$( - $(#[cfg(feature = $feature)])? - mod $module; - $(#[cfg(feature = $feature)])? - pub use self::$module::*; - )+}; - } - - modules! { - messages - messages_bootloader - messages_common - messages_crypto - messages_debug - messages_management - - "bitcoin" => messages_bitcoin - "ethereum" => messages_ethereum - "ethereum" => messages_ethereum_eip712 - "ethereum" => messages_ethereum_definitions - "binance" => messages_binance - "cardano" => messages_cardano - "eos" => messages_eos - "monero" => messages_monero - "nem" => messages_nem - "ripple" => messages_ripple - "solana" => messages_solana - "stellar" => messages_stellar - "tezos" => messages_tezos - "webauthn" => messages_webauthn - "mintlayer" => messages_mintlayer - } -} - -pub use generated::*; diff --git a/wallet/trezor-client/src/transport/error.rs b/wallet/trezor-client/src/transport/error.rs deleted file mode 100644 index 282ae16f65..0000000000 --- a/wallet/trezor-client/src/transport/error.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! # Error Handling - -/// Trezor error. -#[derive(Debug, thiserror::Error)] -pub enum Error { - /// [rusb] error. - #[error(transparent)] - Usb(#[from] rusb::Error), - - /// [std::io] error. - #[error(transparent)] - IO(#[from] std::io::Error), - - /// The device to connect to was not found. - #[error("the device to connect to was not found")] - DeviceNotFound, - - /// The device is no longer available. - #[error("the device is no longer available")] - DeviceDisconnected, - - /// The device produced a data chunk of unexpected size. - #[error("the device produced a data chunk of unexpected size")] - UnexpectedChunkSizeFromDevice(usize), - - /// Timeout expired while reading from device. - #[error("timeout expired while reading from device")] - DeviceReadTimeout, - - /// The device sent a chunk with a wrong magic value. - #[error("the device sent a chunk with a wrong magic value")] - DeviceBadMagic, - - /// The device sent a message with a wrong session id. - #[error("the device sent a message with a wrong session id")] - DeviceBadSessionId, - - /// The device sent an unexpected sequence number. - #[error("the device sent an unexpected sequence number")] - DeviceUnexpectedSequenceNumber, - - /// Received a non-existing message type from the device. - #[error("received a non-existing message type from the device")] - InvalidMessageType(u32), - - /// Unable to determine device serial number. - #[error("unable to determine device serial number")] - NoDeviceSerial, -} diff --git a/wallet/trezor-client/src/transport/mod.rs b/wallet/trezor-client/src/transport/mod.rs deleted file mode 100644 index ee08c9e76c..0000000000 --- a/wallet/trezor-client/src/transport/mod.rs +++ /dev/null @@ -1,85 +0,0 @@ -use super::{AvailableDevice, Model}; -use crate::protos::MessageType; -use std::fmt; - -pub mod error; -pub mod protocol; -pub mod udp; -pub mod webusb; - -/// An available transport for a Trezor device, containing any of the different supported -/// transports. -#[derive(Debug)] -pub enum AvailableDeviceTransport { - WebUsb(webusb::AvailableWebUsbTransport), - Udp(udp::AvailableUdpTransport), -} - -impl fmt::Display for AvailableDeviceTransport { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - AvailableDeviceTransport::WebUsb(ref t) => write!(f, "{}", t), - AvailableDeviceTransport::Udp(ref t) => write!(f, "{}", t), - } - } -} - -/// A protobuf message accompanied by the message type. This type is used to pass messages over the -/// transport and used to contain messages received from the transport. -pub struct ProtoMessage(pub MessageType, pub Vec); - -impl ProtoMessage { - pub fn new(mt: MessageType, payload: Vec) -> ProtoMessage { - ProtoMessage(mt, payload) - } - pub fn message_type(&self) -> MessageType { - self.0 - } - pub fn payload(&self) -> &[u8] { - &self.1 - } - pub fn into_payload(self) -> Vec { - self.1 - } - - /// Take the payload from the ProtoMessage and parse it to a protobuf message. - pub fn into_message(self) -> Result { - protobuf::Message::parse_from_bytes(&self.into_payload()) - } -} - -/// The transport interface that is implemented by the different ways to communicate with a Trezor -/// device. -pub trait Transport: Sync + Send { - fn session_begin(&mut self) -> Result<(), error::Error>; - fn session_end(&mut self) -> Result<(), error::Error>; - - fn write_message(&mut self, message: ProtoMessage) -> Result<(), error::Error>; - fn read_message(&mut self) -> Result; -} - -/// A delegation method to connect an available device transport. It delegates to the different -/// transport types. -pub fn connect(available_device: &AvailableDevice) -> Result, error::Error> { - match available_device.transport { - AvailableDeviceTransport::WebUsb(_) => webusb::WebUsbTransport::connect(available_device), - AvailableDeviceTransport::Udp(_) => udp::UdpTransport::connect(available_device), - } -} - -// A collection of transport-global constants. -mod constants { - pub(crate) const DEV_TREZOR_LEGACY: (u16, u16) = (0x534C, 0x0001); - pub(crate) const DEV_TREZOR: (u16, u16) = (0x1209, 0x53C1); - pub(crate) const DEV_TREZOR_BOOTLOADER: (u16, u16) = (0x1209, 0x53C0); -} - -/// Derive the Trezor model from the USB device. -pub(crate) fn derive_model(dev_id: (u16, u16)) -> Option { - match dev_id { - constants::DEV_TREZOR_LEGACY => Some(Model::TrezorLegacy), - constants::DEV_TREZOR => Some(Model::Trezor), - constants::DEV_TREZOR_BOOTLOADER => Some(Model::TrezorBootloader), - _ => None, - } -} diff --git a/wallet/trezor-client/src/transport/protocol.rs b/wallet/trezor-client/src/transport/protocol.rs deleted file mode 100644 index ab2c6d886a..0000000000 --- a/wallet/trezor-client/src/transport/protocol.rs +++ /dev/null @@ -1,208 +0,0 @@ -use crate::{ - protos::MessageType, - transport::{error::Error, ProtoMessage}, -}; -use byteorder::{BigEndian, ByteOrder}; -use protobuf::Enum; -use std::cmp; - -/// A link represents a serial connection to send and receive byte chunks from and to a device. -pub trait Link { - fn write_chunk(&mut self, chunk: Vec) -> Result<(), Error>; - fn read_chunk(&mut self) -> Result, Error>; -} - -/// A protocol is used to encode messages in chunks that can be sent to the device and to parse -/// chunks into messages. -pub trait Protocol { - fn session_begin(&mut self) -> Result<(), Error>; - fn session_end(&mut self) -> Result<(), Error>; - fn write(&mut self, message: ProtoMessage) -> Result<(), Error>; - fn read(&mut self) -> Result; -} - -/// The length of the chunks sent. -const REPLEN: usize = 64; - -/// V2 of the binary protocol. -/// This version is currently not in use by any device and is subject to change. -#[allow(dead_code)] -pub struct ProtocolV2 { - pub link: L, - pub session_id: u32, -} - -impl Protocol for ProtocolV2 { - fn session_begin(&mut self) -> Result<(), Error> { - let mut chunk = vec![0; REPLEN]; - chunk[0] = 0x03; - self.link.write_chunk(chunk)?; - let resp = self.link.read_chunk()?; - if resp[0] != 0x03 { - println!("bad magic in v2 session_begin: {:x} instead of 0x03", resp[0]); - return Err(Error::DeviceBadMagic); - } - self.session_id = BigEndian::read_u32(&resp[1..5]); - Ok(()) - } - - fn session_end(&mut self) -> Result<(), Error> { - assert!(self.session_id != 0); - let mut chunk = vec![0; REPLEN]; - chunk[0] = 0x04; - BigEndian::write_u32(&mut chunk[1..5], self.session_id); - self.link.write_chunk(chunk)?; - let resp = self.link.read_chunk()?; - if resp[0] != 0x04 { - println!("bad magic in v2 session_end: {:x} instead of 0x04", resp[0]); - return Err(Error::DeviceBadMagic); - } - self.session_id = 0; - Ok(()) - } - - fn write(&mut self, message: ProtoMessage) -> Result<(), Error> { - assert!(self.session_id != 0); - - // First generate the total payload, then write it to the transport in chunks. - let mut data = vec![0; 8]; - BigEndian::write_u32(&mut data[0..4], message.message_type() as u32); - BigEndian::write_u32(&mut data[4..8], message.payload().len() as u32); - data.extend(message.into_payload()); - - let mut cur: usize = 0; - let mut seq: isize = -1; - while cur < data.len() { - // Build header. - let mut chunk = if seq < 0 { - let mut header = vec![0; 5]; - header[0] = 0x01; - BigEndian::write_u32(&mut header[1..5], self.session_id); - header - } else { - let mut header = vec![0; 9]; - header[0] = 0x01; - BigEndian::write_u32(&mut header[1..5], self.session_id); - BigEndian::write_u32(&mut header[5..9], seq as u32); - header - }; - seq += 1; - - // Fill remainder. - let end = cmp::min(cur + (REPLEN - chunk.len()), data.len()); - chunk.extend(&data[cur..end]); - cur = end; - debug_assert!(chunk.len() <= REPLEN); - chunk.resize(REPLEN, 0); - - self.link.write_chunk(chunk)?; - } - - Ok(()) - } - - fn read(&mut self) -> Result { - debug_assert!(self.session_id != 0); - - let chunk = self.link.read_chunk()?; - if chunk[0] != 0x01 { - println!("bad magic in v2 read: {:x} instead of 0x01", chunk[0]); - return Err(Error::DeviceBadMagic); - } - if BigEndian::read_u32(&chunk[1..5]) != self.session_id { - return Err(Error::DeviceBadSessionId); - } - let message_type_id = BigEndian::read_u32(&chunk[5..9]); - let message_type = MessageType::from_i32(message_type_id as i32) - .ok_or(Error::InvalidMessageType(message_type_id))?; - let data_length = BigEndian::read_u32(&chunk[9..13]) as usize; - - let mut data: Vec = chunk[13..].into(); - let mut seq = 0; - while data.len() < data_length { - let chunk = self.link.read_chunk()?; - if chunk[0] != 0x02 { - println!("bad magic in v2 session_begin: {:x} instead of 0x02", chunk[0]); - return Err(Error::DeviceBadMagic); - } - if BigEndian::read_u32(&chunk[1..5]) != self.session_id { - return Err(Error::DeviceBadSessionId); - } - if BigEndian::read_u32(&chunk[5..9]) != seq as u32 { - return Err(Error::DeviceUnexpectedSequenceNumber); - } - seq += 1; - - data.extend(&chunk[9..]); - } - - Ok(ProtoMessage(message_type, data[0..data_length].into())) - } -} - -/// The original binary protocol. -pub struct ProtocolV1 { - pub link: L, -} - -impl Protocol for ProtocolV1 { - fn session_begin(&mut self) -> Result<(), Error> { - Ok(()) // no sessions - } - - fn session_end(&mut self) -> Result<(), Error> { - Ok(()) // no sessions - } - - fn write(&mut self, message: ProtoMessage) -> Result<(), Error> { - // First generate the total payload, then write it to the transport in chunks. - let mut data = vec![0; 8]; - data[0] = 0x23; - data[1] = 0x23; - BigEndian::write_u16(&mut data[2..4], message.message_type() as u16); - BigEndian::write_u32(&mut data[4..8], message.payload().len() as u32); - data.extend(message.into_payload()); - - let mut cur: usize = 0; - while cur < data.len() { - let mut chunk = vec![0x3f]; - let end = cmp::min(cur + (REPLEN - 1), data.len()); - chunk.extend(&data[cur..end]); - cur = end; - debug_assert!(chunk.len() <= REPLEN); - chunk.resize(REPLEN, 0); - - self.link.write_chunk(chunk)?; - } - - Ok(()) - } - - fn read(&mut self) -> Result { - let chunk = self.link.read_chunk()?; - if chunk[0] != 0x3f || chunk[1] != 0x23 || chunk[2] != 0x23 { - println!( - "bad magic in v1 read: {:x}{:x}{:x} instead of 0x3f2323", - chunk[0], chunk[1], chunk[2] - ); - return Err(Error::DeviceBadMagic); - } - let message_type_id = BigEndian::read_u16(&chunk[3..5]) as u32; - let message_type = MessageType::from_i32(message_type_id as i32) - .ok_or(Error::InvalidMessageType(message_type_id))?; - let data_length = BigEndian::read_u32(&chunk[5..9]) as usize; - let mut data: Vec = chunk[9..].into(); - - while data.len() < data_length { - let chunk = self.link.read_chunk()?; - if chunk[0] != 0x3f { - println!("bad magic in v1 read: {:x} instead of 0x3f", chunk[0]); - return Err(Error::DeviceBadMagic); - } - - data.extend(&chunk[1..]); - } - - Ok(ProtoMessage(message_type, data[0..data_length].into())) - } -} diff --git a/wallet/trezor-client/src/transport/udp.rs b/wallet/trezor-client/src/transport/udp.rs deleted file mode 100644 index 921a2c931d..0000000000 --- a/wallet/trezor-client/src/transport/udp.rs +++ /dev/null @@ -1,153 +0,0 @@ -use super::{ - error::Error, - protocol::{Link, Protocol, ProtocolV1}, - AvailableDeviceTransport, ProtoMessage, Transport, -}; -use crate::{AvailableDevice, Model}; -use std::{fmt, net::UdpSocket, result::Result, time::Duration}; - -// A collection of constants related to the Emulator Ports. -mod constants { - pub(crate) const DEFAULT_HOST: &str = "127.0.0.1"; - pub(crate) const DEFAULT_PORT: &str = "21324"; - pub(crate) const DEFAULT_DEBUG_PORT: &str = "21325"; - pub(crate) const LOCAL_LISTENER: &str = "127.0.0.1:0"; -} - -use constants::{DEFAULT_DEBUG_PORT, DEFAULT_HOST, DEFAULT_PORT, LOCAL_LISTENER}; - -/// The chunk size for the serial protocol. -const CHUNK_SIZE: usize = 64; - -const READ_TIMEOUT_MS: u64 = 100000; -const WRITE_TIMEOUT_MS: u64 = 100000; - -/// An available transport for connecting with a device. -#[derive(Debug)] -pub struct AvailableUdpTransport { - pub host: String, - pub port: String, -} - -impl fmt::Display for AvailableUdpTransport { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "udp:{}:{}", self.host, self.port) - } -} - -/// An actual serial HID USB link to a device over which bytes can be sent. -struct UdpLink { - socket: UdpSocket, - device: (String, String), -} -// No need to implement drop as every member is owned - -impl Link for UdpLink { - fn write_chunk(&mut self, chunk: Vec) -> Result<(), Error> { - debug_assert_eq!(CHUNK_SIZE, chunk.len()); - let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); - self.socket.set_write_timeout(Some(timeout))?; - if let Err(e) = self.socket.send(&chunk) { - return Err(e.into()); - } - Ok(()) - } - - fn read_chunk(&mut self) -> Result, Error> { - let mut chunk = vec![0; CHUNK_SIZE]; - let timeout = Duration::from_millis(READ_TIMEOUT_MS); - self.socket.set_read_timeout(Some(timeout))?; - - let n = self.socket.recv(&mut chunk)?; - if n == CHUNK_SIZE { - Ok(chunk) - } else { - Err(Error::DeviceReadTimeout) - } - } -} - -impl UdpLink { - fn open(path: &str) -> Result { - let mut parts = path.split(':'); - let link = Self { - socket: UdpSocket::bind(LOCAL_LISTENER)?, - device: ( - parts.next().expect("Incorrect Path").to_owned(), - parts.next().expect("Incorrect Path").to_owned(), - ), - }; - link.socket.connect(path)?; - Ok(link) - } - - // Ping the port and compare against expected response - fn ping(&self) -> Result { - let mut resp = [0; CHUNK_SIZE]; - self.socket.send("PINGPING".as_bytes())?; - let size = self.socket.recv(&mut resp)?; - Ok(&resp[..size] == "PONGPONG".as_bytes()) - } -} - -/// An implementation of the Transport interface for UDP devices. -pub struct UdpTransport { - protocol: ProtocolV1, -} - -impl UdpTransport { - pub fn find_devices(debug: bool, path: Option<&str>) -> Result, Error> { - let mut devices = Vec::new(); - let mut dest = String::new(); - match path { - Some(p) => dest = p.to_owned(), - None => { - dest.push_str(DEFAULT_HOST); - dest.push(':'); - dest.push_str(if debug { DEFAULT_DEBUG_PORT } else { DEFAULT_PORT }); - } - }; - let link = UdpLink::open(&dest)?; - if link.ping()? { - devices.push(AvailableDevice { - model: Model::TrezorEmulator, - debug, - transport: AvailableDeviceTransport::Udp(AvailableUdpTransport { - host: link.device.0, - port: link.device.1, - }), - }); - } - Ok(devices) - } - - /// Connect to a device over the UDP transport. - pub fn connect(device: &AvailableDevice) -> Result, Error> { - let transport = match device.transport { - AvailableDeviceTransport::Udp(ref t) => t, - _ => panic!("passed wrong AvailableDevice in UdpTransport::connect"), - }; - let mut path = String::new(); - path.push_str(&transport.host); - path.push(':'); - path.push_str(&transport.port); - let link = UdpLink::open(&path)?; - Ok(Box::new(UdpTransport { protocol: ProtocolV1 { link } })) - } -} - -impl super::Transport for UdpTransport { - fn session_begin(&mut self) -> Result<(), Error> { - self.protocol.session_begin() - } - fn session_end(&mut self) -> Result<(), Error> { - self.protocol.session_end() - } - - fn write_message(&mut self, message: ProtoMessage) -> Result<(), Error> { - self.protocol.write(message) - } - fn read_message(&mut self) -> Result { - self.protocol.read() - } -} diff --git a/wallet/trezor-client/src/transport/webusb.rs b/wallet/trezor-client/src/transport/webusb.rs deleted file mode 100644 index 635f048ecb..0000000000 --- a/wallet/trezor-client/src/transport/webusb.rs +++ /dev/null @@ -1,173 +0,0 @@ -use crate::{ - transport::{ - derive_model, - error::Error, - protocol::{Link, Protocol, ProtocolV1}, - AvailableDeviceTransport, ProtoMessage, Transport, - }, - AvailableDevice, -}; -use rusb::*; -use std::{fmt, result::Result, time::Duration}; - -// A collection of constants related to the WebUsb protocol. -mod constants { - pub(crate) const CONFIG_ID: u8 = 0; - pub(crate) const INTERFACE_DESCRIPTOR: u8 = 0; - pub(crate) const LIBUSB_CLASS_VENDOR_SPEC: u8 = 0xff; - - pub(crate) const INTERFACE: u8 = 0; - pub(crate) const INTERFACE_DEBUG: u8 = 1; - pub(crate) const ENDPOINT: u8 = 1; - pub(crate) const ENDPOINT_DEBUG: u8 = 2; - pub(crate) const READ_ENDPOINT_MASK: u8 = 0x80; -} - -/// The chunk size for the serial protocol. -const CHUNK_SIZE: usize = 64; - -const READ_TIMEOUT_MS: u64 = 100000; -const WRITE_TIMEOUT_MS: u64 = 100000; - -/// An available transport for connecting with a device. -#[derive(Debug)] -pub struct AvailableWebUsbTransport { - pub bus: u8, - pub address: u8, -} - -impl fmt::Display for AvailableWebUsbTransport { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "WebUSB ({}:{})", self.bus, self.address) - } -} - -/// An actual serial USB link to a device over which bytes can be sent. -pub struct WebUsbLink { - handle: DeviceHandle, - endpoint: u8, -} - -impl Link for WebUsbLink { - fn write_chunk(&mut self, chunk: Vec) -> Result<(), Error> { - debug_assert_eq!(CHUNK_SIZE, chunk.len()); - let timeout = Duration::from_millis(WRITE_TIMEOUT_MS); - if let Err(e) = self.handle.write_interrupt(self.endpoint, &chunk, timeout) { - return Err(e.into()); - } - Ok(()) - } - - fn read_chunk(&mut self) -> Result, Error> { - let mut chunk = vec![0; CHUNK_SIZE]; - let endpoint = constants::READ_ENDPOINT_MASK | self.endpoint; - let timeout = Duration::from_millis(READ_TIMEOUT_MS); - - let n = self.handle.read_interrupt(endpoint, &mut chunk, timeout)?; - if n == CHUNK_SIZE { - Ok(chunk) - } else { - Err(Error::DeviceReadTimeout) - } - } -} - -/// An implementation of the Transport interface for WebUSB devices. -pub struct WebUsbTransport { - protocol: ProtocolV1, -} - -impl WebUsbTransport { - pub fn find_devices(debug: bool) -> Result, Error> { - let mut devices = Vec::new(); - - for dev in rusb::devices().unwrap().iter() { - let desc = dev.device_descriptor()?; - let dev_id = (desc.vendor_id(), desc.product_id()); - - let model = match derive_model(dev_id) { - Some(m) => m, - None => continue, - }; - - // Check something with interface class code like python-trezor does. - let class_code = dev - .config_descriptor(constants::CONFIG_ID)? - .interfaces() - .find(|i| i.number() == constants::INTERFACE) - .ok_or(rusb::Error::Other)? - .descriptors() - .find(|d| d.setting_number() == constants::INTERFACE_DESCRIPTOR) - .ok_or(rusb::Error::Other)? - .class_code(); - if class_code != constants::LIBUSB_CLASS_VENDOR_SPEC { - continue; - } - - devices.push(AvailableDevice { - model, - debug, - transport: AvailableDeviceTransport::WebUsb(AvailableWebUsbTransport { - bus: dev.bus_number(), - address: dev.address(), - }), - }); - } - Ok(devices) - } - - /// Connect to a device over the WebUSB transport. - pub fn connect(device: &AvailableDevice) -> Result, Error> { - let transport = match &device.transport { - AvailableDeviceTransport::WebUsb(t) => t, - _ => panic!("passed wrong AvailableDevice in WebUsbTransport::connect"), - }; - - let interface = match device.debug { - false => constants::INTERFACE, - true => constants::INTERFACE_DEBUG, - }; - - // Go over the devices again to match the desired device. - let dev = rusb::devices()? - .iter() - .find(|dev| dev.bus_number() == transport.bus && dev.address() == transport.address) - .ok_or(Error::DeviceDisconnected)?; - // Check if there is not another device connected on this bus. - let dev_desc = dev.device_descriptor()?; - let dev_id = (dev_desc.vendor_id(), dev_desc.product_id()); - if derive_model(dev_id).as_ref() != Some(&device.model) { - return Err(Error::DeviceDisconnected); - } - let handle = dev.open()?; - handle.claim_interface(interface)?; - - Ok(Box::new(WebUsbTransport { - protocol: ProtocolV1 { - link: WebUsbLink { - handle, - endpoint: match device.debug { - false => constants::ENDPOINT, - true => constants::ENDPOINT_DEBUG, - }, - }, - }, - })) - } -} - -impl super::Transport for WebUsbTransport { - fn session_begin(&mut self) -> Result<(), Error> { - self.protocol.session_begin() - } - fn session_end(&mut self) -> Result<(), Error> { - self.protocol.session_end() - } - - fn write_message(&mut self, message: ProtoMessage) -> Result<(), Error> { - self.protocol.write(message) - } - fn read_message(&mut self) -> Result { - self.protocol.read() - } -} diff --git a/wallet/trezor-client/src/utils.rs b/wallet/trezor-client/src/utils.rs deleted file mode 100644 index c248599700..0000000000 --- a/wallet/trezor-client/src/utils.rs +++ /dev/null @@ -1,73 +0,0 @@ -use crate::error::{Error, Result}; -use bitcoin::{ - address, - address::Payload, - bip32, - blockdata::script::Script, - hashes::{sha256d, Hash}, - psbt, - secp256k1::ecdsa::{RecoverableSignature, RecoveryId}, - Address, Network, -}; - -/// Retrieve an address from the given script. -pub fn address_from_script(script: &Script, network: Network) -> Option { - let payload = Payload::from_script(script).ok()?; - Some(Address::new(network, payload)) -} - -/// Find the (first if multiple) PSBT input that refers to the given txid. -pub fn psbt_find_input(psbt: &psbt::Psbt, txid: sha256d::Hash) -> Result<&psbt::Input> { - let inputs = &psbt.unsigned_tx.input; - let idx = inputs - .iter() - .position(|tx| *tx.previous_output.txid.as_raw_hash() == txid) - .ok_or(Error::TxRequestUnknownTxid(txid))?; - psbt.inputs.get(idx).ok_or(Error::TxRequestInvalidIndex(idx)) -} - -/// Get a hash from a reverse byte representation. -pub fn from_rev_bytes(rev_bytes: &[u8]) -> Option { - let mut bytes = rev_bytes.to_vec(); - bytes.reverse(); - sha256d::Hash::from_slice(&bytes).ok() -} - -/// Get the reverse byte representation of a hash. -pub fn to_rev_bytes(hash: &sha256d::Hash) -> [u8; 32] { - let mut bytes = hash.to_byte_array(); - bytes.reverse(); - bytes -} - -/// Parse a Bitcoin Core-style 65-byte recoverable signature. -pub fn parse_recoverable_signature( - sig: &[u8], -) -> Result { - if sig.len() != 65 { - return Err(bitcoin::secp256k1::Error::InvalidSignature); - } - - // Bitcoin Core sets the first byte to `27 + rec + (fCompressed ? 4 : 0)`. - let rec_id = RecoveryId::from_i32(if sig[0] >= 31 { - (sig[0] - 31) as i32 - } else { - (sig[0] - 27) as i32 - })?; - - RecoverableSignature::from_compact(&sig[1..], rec_id) -} - -/// Convert a bitcoin network constant to the Trezor-compatible coin_name string. -pub fn coin_name(network: Network) -> Result { - match network { - Network::Bitcoin => Ok("Bitcoin".to_owned()), - Network::Testnet => Ok("Testnet".to_owned()), - _ => Err(Error::UnsupportedNetwork), - } -} - -/// Convert a BIP-32 derivation path into a `Vec`. -pub fn convert_path(path: &bip32::DerivationPath) -> Vec { - path.into_iter().map(|i| u32::from(*i)).collect() -} From ae99ba11f9b24d578023930c87c752f4f83ee166 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 13 Aug 2024 00:47:11 +0200 Subject: [PATCH 16/48] add support for Hot wallet with trezor device --- node-gui/backend/src/backend_impl.rs | 72 ++++++++++++++++++- node-gui/backend/src/lib.rs | 11 --- node-gui/src/main.rs | 19 ----- node-gui/src/main_window/main_menu.rs | 58 +++++++++------ .../src/main_window/main_widget/tabs/mod.rs | 6 -- .../main_widget/tabs/wallet/left_panel.rs | 24 ++++++- node-gui/src/main_window/mod.rs | 35 ++++++--- node-gui/src/widgets/create_hw_wallet.rs | 42 ++++++++--- wallet/src/signer/software_signer/tests.rs | 7 +- wallet/src/signer/trezor_signer/mod.rs | 23 +++--- wallet/src/signer/trezor_signer/tests.rs | 7 +- wallet/src/wallet/mod.rs | 30 ++++---- wallet/src/wallet/tests.rs | 10 +-- wallet/types/src/wallet_type.rs | 42 +++++++++++ wallet/wallet-controller/src/lib.rs | 13 ++-- .../wallet-controller/src/sync/tests/mod.rs | 6 +- wallet/wallet-controller/src/types/mod.rs | 18 ++++- .../src/handles_client/mod.rs | 6 +- wallet/wallet-node-client/src/node_traits.rs | 4 +- .../src/rpc_client/client_impl.rs | 6 +- .../src/rpc_client/cold_wallet_client.rs | 6 +- .../src/handles_client/mod.rs | 3 +- wallet/wallet-rpc-lib/src/lib.rs | 4 +- wallet/wallet-rpc-lib/src/rpc/mod.rs | 9 +-- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 3 +- wallet/wallet-rpc-lib/src/service/worker.rs | 43 ++++++----- 26 files changed, 337 insertions(+), 170 deletions(-) diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index 919fc844d0..ff5a3afa06 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -320,7 +320,37 @@ impl Backend { (wallet_data, accounts_info, best_block) } #[cfg(feature = "trezor")] - (WalletType::Trezor, _) => { + (WalletType::Trezor, ColdHotNodeController::Hot(controller)) => { + let handles_client = WalletHandlesClient::new( + controller.chainstate.clone(), + controller.mempool.clone(), + controller.block_prod.clone(), + controller.p2p.clone(), + ) + .await + .map_err(|e| BackendError::WalletError(e.to_string()))?; + + let (wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self + .create_wallet( + handles_client, + file_path.clone(), + wallet_args, + import, + wallet_events, + ) + .await?; + + let wallet_data = WalletData { + controller: GuiHotColdController::Hot(wallet_rpc, command_handler), + accounts: accounts_data, + best_block, + updated: false, + }; + + (wallet_data, accounts_info, best_block) + } + #[cfg(feature = "trezor")] + (WalletType::Trezor, ColdHotNodeController::Cold) => { let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); let (wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self @@ -398,7 +428,7 @@ impl Backend { let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); wallet_rpc - .create_wallet(file_path, wallet_args, import.skip_syncing()) + .create_wallet(file_path, wallet_args, true, import.scan_blokchain()) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; tokio::spawn(forward_events( @@ -510,7 +540,43 @@ impl Backend { (wallet_data, accounts_info, best_block, encryption_state) } #[cfg(feature = "trezor")] - (WalletType::Trezor, _) => { + (WalletType::Trezor, ColdHotNodeController::Hot(controller)) => { + let handles_client = WalletHandlesClient::new( + controller.chainstate.clone(), + controller.mempool.clone(), + controller.block_prod.clone(), + controller.p2p.clone(), + ) + .await + .map_err(|e| BackendError::WalletError(e.to_string()))?; + + let ( + wallet_rpc, + command_handler, + encryption_state, + best_block, + accounts_info, + accounts_data, + ) = self + .open_wallet( + handles_client, + file_path.clone(), + wallet_events, + Some(HardwareWalletType::Trezor), + ) + .await?; + + let wallet_data = WalletData { + controller: GuiHotColdController::Hot(wallet_rpc, command_handler), + accounts: accounts_data, + best_block, + updated: false, + }; + + (wallet_data, accounts_info, best_block, encryption_state) + } + #[cfg(feature = "trezor")] + (WalletType::Trezor, ColdHotNodeController::Cold) => { let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); let ( diff --git a/node-gui/backend/src/lib.rs b/node-gui/backend/src/lib.rs index ac41c53030..4327f92ffe 100644 --- a/node-gui/backend/src/lib.rs +++ b/node-gui/backend/src/lib.rs @@ -65,8 +65,6 @@ impl ImportOrCreate { pub enum WalletMode { Cold, Hot, - #[cfg(feature = "trezor")] - Trezor, } #[derive(Debug)] @@ -184,15 +182,6 @@ pub async fn node_initialize( }); (chain_config, chain_info) } - #[cfg(feature = "trezor")] - WalletMode::Trezor => spawn_cold_backend( - network, - event_tx, - request_rx, - low_priority_event_tx, - wallet_updated_tx, - wallet_updated_rx, - ), WalletMode::Cold => spawn_cold_backend( network, event_tx, diff --git a/node-gui/src/main.rs b/node-gui/src/main.rs index 361db199e2..a112506a20 100644 --- a/node-gui/src/main.rs +++ b/node-gui/src/main.rs @@ -37,9 +37,6 @@ use tokio::sync::mpsc::UnboundedReceiver; const COLD_WALLET_TOOLTIP_TEXT: &str = "Start the wallet in Cold mode without connecting to the network or any nodes. The Cold mode is made to run the wallet on an air-gapped machine without internet connection for storage of keys of high-value. For example, pool decommission keys."; const HOT_WALLET_TOOLTIP_TEXT: &str = "Start the wallet in Hot mode and connect to the network."; -#[cfg(feature = "trezor")] -const TREZOR_WALLET_TOOLTIP_TEXT: &str = - "Start the wallet in Trezor mode and connect to a Trezor hardware wallet."; const MAIN_NETWORK_TOOLTIP: &str = "The 'Mainnet' is the main network that has coins with value."; const TEST_NETWORK_TOOLTIP: &str = "The 'Testnet' is the network with coins that have no value, but is used for testing various applications before deploying them on Mainnet."; @@ -355,22 +352,6 @@ impl Application for MintlayerNodeGUI { .align_items(iced::Alignment::Center) .spacing(5); - #[cfg(feature = "trezor")] - let error_box = { - let trezor_row = row![ - iced::widget::button(text("Trezor")).on_press(WalletMode::Trezor), - tooltip( - Text::new(iced_aw::Bootstrap::Question.to_string()) - .font(iced_aw::BOOTSTRAP_FONT), - TREZOR_WALLET_TOOLTIP_TEXT, - tooltip::Position::Bottom - ) - .gap(10) - .style(iced::theme::Container::Box) - ]; - error_box.push(trezor_row) - }; - let res: Element = container(error_box) .width(Length::Fill) .height(Length::Fill) diff --git a/node-gui/src/main_window/main_menu.rs b/node-gui/src/main_window/main_menu.rs index 39252621c0..4445cc6e96 100644 --- a/node-gui/src/main_window/main_menu.rs +++ b/node-gui/src/main_window/main_menu.rs @@ -108,7 +108,7 @@ fn make_menu_file<'a>(wallet_mode: WalletMode) -> Item<'a, MenuMessage, Theme, i labeled_button("File", MenuMessage::NoOp), Menu::new(match wallet_mode { WalletMode::Hot => { - vec![ + let menu = vec![ menu_item( "Create new Hot wallet", MenuMessage::CreateNewWallet { @@ -130,7 +130,41 @@ fn make_menu_file<'a>(wallet_mode: WalletMode) -> Item<'a, MenuMessage, Theme, i // TODO: enable setting when needed // menu_item("Settings", MenuMessage::NoOp), menu_item("Exit", MenuMessage::Exit), - ] + ]; + #[cfg(feature = "trezor")] + { + let mut menu = menu; + menu.insert( + 1, + menu_item( + "Create new Trezor wallet", + MenuMessage::CreateNewWallet { + wallet_type: WalletType::Trezor, + }, + ), + ); + menu.insert( + 3, + menu_item( + "Recover from Trezor wallet", + MenuMessage::RecoverWallet { + wallet_type: WalletType::Trezor, + }, + ), + ); + menu.insert( + 5, + menu_item( + "Open Trezor wallet", + MenuMessage::OpenWallet { + wallet_type: WalletType::Trezor, + }, + ), + ); + menu + } + #[cfg(not(feature = "trezor"))] + menu } WalletMode::Cold => { vec![ @@ -157,26 +191,6 @@ fn make_menu_file<'a>(wallet_mode: WalletMode) -> Item<'a, MenuMessage, Theme, i menu_item("Exit", MenuMessage::Exit), ] } - #[cfg(feature = "trezor")] - WalletMode::Trezor => { - vec![ - menu_item( - "Create new Trezor wallet", - MenuMessage::CreateNewWallet { - wallet_type: WalletType::Trezor, - }, - ), - menu_item( - "Open Trezor wallet", - MenuMessage::OpenWallet { - wallet_type: WalletType::Trezor, - }, - ), - // TODO: enable setting when needed - // menu_item("Settings", MenuMessage::NoOp), - menu_item("Exit", MenuMessage::Exit), - ] - } }) .width(260), ); diff --git a/node-gui/src/main_window/main_widget/tabs/mod.rs b/node-gui/src/main_window/main_widget/tabs/mod.rs index fcb9278f7c..a862e79622 100644 --- a/node-gui/src/main_window/main_widget/tabs/mod.rs +++ b/node-gui/src/main_window/main_widget/tabs/mod.rs @@ -115,12 +115,6 @@ impl TabsWidget { self.cold_wallet_tab.tab_label(), self.cold_wallet_tab.view(node_state), ), - #[cfg(feature = "trezor")] - WalletMode::Trezor => tabs.push( - TabIndex::Summary as usize, - self.cold_wallet_tab.tab_label(), - self.cold_wallet_tab.view(node_state), - ), }; // TODO: enable settings tab when needed //.push( diff --git a/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs b/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs index f55a8b3102..dd56598773 100644 --- a/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs +++ b/node-gui/src/main_window/main_widget/tabs/wallet/left_panel.rs @@ -116,9 +116,11 @@ pub fn view_left_panel( // `next_height` is used to prevent flickering when a new block is found let show_scan_progress = match wallet_info.wallet_type { - #[cfg(feature = "trezor")] - WalletType::Trezor => false, WalletType::Cold => false, + #[cfg(feature = "trezor")] + WalletType::Trezor => { + wallet_info.best_block.1.next_height() < node_state.chain_info.best_block_height + } WalletType::Hot => { wallet_info.best_block.1.next_height() < node_state.chain_info.best_block_height } @@ -179,12 +181,30 @@ pub fn view_left_panel( #[cfg(feature = "trezor")] WalletType::Trezor => { column![ + panel_button( + "Transactions", + SelectedPanel::Transactions, + selected_panel, + TRANSACTIONS_TOOLTIP_TEXT + ), panel_button( "Addresses", SelectedPanel::Addresses, selected_panel, ADDRESSES_TOOLTIP_TEXT ), + panel_button( + "Send", + SelectedPanel::Send, + selected_panel, + SEND_TOOLTIP_TEXT + ), + panel_button( + "Delegation", + SelectedPanel::Delegation, + selected_panel, + DELEGATION_TOOLTIP_TEXT + ), panel_button( "Console", SelectedPanel::Console, diff --git a/node-gui/src/main_window/mod.rs b/node-gui/src/main_window/mod.rs index 660a849198..e60361ae68 100644 --- a/node-gui/src/main_window/mod.rs +++ b/node-gui/src/main_window/mod.rs @@ -809,6 +809,7 @@ impl MainWindow { wallet_type, }), Box::new(|| MainWindowMessage::CloseDialog), + ImportOrCreate::Create, ) .into(), } @@ -816,16 +817,30 @@ impl MainWindow { ActiveDialog::WalletRecover { wallet_type } => { let wallet_type = *wallet_type; - wallet_mnemonic_dialog( - None, - Box::new(move |mnemonic| MainWindowMessage::ImportWalletMnemonic { - args: WalletArgs::Software { mnemonic }, - import: ImportOrCreate::Import, - wallet_type, - }), - Box::new(|| MainWindowMessage::CloseDialog), - ) - .into() + // FIXME + match wallet_type { + WalletType::Hot | WalletType::Cold => wallet_mnemonic_dialog( + None, + Box::new(move |mnemonic| MainWindowMessage::ImportWalletMnemonic { + args: WalletArgs::Software { mnemonic }, + import: ImportOrCreate::Import, + wallet_type, + }), + Box::new(|| MainWindowMessage::CloseDialog), + ) + .into(), + #[cfg(feature = "trezor")] + WalletType::Trezor => hw_wallet_create_dialog( + Box::new(move || MainWindowMessage::ImportWalletMnemonic { + args: WalletArgs::Trezor, + import: ImportOrCreate::Import, + wallet_type, + }), + Box::new(|| MainWindowMessage::CloseDialog), + ImportOrCreate::Import, + ) + .into(), + } } ActiveDialog::WalletSetPassword { wallet_id } => { diff --git a/node-gui/src/widgets/create_hw_wallet.rs b/node-gui/src/widgets/create_hw_wallet.rs index c7904ec4c0..4ab707b62c 100644 --- a/node-gui/src/widgets/create_hw_wallet.rs +++ b/node-gui/src/widgets/create_hw_wallet.rs @@ -13,9 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::main_window::ImportOrCreate; use iced::{ alignment::Horizontal, - widget::{self, container, Button, Component, Text}, + widget::{self, container, text, Button, Component, Text}, Element, Length, Theme, }; use iced_aw::Card; @@ -23,18 +24,26 @@ use iced_aw::Card; pub struct CreateHwWalletDialog { on_import: Box Message>, on_close: Box Message>, + mode: ImportOrCreate, } pub fn hw_wallet_create_dialog( on_import: Box Message>, on_close: Box Message>, + mode: ImportOrCreate, ) -> CreateHwWalletDialog { CreateHwWalletDialog { on_import, on_close, + mode, } } +#[derive(Default)] +pub struct ImportState { + importing: bool, +} + #[derive(Clone)] pub enum ImportEvent { Ok, @@ -42,26 +51,39 @@ pub enum ImportEvent { } impl Component for CreateHwWalletDialog { - type State = (); + type State = ImportState; type Event = ImportEvent; - fn update(&mut self, _state: &mut Self::State, event: Self::Event) -> Option { + fn update(&mut self, state: &mut Self::State, event: Self::Event) -> Option { match event { - ImportEvent::Ok => Some((self.on_import)()), + ImportEvent::Ok => { + state.importing = true; + Some((self.on_import)()) + } ImportEvent::Cancel => Some((self.on_close)()), } } - fn view(&self, _state: &Self::State) -> Element { + fn view(&self, state: &Self::State) -> Element { let button = Button::new(Text::new("Select file").horizontal_alignment(Horizontal::Center)) .width(100.0) .on_press(ImportEvent::Ok); - Card::new( - Text::new("Create new Wallet"), - Text::new("Create a new Trezor wallet using the connected Trezor device"), - ) - .foot(container(button).width(Length::Fill).center_x()) + let card = match self.mode { + ImportOrCreate::Create => Card::new( + Text::new("Create new Wallet"), + Text::new("Create a new Trezor wallet using the connected Trezor device"), + ), + ImportOrCreate::Import => Card::new( + Text::new("Recover new Wallet"), + Text::new("Recover a new wallet using the connected Trezor device"), + ), + }; + if state.importing { + card.foot(container(text("Loading...")).width(Length::Fill).center_x()) + } else { + card.foot(container(button).width(Length::Fill).center_x()) + } .max_width(600.0) .on_close(ImportEvent::Cancel) .into() diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index c2ee84b145..bb09f58ffa 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -66,12 +66,7 @@ fn sign_message(#[case] seed: Seed) { let mut signer = SoftwareSigner::new(config.clone(), DEFAULT_ACCOUNT_INDEX); let message = vec![rng.gen::(), rng.gen::(), rng.gen::()]; let res = signer - .sign_challenge( - message.clone(), - destination.clone(), - account.key_chain(), - &db_tx, - ) + .sign_challenge(&message, &destination, account.key_chain(), &db_tx) .unwrap(); let message_challenge = produce_message_challenge(&message); diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 7b557f0f43..e9a511350f 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -379,12 +379,12 @@ impl Signer for TrezorSigner { fn sign_challenge( &mut self, - message: Vec, - destination: Destination, + message: &[u8], + destination: &Destination, key_chain: &impl AccountKeyChains, _db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult { - let data = match key_chain.find_public_key(&destination) { + let data = match key_chain.find_public_key(destination) { Some(FoundPubKey::Hierarchy(xpub)) => { let address_n = xpub .get_derivation_path() @@ -401,7 +401,7 @@ impl Signer for TrezorSigner { .client .lock() .expect("poisoned lock") - .mintlayer_sign_message(address_n, addr, message) + .mintlayer_sign_message(address_n, addr, message.to_vec()) .map_err(TrezorError::DeviceError)?; let mut signature = sig; signature.insert(0, 0); @@ -442,11 +442,11 @@ impl Signer for TrezorSigner { fn sign_transaction_intent( &mut self, - transaction: &Transaction, - input_destinations: &[Destination], - intent: &str, - key_chain: &impl AccountKeyChains, - db_tx: &impl WalletStorageReadUnlocked, + _transaction: &Transaction, + _input_destinations: &[Destination], + _intent: &str, + _key_chain: &impl AccountKeyChains, + _db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult { unimplemented!("FIXME") } @@ -466,7 +466,7 @@ fn tx_output_value(out: &TxOutput) -> OutputValue { | TxOutput::CreateDelegationId(_, _) | TxOutput::ProduceBlockFromStake(_, _) | TxOutput::IssueFungibleToken(_) - | TxOutput::AnyoneCanTake(_) + | TxOutput::CreateOrder(_) | TxOutput::DataDeposit(_) => OutputValue::Coin(Amount::ZERO), } } @@ -578,6 +578,7 @@ fn to_trezor_account_command_input( AccountCommand::ConcludeOrder(_) | AccountCommand::FillOrder(_, _, _) => { unimplemented!("order commands") } + AccountCommand::ChangeTokenMetadataUri(_, _) => unimplemented!("FIXME"), } let mut inp = MintlayerTxInput::new(); inp.account_command = Some(inp_req).into(); @@ -985,7 +986,7 @@ fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> Mintlayer out } TxOutput::Htlc(_, _) => unimplemented!("HTLC"), - TxOutput::AnyoneCanTake(_) => unimplemented!("AnyoneCanTake"), + TxOutput::CreateOrder(_) => unimplemented!("CreateOrder"), } } diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 2862594e79..bdde74dac3 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -73,12 +73,7 @@ fn sign_message(#[case] seed: Seed) { let mut signer = TrezorSigner::new(chain_config.clone(), Arc::new(Mutex::new(client))); let message = vec![rng.gen::(), rng.gen::(), rng.gen::()]; let res = signer - .sign_challenge( - message.clone(), - destination.clone(), - account.key_chain(), - &db_tx, - ) + .sign_challenge(&message, &destination, account.key_chain(), &db_tx) .unwrap(); let message_challenge = produce_message_challenge(&message); diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 6b20f93674..56c703ff02 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -79,7 +79,7 @@ use wallet_types::seed_phrase::SerializableSeedPhrase; use wallet_types::signature_status::SignatureStatus; use wallet_types::utxo_types::{UtxoStates, UtxoTypes}; use wallet_types::wallet_tx::{TxData, TxState}; -use wallet_types::wallet_type::WalletType; +use wallet_types::wallet_type::{WalletControllerMode, WalletType}; use wallet_types::with_locked::WithLocked; use wallet_types::{ AccountId, AccountKeyPurposeId, BlockInfo, Currency, KeyPurpose, KeychainUsageState, @@ -101,7 +101,7 @@ pub enum WalletError { #[error("Wallet is not initialized")] WalletNotInitialized, #[error("A {0} wallet is trying to open a {1} wallet file")] - DifferentWalletType(WalletType, WalletType), + DifferentWalletType(WalletControllerMode, WalletType), #[error("The wallet belongs to a different chain than the one specified")] DifferentChainType, #[error("Unsupported wallet version: {0}, max supported version of this software is {CURRENT_WALLET_VERSION}")] @@ -493,7 +493,7 @@ where fn migration_v7( db: &Store, chain_config: Arc, - wallet_type: WalletType, + controller_mode: WalletControllerMode, ) -> WalletResult<()> { let mut db_tx = db.transaction_rw(None)?; let accs = db_tx.get_accounts_info()?; @@ -502,11 +502,11 @@ where accs.values().all(|acc| acc.best_block_id() == chain_config.genesis_block_id()); ensure!( - wallet_type == WalletType::Hot || cold_wallet, - WalletError::DifferentWalletType(wallet_type, WalletType::Hot) + controller_mode == WalletControllerMode::Hot || cold_wallet, + WalletError::DifferentWalletType(controller_mode, WalletType::Hot) ); - db_tx.set_wallet_type(wallet_type)?; + db_tx.set_wallet_type(controller_mode.into())?; db_tx.set_storage_version(WALLET_VERSION_V7)?; db_tx.commit()?; @@ -526,7 +526,7 @@ where db: &Store, chain_config: Arc, pre_migration: F, - wallet_type: WalletType, + controller_mode: WalletControllerMode, signer_provider: F2, ) -> WalletResult

{ let version = db.transaction_ro()?.get_storage_version()?; @@ -563,7 +563,7 @@ where } WALLET_VERSION_V6 => { pre_migration(WALLET_VERSION_V6)?; - Self::migration_v7(db, chain_config.clone(), wallet_type)?; + Self::migration_v7(db, chain_config.clone(), controller_mode)?; } CURRENT_WALLET_VERSION => return Ok(signer_provider), unsupported_version => { @@ -576,7 +576,7 @@ where fn validate_chain_info( chain_config: &ChainConfig, db_tx: &impl WalletStorageReadLocked, - wallet_type: WalletType, + controller_mode: WalletControllerMode, ) -> WalletResult<()> { let chain_info = db_tx.get_chain_info()?; ensure!( @@ -586,8 +586,8 @@ where let this_wallet_type = db_tx.get_wallet_type()?; ensure!( - this_wallet_type == wallet_type, - WalletError::DifferentWalletType(wallet_type, this_wallet_type) + this_wallet_type.is_compatible(controller_mode), + WalletError::DifferentWalletType(controller_mode, this_wallet_type) ); Ok(()) @@ -746,7 +746,7 @@ where mut db: Store, password: Option, pre_migration: F, - wallet_type: WalletType, + controller_mode: WalletControllerMode, force_change_wallet_type: bool, signer_provider: F2, ) -> WalletResult { @@ -757,12 +757,12 @@ where &db, chain_config.clone(), pre_migration, - wallet_type, + controller_mode, signer_provider, )?; if force_change_wallet_type { Self::force_migrate_wallet_type( - wallet_type, + controller_mode.into(), &db, chain_config.clone(), &signer_provider, @@ -773,7 +773,7 @@ where // Some unit tests expect that loading the wallet does not change the DB. let db_tx = db.transaction_ro()?; - Self::validate_chain_info(chain_config.as_ref(), &db_tx, wallet_type)?; + Self::validate_chain_info(chain_config.as_ref(), &db_tx, controller_mode)?; let accounts_info = db_tx.get_accounts_info()?; diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index edb404ee8b..f3568a37c7 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -266,7 +266,7 @@ fn verify_wallet_balance( db_copy, None, |_| Ok(()), - WalletType::Hot, + WalletControllerMode::Hot, false, |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) @@ -363,7 +363,7 @@ fn wallet_creation_in_memory() { empty_db, None, |_| Ok(()), - WalletType::Hot, + WalletControllerMode::Hot, false, |db_tx| SoftwareSignerProvider::load_from_database(chain_config2, db_tx), ) { @@ -381,7 +381,7 @@ fn wallet_creation_in_memory() { initialized_db, None, |_| Ok(()), - WalletType::Hot, + WalletControllerMode::Hot, false, |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) @@ -472,7 +472,7 @@ fn wallet_migration_to_v2(#[case] seed: Seed) { new_db, password, |_| Ok(()), - WalletType::Hot, + WalletControllerMode::Hot, false, |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) @@ -951,7 +951,7 @@ fn test_wallet_accounts( db_copy, None, |_| Ok(()), - WalletType::Hot, + WalletControllerMode::Hot, false, |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) diff --git a/wallet/types/src/wallet_type.rs b/wallet/types/src/wallet_type.rs index 7be9b18823..99d3110f9e 100644 --- a/wallet/types/src/wallet_type.rs +++ b/wallet/types/src/wallet_type.rs @@ -27,6 +27,48 @@ pub enum WalletType { Trezor, } +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub enum WalletControllerMode { + Cold, + Hot, +} + +impl Display for WalletControllerMode { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::Hot => write!(f, "Hot"), + Self::Cold => write!(f, "Cold"), + } + } +} + +impl WalletType { + /// Check if current Wallet type is compatible to be oppened as the other wallet type + pub fn is_compatible(&self, other: WalletControllerMode) -> bool { + match (*self, other) { + (Self::Hot, WalletControllerMode::Hot) | (Self::Cold, WalletControllerMode::Cold) => { + true + } + (Self::Hot, WalletControllerMode::Cold) | (Self::Cold, WalletControllerMode::Hot) => { + false + } + #[cfg(feature = "trezor")] + (Self::Trezor, WalletControllerMode::Hot) => true, + #[cfg(feature = "trezor")] + (Self::Trezor, WalletControllerMode::Cold) => false, + } + } +} + +impl From for WalletType { + fn from(value: WalletControllerMode) -> Self { + match value { + WalletControllerMode::Hot => WalletType::Hot, + WalletControllerMode::Cold => WalletType::Cold, + } + } +} + impl Display for WalletType { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index a3bbf47594..c62a4ccb4b 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -102,8 +102,11 @@ pub use wallet_types::{ utxo_types::{UtxoState, UtxoStates, UtxoType, UtxoTypes}, }; use wallet_types::{ - seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, wallet_type::WalletType, - with_locked::WithLocked, Currency, + seed_phrase::StoreSeedPhrase, + signature_status::SignatureStatus, + wallet_type::{WalletControllerMode, WalletType}, + with_locked::WithLocked, + Currency, }; #[derive(thiserror::Error, Debug)] @@ -380,7 +383,7 @@ where chain_config: Arc, file_path: impl AsRef, password: Option, - current_wallet_type: WalletType, + current_controller_mode: WalletControllerMode, force_change_wallet_type: bool, open_as_wallet_type: WalletType, ) -> Result, ControllerError> { @@ -402,7 +405,7 @@ where db, password, |version| Self::make_backup_wallet_file(file_path.as_ref(), version), - current_wallet_type, + current_controller_mode, force_change_wallet_type, |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) @@ -416,7 +419,7 @@ where db, password, |version| Self::make_backup_wallet_file(file_path.as_ref(), version), - current_wallet_type, + current_controller_mode, force_change_wallet_type, |db_tx| TrezorSignerProvider::load_from_database(chain_config.clone(), db_tx), ) diff --git a/wallet/wallet-controller/src/sync/tests/mod.rs b/wallet/wallet-controller/src/sync/tests/mod.rs index f0069b514b..e3c41e2b27 100644 --- a/wallet/wallet-controller/src/sync/tests/mod.rs +++ b/wallet/wallet-controller/src/sync/tests/mod.rs @@ -46,7 +46,7 @@ use test_utils::random::{make_seedable_rng, Seed}; use tokio::sync::mpsc; use utils_networking::IpOrSocketAddress; use wallet::wallet_events::WalletEventsNoOp; -use wallet_types::{account_info::DEFAULT_ACCOUNT_INDEX, wallet_type::WalletType}; +use wallet_types::{account_info::DEFAULT_ACCOUNT_INDEX, wallet_type::WalletControllerMode}; use super::*; @@ -202,8 +202,8 @@ impl MockNode { impl NodeInterface for MockNode { type Error = NodeRpcError; - fn is_cold_wallet_node(&self) -> WalletType { - WalletType::Hot + fn is_cold_wallet_node(&self) -> WalletControllerMode { + WalletControllerMode::Hot } async fn chainstate_info(&self) -> Result { diff --git a/wallet/wallet-controller/src/types/mod.rs b/wallet/wallet-controller/src/types/mod.rs index ce455bf232..e346b3ccc5 100644 --- a/wallet/wallet-controller/src/types/mod.rs +++ b/wallet/wallet-controller/src/types/mod.rs @@ -39,7 +39,10 @@ pub use transaction::{ InspectTransaction, SignatureStats, TransactionToInspect, ValidatedSignatures, }; use utils::ensure; -use wallet_types::seed_phrase::StoreSeedPhrase; +use wallet_types::{ + seed_phrase::StoreSeedPhrase, + wallet_type::{WalletControllerMode, WalletType}, +}; use crate::mnemonic; @@ -162,6 +165,17 @@ pub enum WalletTypeArgs { } impl WalletTypeArgs { + pub fn wallet_type(&self, controller_mode: WalletControllerMode) -> WalletType { + match self { + Self::Software { + mnemonic: _, + passphrase: _, + store_seed_phrase: _, + } => controller_mode.into(), + #[cfg(feature = "trezor")] + Self::Trezor => WalletType::Trezor, + } + } pub fn user_supplied_menmonic(&self) -> bool { match self { Self::Software { @@ -170,7 +184,7 @@ impl WalletTypeArgs { store_seed_phrase: _, } => mnemonic.is_some(), #[cfg(feature = "trezor")] - Self::Trezor => false, + Self::Trezor => true, } } diff --git a/wallet/wallet-node-client/src/handles_client/mod.rs b/wallet/wallet-node-client/src/handles_client/mod.rs index f2f12d6b6a..bbf589ae0c 100644 --- a/wallet/wallet-node-client/src/handles_client/mod.rs +++ b/wallet/wallet-node-client/src/handles_client/mod.rs @@ -38,7 +38,7 @@ use p2p::{ }; use serialization::hex::HexError; use utils_networking::IpOrSocketAddress; -use wallet_types::wallet_type::WalletType; +use wallet_types::wallet_type::WalletControllerMode; use crate::node_traits::NodeInterface; @@ -103,8 +103,8 @@ impl WalletHandlesClient { impl NodeInterface for WalletHandlesClient { type Error = WalletHandlesClientError; - fn is_cold_wallet_node(&self) -> WalletType { - WalletType::Hot + fn is_cold_wallet_node(&self) -> WalletControllerMode { + WalletControllerMode::Hot } async fn chainstate_info(&self) -> Result { diff --git a/wallet/wallet-node-client/src/node_traits.rs b/wallet/wallet-node-client/src/node_traits.rs index afc22cd9d6..282645a811 100644 --- a/wallet/wallet-node-client/src/node_traits.rs +++ b/wallet/wallet-node-client/src/node_traits.rs @@ -31,13 +31,13 @@ use mempool::{tx_accumulator::PackingStrategy, tx_options::TxOptionsOverrides, F use p2p::types::{bannable_address::BannableAddress, socket_address::SocketAddress}; pub use p2p::{interface::types::ConnectedPeer, types::peer_id::PeerId}; use utils_networking::IpOrSocketAddress; -use wallet_types::wallet_type::WalletType; +use wallet_types::wallet_type::WalletControllerMode; #[async_trait::async_trait] pub trait NodeInterface { type Error: std::error::Error + Send + Sync + 'static; - fn is_cold_wallet_node(&self) -> WalletType; + fn is_cold_wallet_node(&self) -> WalletControllerMode; async fn chainstate_info(&self) -> Result; async fn get_best_block_id(&self) -> Result, Self::Error>; diff --git a/wallet/wallet-node-client/src/rpc_client/client_impl.rs b/wallet/wallet-node-client/src/rpc_client/client_impl.rs index 29e992cc08..804d81e3c9 100644 --- a/wallet/wallet-node-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-node-client/src/rpc_client/client_impl.rs @@ -38,7 +38,7 @@ use p2p::{ }; use serialization::hex_encoded::HexEncoded; use utils_networking::IpOrSocketAddress; -use wallet_types::wallet_type::WalletType; +use wallet_types::wallet_type::WalletControllerMode; use crate::node_traits::NodeInterface; @@ -48,8 +48,8 @@ use super::{NodeRpcClient, NodeRpcError}; impl NodeInterface for NodeRpcClient { type Error = NodeRpcError; - fn is_cold_wallet_node(&self) -> WalletType { - WalletType::Hot + fn is_cold_wallet_node(&self) -> WalletControllerMode { + WalletControllerMode::Hot } async fn chainstate_info(&self) -> Result { diff --git a/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs b/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs index 7b2c035392..12ae3c13be 100644 --- a/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs +++ b/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs @@ -33,7 +33,7 @@ use p2p::{ types::{bannable_address::BannableAddress, socket_address::SocketAddress, PeerId}, }; use utils_networking::IpOrSocketAddress; -use wallet_types::wallet_type::WalletType; +use wallet_types::wallet_type::WalletControllerMode; use crate::node_traits::NodeInterface; @@ -49,8 +49,8 @@ pub enum ColdWalletRpcError { impl NodeInterface for ColdWalletClient { type Error = ColdWalletRpcError; - fn is_cold_wallet_node(&self) -> WalletType { - WalletType::Cold + fn is_cold_wallet_node(&self) -> WalletControllerMode { + WalletControllerMode::Cold } async fn chainstate_info(&self) -> Result { diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 59babca8e3..4864af1d55 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -158,8 +158,9 @@ where } }; + let scan_blockchain = args.user_supplied_menmonic(); self.wallet_rpc - .create_wallet(path, args, false) + .create_wallet(path, args, false, scan_blockchain) .await .map(Into::into) .map_err(WalletRpcHandlesClientError::WalletRpcError) diff --git a/wallet/wallet-rpc-lib/src/lib.rs b/wallet/wallet-rpc-lib/src/lib.rs index 2c0dd3a7de..c4e9e476da 100644 --- a/wallet/wallet-rpc-lib/src/lib.rs +++ b/wallet/wallet-rpc-lib/src/lib.rs @@ -102,7 +102,9 @@ where let wallet_service = WalletService::start( wallet_config.chain_config, // TODO add support for trezor wallet - wallet_config.wallet_file.map(|file| (file, node_rpc.is_cold_wallet_node())), + wallet_config + .wallet_file + .map(|file| (file, node_rpc.is_cold_wallet_node().into())), wallet_config.force_change_wallet_type, wallet_config.start_staking_for_account, node_rpc, diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index 2b97c03a91..88bf17f34e 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -134,12 +134,13 @@ where path: PathBuf, args: WalletTypeArgs, skip_syncing: bool, + scan_blockchain: bool, ) -> WRpcResult { self.wallet .manage_async(move |wallet_manager| { - Box::pin( - async move { wallet_manager.create_wallet(path, args, skip_syncing).await }, - ) + Box::pin(async move { + wallet_manager.create_wallet(path, args, skip_syncing, scan_blockchain).await + }) }) .await? } @@ -152,7 +153,7 @@ where open_as_hw_wallet: Option, ) -> WRpcResult<(), N> { let open_as_wallet_type = - open_as_hw_wallet.map_or(self.node.is_cold_wallet_node(), |hw| match hw { + open_as_hw_wallet.map_or(self.node.is_cold_wallet_node().into(), |hw| match hw { #[cfg(feature = "trezor")] HardwareWalletType::Trezor => WalletType::Trezor, }); diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index f97f05b2f5..d2259c787b 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -125,8 +125,9 @@ where } }; + let scan_blockchain = args.user_supplied_menmonic(); rpc::handle_result( - self.create_wallet(path.into(), args, false) + self.create_wallet(path.into(), args, false, scan_blockchain) .await .map(Into::::into), ) diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index a236e53e9c..2fe7345185 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -185,42 +185,53 @@ where wallet_path: PathBuf, args: WalletTypeArgs, skip_syncing: bool, + scan_blockchain: bool, ) -> Result> { utils::ensure!( self.controller.is_none(), ControllerError::WalletFileAlreadyOpen ); - let newly_generated_mnemonic = !args.user_supplied_menmonic(); + // let newly_generated_mnemonic = !args.user_supplied_menmonic(); + let wallet_type = args.wallet_type(self.node_rpc.is_cold_wallet_node()); let (computed_args, wallet_created) = args.parse_mnemonic().map_err(RpcError::InvalidMnemonic)?; - let wallet = if newly_generated_mnemonic || skip_syncing { - let info = self.node_rpc.chainstate_info().await.map_err(RpcError::RpcError)?; - WalletController::create_wallet( + let wallet = if scan_blockchain { + WalletController::recover_wallet( self.chain_config.clone(), wallet_path, computed_args, - (info.best_block_height, info.best_block_id), - self.node_rpc.is_cold_wallet_node(), + wallet_type, ) } else { - WalletController::recover_wallet( + let info = self.node_rpc.chainstate_info().await.map_err(RpcError::RpcError)?; + WalletController::create_wallet( self.chain_config.clone(), wallet_path, computed_args, - self.node_rpc.is_cold_wallet_node(), + (info.best_block_height, info.best_block_id), + wallet_type, ) } .map_err(RpcError::Controller)?; - let controller = WalletController::new( - self.chain_config.clone(), - self.node_rpc.clone(), - wallet, - self.wallet_events.clone(), - ) - .await - .map_err(RpcError::Controller)?; + let controller = if skip_syncing { + WalletController::new_unsynced( + self.chain_config.clone(), + self.node_rpc.clone(), + wallet, + self.wallet_events.clone(), + ) + } else { + WalletController::new( + self.chain_config.clone(), + self.node_rpc.clone(), + wallet, + self.wallet_events.clone(), + ) + .await + .map_err(RpcError::Controller)? + }; self.controller.replace(controller); From fde2a1fb2a3467c3b2d9b245d2f59e3ddbc9974e Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 13 Aug 2024 15:12:37 +0200 Subject: [PATCH 17/48] add wallet-recover command - it will rescan the blokchain on wallet creation - wallet-create will only scan forward from the current block height --- node-gui/src/main_window/mod.rs | 1 - .../test_framework/wallet_cli_controller.py | 2 +- .../src/command_handler/mod.rs | 56 +++++++++++++++++++ wallet/wallet-cli-commands/src/lib.rs | 25 +++++++++ .../tests/cli_test_framework.rs | 2 +- .../src/handles_client/mod.rs | 46 ++++++++++++++- .../src/rpc_client/client_impl.rs | 20 +++++++ .../src/wallet_rpc_traits.rs | 9 +++ wallet/wallet-rpc-daemon/docs/RPC.md | 37 +++++++++++- wallet/wallet-rpc-lib/src/rpc/interface.rs | 13 ++++- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 50 ++++++++++++++++- wallet/wallet-rpc-lib/src/rpc/types.rs | 3 + 12 files changed, 256 insertions(+), 8 deletions(-) diff --git a/node-gui/src/main_window/mod.rs b/node-gui/src/main_window/mod.rs index e60361ae68..aa1ea8d10f 100644 --- a/node-gui/src/main_window/mod.rs +++ b/node-gui/src/main_window/mod.rs @@ -817,7 +817,6 @@ impl MainWindow { ActiveDialog::WalletRecover { wallet_type } => { let wallet_type = *wallet_type; - // FIXME match wallet_type { WalletType::Hot | WalletType::Cold => wallet_mnemonic_dialog( None, diff --git a/test/functional/test_framework/wallet_cli_controller.py b/test/functional/test_framework/wallet_cli_controller.py index b4e111f1b7..954fbde84e 100644 --- a/test/functional/test_framework/wallet_cli_controller.py +++ b/test/functional/test_framework/wallet_cli_controller.py @@ -176,7 +176,7 @@ async def open_wallet(self, name: str, password: Optional[str] = None, force_cha async def recover_wallet(self, mnemonic: str, name: str = "recovered_wallet") -> str: wallet_file = os.path.join(self.node.datadir, name) - return await self._write_command(f"wallet-create \"{wallet_file}\" store-seed-phrase \"{mnemonic}\"\n") + return await self._write_command(f"wallet-recover \"{wallet_file}\" store-seed-phrase \"{mnemonic}\"\n") async def close_wallet(self) -> str: return await self._write_command("wallet-close\n") diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index f953134ebd..037dbab366 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -199,6 +199,62 @@ where }) } + WalletManagementCommand::RecoverWallet { + wallet_path, + mnemonic, + whether_to_store_seed_phrase, + passphrase, + hardware_wallet, + } => { + let hardware_wallet = hardware_wallet.and_then(|t| match t { + #[cfg(feature = "trezor")] + CLIHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), + CLIHardwareWalletType::None => None, + }); + + let newly_generated_mnemonic = self + .wallet() + .await? + .recover_wallet( + wallet_path, + whether_to_store_seed_phrase.to_bool(), + mnemonic, + passphrase, + hardware_wallet, + ) + .await?; + + self.wallet.update_wallet::().await; + + let msg = match newly_generated_mnemonic.mnemonic { + MnemonicInfo::NewlyGenerated { + mnemonic, + passphrase, + } => { + let passphrase = if let Some(passphrase) = passphrase { + format!("passphrase: {passphrase}\n") + } else { + String::new() + }; + format!( + "New wallet created successfully\nYour mnemonic: {}\n{passphrase}\ + Please write it somewhere safe to be able to restore your wallet. \ + It's recommended that you attempt to recover the wallet now as practice\ + to check that you arrive at the same addresses, \ + to ensure that you have done everything correctly. + ", + mnemonic + ) + } + MnemonicInfo::UserProvided => "New wallet created successfully".to_owned(), + }; + + Ok(ConsoleCommand::SetStatus { + status: self.repl_status().await?, + print_message: msg, + }) + } + WalletManagementCommand::OpenWallet { wallet_path, encryption_password, diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index 0a039eee27..d74644f133 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -69,6 +69,31 @@ pub enum WalletManagementCommand { hardware_wallet: Option, }, + #[clap(name = "wallet-recover")] + RecoverWallet { + /// File path of the wallet file + wallet_path: PathBuf, + + /// If 'store-seed-phrase', the seed-phrase will be stored in the wallet file. + /// If 'do-not-store-seed-phrase', the seed-phrase will only be printed on the screen. + /// Not storing the seed-phrase can be seen as a security measure + /// to ensure sufficient secrecy in case that seed-phrase is reused + /// elsewhere if this wallet is compromised. + whether_to_store_seed_phrase: CliStoreSeedPhrase, + + /// Mnemonic phrase (12, 15, or 24 words as a single quoted argument). If not specified, a new mnemonic phrase is generated and printed. + mnemonic: Option, + + /// Passphrase along the mnemonic + #[arg(long = "passphrase")] + passphrase: Option, + + /// Create a wallet using a connected hardware wallet. Only the public keys will be kept in + /// the software wallet + #[arg(long, conflicts_with_all(["mnemonic", "passphrase"]))] + hardware_wallet: Option, + }, + #[clap(name = "wallet-open")] OpenWallet { /// File path of the wallet file diff --git a/wallet/wallet-cli-lib/tests/cli_test_framework.rs b/wallet/wallet-cli-lib/tests/cli_test_framework.rs index 13af81d10a..0b88cd8406 100644 --- a/wallet/wallet-cli-lib/tests/cli_test_framework.rs +++ b/wallet/wallet-cli-lib/tests/cli_test_framework.rs @@ -198,7 +198,7 @@ impl CliTestFramework { .unwrap() .to_owned(); let cmd = format!( - "wallet-create \"{}\" store-seed-phrase \"{}\"", + "wallet-recover \"{}\" store-seed-phrase \"{}\"", file_name, MNEMONIC ); assert_eq!(self.exec(&cmd), "New wallet created successfully"); diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 4864af1d55..9952b18368 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -158,7 +158,51 @@ where } }; - let scan_blockchain = args.user_supplied_menmonic(); + let scan_blockchain = false; + self.wallet_rpc + .create_wallet(path, args, false, scan_blockchain) + .await + .map(Into::into) + .map_err(WalletRpcHandlesClientError::WalletRpcError) + } + + async fn recover_wallet( + &self, + path: PathBuf, + store_seed_phrase: bool, + mnemonic: Option, + passphrase: Option, + hardware_wallet: Option, + ) -> Result { + let store_seed_phrase = if store_seed_phrase { + StoreSeedPhrase::Store + } else { + StoreSeedPhrase::DoNotStore + }; + + let args = match hardware_wallet { + None => WalletTypeArgs::Software { + mnemonic, + passphrase, + store_seed_phrase, + }, + #[cfg(feature = "trezor")] + Some(HardwareWalletType::Trezor) => { + ensure!( + mnemonic.is_none() + && passphrase.is_none() + && store_seed_phrase == StoreSeedPhrase::DoNotStore, + RpcError::HardwareWalletWithMnemonic + ); + WalletTypeArgs::Trezor + } + #[cfg(not(feature = "trezor"))] + Some(_) => { + return Err(RpcError::::InvalidHardwareWallet)?; + } + }; + + let scan_blockchain = true; self.wallet_rpc .create_wallet(path, args, false, scan_blockchain) .await diff --git a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs index 37e5a97564..59dbd00b74 100644 --- a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs @@ -99,6 +99,26 @@ impl WalletInterface for ClientWalletRpc { .map_err(WalletRpcError::ResponseError) } + async fn recover_wallet( + &self, + path: PathBuf, + store_seed_phrase: bool, + mnemonic: Option, + passphrase: Option, + hardware_wallet: Option, + ) -> Result { + ColdWalletRpcClient::recover_wallet( + &self.http_client, + path.to_string_lossy().to_string(), + store_seed_phrase, + mnemonic, + passphrase, + hardware_wallet, + ) + .await + .map_err(WalletRpcError::ResponseError) + } + async fn open_wallet( &self, path: PathBuf, diff --git a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs index 1f661e6294..09fbf05f6a 100644 --- a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs +++ b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs @@ -75,6 +75,15 @@ pub trait WalletInterface { hardware_wallet: Option, ) -> Result; + async fn recover_wallet( + &self, + path: PathBuf, + store_seed_phrase: bool, + mnemonic: Option, + passphrase: Option, + hardware_wallet: Option, + ) -> Result; + async fn open_wallet( &self, path: PathBuf, diff --git a/wallet/wallet-rpc-daemon/docs/RPC.md b/wallet/wallet-rpc-daemon/docs/RPC.md index 1b80b67214..6d6a589601 100644 --- a/wallet/wallet-rpc-daemon/docs/RPC.md +++ b/wallet/wallet-rpc-daemon/docs/RPC.md @@ -2693,7 +2693,42 @@ string ### Method `wallet_create` -Create new wallet +Create a new wallet, this will skip scanning the blockchain + + +Parameters: +``` +{ + "path": string, + "store_seed_phrase": bool, + "mnemonic": EITHER OF + 1) string + 2) null, + "passphrase": EITHER OF + 1) string + 2) null, + "hardware_wallet": null, +} +``` + +Returns: +``` +{ "mnemonic": EITHER OF + 1) { "type": "UserProvided" } + 2) { + "type": "NewlyGenerated", + "content": { + "mnemonic": string, + "passphrase": EITHER OF + 1) string + 2) null, + }, + } } +``` + +### Method `wallet_recover` + +Recover new wallet, this will rescan the blockchain upon creation Parameters: diff --git a/wallet/wallet-rpc-lib/src/rpc/interface.rs b/wallet/wallet-rpc-lib/src/rpc/interface.rs index a25fdf5743..0d13886cdc 100644 --- a/wallet/wallet-rpc-lib/src/rpc/interface.rs +++ b/wallet/wallet-rpc-lib/src/rpc/interface.rs @@ -66,7 +66,7 @@ trait ColdWalletRpc { #[method(name = "version")] async fn version(&self) -> rpc::RpcResult; - /// Create new wallet + /// Create a new wallet, this will skip scanning the blockchain #[method(name = "wallet_create")] async fn create_wallet( &self, @@ -77,6 +77,17 @@ trait ColdWalletRpc { hardware_wallet: Option, ) -> rpc::RpcResult; + /// Recover new wallet, this will rescan the blockchain upon creation + #[method(name = "wallet_recover")] + async fn recover_wallet( + &self, + path: String, + store_seed_phrase: bool, + mnemonic: Option, + passphrase: Option, + hardware_wallet: Option, + ) -> rpc::RpcResult; + /// Open an exiting wallet by specifying the file location of the wallet file #[method(name = "wallet_open")] async fn open_wallet( diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index d2259c787b..7c4f0752ab 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -30,7 +30,6 @@ use common::{ use crypto::key::PrivateKey; use p2p_types::{bannable_address::BannableAddress, socket_address::SocketAddress, PeerId}; use serialization::{hex::HexEncode, json_encoded::JsonEncoded}; -#[cfg(feature = "trezor")] use utils::ensure; use utils_networking::IpOrSocketAddress; use wallet::{account::TxInfo, version::get_version}; @@ -125,7 +124,54 @@ where } }; - let scan_blockchain = args.user_supplied_menmonic(); + let scan_blockchain = false; + rpc::handle_result( + self.create_wallet(path.into(), args, false, scan_blockchain) + .await + .map(Into::::into), + ) + } + + async fn recover_wallet( + &self, + path: String, + store_seed_phrase: bool, + mnemonic: Option, + passphrase: Option, + hardware_wallet: Option, + ) -> rpc::RpcResult { + let store_seed_phrase = if store_seed_phrase { + StoreSeedPhrase::Store + } else { + StoreSeedPhrase::DoNotStore + }; + + let args = match hardware_wallet { + None => { + ensure!(mnemonic.is_some(), RpcError::::EmptyMnemonic); + WalletTypeArgs::Software { + mnemonic, + passphrase, + store_seed_phrase, + } + } + #[cfg(feature = "trezor")] + Some(HardwareWalletType::Trezor) => { + ensure!( + mnemonic.is_none() + && passphrase.is_none() + && store_seed_phrase == StoreSeedPhrase::DoNotStore, + RpcError::::HardwareWalletWithMnemonic + ); + WalletTypeArgs::Trezor + } + #[cfg(not(feature = "trezor"))] + Some(_) => { + return Err(RpcError::::InvalidHardwareWallet)?; + } + }; + + let scan_blockchain = true; rpc::handle_result( self.create_wallet(path.into(), args, false, scan_blockchain) .await diff --git a/wallet/wallet-rpc-lib/src/rpc/types.rs b/wallet/wallet-rpc-lib/src/rpc/types.rs index 650d0273d2..18bd4fa197 100644 --- a/wallet/wallet-rpc-lib/src/rpc/types.rs +++ b/wallet/wallet-rpc-lib/src/rpc/types.rs @@ -92,6 +92,9 @@ pub enum RpcError { #[error("Invalid mnemonic: {0}")] InvalidMnemonic(wallet_controller::mnemonic::Error), + #[error("Cannont recover a software wallet without providing a mnemonic")] + EmptyMnemonic, + #[error("Cannot specify a mnemonic or passphrase when using a hardware wallet")] HardwareWalletWithMnemonic, From 2ee0e0b196e67e42fa52eadda7998f1222dcbdcf Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 7 Aug 2024 00:37:07 +0200 Subject: [PATCH 18/48] add additional UTXO info to partially signed tx --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 2c4942ae2f..3deeb57542 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8376,7 +8376,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.3" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer#aaf3552da31a9446e868c4fafb9ee740afac0c48" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer#653a62d73675b2d74f5412da61e752bbd73b2ce4" dependencies = [ "bitcoin", "byteorder", From d65bab950bac3ad6985ec47728cf7351dfb94930 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 7 Aug 2024 00:37:07 +0200 Subject: [PATCH 19/48] add additional UTXO info to partially signed tx --- Cargo.lock | 5 +- chainstate/src/rpc/mod.rs | 28 +- chainstate/src/rpc/types/output.rs | 31 ++ common/src/chain/tokens/rpc.rs | 7 + .../partially_signed_transaction.rs | 19 +- wallet/Cargo.toml | 4 +- wallet/src/account/mod.rs | 98 +++--- wallet/src/send_request/mod.rs | 18 +- wallet/src/signer/software_signer/mod.rs | 3 +- wallet/src/signer/trezor_signer/mod.rs | 20 +- wallet/src/wallet/mod.rs | 36 ++- wallet/src/wallet/tests.rs | 109 ++++--- wallet/wallet-controller/Cargo.toml | 1 + wallet/wallet-controller/src/helpers.rs | 279 ++++++++++++++++++ wallet/wallet-controller/src/lib.rs | 96 ++---- .../wallet-controller/src/sync/tests/mod.rs | 5 + .../src/synced_controller.rs | 52 ++-- wallet/wallet-node-client/Cargo.toml | 1 + .../src/handles_client/mod.rs | 6 + wallet/wallet-node-client/src/node_traits.rs | 2 + .../src/rpc_client/client_impl.rs | 21 +- .../src/rpc_client/cold_wallet_client.rs | 5 + .../wallet-node-client/src/rpc_client/mod.rs | 3 + wallet/wallet-rpc-lib/src/rpc/mod.rs | 2 + 24 files changed, 584 insertions(+), 267 deletions(-) create mode 100644 wallet/wallet-controller/src/helpers.rs diff --git a/Cargo.lock b/Cargo.lock index 3deeb57542..67def8cc7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4771,6 +4771,7 @@ dependencies = [ "mempool", "node-lib", "p2p", + "pos-accounting", "rpc", "serde_json", "serialization", @@ -8375,8 +8376,7 @@ dependencies = [ [[package]] name = "trezor-client" -version = "0.1.3" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer#653a62d73675b2d74f5412da61e752bbd73b2ce4" +version = "0.1.4" dependencies = [ "bitcoin", "byteorder", @@ -8921,6 +8921,7 @@ dependencies = [ "mempool-types", "node-comm", "p2p-types", + "pos-accounting", "randomness", "rpc-description", "rstest", diff --git a/chainstate/src/rpc/mod.rs b/chainstate/src/rpc/mod.rs index 7d95782a32..4ac716b98e 100644 --- a/chainstate/src/rpc/mod.rs +++ b/chainstate/src/rpc/mod.rs @@ -24,7 +24,7 @@ use std::{ sync::Arc, }; -use self::types::{block::RpcBlock, event::RpcEvent}; +use self::types::{block::RpcBlock, event::RpcEvent, output::RpcPoolData}; use crate::{Block, BlockSource, ChainInfo, GenBlock}; use chainstate_types::BlockIndex; use common::{ @@ -144,6 +144,12 @@ trait ChainstateRpc { #[method(name = "staker_balance")] async fn staker_balance(&self, pool_address: String) -> RpcResult>; + /// Returns the pool data of the pool associated with the given pool address. + /// + /// Returns `None` (null) if the pool is not found. + #[method(name = "pool_data")] + async fn pool_data(&self, pool_address: String) -> RpcResult>; + /// Given a pool defined by a pool address, and a delegation address, /// returns the amount of coins owned by that delegation in that pool. #[method(name = "delegation_share")] @@ -338,6 +344,26 @@ impl ChainstateRpcServer for super::ChainstateHandle { ) } + async fn pool_data(&self, pool_address: String) -> RpcResult> { + rpc::handle_result( + self.call(move |this| { + let chain_config = this.get_chain_config(); + let result: Result, _> = + dynamize_err(Address::::from_string(chain_config, pool_address)) + .map(|address| address.into_object()) + .and_then(|pool_id| dynamize_err(this.get_stake_pool_data(pool_id))) + .and_then(|pool_data| { + dynamize_err( + pool_data.map(|d| RpcPoolData::new(chain_config, &d)).transpose(), + ) + }); + + result + }) + .await, + ) + } + async fn delegation_share( &self, pool_address: String, diff --git a/chainstate/src/rpc/types/output.rs b/chainstate/src/rpc/types/output.rs index 814c4487dc..3c67668561 100644 --- a/chainstate/src/rpc/types/output.rs +++ b/chainstate/src/rpc/types/output.rs @@ -23,6 +23,7 @@ use common::{ primitives::amount::{RpcAmountIn, RpcAmountOut}, }; use crypto::vrf::VRFPublicKey; +use pos_accounting::PoolData; use rpc::types::RpcHexString; use super::token::{RpcNftIssuance, RpcTokenIssuance}; @@ -68,6 +69,36 @@ impl RpcOutputValueOut { } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, rpc_description::HasValueHint)] +pub struct RpcPoolData { + pub pledge: RpcAmountOut, + pub rewards: RpcAmountOut, + pub vrf_public_key: RpcAddress, + pub decommission_key: RpcAddress, + pub margin_ratio_per_thousand: String, + pub cost_per_block: RpcAmountOut, +} + +impl RpcPoolData { + pub fn new(chain_config: &ChainConfig, data: &PoolData) -> Result { + let result = Self { + pledge: RpcAmountOut::from_amount(data.pledge_amount(), chain_config.coin_decimals()), + rewards: RpcAmountOut::from_amount(data.staker_rewards(), chain_config.coin_decimals()), + vrf_public_key: RpcAddress::new(chain_config, data.vrf_public_key().clone())?, + decommission_key: RpcAddress::new( + chain_config, + data.decommission_destination().clone(), + )?, + margin_ratio_per_thousand: data.margin_ratio_per_thousand().to_percentage_str(), + cost_per_block: RpcAmountOut::from_amount( + data.cost_per_block(), + chain_config.coin_decimals(), + ), + }; + Ok(result) + } +} + +#[derive(Debug, Clone, serde::Serialize, rpc_description::HasValueHint)] pub struct RpcStakePoolData { pledge: RpcAmountOut, staker: RpcAddress, diff --git a/common/src/chain/tokens/rpc.rs b/common/src/chain/tokens/rpc.rs index b704404ee9..0585727656 100644 --- a/common/src/chain/tokens/rpc.rs +++ b/common/src/chain/tokens/rpc.rs @@ -51,6 +51,13 @@ impl RPCTokenInfo { Self::NonFungibleToken(_) => 0, } } + + pub fn token_ticker(&self) -> Vec { + match self { + Self::FungibleToken(info) => info.token_ticker.clone().into_bytes(), + Self::NonFungibleToken(info) => info.metadata.ticker.clone().into_bytes(), + } + } } #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize, HasValueHint)] diff --git a/common/src/chain/transaction/partially_signed_transaction.rs b/common/src/chain/transaction/partially_signed_transaction.rs index 4705aa83c5..6509dd5575 100644 --- a/common/src/chain/transaction/partially_signed_transaction.rs +++ b/common/src/chain/transaction/partially_signed_transaction.rs @@ -18,16 +18,27 @@ use super::{ signature::{inputsig::InputWitness, Signable, Transactable}, Destination, Transaction, TxOutput, }; -use crate::chain::{SignedTransaction, TransactionCreationError, TxInput}; +use crate::{ + chain::{SignedTransaction, TransactionCreationError, TxInput}, + primitives::Amount, +}; use serialization::{Decode, Encode}; use utils::ensure; +/// Additional info for UTXOs +#[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] +pub enum UtxoAdditionalInfo { + TokenInfo { num_decimals: u8, ticker: Vec }, + PoolInfo { staker_balance: Amount }, + NoAdditionalInfo, +} + #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub struct PartiallySignedTransaction { tx: Transaction, witnesses: Vec>, - input_utxos: Vec>, + input_utxos: Vec>, destinations: Vec>, htlc_secrets: Vec>, @@ -37,7 +48,7 @@ impl PartiallySignedTransaction { pub fn new( tx: Transaction, witnesses: Vec>, - input_utxos: Vec>, + input_utxos: Vec>, destinations: Vec>, htlc_secrets: Option>>, ) -> Result { @@ -93,7 +104,7 @@ impl PartiallySignedTransaction { self.tx } - pub fn input_utxos(&self) -> &[Option] { + pub fn input_utxos(&self) -> &[Option<(TxOutput, UtxoAdditionalInfo)>] { self.input_utxos.as_ref() } diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 95064c36c2..9a7decec39 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -26,8 +26,8 @@ utils-networking = { path = "../utils/networking" } utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } -trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer", features = ["bitcoin", "mintlayer"], optional = true } -# trezor-client = { path = "../../trezor-firmware/rust/trezor-client", features = ["bitcoin", "mintlayer"], optional = true } +# trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer", features = ["bitcoin", "mintlayer"], optional = true } +trezor-client = { path = "../../trezor-firmware/rust/trezor-client", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } hex.workspace = true diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index f2ee24fadd..95554802db 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -1329,72 +1329,42 @@ impl Account { self.output_cache.pool_data(pool_id).is_ok() } - pub fn tx_to_partially_signed_tx( + pub fn find_account_destination( &self, - tx: Transaction, - median_time: BlockTimestamp, - ) -> WalletResult { - let current_block_info = BlockInfo { - height: self.account_info.best_block_height(), - timestamp: median_time, - }; + acc_outpoint: &AccountOutPoint, + ) -> WalletResult { + match acc_outpoint.account() { + AccountSpending::DelegationBalance(delegation_id, _) => self + .output_cache + .delegation_data(delegation_id) + .map(|data| data.destination.clone()) + .ok_or(WalletError::DelegationNotFound(*delegation_id)), + } + } - let (input_utxos, destinations) = tx - .inputs() - .iter() - .map(|tx_inp| match tx_inp { - TxInput::Utxo(outpoint) => { - // find utxo from cache - self.find_unspent_utxo_with_destination(outpoint, current_block_info) - .map(|(out, dest)| (Some(out), Some(dest))) - } - TxInput::Account(acc_outpoint) => { - // find delegation destination - match acc_outpoint.account() { - AccountSpending::DelegationBalance(delegation_id, _) => self - .output_cache - .delegation_data(delegation_id) - .map(|data| (None, Some(data.destination.clone()))) - .ok_or(WalletError::DelegationNotFound(*delegation_id)), - } - } - TxInput::AccountCommand(_, cmd) => { - match cmd { - // find authority of the token - AccountCommand::MintTokens(token_id, _) - | AccountCommand::UnmintTokens(token_id) - | AccountCommand::LockTokenSupply(token_id) - | AccountCommand::ChangeTokenAuthority(token_id, _) - | AccountCommand::ChangeTokenMetadataUri(token_id, _) - | AccountCommand::FreezeToken(token_id, _) - | AccountCommand::UnfreezeToken(token_id) => self - .output_cache - .token_data(token_id) - .map(|data| (None, Some(data.authority.clone()))) - .ok_or(WalletError::UnknownTokenId(*token_id)), - // find authority of the order - AccountCommand::ConcludeOrder(order_id) => self - .output_cache - .order_data(order_id) - .map(|data| (None, Some(data.conclude_key.clone()))) - .ok_or(WalletError::UnknownOrderId(*order_id)), - AccountCommand::FillOrder(_, _, dest) => Ok((None, Some(dest.clone()))), - } - } - }) - .collect::>>()? - .into_iter() - .unzip(); - - let num_inputs = tx.inputs().len(); - let ptx = PartiallySignedTransaction::new( - tx, - vec![None; num_inputs], - input_utxos, - destinations, - None, - )?; - Ok(ptx) + pub fn find_account_command_destination( + &self, + cmd: &AccountCommand, + ) -> WalletResult { + match cmd { + AccountCommand::MintTokens(token_id, _) + | AccountCommand::UnmintTokens(token_id) + | AccountCommand::LockTokenSupply(token_id) + | AccountCommand::ChangeTokenAuthority(token_id, _) + | AccountCommand::ChangeTokenMetadataUri(token_id, _) + | AccountCommand::FreezeToken(token_id, _) + | AccountCommand::UnfreezeToken(token_id) => self + .output_cache + .token_data(token_id) + .map(|data| data.authority.clone()) + .ok_or(WalletError::UnknownTokenId(*token_id)), + AccountCommand::ConcludeOrder(order_id) => self + .output_cache + .order_data(order_id) + .map(|data| data.conclude_key.clone()) + .ok_or(WalletError::UnknownOrderId(*order_id)), + AccountCommand::FillOrder(_, _, dest) => Ok(dest.clone()), + } } pub fn find_unspent_utxo_with_destination( diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 1601522af5..2bed743a92 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -18,7 +18,7 @@ use std::mem::take; use common::address::Address; use common::chain::output_value::OutputValue; -use common::chain::partially_signed_transaction::PartiallySignedTransaction; +use common::chain::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock::ForBlockCount; use common::chain::tokens::{Metadata, TokenId, TokenIssuance}; @@ -292,14 +292,14 @@ impl SendRequest { let num_inputs = self.inputs.len(); let tx = Transaction::new(self.flags, self.inputs, self.outputs)?; let destinations = self.destinations.into_iter().map(Some).collect(); - - let ptx = PartiallySignedTransaction::new( - tx, - vec![None; num_inputs], - self.utxos, - destinations, - None, - )?; + let utxos = self + .utxos + .into_iter() + .map(|utxo| utxo.map(|utxo| (utxo, UtxoAdditionalInfo::NoAdditionalInfo))) + .collect(); + + let ptx = + PartiallySignedTransaction::new(tx, vec![None; num_inputs], utxos, destinations, None)?; Ok(ptx) } } diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index c8204cb177..5c413f4947 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -262,7 +262,8 @@ impl Signer for SoftwareSigner { Vec, Vec, )> { - let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); + let inputs_utxo_refs: Vec<_> = + ptx.input_utxos().iter().map(|u| u.as_ref().map(|(x, _)| x)).collect(); let (witnesses, prev_statuses, new_statuses) = ptx .witnesses() diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index e9a511350f..df2a2d7db8 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -58,9 +58,9 @@ use trezor_client::{ find_devices, protos::{ MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerAddressPath, - MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerCreateDelegationIdTxOutput, - MintlayerCreateStakePoolTxOutput, MintlayerDataDepositTxOutput, - MintlayerDelegateStakingTxOutput, MintlayerFreezeToken, + MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerChangeTokenMediaUri, + MintlayerCreateDelegationIdTxOutput, MintlayerCreateStakePoolTxOutput, + MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFreezeToken, MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, MintlayerLockThenTransferTxOutput, MintlayerLockTokenSupply, MintlayerMintTokens, MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, MintlayerTokenTotalSupply, @@ -242,7 +242,8 @@ impl Signer for TrezorSigner { .mintlayer_sign_tx(inputs, outputs, utxos) .map_err(TrezorError::DeviceError)?; - let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); + let inputs_utxo_refs: Vec<_> = + ptx.input_utxos().iter().map(|u| u.as_ref().map(|(x, _)| x)).collect(); let (witnesses, prev_statuses, new_statuses) = ptx .witnesses() @@ -484,7 +485,7 @@ fn to_trezor_input_msgs( .map(|((inp, utxo), dest)| match (inp, utxo, dest) { (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => Ok(to_trezor_utxo_input( outpoint, - utxo, + &utxo.0, chain_config, dest, key_chain, @@ -575,6 +576,13 @@ fn to_trezor_account_command_input( inp_req.change_token_authority = Some(req).into(); } + AccountCommand::ChangeTokenMetadataUri(token_id, uri) => { + let mut req = MintlayerChangeTokenMediaUri::new(); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_media_uri(uri.clone()); + + inp_req.change_token_metadata_uri = Some(req).into(); + } AccountCommand::ConcludeOrder(_) | AccountCommand::FillOrder(_, _, _) => { unimplemented!("order commands") } @@ -729,7 +737,7 @@ fn to_trezor_utxo_msgs( OutPointSourceId::Transaction(id) => id.to_hash().0, OutPointSourceId::BlockReward(id) => id.to_hash().0, }; - let out = to_trezor_output_msg(chain_config, utxo); + let out = to_trezor_output_msg(chain_config, &utxo.0); map.entry(id).or_default().insert(outpoint.output_index(), out); } (TxInput::Utxo(_), None) => unimplemented!("missing utxo"), diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 56c703ff02..c515ab188d 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -17,11 +17,9 @@ use std::collections::{BTreeMap, BTreeSet}; use std::path::{Path, PathBuf}; use std::sync::Arc; -use crate::account::transaction_list::TransactionList; -use crate::account::{CoinSelectionAlgo, TxInfo}; use crate::account::{ - CurrentFeeRate, DelegationData, PoolData, TransactionToSign, UnconfirmedTokenInfo, - UtxoSelectorError, + transaction_list::TransactionList, CoinSelectionAlgo, CurrentFeeRate, DelegationData, PoolData, + TxInfo, UnconfirmedTokenInfo, UtxoSelectorError, }; use crate::key_chain::{ make_account_path, make_path_to_vrf_key, AccountKeyChainImplSoftware, KeyChainError, @@ -49,9 +47,10 @@ use common::chain::tokens::{ make_token_id, IsTokenUnfreezable, Metadata, RPCFungibleTokenInfo, TokenId, TokenIssuance, }; use common::chain::{ - make_order_id, AccountNonce, Block, ChainConfig, DelegationId, Destination, GenBlock, OrderId, - OutPointSourceId, PoolId, RpcOrderInfo, SignedTransaction, SignedTransactionIntent, - Transaction, TransactionCreationError, TxInput, TxOutput, UtxoOutPoint, + make_order_id, AccountCommand, AccountNonce, AccountOutPoint, Block, ChainConfig, DelegationId, + Destination, GenBlock, OrderId, OutPointSourceId, PoolId, RpcOrderInfo, SignedTransaction, + SignedTransactionIntent, Transaction, TransactionCreationError, TxInput, TxOutput, + UtxoOutPoint, }; use common::primitives::id::{hash_encoded, WithId}; use common::primitives::{Amount, BlockHeight, Id, H256}; @@ -1049,7 +1048,7 @@ where let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; let inputs_utxo_refs: Vec<_> = - ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); + ptx.input_utxos().iter().map(|u| u.as_ref().map(|(x, _)| x)).collect(); let is_fully_signed = ptx.destinations().iter().enumerate().zip(ptx.witnesses()).all( |((i, destination), witness)| match (witness, destination) { @@ -1167,6 +1166,18 @@ where Ok(utxos) } + pub fn find_account_destination(&self, acc_outpoint: &AccountOutPoint) -> Option { + self.accounts + .values() + .find_map(|acc| acc.find_account_destination(acc_outpoint).ok()) + } + + pub fn find_account_command_destination(&self, cmd: &AccountCommand) -> Option { + self.accounts + .values() + .find_map(|acc| acc.find_account_command_destination(cmd).ok()) + } + pub fn find_unspent_utxo_with_destination( &self, outpoint: &UtxoOutPoint, @@ -1989,22 +2000,15 @@ where pub fn sign_raw_transaction( &mut self, account_index: U31, - tx: TransactionToSign, + ptx: PartiallySignedTransaction, ) -> WalletResult<( PartiallySignedTransaction, Vec, Vec, )> { - let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked( account_index, |account, db_tx, chain_config, signer_provider| { - let ptx = match tx { - TransactionToSign::Partial(ptx) => ptx, - TransactionToSign::Tx(tx) => { - account.tx_to_partially_signed_tx(tx, latest_median_time)? - } - }; let mut signer = signer_provider.provide(Arc::new(chain_config.clone()), account_index); diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index f3568a37c7..7ce4e4d880 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -34,6 +34,7 @@ use common::{ block::{consensus_data::PoSData, timestamp::BlockTimestamp, BlockReward, ConsensusData}, config::{create_mainnet, create_regtest, create_unit_test_config, Builder, ChainType}, output_value::{OutputValue, RpcOutputValue}, + partially_signed_transaction::UtxoAdditionalInfo, signature::inputsig::InputWitness, timelock::OutputTimeLock, tokens::{RPCIsTokenFrozen, TokenData, TokenIssuanceV0, TokenIssuanceV1}, @@ -4250,7 +4251,8 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { // Generate a new block which sends reward to the wallet let block1_amount = Amount::from_atoms(rng.gen_range(NETWORK_FEE + 100..NETWORK_FEE + 10000)); - let _ = create_block(&chain_config, &mut wallet, vec![], block1_amount, 0); + let (addr, _) = create_block(&chain_config, &mut wallet, vec![], block1_amount, 0); + let utxo = make_address_output(addr.clone(), block1_amount); let pool_ids = wallet.get_pool_ids(acc_0_index, WalletPoolsFilter::All).unwrap(); assert!(pool_ids.is_empty()); @@ -4281,8 +4283,17 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { // remove the signatures and try to sign it again let tx = stake_pool_transaction.transaction().clone(); + let inps = tx.inputs().len(); + let ptx = PartiallySignedTransaction::new( + tx, + vec![None; inps], + vec![Some((utxo, UtxoAdditionalInfo::NoAdditionalInfo))], + vec![Some(addr.into_object())], + None, + ) + .unwrap(); let stake_pool_transaction = wallet - .sign_raw_transaction(acc_0_index, TransactionToSign::Tx(tx)) + .sign_raw_transaction(acc_0_index, ptx) .unwrap() .0 .into_signed_tx() @@ -4314,20 +4325,14 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { // Try to sign decommission request with wrong account let sign_from_acc0_res = wallet - .sign_raw_transaction( - acc_0_index, - TransactionToSign::Partial(decommission_partial_tx.clone()), - ) + .sign_raw_transaction(acc_0_index, decommission_partial_tx.clone()) .unwrap() .0; // the tx is still not fully signed assert!(!sign_from_acc0_res.all_signatures_available()); let signed_tx = wallet - .sign_raw_transaction( - acc_1_index, - TransactionToSign::Partial(decommission_partial_tx), - ) + .sign_raw_transaction(acc_1_index, decommission_partial_tx) .unwrap() .0 .into_signed_tx() @@ -4410,10 +4415,7 @@ fn sign_decommission_pool_request_cold_wallet(#[case] seed: Seed) { // sign the tx with cold wallet let partially_signed_transaction = cold_wallet - .sign_raw_transaction( - DEFAULT_ACCOUNT_INDEX, - TransactionToSign::Partial(decommission_partial_tx), - ) + .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, decommission_partial_tx) .unwrap() .0; assert!(partially_signed_transaction.all_signatures_available()); @@ -4421,10 +4423,7 @@ fn sign_decommission_pool_request_cold_wallet(#[case] seed: Seed) { // sign it with the hot wallet should leave the signatures in place even if it can't find the // destinations for the inputs let partially_signed_transaction = hot_wallet - .sign_raw_transaction( - DEFAULT_ACCOUNT_INDEX, - TransactionToSign::Partial(partially_signed_transaction), - ) + .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, partially_signed_transaction) .unwrap() .0; assert!(partially_signed_transaction.all_signatures_available()); @@ -4584,10 +4583,7 @@ fn sign_send_request_cold_wallet(#[case] seed: Seed) { // Try to sign request with the hot wallet let tx = hot_wallet - .sign_raw_transaction( - DEFAULT_ACCOUNT_INDEX, - TransactionToSign::Partial(send_req.clone()), - ) + .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, send_req.clone()) .unwrap() .0; // the tx is not fully signed @@ -4595,7 +4591,7 @@ fn sign_send_request_cold_wallet(#[case] seed: Seed) { // sign the tx with cold wallet let signed_tx = cold_wallet - .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, TransactionToSign::Partial(send_req)) + .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, send_req) .unwrap() .0 .into_signed_tx() @@ -4817,41 +4813,41 @@ fn test_add_standalone_multisig(#[case] seed: Seed) { )], ) .unwrap(); + let spend_multisig_tx = PartiallySignedTransaction::new( + spend_multisig_tx, + vec![None; 1], + vec![Some(( + tx.outputs()[0].clone(), + UtxoAdditionalInfo::NoAdditionalInfo, + ))], + vec![Some(multisig_address.as_object().clone())], + None, + ) + .unwrap(); // sign it with wallet1 - let (ptx, _, statuses) = wallet1 - .sign_raw_transaction( - DEFAULT_ACCOUNT_INDEX, - TransactionToSign::Tx(spend_multisig_tx), - ) - .unwrap(); + let (ptx, _, statuses) = + wallet1.sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, spend_multisig_tx).unwrap(); // check it is still not fully signed assert!(ptx.all_signatures_available()); assert!(!statuses.iter().all(|s| *s == SignatureStatus::FullySigned)); // try to sign it with wallet1 again - let (ptx, _, statuses) = wallet1 - .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, TransactionToSign::Partial(ptx)) - .unwrap(); + let (ptx, _, statuses) = wallet1.sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, ptx).unwrap(); // check it is still not fully signed assert!(ptx.all_signatures_available()); assert!(!statuses.iter().all(|s| *s == SignatureStatus::FullySigned)); // try to sign it with wallet2 but wallet2 does not have the multisig added as standalone - let ptx = wallet2 - .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, TransactionToSign::Partial(ptx)) - .unwrap() - .0; + let ptx = wallet2.sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, ptx).unwrap().0; // add it to wallet2 as well wallet2.add_standalone_multisig(DEFAULT_ACCOUNT_INDEX, challenge, None).unwrap(); // now we can sign it - let (ptx, _, statuses) = wallet2 - .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, TransactionToSign::Partial(ptx)) - .unwrap(); + let (ptx, _, statuses) = wallet2.sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, ptx).unwrap(); // now it is fully signed assert!(ptx.all_signatures_available()); @@ -4970,7 +4966,12 @@ fn create_htlc_and_spend(#[case] seed: Seed) { vec![TxOutput::Transfer(output_value, address2.into_object())], ) .unwrap(); - let spend_utxos = vec![create_htlc_tx.transaction().outputs().first().cloned()]; + let spend_utxos = vec![create_htlc_tx + .transaction() + .outputs() + .first() + .cloned() + .map(|out| (out, UtxoAdditionalInfo::NoAdditionalInfo))]; let spend_ptx = PartiallySignedTransaction::new( spend_tx, vec![None], @@ -4980,9 +4981,8 @@ fn create_htlc_and_spend(#[case] seed: Seed) { ) .unwrap(); - let (spend_ptx, _, new_statuses) = wallet2 - .sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, TransactionToSign::Partial(spend_ptx)) - .unwrap(); + let (spend_ptx, _, new_statuses) = + wallet2.sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, spend_ptx).unwrap(); assert_eq!(vec![SignatureStatus::FullySigned], new_statuses); let spend_tx = spend_ptx.into_signed_tx().unwrap(); @@ -5068,7 +5068,12 @@ fn create_htlc_and_refund(#[case] seed: Seed) { vec![TxOutput::Transfer(output_value, address1.into_object())], ) .unwrap(); - let refund_utxos = vec![create_htlc_tx.transaction().outputs().first().cloned()]; + let refund_utxos = vec![create_htlc_tx + .transaction() + .outputs() + .first() + .cloned() + .map(|out| (out, UtxoAdditionalInfo::NoAdditionalInfo))]; let refund_ptx = PartiallySignedTransaction::new( refund_tx, vec![None], @@ -5110,12 +5115,8 @@ fn create_htlc_and_refund(#[case] seed: Seed) { .unwrap(); assert_eq!(wallet2_multisig_utxos.len(), 1); - let (refund_ptx, prev_statuses, new_statuses) = wallet2 - .sign_raw_transaction( - DEFAULT_ACCOUNT_INDEX, - TransactionToSign::Partial(refund_ptx), - ) - .unwrap(); + let (refund_ptx, prev_statuses, new_statuses) = + wallet2.sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, refund_ptx).unwrap(); assert_eq!(vec![SignatureStatus::NotSigned], prev_statuses); assert_eq!( @@ -5126,12 +5127,8 @@ fn create_htlc_and_refund(#[case] seed: Seed) { new_statuses ); - let (refund_ptx, prev_statuses, new_statuses) = wallet1 - .sign_raw_transaction( - DEFAULT_ACCOUNT_INDEX, - TransactionToSign::Partial(refund_ptx), - ) - .unwrap(); + let (refund_ptx, prev_statuses, new_statuses) = + wallet1.sign_raw_transaction(DEFAULT_ACCOUNT_INDEX, refund_ptx).unwrap(); assert_eq!( vec![SignatureStatus::PartialMultisig { required_signatures: 2, diff --git a/wallet/wallet-controller/Cargo.toml b/wallet/wallet-controller/Cargo.toml index 04741d42d9..a1a0c055ec 100644 --- a/wallet/wallet-controller/Cargo.toml +++ b/wallet/wallet-controller/Cargo.toml @@ -22,6 +22,7 @@ randomness = { path = "../../randomness" } serialization = { path = "../../serialization" } storage = { path = "../../storage" } storage-inmemory = { path = "../../storage/inmemory" } +pos-accounting = { path = "../../pos-accounting" } utils = { path = "../../utils" } utils-networking = { path = "../../utils/networking" } wallet = { path = ".." } diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs new file mode 100644 index 0000000000..f3771a2143 --- /dev/null +++ b/wallet/wallet-controller/src/helpers.rs @@ -0,0 +1,279 @@ +// Copyright (c) 2023 RBB S.r.l +// opensource@mintlayer.org +// SPDX-License-Identifier: MIT +// Licensed under the MIT License; +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Common code for read and synced controllers + +use std::collections::BTreeMap; + +use common::{ + address::RpcAddress, + chain::{ + output_value::OutputValue, + partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, + tokens::{RPCTokenInfo, TokenId}, + ChainConfig, Destination, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, + }, + primitives::{amount::RpcAmountOut, Amount}, +}; +use futures::{ + stream::{FuturesOrdered, FuturesUnordered}, + TryStreamExt, +}; +use node_comm::node_traits::NodeInterface; +use wallet::{ + account::currency_grouper::Currency, + destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, + WalletError, +}; + +use crate::{types::Balances, ControllerError, WalletType2}; + +pub async fn fetch_token_info( + rpc_client: &T, + token_id: TokenId, +) -> Result> { + rpc_client + .get_token_info(token_id) + .await + .map_err(ControllerError::NodeCallError)? + .ok_or(ControllerError::WalletError(WalletError::UnknownTokenId( + token_id, + ))) +} + +pub async fn fetch_utxo( + rpc_client: &T, + input: &UtxoOutPoint, + wallet: &WalletType2, +) -> Result> { + // search locally for the unspent utxo + if let Some(out) = match &wallet { + WalletType2::Software(w) => w.find_unspent_utxo_with_destination(input), + #[cfg(feature = "trezor")] + WalletType2::Trezor(w) => w.find_unspent_utxo_with_destination(input), + } { + return Ok(out.0); + } + + // check the chainstate + rpc_client + .get_utxo(input.clone()) + .await + .map_err(ControllerError::NodeCallError)? + .ok_or(ControllerError::WalletError(WalletError::CannotFindUtxo( + input.clone(), + ))) +} + +pub async fn fetch_utxo_with_destination( + rpc_client: &T, + input: &UtxoOutPoint, + wallet: &WalletType2, +) -> Result<(TxOutput, Destination), ControllerError> { + // search locally for the unspent utxo + if let Some(out) = match &wallet { + WalletType2::Software(w) => w.find_unspent_utxo_with_destination(input), + #[cfg(feature = "trezor")] + WalletType2::Trezor(w) => w.find_unspent_utxo_with_destination(input), + } { + return Ok(out); + } + + // check the chainstate + let utxo = rpc_client + .get_utxo(input.clone()) + .await + .map_err(ControllerError::NodeCallError)? + .ok_or(ControllerError::WalletError(WalletError::CannotFindUtxo( + input.clone(), + )))?; + + let pool_id = pool_id_from_txo(&utxo); + let dest = if let Some(pool_id) = pool_id { + rpc_client + .get_pool_data(pool_id) + .await + .map_err(ControllerError::NodeCallError)? + .map(|data| data.decommission_destination().clone()) + } else { + // FIXME + get_tx_output_destination(&utxo, &|_| None, HtlcSpendingCondition::Skip) + } + .ok_or(ControllerError::WalletError(WalletError::CannotFindUtxo( + input.clone(), + )))?; + + Ok((utxo, dest)) +} + +fn pool_id_from_txo(utxo: &TxOutput) -> Option { + match utxo { + TxOutput::CreateStakePool(pool_id, _) | TxOutput::ProduceBlockFromStake(_, pool_id) => { + Some(*pool_id) + } + TxOutput::Burn(_) + | TxOutput::Transfer(_, _) + | TxOutput::LockThenTransfer(_, _, _) + | TxOutput::Htlc(_, _) + | TxOutput::AnyoneCanTake(_) + | TxOutput::IssueNft(_, _, _) + | TxOutput::IssueFungibleToken(_) + | TxOutput::DelegateStaking(_, _) + | TxOutput::CreateDelegationId(_, _) + | TxOutput::DataDeposit(_) => None, + } +} + +pub async fn fetch_utxo_exra_info( + rpc_client: &T, + utxo: TxOutput, +) -> Result<(TxOutput, UtxoAdditionalInfo), ControllerError> +where + T: NodeInterface, +{ + match &utxo { + TxOutput::Burn(value) + | TxOutput::Transfer(value, _) + | TxOutput::LockThenTransfer(value, _, _) + | TxOutput::Htlc(value, _) => match value { + OutputValue::Coin(_) | OutputValue::TokenV0(_) => { + Ok((utxo, UtxoAdditionalInfo::NoAdditionalInfo)) + } + OutputValue::TokenV1(token_id, _) => { + let info = fetch_token_info(rpc_client, *token_id).await?; + Ok(( + utxo, + UtxoAdditionalInfo::TokenInfo { + num_decimals: info.token_number_of_decimals(), + ticker: info.token_ticker(), + }, + )) + } + }, + TxOutput::AnyoneCanTake(order) => match order.ask() { + OutputValue::Coin(_) | OutputValue::TokenV0(_) => { + Ok((utxo, UtxoAdditionalInfo::NoAdditionalInfo)) + } + OutputValue::TokenV1(token_id, _) => { + let info = fetch_token_info(rpc_client, *token_id).await?; + Ok(( + utxo, + UtxoAdditionalInfo::TokenInfo { + num_decimals: info.token_number_of_decimals(), + ticker: info.token_ticker(), + }, + )) + } + }, + TxOutput::ProduceBlockFromStake(_, pool_id) => { + let staker_balance = rpc_client + .get_staker_balance(*pool_id) + .await + .map_err(ControllerError::NodeCallError)? + .ok_or(WalletError::UnknownPoolId(*pool_id))?; + Ok((utxo, UtxoAdditionalInfo::PoolInfo { staker_balance })) + } + TxOutput::IssueNft(_, _, _) + | TxOutput::IssueFungibleToken(_) + | TxOutput::CreateStakePool(_, _) + | TxOutput::DelegateStaking(_, _) + | TxOutput::CreateDelegationId(_, _) + | TxOutput::DataDeposit(_) => Ok((utxo, UtxoAdditionalInfo::NoAdditionalInfo)), + } +} + +pub async fn into_balances( + rpc_client: &T, + chain_config: &ChainConfig, + mut balances: BTreeMap, +) -> Result> { + let coins = balances.remove(&Currency::Coin).unwrap_or(Amount::ZERO); + let coins = RpcAmountOut::from_amount_no_padding(coins, chain_config.coin_decimals()); + + let tasks: FuturesUnordered<_> = balances + .into_iter() + .map(|(currency, amount)| async move { + let token_id = match currency { + Currency::Coin => panic!("Removed just above"), + Currency::Token(token_id) => token_id, + }; + + fetch_token_info(rpc_client, token_id).await.map(|info| { + let decimals = info.token_number_of_decimals(); + let amount = RpcAmountOut::from_amount_no_padding(amount, decimals); + let token_id = RpcAddress::new(chain_config, token_id).expect("addressable"); + (token_id, amount) + }) + }) + .collect(); + + Ok(Balances::new(coins, tasks.try_collect().await?)) +} + +pub async fn tx_to_partially_signed_tx( + rpc_client: &T, + wallet: &WalletType2, + tx: Transaction, +) -> Result> { + let tasks: FuturesOrdered<_> = tx + .inputs() + .iter() + .map(|inp| into_utxo_and_destination(rpc_client, wallet, inp)) + .collect(); + let (input_utxos, destinations) = tasks.try_collect::>().await?.into_iter().unzip(); + let num_inputs = tx.inputs().len(); + + let ptx = PartiallySignedTransaction::new( + tx, + vec![None; num_inputs], + input_utxos, + destinations, + None, + ) + .map_err(WalletError::TransactionCreation)?; + Ok(ptx) +} + +async fn into_utxo_and_destination( + rpc_client: &T, + wallet: &WalletType2, + tx_inp: &TxInput, +) -> Result<(Option<(TxOutput, UtxoAdditionalInfo)>, Option), ControllerError> { + Ok(match tx_inp { + TxInput::Utxo(outpoint) => { + let (utxo, dest) = fetch_utxo_with_destination(rpc_client, outpoint, wallet).await?; + let utxo_with_extra_info = fetch_utxo_exra_info(rpc_client, utxo).await?; + (Some(utxo_with_extra_info), Some(dest)) + } + TxInput::Account(acc_outpoint) => { + // find delegation destination + let dest = match &wallet { + WalletType2::Software(w) => w.find_account_destination(acc_outpoint), + #[cfg(feature = "trezor")] + WalletType2::Trezor(w) => w.find_account_destination(acc_outpoint), + }; + (None, dest) + } + TxInput::AccountCommand(_, cmd) => { + // find authority of the token + let dest = match &wallet { + WalletType2::Software(w) => w.find_account_command_destination(cmd), + #[cfg(feature = "trezor")] + WalletType2::Trezor(w) => w.find_account_command_destination(cmd), + }; + (None, dest) + } + }) +} diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index c62a4ccb4b..1b4f7f7437 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -15,6 +15,7 @@ //! Common code for wallet UI applications +mod helpers; pub mod mnemonic; pub mod read; mod sync; @@ -28,11 +29,8 @@ use blockprod::BlockProductionError; use chainstate::tx_verifier::{ self, error::ScriptError, input_check::signature_only_check::SignatureOnlyVerifiable, }; -use futures::{ - never::Never, - stream::{FuturesOrdered, FuturesUnordered}, - TryStreamExt, -}; +use futures::{never::Never, stream::FuturesOrdered, TryStreamExt}; +use helpers::{fetch_token_info, fetch_utxo, fetch_utxo_exra_info, into_balances}; use node_comm::rpc_client::ColdWalletClient; use std::{ collections::{BTreeMap, BTreeSet}, @@ -54,18 +52,17 @@ use sync::InSync; use synced_controller::SyncedController; use common::{ - address::{AddressError, RpcAddress}, + address::AddressError, chain::{ block::timestamp::BlockTimestamp, htlc::HtlcSecret, - partially_signed_transaction::PartiallySignedTransaction, + partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, signature::{inputsig::InputWitness, DestinationSigError, Transactable}, tokens::{RPCTokenInfo, TokenId}, Block, ChainConfig, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, SignedTransaction, Transaction, TxInput, TxOutput, UtxoOutPoint, }, primitives::{ - amount::RpcAmountOut, time::{get_time, Time}, Amount, BlockHeight, Id, Idable, }, @@ -982,9 +979,11 @@ where &self, ptx: PartiallySignedTransaction, ) -> Result> { - let input_utxos: Vec<_> = ptx.input_utxos().iter().flatten().cloned().collect(); + let input_utxos: Vec<_> = + ptx.input_utxos().iter().flatten().map(|(utxo, _)| utxo).cloned().collect(); let fees = self.get_fees(&input_utxos, ptx.tx().outputs()).await?; - let inputs_utxos_refs: Vec<_> = ptx.input_utxos().iter().map(|out| out.as_ref()).collect(); + let inputs_utxos_refs: Vec<_> = + ptx.input_utxos().iter().map(|out| out.as_ref().map(|(utxo, _)| utxo)).collect(); let signature_statuses: Vec<_> = ptx .witnesses() .iter() @@ -1121,6 +1120,7 @@ where .collect::, WalletError>>() .map_err(ControllerError::WalletError)?; + let input_utxos = self.fetch_utxos_extra_info(input_utxos).await?; let tx = PartiallySignedTransaction::new( tx, vec![None; num_inputs], @@ -1201,29 +1201,24 @@ where &self, inputs: &[UtxoOutPoint], ) -> Result, ControllerError> { - let tasks: FuturesOrdered<_> = inputs.iter().map(|input| self.fetch_utxo(input)).collect(); + let tasks: FuturesOrdered<_> = inputs + .iter() + .map(|input| fetch_utxo(&self.rpc_client, input, &self.wallet)) + .collect(); let input_utxos: Vec = tasks.try_collect().await?; Ok(input_utxos) } - async fn fetch_utxo(&self, input: &UtxoOutPoint) -> Result> { - // search locally for the unspent utxo - if let Some(out) = match &self.wallet { - WalletType2::Software(w) => w.find_unspent_utxo_with_destination(input), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.find_unspent_utxo_with_destination(input), - } { - return Ok(out.0); - } - - // check the chainstate - self.rpc_client - .get_utxo(input.clone()) - .await - .map_err(ControllerError::NodeCallError)? - .ok_or(ControllerError::WalletError(WalletError::CannotFindUtxo( - input.clone(), - ))) + async fn fetch_utxos_extra_info( + &self, + inputs: Vec, + ) -> Result, ControllerError> { + let tasks: FuturesOrdered<_> = inputs + .into_iter() + .map(|input| fetch_utxo_exra_info(&self.rpc_client, input)) + .collect(); + let input_utxos: Vec<(TxOutput, UtxoAdditionalInfo)> = tasks.try_collect().await?; + Ok(input_utxos) } async fn fetch_opt_utxo( @@ -1231,7 +1226,7 @@ where input: &TxInput, ) -> Result, ControllerError> { match input { - TxInput::Utxo(utxo) => self.fetch_utxo(utxo).await.map(Some), + TxInput::Utxo(utxo) => fetch_utxo(&self.rpc_client, utxo, &self.wallet).await.map(Some), TxInput::Account(_) => Ok(None), TxInput::AccountCommand(_, _) => Ok(None), } @@ -1314,44 +1309,3 @@ where } } } - -pub async fn fetch_token_info( - rpc_client: &T, - token_id: TokenId, -) -> Result> { - rpc_client - .get_token_info(token_id) - .await - .map_err(ControllerError::NodeCallError)? - .ok_or(ControllerError::WalletError(WalletError::UnknownTokenId( - token_id, - ))) -} - -pub async fn into_balances( - rpc_client: &T, - chain_config: &ChainConfig, - mut balances: BTreeMap, -) -> Result> { - let coins = balances.remove(&Currency::Coin).unwrap_or(Amount::ZERO); - let coins = RpcAmountOut::from_amount_no_padding(coins, chain_config.coin_decimals()); - - let tasks: FuturesUnordered<_> = balances - .into_iter() - .map(|(currency, amount)| async move { - let token_id = match currency { - Currency::Coin => panic!("Removed just above"), - Currency::Token(token_id) => token_id, - }; - - fetch_token_info(rpc_client, token_id).await.map(|info| { - let decimals = info.token_number_of_decimals(); - let amount = RpcAmountOut::from_amount_no_padding(amount, decimals); - let token_id = RpcAddress::new(chain_config, token_id).expect("addressable"); - (token_id, amount) - }) - }) - .collect(); - - Ok(Balances::new(coins, tasks.try_collect().await?)) -} diff --git a/wallet/wallet-controller/src/sync/tests/mod.rs b/wallet/wallet-controller/src/sync/tests/mod.rs index e3c41e2b27..0a7e3a085c 100644 --- a/wallet/wallet-controller/src/sync/tests/mod.rs +++ b/wallet/wallet-controller/src/sync/tests/mod.rs @@ -40,6 +40,7 @@ use node_comm::{ rpc_client::NodeRpcError, }; use p2p_types::{bannable_address::BannableAddress, socket_address::SocketAddress}; +use pos_accounting::PoolData; use randomness::{seq::IteratorRandom, CryptoRng, Rng}; use rstest::rstest; use test_utils::random::{make_seedable_rng, Seed}; @@ -275,6 +276,10 @@ impl NodeInterface for MockNode { unreachable!() } + async fn get_pool_data(&self, _pool_id: PoolId) -> Result, Self::Error> { + unreachable!() + } + async fn get_delegation_share( &self, _pool_id: PoolId, diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 2115e90fce..f53cf41c7c 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -63,7 +63,7 @@ use wallet_types::{ }; use crate::{ - into_balances, + helpers::{fetch_token_info, fetch_utxo, into_balances, tx_to_partially_signed_tx}, types::{Balances, GenericCurrencyTransfer}, ControllerConfig, ControllerError, WalletType2, }; @@ -104,25 +104,14 @@ where } } - pub async fn get_token_info( - &self, - token_id: TokenId, - ) -> Result> { - self.rpc_client - .get_token_info(token_id) - .await - .map_err(ControllerError::NodeCallError)? - .ok_or(ControllerError::WalletError(WalletError::UnknownTokenId( - token_id, - ))) - } - async fn fetch_token_infos( &self, tokens: BTreeSet, ) -> Result, ControllerError> { - let tasks: FuturesUnordered<_> = - tokens.into_iter().map(|token_id| self.get_token_info(token_id)).collect(); + let tasks: FuturesUnordered<_> = tokens + .into_iter() + .map(|token_id| fetch_token_info(&self.rpc_client, token_id)) + .collect(); tasks.try_collect().await } @@ -175,7 +164,7 @@ where let mut result = vec![]; for utxo in input_utxos { if let Some(token_id) = utxo.2 { - let token_info = self.get_token_info(token_id).await?; + let token_info = fetch_token_info(&self.rpc_client, token_id).await?; let ok_to_use = match token_info { RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { @@ -829,7 +818,7 @@ where ) -> Result<(PartiallySignedTransaction, Balances), ControllerError> { let output = make_address_output(address, amount); - let utxo_output = self.fetch_utxo(&selected_utxo).await?; + let utxo_output = fetch_utxo(&self.rpc_client, &selected_utxo, self.wallet).await?; let change_address = if let Some(change_address) = change_address { change_address } else { @@ -915,7 +904,7 @@ where let mut result = Vec::new(); for (token_id, outputs_vec) in outputs { - let token_info = self.get_token_info(token_id).await?; + let token_info = fetch_token_info(&self.rpc_client, token_id).await?; match &token_info { RPCTokenInfo::FungibleToken(token_info) => { @@ -1483,7 +1472,7 @@ where /// Tries to sign any unsigned inputs of a raw or partially signed transaction with the private /// keys in this wallet. - pub fn sign_raw_transaction( + pub async fn sign_raw_transaction( &mut self, tx: TransactionToSign, ) -> Result< @@ -1494,10 +1483,17 @@ where ), ControllerError, > { + let ptx = match tx { + TransactionToSign::Partial(ptx) => ptx, + TransactionToSign::Tx(tx) => { + tx_to_partially_signed_tx(&self.rpc_client, self.wallet, tx).await? + } + }; + match &mut self.wallet { - WalletType2::Software(w) => w.sign_raw_transaction(self.account_index, tx), + WalletType2::Software(w) => w.sign_raw_transaction(self.account_index, ptx), #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.sign_raw_transaction(self.account_index, tx), + WalletType2::Trezor(w) => w.sign_raw_transaction(self.account_index, ptx), } .map_err(ControllerError::WalletError) } @@ -1687,16 +1683,4 @@ where let tx = self.broadcast_to_mempool_if_needed(tx).await?; Ok((tx, id)) } - - async fn fetch_utxo(&self, input: &UtxoOutPoint) -> Result> { - let utxo = self - .rpc_client - .get_utxo(input.clone()) - .await - .map_err(ControllerError::NodeCallError)?; - - utxo.ok_or(ControllerError::WalletError(WalletError::CannotFindUtxo( - input.clone(), - ))) - } } diff --git a/wallet/wallet-node-client/Cargo.toml b/wallet/wallet-node-client/Cargo.toml index 8970753a39..8d8741ee86 100644 --- a/wallet/wallet-node-client/Cargo.toml +++ b/wallet/wallet-node-client/Cargo.toml @@ -17,6 +17,7 @@ logging = { path = "../../logging" } mempool = { path = "../../mempool" } node-lib = { path = "../../node-lib" } p2p = { path = "../../p2p" } +pos-accounting = { path = "../../pos-accounting" } rpc = { path = "../../rpc" } serialization = { path = "../../serialization" } subsystem = { path = "../../subsystem" } diff --git a/wallet/wallet-node-client/src/handles_client/mod.rs b/wallet/wallet-node-client/src/handles_client/mod.rs index bbf589ae0c..fd6b918205 100644 --- a/wallet/wallet-node-client/src/handles_client/mod.rs +++ b/wallet/wallet-node-client/src/handles_client/mod.rs @@ -36,6 +36,7 @@ use p2p::{ types::{bannable_address::BannableAddress, peer_id::PeerId, socket_address::SocketAddress}, P2pHandle, }; +use pos_accounting::PoolData; use serialization::hex::HexError; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -196,6 +197,11 @@ impl NodeInterface for WalletHandlesClient { Ok(result) } + async fn get_pool_data(&self, pool_id: PoolId) -> Result, Self::Error> { + let result = self.chainstate.call(move |this| this.get_stake_pool_data(pool_id)).await??; + Ok(result) + } + async fn get_delegation_share( &self, pool_id: PoolId, diff --git a/wallet/wallet-node-client/src/node_traits.rs b/wallet/wallet-node-client/src/node_traits.rs index 282645a811..369f064e49 100644 --- a/wallet/wallet-node-client/src/node_traits.rs +++ b/wallet/wallet-node-client/src/node_traits.rs @@ -30,6 +30,7 @@ use crypto::ephemeral_e2e::EndToEndPublicKey; use mempool::{tx_accumulator::PackingStrategy, tx_options::TxOptionsOverrides, FeeRate}; use p2p::types::{bannable_address::BannableAddress, socket_address::SocketAddress}; pub use p2p::{interface::types::ConnectedPeer, types::peer_id::PeerId}; +use pos_accounting::PoolData; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -65,6 +66,7 @@ pub trait NodeInterface { ) -> Result, BlockHeight)>, Self::Error>; async fn get_stake_pool_balance(&self, pool_id: PoolId) -> Result, Self::Error>; async fn get_staker_balance(&self, pool_id: PoolId) -> Result, Self::Error>; + async fn get_pool_data(&self, pool_id: PoolId) -> Result, Self::Error>; async fn get_delegation_share( &self, pool_id: PoolId, diff --git a/wallet/wallet-node-client/src/rpc_client/client_impl.rs b/wallet/wallet-node-client/src/rpc_client/client_impl.rs index 804d81e3c9..63f4dc28a7 100644 --- a/wallet/wallet-node-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-node-client/src/rpc_client/client_impl.rs @@ -24,7 +24,7 @@ use common::{ Block, DelegationId, GenBlock, OrderId, PoolId, RpcOrderInfo, SignedTransaction, Transaction, TxOutput, UtxoOutPoint, }, - primitives::{time::Time, Amount, BlockHeight, Id}, + primitives::{per_thousand::PerThousand, time::Time, Amount, BlockHeight, Id}, }; use consensus::GenerateBlockInputData; use crypto::ephemeral_e2e::EndToEndPublicKey; @@ -36,6 +36,7 @@ use p2p::{ rpc::P2pRpcClient, types::{bannable_address::BannableAddress, peer_id::PeerId, socket_address::SocketAddress}, }; +use pos_accounting::PoolData; use serialization::hex_encoded::HexEncoded; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -141,6 +142,24 @@ impl NodeInterface for NodeRpcClient { .map_err(NodeRpcError::ResponseError) } + async fn get_pool_data(&self, pool_id: PoolId) -> Result, Self::Error> { + let pool_address = Address::new(&self.chain_config, pool_id)?; + ChainstateRpcClient::pool_data(&self.http_client, pool_address.into_string()) + .await + .map_err(NodeRpcError::ResponseError)? + .map(|d| { + Ok(PoolData::new( + d.decommission_key.decode_object(&self.chain_config)?, + d.pledge.amount(), + d.rewards.amount(), + d.vrf_public_key.decode_object(&self.chain_config)?, + PerThousand::from_decimal_str(&d.margin_ratio_per_thousand)?, + d.cost_per_block.amount(), + )) + }) + .transpose() + } + async fn get_delegation_share( &self, pool_id: PoolId, diff --git a/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs b/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs index 12ae3c13be..2b240fcf31 100644 --- a/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs +++ b/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs @@ -32,6 +32,7 @@ use p2p::{ interface::types::ConnectedPeer, types::{bannable_address::BannableAddress, socket_address::SocketAddress, PeerId}, }; +use pos_accounting::PoolData; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -119,6 +120,10 @@ impl NodeInterface for ColdWalletClient { Err(ColdWalletRpcError::NotAvailable) } + async fn get_pool_data(&self, _pool_id: PoolId) -> Result, Self::Error> { + Err(ColdWalletRpcError::NotAvailable) + } + async fn get_delegation_share( &self, _pool_id: PoolId, diff --git a/wallet/wallet-node-client/src/rpc_client/mod.rs b/wallet/wallet-node-client/src/rpc_client/mod.rs index 3e646cc750..c24021e9b5 100644 --- a/wallet/wallet-node-client/src/rpc_client/mod.rs +++ b/wallet/wallet-node-client/src/rpc_client/mod.rs @@ -20,6 +20,7 @@ use std::sync::Arc; use common::address::AddressError; use common::chain::ChainConfig; +use common::primitives::per_thousand::PerThousandParseError; use rpc::new_http_client; use rpc::ClientError; use rpc::RpcAuthData; @@ -39,6 +40,8 @@ pub enum NodeRpcError { ResponseError(ClientError), #[error("Address error: {0}")] AddressError(#[from] AddressError), + #[error("PerThousand parse error: {0}")] + PerThousandParseError(#[from] PerThousandParseError), } #[derive(Clone, Debug)] diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index 88bf17f34e..c1c7a16985 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -841,6 +841,7 @@ where .synced_controller(account_index, config) .await? .sign_raw_transaction(tx_to_sign) + .await .map_err(RpcError::Controller) }) }) @@ -1228,6 +1229,7 @@ where let (tx, _, cur_signatures) = synced_controller .sign_raw_transaction(TransactionToSign::Partial(tx)) + .await .map_err(RpcError::Controller)?; Ok::<_, RpcError>((tx, cur_signatures, fees)) From 0023d11a931b71a97f02e3e0c417db8af90b8724 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 7 Aug 2024 12:39:03 +0200 Subject: [PATCH 20/48] update RPC docs --- node-daemon/docs/RPC.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/node-daemon/docs/RPC.md b/node-daemon/docs/RPC.md index e180cbe9a5..d202ef5185 100644 --- a/node-daemon/docs/RPC.md +++ b/node-daemon/docs/RPC.md @@ -347,6 +347,41 @@ EITHER OF 2) null ``` +### Method `chainstate_pool_data` + +Returns the pool data of the pool associated with the given pool address. + +Returns `None` (null) if the pool is not found. + + +Parameters: +``` +{ "pool_address": string } +``` + +Returns: +``` +EITHER OF + 1) { + "pledge": { + "atoms": number string, + "decimal": decimal string, + }, + "rewards": { + "atoms": number string, + "decimal": decimal string, + }, + "vrf_public_key": bech32 string, + "decommission_key": bech32 string, + "margin_ratio_per_thousand": string, + "cost_per_block": { + "atoms": number string, + "decimal": decimal string, + }, + } + 2) null +``` + ### Method `chainstate_delegation_share` Given a pool defined by a pool address, and a delegation address, From e6450d084a0607850df07d935565b6275595ac05 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Thu, 15 Aug 2024 15:55:53 +0200 Subject: [PATCH 21/48] add additional token info for utxos in partially signed tx --- common/src/chain/tokens/tokens_utils.rs | 20 ++ rpc/types/src/string.rs | 4 + wallet/src/account/mod.rs | 16 +- wallet/src/account/output_cache/mod.rs | 114 +++--- wallet/src/send_request/mod.rs | 65 +++- wallet/src/signer/software_signer/tests.rs | 3 +- wallet/src/signer/trezor_signer/tests.rs | 2 +- wallet/src/wallet/mod.rs | 324 ++++++++++++------ wallet/src/wallet/tests.rs | 177 +++++++--- .../src/synced_controller.rs | 75 ++-- 10 files changed, 557 insertions(+), 243 deletions(-) diff --git a/common/src/chain/tokens/tokens_utils.rs b/common/src/chain/tokens/tokens_utils.rs index ffbaa60486..626cc0c7fb 100644 --- a/common/src/chain/tokens/tokens_utils.rs +++ b/common/src/chain/tokens/tokens_utils.rs @@ -88,3 +88,23 @@ pub fn is_token_or_nft_issuance(output: &TxOutput) -> bool { TxOutput::IssueFungibleToken(_) | TxOutput::IssueNft(_, _, _) => true, } } + +pub fn get_token_id_for_tx_output(output: &TxOutput, inputs: &[TxInput]) -> Option { + match output { + TxOutput::Transfer(v, _) | TxOutput::LockThenTransfer(v, _, _) | TxOutput::Burn(v) => { + match v { + OutputValue::Coin(_) | OutputValue::TokenV0(_) => None, + OutputValue::TokenV1(token_id, _) => Some(*token_id), + } + } + TxOutput::CreateStakePool(_, _) + | TxOutput::ProduceBlockFromStake(_, _) + | TxOutput::CreateDelegationId(_, _) + | TxOutput::DelegateStaking(_, _) + | TxOutput::DataDeposit(_) + | TxOutput::Htlc(_, _) + | TxOutput::IssueFungibleToken(_) + | TxOutput::CreateOrder(_) => None, + TxOutput::IssueNft(_, _, _) => make_token_id(inputs), + } +} diff --git a/rpc/types/src/string.rs b/rpc/types/src/string.rs index c93ec4ee40..e609b49977 100644 --- a/rpc/types/src/string.rs +++ b/rpc/types/src/string.rs @@ -112,6 +112,10 @@ impl RpcString { self.0 } + pub fn as_bytes(&self) -> &[u8] { + &self.0 + } + pub fn try_into_string(self) -> Result { String::from_utf8(self.0).map_err(|e| { let err = e.utf8_error(); diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index 95554802db..92c1e233b2 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -648,7 +648,7 @@ impl Account { )?; let fees = request.get_fees(); - let ptx = request.into_partially_signed_tx()?; + let ptx = request.into_partially_signed_tx(&BTreeMap::new())?; Ok((ptx, fees)) } @@ -891,7 +891,7 @@ impl Account { pub fn get_token_unconfirmed_info( &self, - token_info: &RPCFungibleTokenInfo, + token_info: RPCFungibleTokenInfo, ) -> WalletResult { self.output_cache .get_token_unconfirmed_info(token_info, |destination: &Destination| { @@ -1127,7 +1127,7 @@ impl Account { median_time: BlockTimestamp, fee_rate: CurrentFeeRate, ) -> WalletResult { - let token_id = *token_info.token_id(); + let token_id = token_info.token_id(); let outputs = make_mint_token_outputs(token_id, amount, address); token_info.check_can_mint(amount)?; @@ -1154,7 +1154,7 @@ impl Account { median_time: BlockTimestamp, fee_rate: CurrentFeeRate, ) -> WalletResult { - let token_id = *token_info.token_id(); + let token_id = token_info.token_id(); let outputs = make_unmint_token_outputs(token_id, amount); token_info.check_can_unmint(amount)?; @@ -1180,7 +1180,7 @@ impl Account { median_time: BlockTimestamp, fee_rate: CurrentFeeRate, ) -> WalletResult { - let token_id = *token_info.token_id(); + let token_id = token_info.token_id(); token_info.check_can_lock()?; let nonce = token_info.get_next_nonce()?; @@ -1210,7 +1210,7 @@ impl Account { let nonce = token_info.get_next_nonce()?; let tx_input = TxInput::AccountCommand( nonce, - AccountCommand::FreezeToken(*token_info.token_id(), is_token_unfreezable), + AccountCommand::FreezeToken(token_info.token_id(), is_token_unfreezable), ); let authority = token_info.authority()?.clone(); @@ -1235,7 +1235,7 @@ impl Account { let nonce = token_info.get_next_nonce()?; let tx_input = - TxInput::AccountCommand(nonce, AccountCommand::UnfreezeToken(*token_info.token_id())); + TxInput::AccountCommand(nonce, AccountCommand::UnfreezeToken(token_info.token_id())); let authority = token_info.authority()?.clone(); self.change_token_supply_transaction( @@ -1261,7 +1261,7 @@ impl Account { let nonce = token_info.get_next_nonce()?; let tx_input = TxInput::AccountCommand( nonce, - AccountCommand::ChangeTokenAuthority(*token_info.token_id(), new_authority), + AccountCommand::ChangeTokenAuthority(token_info.token_id(), new_authority), ); let authority = token_info.authority()?.clone(); diff --git a/wallet/src/account/output_cache/mod.rs b/wallet/src/account/output_cache/mod.rs index b6f09c6892..e70f2ef936 100644 --- a/wallet/src/account/output_cache/mod.rs +++ b/wallet/src/account/output_cache/mod.rs @@ -26,9 +26,9 @@ use common::{ output_value::OutputValue, stakelock::StakePoolData, tokens::{ - is_token_or_nft_issuance, make_token_id, IsTokenFreezable, IsTokenUnfreezable, - RPCFungibleTokenInfo, RPCIsTokenFrozen, RPCTokenTotalSupply, TokenId, TokenIssuance, - TokenTotalSupply, + get_token_id_for_tx_output, make_token_id, IsTokenFreezable, IsTokenUnfreezable, + RPCFungibleTokenInfo, RPCIsTokenFrozen, RPCNonFungibleTokenInfo, RPCTokenTotalSupply, + TokenId, TokenIssuance, TokenTotalSupply, }, AccountCommand, AccountNonce, AccountSpending, DelegationId, Destination, GenBlock, OrderId, OutPointSourceId, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, @@ -268,36 +268,58 @@ pub struct FungibleTokenInfo { authority: Destination, } +/// Token info from the Node + any unconfirmed Txs from this wallet pub enum UnconfirmedTokenInfo { - OwnFungibleToken(TokenId, FungibleTokenInfo), - FungibleToken(TokenId, TokenFreezableState), - NonFungibleToken(TokenId), + /// Token info owned by this wallet + OwnFungibleToken(TokenId, FungibleTokenInfo, RPCFungibleTokenInfo), + /// Token info not owned by this wallet + FungibleToken(TokenId, TokenFreezableState, RPCFungibleTokenInfo), + /// NFT info + NonFungibleToken(TokenId, Box), } impl UnconfirmedTokenInfo { - pub fn token_id(&self) -> &TokenId { + pub fn token_id(&self) -> TokenId { match self { - Self::OwnFungibleToken(token_id, _) - | Self::FungibleToken(token_id, _) - | Self::NonFungibleToken(token_id) => token_id, + Self::OwnFungibleToken(token_id, _, _) + | Self::FungibleToken(token_id, _, _) + | Self::NonFungibleToken(token_id, _) => *token_id, + } + } + + pub fn num_decimals(&self) -> u8 { + match self { + Self::OwnFungibleToken(_, _, info) | Self::FungibleToken(_, _, info) => { + info.number_of_decimals + } + Self::NonFungibleToken(_, _) => 0, + } + } + + pub fn token_ticker(&self) -> &[u8] { + match self { + Self::OwnFungibleToken(_, _, info) | Self::FungibleToken(_, _, info) => { + info.token_ticker.as_bytes() + } + Self::NonFungibleToken(_, info) => info.metadata.ticker.as_bytes(), } } pub fn check_can_be_used(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state) => state.frozen.check_can_be_used(), - Self::FungibleToken(_, state) => state.check_can_be_used(), - Self::NonFungibleToken(_) => Ok(()), + Self::OwnFungibleToken(_, state, _) => state.frozen.check_can_be_used(), + Self::FungibleToken(_, state, _) => state.check_can_be_used(), + Self::NonFungibleToken(_, _) => Ok(()), } } pub fn check_can_freeze(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state) => state.frozen.check_can_freeze(), - Self::FungibleToken(token_id, _) => { + Self::OwnFungibleToken(_, state, _) => state.frozen.check_can_freeze(), + Self::FungibleToken(token_id, _, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } - Self::NonFungibleToken(token_id) => { + Self::NonFungibleToken(token_id, _) => { Err(WalletError::CannotChangeNonFungibleToken(*token_id)) } } @@ -305,11 +327,11 @@ impl UnconfirmedTokenInfo { pub fn check_can_unfreeze(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state) => state.frozen.check_can_unfreeze(), - Self::FungibleToken(token_id, _) => { + Self::OwnFungibleToken(_, state, _) => state.frozen.check_can_unfreeze(), + Self::FungibleToken(token_id, _, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } - Self::NonFungibleToken(token_id) => { + Self::NonFungibleToken(token_id, _) => { Err(WalletError::CannotChangeNonFungibleToken(*token_id)) } } @@ -317,14 +339,14 @@ impl UnconfirmedTokenInfo { pub fn get_next_nonce(&self) -> WalletResult { match self { - Self::OwnFungibleToken(token_id, state) => state + Self::OwnFungibleToken(token_id, state, _) => state .last_nonce .map_or(Some(AccountNonce::new(0)), |nonce| nonce.increment()) .ok_or(WalletError::TokenIssuanceNonceOverflow(*token_id)), - Self::FungibleToken(token_id, _) => { + Self::FungibleToken(token_id, _, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } - Self::NonFungibleToken(token_id) => { + Self::NonFungibleToken(token_id, _) => { Err(WalletError::CannotChangeNonFungibleToken(*token_id)) } } @@ -332,11 +354,11 @@ impl UnconfirmedTokenInfo { pub fn authority(&self) -> WalletResult<&Destination> { match self { - Self::OwnFungibleToken(_, state) => Ok(&state.authority), - Self::FungibleToken(token_id, _) => { + Self::OwnFungibleToken(_, state, _) => Ok(&state.authority), + Self::FungibleToken(token_id, _, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } - Self::NonFungibleToken(token_id) => { + Self::NonFungibleToken(token_id, _) => { Err(WalletError::CannotChangeNonFungibleToken(*token_id)) } } @@ -344,11 +366,11 @@ impl UnconfirmedTokenInfo { pub fn check_can_mint(&self, amount: Amount) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state) => state.total_supply.check_can_mint(amount), - Self::FungibleToken(token_id, _) => { + Self::OwnFungibleToken(_, state, _) => state.total_supply.check_can_mint(amount), + Self::FungibleToken(token_id, _, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } - Self::NonFungibleToken(token_id) => { + Self::NonFungibleToken(token_id, _) => { Err(WalletError::CannotChangeNonFungibleToken(*token_id)) } } @@ -356,11 +378,11 @@ impl UnconfirmedTokenInfo { pub fn check_can_unmint(&self, amount: Amount) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state) => state.total_supply.check_can_unmint(amount), - Self::FungibleToken(token_id, _) => { + Self::OwnFungibleToken(_, state, _) => state.total_supply.check_can_unmint(amount), + Self::FungibleToken(token_id, _, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } - Self::NonFungibleToken(token_id) => { + Self::NonFungibleToken(token_id, _) => { Err(WalletError::CannotChangeNonFungibleToken(*token_id)) } } @@ -368,11 +390,11 @@ impl UnconfirmedTokenInfo { pub fn check_can_lock(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state) => state.total_supply.check_can_lock(), - Self::FungibleToken(token_id, _) => { + Self::OwnFungibleToken(_, state, _) => state.total_supply.check_can_lock(), + Self::FungibleToken(token_id, _, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } - Self::NonFungibleToken(token_id) => { + Self::NonFungibleToken(token_id, _) => { Err(WalletError::CannotChangeNonFungibleToken(*token_id)) } } @@ -381,9 +403,9 @@ impl UnconfirmedTokenInfo { #[cfg(test)] pub fn current_supply(&self) -> Option { match self { - Self::OwnFungibleToken(_, state) => Some(state.total_supply.current_supply()), - Self::FungibleToken(_, _) => None, - Self::NonFungibleToken(_) => None, + Self::OwnFungibleToken(_, state, _) => Some(state.total_supply.current_supply()), + Self::FungibleToken(_, _, _) => None, + Self::NonFungibleToken(_, _) => None, } } } @@ -627,7 +649,7 @@ impl OutputCache { pub fn get_token_unconfirmed_info bool>( &self, - token_info: &RPCFungibleTokenInfo, + token_info: RPCFungibleTokenInfo, is_mine: F, ) -> WalletResult { let token_data = match self.token_issuance.get(&token_info.token_id) { @@ -636,6 +658,7 @@ impl OutputCache { return Ok(UnconfirmedTokenInfo::FungibleToken( token_info.token_id, token_info.frozen.into(), + token_info, )); } token_data @@ -645,6 +668,7 @@ impl OutputCache { return Ok(UnconfirmedTokenInfo::FungibleToken( token_info.token_id, token_info.frozen.into(), + token_info, )); } }; @@ -677,6 +701,7 @@ impl OutputCache { total_supply, authority: token_data.authority.clone(), }, + token_info, )) } @@ -1211,9 +1236,9 @@ impl OutputCache { ); let token_id = match tx { - WalletTx::Tx(tx_data) => is_token_or_nft_issuance(output) - .then_some(make_token_id(tx_data.get_transaction().inputs())) - .flatten(), + WalletTx::Tx(tx_data) => { + get_token_id_for_tx_output(output, tx_data.get_transaction().inputs()) + } WalletTx::Block(_) => None, }; @@ -1281,9 +1306,10 @@ impl OutputCache { }) .map(move |(output, outpoint)| { let token_id = match tx { - WalletTx::Tx(tx_data) => is_token_or_nft_issuance(output) - .then_some(make_token_id(tx_data.get_transaction().inputs())) - .flatten(), + WalletTx::Tx(tx_data) => get_token_id_for_tx_output( + output, + tx_data.get_transaction().inputs(), + ), WalletTx::Block(_) => None, }; (outpoint, (output, token_id)) diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 2bed743a92..a93da98922 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -21,7 +21,7 @@ use common::chain::output_value::OutputValue; use common::chain::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock::ForBlockCount; -use common::chain::tokens::{Metadata, TokenId, TokenIssuance}; +use common::chain::tokens::{Metadata, NftIssuance, TokenId, TokenIssuance}; use common::chain::{ ChainConfig, Destination, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, }; @@ -35,6 +35,12 @@ use crate::account::PoolData; use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; use crate::{WalletError, WalletResult}; +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub enum PoolOrTokenId { + PoolId(PoolId), + TokenId(TokenId), +} + /// The `SendRequest` struct provides the necessary information to the wallet /// on the precise method of sending funds to a designated destination. #[derive(Debug, Clone)] @@ -288,15 +294,53 @@ impl SendRequest { take(&mut self.fees) } - pub fn into_partially_signed_tx(self) -> WalletResult { + pub fn into_partially_signed_tx( + self, + additional_info: &BTreeMap, + ) -> WalletResult { let num_inputs = self.inputs.len(); let tx = Transaction::new(self.flags, self.inputs, self.outputs)?; let destinations = self.destinations.into_iter().map(Some).collect(); let utxos = self .utxos .into_iter() - .map(|utxo| utxo.map(|utxo| (utxo, UtxoAdditionalInfo::NoAdditionalInfo))) - .collect(); + .map(|utxo| { + utxo.map(|utxo| { + let additional_info = match &utxo { + TxOutput::Burn(value) + | TxOutput::Htlc(value, _) + | TxOutput::Transfer(value, _) + | TxOutput::LockThenTransfer(value, _, _) => { + find_additional_info(value, additional_info)? + } + TxOutput::AnyoneCanTake(data) => { + find_additional_info(data.as_ref().ask(), additional_info)? + } + TxOutput::IssueNft(_, data, _) => UtxoAdditionalInfo::TokenInfo { + num_decimals: 0, + ticker: match data.as_ref() { + NftIssuance::V0(data) => data.metadata.ticker().clone(), + }, + }, + TxOutput::CreateStakePool(_, data) => UtxoAdditionalInfo::PoolInfo { + staker_balance: data.pledge(), + }, + TxOutput::ProduceBlockFromStake(_, pool_id) => additional_info + .get(&PoolOrTokenId::PoolId(*pool_id)) + .ok_or(WalletError::MissingPoolAdditionalData(*pool_id))? + .clone(), + TxOutput::DataDeposit(_) + | TxOutput::IssueFungibleToken(_) + | TxOutput::DelegateStaking(_, _) + | TxOutput::CreateDelegationId(_, _) => { + UtxoAdditionalInfo::NoAdditionalInfo + } + }; + Ok((utxo, additional_info)) + }) + .transpose() + }) + .collect::>>()?; let ptx = PartiallySignedTransaction::new(tx, vec![None; num_inputs], utxos, destinations, None)?; @@ -304,6 +348,19 @@ impl SendRequest { } } +fn find_additional_info( + value: &OutputValue, + additional_info: &BTreeMap, +) -> WalletResult { + match value { + OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(UtxoAdditionalInfo::NoAdditionalInfo), + OutputValue::TokenV1(token_id, _) => additional_info + .get(&PoolOrTokenId::TokenId(*token_id)) + .ok_or(WalletError::MissingTokenAdditionalData(*token_id)) + .cloned(), + } +} + pub enum SelectedInputs { Utxos(Vec), Inputs(Vec<(UtxoOutPoint, TxOutput)>), diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index bb09f58ffa..b6df6062ee 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::collections::BTreeMap; use std::ops::{Add, Div, Mul, Sub}; use super::*; @@ -162,7 +163,7 @@ fn sign_transaction(#[case] seed: Seed) { let tx = Transaction::new(0, inputs, outputs).unwrap(); let req = SendRequest::from_transaction(tx, utxos.clone(), &|_| None).unwrap(); - let ptx = req.into_partially_signed_tx().unwrap(); + let ptx = req.into_partially_signed_tx(&BTreeMap::default()).unwrap(); let mut signer = SoftwareSigner::new(config.clone(), DEFAULT_ACCOUNT_INDEX); let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index bdde74dac3..d2503c5379 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -205,7 +205,7 @@ fn sign_transaction(#[case] seed: Seed) { .unwrap() .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); - let ptx = req.into_partially_signed_tx().unwrap(); + let ptx = req.into_partially_signed_tx(&BTreeMap::default()).unwrap(); let mut devices = find_devices(false); assert!(!devices.is_empty()); diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index c515ab188d..52f9886100 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -26,7 +26,8 @@ use crate::key_chain::{ MasterKeyChain, LOOKAHEAD_SIZE, VRF_INDEX, }; use crate::send_request::{ - make_issue_token_outputs, IssueNftArguments, SelectedInputs, StakePoolDataArguments, + make_issue_token_outputs, IssueNftArguments, PoolOrTokenId, SelectedInputs, + StakePoolDataArguments, }; use crate::signer::{Signer, SignerError, SignerProvider}; use crate::wallet_events::{WalletEvents, WalletEventsNoOp}; @@ -38,7 +39,7 @@ use common::chain::block::timestamp::BlockTimestamp; use common::chain::classic_multisig::ClassicMultisigChallenge; use common::chain::htlc::HashedTimelockContract; use common::chain::output_value::OutputValue; -use common::chain::partially_signed_transaction::PartiallySignedTransaction; +use common::chain::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; use common::chain::signature::inputsig::arbitrary_message::{ ArbitraryMessageSignature, SignArbitraryMessageError, }; @@ -253,6 +254,10 @@ pub enum WalletError { CannotChangeTrezorWalletType, #[error("The file being loaded does not correspond to the connected hardware wallet")] HardwareWalletDifferentFile, + #[error("Missing additional data for Pool {0}")] + MissingPoolAdditionalData(PoolId), + #[error("Missing additional data for Token {0}")] + MissingTokenAdditionalData(TokenId), } /// Result type used for the wallet @@ -1028,6 +1033,7 @@ where fn for_account_rw_unlocked_and_check_tx_generic( &mut self, account_index: U31, + additional_utxo_infos: &BTreeMap, f: impl FnOnce( &mut Account, &mut StoreTxRwUnlocked, @@ -1041,7 +1047,7 @@ where |account, db_tx, chain_config, signer_provider| { let (request, additional_data) = f(account, db_tx)?; - let ptx = request.into_partially_signed_tx()?; + let ptx = request.into_partially_signed_tx(additional_utxo_infos)?; let mut signer = signer_provider.provide(Arc::new(chain_config.clone()), account_index); @@ -1085,11 +1091,13 @@ where fn for_account_rw_unlocked_and_check_tx( &mut self, account_index: U31, + additional_utxo_infos: &BTreeMap, f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked) -> WalletResult, ) -> WalletResult { Ok(self .for_account_rw_unlocked_and_check_tx_generic( account_index, + additional_utxo_infos, |account, db_tx| Ok((f(account, db_tx)?, ())), |err| err, )? @@ -1398,10 +1406,13 @@ where /// current_fee_rate is lower than the consolidate_fee_rate then the wallet will tend to /// use and consolidate multiple smaller inputs, else if the current_fee_rate is higher it will /// tend to use inputs with lowest fee. + /// * `additional_utxo_infos` - Any additional info for Tokens or Pools used in the UTXOs of + /// the transaction to be created /// /// # Returns /// /// A `WalletResult` containing the signed transaction if successful, or an error indicating the reason for failure. + #[allow(clippy::too_many_arguments)] pub fn create_transaction_to_addresses( &mut self, account_index: U31, @@ -1410,6 +1421,7 @@ where change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult { Ok(self .create_transaction_to_addresses_impl( @@ -1481,6 +1493,7 @@ where let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx_generic( account_index, + additional_utxo_infos, |account, db_tx| { let send_request = account.process_send_request_and_sign( db_tx, @@ -1536,6 +1549,7 @@ where destination: Destination, inputs: Vec<(UtxoOutPoint, TxOutput, Option)>, current_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult { let request = SendRequest::new().with_inputs( inputs @@ -1544,9 +1558,11 @@ where &|_| None, )?; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, _| { - account.sweep_addresses(destination, request, current_fee_rate) - }) + self.for_account_rw_unlocked_and_check_tx( + account_index, + additional_utxo_infos, + |account, _| account.sweep_addresses(destination, request, current_fee_rate), + ) } pub fn create_sweep_from_delegation_transaction( @@ -1557,7 +1573,7 @@ where delegation_share: Amount, current_fee_rate: FeeRate, ) -> WalletResult { - self.for_account_rw_unlocked_and_check_tx(account_index, |account, _| { + self.for_account_rw_unlocked_and_check_tx(account_index, &BTreeMap::new(), |account, _| { account.sweep_delegation(address, delegation_id, delegation_share, current_fee_rate) }) } @@ -1571,7 +1587,7 @@ where delegation_share: Amount, current_fee_rate: FeeRate, ) -> WalletResult { - self.for_account_rw_unlocked_and_check_tx(account_index, |account, _| { + self.for_account_rw_unlocked_and_check_tx(account_index, &BTreeMap::new(), |account, _| { account.spend_from_delegation( address, amount, @@ -1592,19 +1608,30 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.mint_tokens( - db_tx, - token_info, - destination, - amount, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); + self.for_account_rw_unlocked_and_check_tx( + account_index, + &additional_utxo_infos, + |account, db_tx| { + account.mint_tokens( + db_tx, + token_info, + destination, + amount, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn unmint_tokens( @@ -1616,18 +1643,29 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.unmint_tokens( - db_tx, - token_info, - amount, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); + self.for_account_rw_unlocked_and_check_tx( + account_index, + &additional_utxo_infos, + |account, db_tx| { + account.unmint_tokens( + db_tx, + token_info, + amount, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn lock_token_supply( @@ -1638,17 +1676,28 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.lock_token_supply( - db_tx, - token_info, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); + self.for_account_rw_unlocked_and_check_tx( + account_index, + &additional_utxo_infos, + |account, db_tx| { + account.lock_token_supply( + db_tx, + token_info, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn freeze_token( @@ -1660,18 +1709,29 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.freeze_token( - db_tx, - token_info, - is_token_unfreezable, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); + self.for_account_rw_unlocked_and_check_tx( + account_index, + &additional_utxo_infos, + |account, db_tx| { + account.freeze_token( + db_tx, + token_info, + is_token_unfreezable, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn unfreeze_token( @@ -1682,17 +1742,28 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.unfreeze_token( - db_tx, - token_info, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); + self.for_account_rw_unlocked_and_check_tx( + account_index, + &additional_utxo_infos, + |account, db_tx| { + account.unfreeze_token( + db_tx, + token_info, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn change_token_authority( @@ -1704,18 +1775,29 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.change_token_authority( - db_tx, - token_info, - address, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); + self.for_account_rw_unlocked_and_check_tx( + account_index, + &additional_utxo_infos, + |account, db_tx| { + account.change_token_authority( + db_tx, + token_info, + address, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn change_token_metadata_uri( @@ -1753,7 +1835,7 @@ where pub fn get_token_unconfirmed_info( &self, account_index: U31, - token_info: &RPCFungibleTokenInfo, + token_info: RPCFungibleTokenInfo, ) -> WalletResult { self.get_account(account_index)?.get_token_unconfirmed_info(token_info) } @@ -1772,6 +1854,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), )?; let input0_outpoint = crate::utils::get_first_utxo_outpoint(tx.transaction().inputs())?; let delegation_id = make_delegation_id(input0_outpoint); @@ -1794,6 +1877,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), )?; let token_id = make_token_id(tx.transaction().inputs()).ok_or(WalletError::MissingTokenId)?; @@ -1811,8 +1895,10 @@ where let destination = address.into_object(); let latest_median_time = self.latest_median_time; - let signed_transaction = - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { + let signed_transaction = self.for_account_rw_unlocked_and_check_tx( + account_index, + &BTreeMap::new(), + |account, db_tx| { account.create_issue_nft_tx( db_tx, IssueNftArguments { @@ -1825,7 +1911,8 @@ where consolidate_fee_rate, }, ) - })?; + }, + )?; let token_id = make_token_id(signed_transaction.transaction().inputs()) .ok_or(WalletError::MissingTokenId)?; @@ -1836,13 +1923,18 @@ where &mut self, account_index: U31, pool_id: PoolId, - pool_balance: Amount, + staker_balance: Amount, output_address: Option, current_fee_rate: FeeRate, ) -> WalletResult { + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::PoolId(pool_id), + UtxoAdditionalInfo::PoolInfo { staker_balance }, + )]); Ok(self .for_account_rw_unlocked_and_check_tx_generic( account_index, + &additional_utxo_infos, |account, db_tx| { Ok(( account.decommission_stake_pool( @@ -1864,22 +1956,26 @@ where &mut self, account_index: U31, pool_id: PoolId, - pool_balance: Amount, + staker_balance: Amount, output_address: Option, current_fee_rate: FeeRate, ) -> WalletResult { + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::PoolId(pool_id), + UtxoAdditionalInfo::PoolInfo { staker_balance }, + )]); self.for_account_rw_unlocked( account_index, |account, db_tx, chain_config, signer_provider| { let request = account.decommission_stake_pool_request( db_tx, pool_id, - pool_balance, + staker_balance, output_address, current_fee_rate, )?; - let ptx = request.into_partially_signed_tx()?; + let ptx = request.into_partially_signed_tx(&additional_utxo_infos)?; let mut signer = signer_provider.provide(Arc::new(chain_config.clone()), account_index); @@ -1902,18 +1998,22 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.create_htlc_tx( - db_tx, - output_value, - htlc, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + self.for_account_rw_unlocked_and_check_tx( + account_index, + &BTreeMap::new(), + |account, db_tx| { + account.create_htlc_tx( + db_tx, + output_value, + htlc, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn create_order_tx( @@ -2241,17 +2341,21 @@ where stake_pool_arguments: StakePoolDataArguments, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.create_stake_pool_tx( - db_tx, - stake_pool_arguments, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + self.for_account_rw_unlocked_and_check_tx( + account_index, + &BTreeMap::new(), + |account, db_tx| { + account.create_stake_pool_tx( + db_tx, + stake_pool_arguments, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn get_pos_gen_block_data( &self, diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 7ce4e4d880..5d6f25339d 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -996,6 +996,7 @@ fn wallet_accounts_creation() { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -1155,6 +1156,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ), Err(WalletError::DatabaseError( wallet_storage::Error::WalletLocked @@ -1172,6 +1174,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); } else { @@ -1201,6 +1204,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); } @@ -1228,6 +1232,7 @@ fn wallet_get_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -1287,6 +1292,7 @@ fn wallet_list_mainchain_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -1309,6 +1315,7 @@ fn wallet_list_mainchain_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); let spend_from_tx_id = tx.transaction().get_id(); @@ -1363,6 +1370,7 @@ fn wallet_transaction_with_fees(#[case] seed: Seed) { BTreeMap::new(), very_big_feerate, very_big_feerate, + &BTreeMap::new(), ) .unwrap_err(); @@ -1390,6 +1398,7 @@ fn wallet_transaction_with_fees(#[case] seed: Seed) { BTreeMap::new(), feerate, feerate, + &BTreeMap::new(), ) .unwrap(); @@ -1476,6 +1485,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap_err(); assert_eq!(err, WalletError::CannotFindUtxo(missing_utxo.clone())); @@ -1502,6 +1512,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -1539,6 +1550,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap_err(); @@ -1836,6 +1848,7 @@ fn send_to_unknown_delegation(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -1983,6 +1996,7 @@ fn create_spend_from_delegations(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -2187,10 +2201,12 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { let amount_fraction = (block1_amount.into_atoms() - NETWORK_FEE) / 10; let mut token_amount_to_issue = Amount::from_atoms(rng.gen_range(1..amount_fraction)); + let mut number_of_decimals = rng.gen_range(1..18); + let token_ticker = "XXXX".as_bytes().to_vec(); let (issued_token_id, token_issuance_transactions) = if issue_fungible_token { let token_issuance = TokenIssuanceV1 { - token_ticker: "XXXX".as_bytes().to_vec(), - number_of_decimals: rng.gen_range(1..18), + token_ticker: token_ticker.clone(), + number_of_decimals, metadata_uri: "http://uri".as_bytes().to_vec(), total_supply: common::chain::tokens::TokenTotalSupply::Unlimited, authority: token_authority_and_destination.as_object().clone(), @@ -2259,7 +2275,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { // wallet1 should know about the issued token from the random wallet let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info).unwrap(); let mint_transaction = wallet .mint_tokens( DEFAULT_ACCOUNT_INDEX, @@ -2276,6 +2292,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { vec![token_issuance_transaction, transfer_tx, mint_transaction], ) } else { + number_of_decimals = 0; token_amount_to_issue = Amount::from_atoms(1); let (issued_token_id, nft_issuance_transaction) = random_issuing_wallet .issue_new_nft( @@ -2285,7 +2302,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { creator: None, name: "Name".as_bytes().to_vec(), description: "SomeNFT".as_bytes().to_vec(), - ticker: "XXXX".as_bytes().to_vec(), + ticker: token_ticker.clone(), icon_uri: DataOrNoVec::from(None), additional_metadata_uri: DataOrNoVec::from(None), media_uri: DataOrNoVec::from(None), @@ -2347,6 +2364,13 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { Destination::PublicKeyHash(some_other_address), ); + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(*token_id), + UtxoAdditionalInfo::TokenInfo { + num_decimals: number_of_decimals, + ticker: token_ticker.clone(), + }, + )]); let transfer_tokens_transaction = wallet .create_transaction_to_addresses( DEFAULT_ACCOUNT_INDEX, @@ -2355,6 +2379,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); wallet @@ -2408,6 +2433,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .err() .unwrap(); @@ -2452,13 +2478,15 @@ fn check_tokens_v0_are_ignored(#[case] seed: Seed) { assert_eq!(coin_balance, block1_amount); let address2 = wallet.get_new_address(DEFAULT_ACCOUNT_INDEX).unwrap().1; + let token_ticker = "XXXX".as_bytes().to_vec(); + let number_of_decimals = rng.gen_range(1..18); let result = wallet.create_transaction_to_addresses( DEFAULT_ACCOUNT_INDEX, [TxOutput::Transfer( OutputValue::TokenV0(Box::new(TokenData::TokenIssuance(Box::new( TokenIssuanceV0 { - token_ticker: "XXXX".as_bytes().to_vec(), - number_of_decimals: rng.gen_range(1..18), + token_ticker, + number_of_decimals, metadata_uri: "http://uri".as_bytes().to_vec(), amount_to_issue: Amount::from_atoms(rng.gen_range(1..10000)), }, @@ -2469,6 +2497,7 @@ fn check_tokens_v0_are_ignored(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ); matches!( @@ -2548,8 +2577,9 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let amount_to_mint = Amount::from_atoms(rng.gen_range(1..=fixed_max_amount.into_atoms())); let mint_tx = wallet @@ -2565,8 +2595,9 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { let _ = create_block(&chain_config, &mut wallet, vec![mint_tx], block2_amount, 2); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let freeze_tx = wallet .freeze_token( @@ -2580,8 +2611,9 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { wallet.add_unconfirmed_tx(freeze_tx.clone(), &WalletEventsNoOp).unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.check_can_freeze().unwrap_err(), @@ -2607,8 +2639,9 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { wallet.add_unconfirmed_tx(unfreeze_tx.clone(), &WalletEventsNoOp).unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); unconfirmed_token_info.check_can_freeze().unwrap(); assert_eq!( @@ -2626,8 +2659,9 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { .abandon_transaction(DEFAULT_ACCOUNT_INDEX, freeze_tx.transaction().get_id()) .unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); unconfirmed_token_info.check_can_freeze().unwrap(); assert_eq!( @@ -2648,8 +2682,9 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { 3, ); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -2680,6 +2715,13 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { Destination::PublicKeyHash(some_other_address), ); + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }, + )]); let transfer_tokens_transaction = wallet .create_transaction_to_addresses( DEFAULT_ACCOUNT_INDEX, @@ -2688,6 +2730,7 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); @@ -2696,8 +2739,9 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { .unwrap(); wallet.add_unconfirmed_tx(freeze_tx.clone(), &WalletEventsNoOp).unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.check_can_freeze().unwrap_err(), @@ -2831,8 +2875,9 @@ fn change_token_supply_fixed(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.authority().unwrap(), @@ -2863,8 +2908,9 @@ fn change_token_supply_fixed(#[case] seed: Seed) { wallet.add_unconfirmed_tx(mint_transaction.clone(), &WalletEventsNoOp).unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); // Try to mint more then the fixed maximum let leftover = (fixed_max_amount - token_amount_to_mint).unwrap(); @@ -2909,8 +2955,9 @@ fn change_token_supply_fixed(#[case] seed: Seed) { ) .unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -2932,8 +2979,9 @@ fn change_token_supply_fixed(#[case] seed: Seed) { ); token_info.circulating_supply = unconfirmed_token_info.current_supply().unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -2976,8 +3024,9 @@ fn change_token_supply_fixed(#[case] seed: Seed) { wallet .add_unconfirmed_tx(unmint_transaction.clone(), &WalletEventsNoOp) .unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let _ = create_block( &chain_config, @@ -2988,8 +3037,9 @@ fn change_token_supply_fixed(#[case] seed: Seed) { ); token_info.circulating_supply = unconfirmed_token_info.current_supply().unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -3079,8 +3129,9 @@ fn change_token_supply_unlimited(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.authority().unwrap(), @@ -3110,8 +3161,9 @@ fn change_token_supply_unlimited(#[case] seed: Seed) { .unwrap(); wallet.add_unconfirmed_tx(mint_transaction.clone(), &WalletEventsNoOp).unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let _ = create_block( &chain_config, @@ -3122,8 +3174,9 @@ fn change_token_supply_unlimited(#[case] seed: Seed) { ); token_info.circulating_supply = unconfirmed_token_info.current_supply().unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -3165,8 +3218,9 @@ fn change_token_supply_unlimited(#[case] seed: Seed) { wallet .add_unconfirmed_tx(unmint_transaction.clone(), &WalletEventsNoOp) .unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let _ = create_block( &chain_config, @@ -3177,8 +3231,9 @@ fn change_token_supply_unlimited(#[case] seed: Seed) { ); token_info.circulating_supply = unconfirmed_token_info.current_supply().unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -3268,8 +3323,9 @@ fn change_and_lock_token_supply_lockable(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.authority().unwrap(), @@ -3298,8 +3354,9 @@ fn change_and_lock_token_supply_lockable(#[case] seed: Seed) { ) .unwrap(); wallet.add_unconfirmed_tx(mint_transaction.clone(), &WalletEventsNoOp).unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let _ = create_block( &chain_config, @@ -3310,8 +3367,9 @@ fn change_and_lock_token_supply_lockable(#[case] seed: Seed) { ); token_info.circulating_supply = unconfirmed_token_info.current_supply().unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -3354,8 +3412,9 @@ fn change_and_lock_token_supply_lockable(#[case] seed: Seed) { wallet .add_unconfirmed_tx(unmint_transaction.clone(), &WalletEventsNoOp) .unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let _ = create_block( &chain_config, @@ -3366,8 +3425,9 @@ fn change_and_lock_token_supply_lockable(#[case] seed: Seed) { ); token_info.circulating_supply = unconfirmed_token_info.current_supply().unwrap(); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -3398,8 +3458,9 @@ fn change_and_lock_token_supply_lockable(#[case] seed: Seed) { ); token_info.is_locked = true; - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); assert_eq!( unconfirmed_token_info.get_next_nonce().unwrap(), @@ -3517,6 +3578,7 @@ fn lock_then_transfer(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); wallet @@ -3638,6 +3700,7 @@ fn wallet_multiple_transactions_in_single_block(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3729,6 +3792,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -3764,6 +3828,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3803,6 +3868,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap_err(); assert_eq!( @@ -3829,6 +3895,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3913,6 +3980,7 @@ fn wallet_abandone_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); wallet @@ -4680,6 +4748,7 @@ fn test_not_exhaustion_of_keys(#[case] seed: Seed) { [].into(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index f53cf41c7c..f538177614 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -21,7 +21,7 @@ use common::{ classic_multisig::ClassicMultisigChallenge, htlc::HashedTimelockContract, output_value::OutputValue, - partially_signed_transaction::PartiallySignedTransaction, + partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, signature::inputsig::arbitrary_message::ArbitraryMessageSignature, tokens::{ IsTokenFreezable, IsTokenUnfreezable, Metadata, RPCFungibleTokenInfo, RPCTokenInfo, @@ -49,7 +49,7 @@ use wallet::{ destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, send_request::{ make_address_output, make_address_output_token, make_create_delegation_output, - make_data_deposit_output, SelectedInputs, StakePoolDataArguments, + make_data_deposit_output, PoolOrTokenId, SelectedInputs, StakePoolDataArguments, }, wallet::WalletPoolsFilter, wallet_events::WalletEvents, @@ -130,7 +130,7 @@ where for token_info in self.fetch_token_infos(token_ids).await? { match token_info { RPCTokenInfo::FungibleToken(token_info) => { - self.check_fungible_token_is_usable(&token_info)? + self.check_fungible_token_is_usable(token_info)? } RPCTokenInfo::NonFungibleToken(_) => {} } @@ -140,7 +140,7 @@ where pub fn check_fungible_token_is_usable( &self, - token_info: &RPCFungibleTokenInfo, + token_info: RPCFungibleTokenInfo, ) -> Result<(), ControllerError> { match &self.wallet { WalletType2::Software(w) => { @@ -160,20 +160,27 @@ where async fn filter_out_utxos_with_frozen_tokens( &self, input_utxos: Vec<(UtxoOutPoint, TxOutput, Option)>, - ) -> Result)>, ControllerError> { + ) -> Result< + ( + Vec<(UtxoOutPoint, TxOutput, Option)>, + BTreeMap, + ), + ControllerError, + > { let mut result = vec![]; + let mut additional_utxo_infos = BTreeMap::new(); for utxo in input_utxos { if let Some(token_id) = utxo.2 { let token_info = fetch_token_info(&self.rpc_client, token_id).await?; - let ok_to_use = match token_info { + let ok_to_use = match &token_info { RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { WalletType2::Software(w) => { - w.get_token_unconfirmed_info(self.account_index, &token_info) + w.get_token_unconfirmed_info(self.account_index, token_info.clone()) } #[cfg(feature = "trezor")] WalletType2::Trezor(w) => { - w.get_token_unconfirmed_info(self.account_index, &token_info) + w.get_token_unconfirmed_info(self.account_index, token_info.clone()) } } .map_err(ControllerError::WalletError)? @@ -183,12 +190,20 @@ where }; if ok_to_use { result.push(utxo); + additional_utxo_infos.insert( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.token_number_of_decimals(), + ticker: token_info.token_ticker(), + }, + ); } } else { result.push(utxo); } } - Ok(result) + + Ok((result, additional_utxo_infos)) } pub fn abandon_transaction( @@ -391,7 +406,7 @@ where address: Address, ) -> Result> { self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, wallet: &mut WalletType2, @@ -427,7 +442,7 @@ where amount: Amount, ) -> Result> { self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, wallet: &mut WalletType2, @@ -461,7 +476,7 @@ where token_info: RPCTokenInfo, ) -> Result> { self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, wallet: &mut WalletType2, @@ -496,7 +511,7 @@ where is_token_unfreezable: IsTokenUnfreezable, ) -> Result> { self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, wallet: &mut WalletType2, @@ -530,7 +545,7 @@ where token_info: RPCTokenInfo, ) -> Result> { self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, wallet: &mut WalletType2, @@ -564,7 +579,7 @@ where address: Address, ) -> Result> { self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, wallet: &mut WalletType2, @@ -636,6 +651,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), ), #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( @@ -645,6 +661,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), ), } }, @@ -678,6 +695,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), ), #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( @@ -687,6 +705,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), ), } }, @@ -718,9 +737,10 @@ where } .map_err(ControllerError::WalletError)?; - let filtered_inputs = self - .filter_out_utxos_with_frozen_tokens(selected_utxos) - .await? + let (inputs, additional_utxo_infos) = + self.filter_out_utxos_with_frozen_tokens(selected_utxos).await?; + + let filtered_inputs = inputs .into_iter() .filter(|(_, output, _)| { get_tx_output_destination(output, &|_| None, HtlcSpendingCondition::Skip) @@ -739,6 +759,7 @@ where destination_address, filtered_inputs, current_fee_rate, + &additional_utxo_infos, ), #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_sweep_transaction( @@ -746,6 +767,7 @@ where destination_address, filtered_inputs, current_fee_rate, + &additional_utxo_infos, ), } }, @@ -908,7 +930,7 @@ where match &token_info { RPCTokenInfo::FungibleToken(token_info) => { - self.check_fungible_token_is_usable(token_info)? + self.check_fungible_token_is_usable(token_info.clone())? } RPCTokenInfo::NonFungibleToken(_) => { return Err(ControllerError::::NotFungibleToken(token_id)); @@ -1085,6 +1107,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), ), #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( @@ -1094,6 +1117,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), ), } }, @@ -1165,13 +1189,20 @@ where ) -> Result> { let output = make_address_output_token(address, amount, token_info.token_id()); self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, wallet: &mut WalletType2, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); match wallet { WalletType2::Software(w) => w.create_transaction_to_addresses( account_index, @@ -1180,6 +1211,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &additional_info, ), #[cfg(feature = "trezor")] WalletType2::Trezor(w) => w.create_transaction_to_addresses( @@ -1189,6 +1221,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, + &additional_info, ), } }, @@ -1622,7 +1655,7 @@ where } .map_err(ControllerError::WalletError)?, RPCTokenInfo::NonFungibleToken(info) => { - UnconfirmedTokenInfo::NonFungibleToken(info.token_id) + UnconfirmedTokenInfo::NonFungibleToken(info.token_id, info) } }; From 89d3a9f0147ce21d03a926953563a849b75190df Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Fri, 16 Aug 2024 11:12:00 +0200 Subject: [PATCH 22/48] clean up from review comments --- chainstate/src/rpc/mod.rs | 26 ++--- chainstate/src/rpc/types/output.rs | 31 ------ common/src/chain/tokens/rpc.rs | 6 +- .../partially_signed_transaction.rs | 21 +++- wallet/src/send_request/mod.rs | 6 +- wallet/src/signer/software_signer/mod.rs | 2 +- wallet/src/signer/trezor_signer/mod.rs | 6 +- wallet/src/wallet/mod.rs | 95 +++++++++++-------- wallet/src/wallet/tests.rs | 33 ++++--- wallet/wallet-controller/src/helpers.rs | 43 +++++---- wallet/wallet-controller/src/lib.rs | 15 +-- .../wallet-controller/src/sync/tests/mod.rs | 6 +- .../src/synced_controller.rs | 2 +- .../src/handles_client/mod.rs | 16 +++- wallet/wallet-node-client/src/node_traits.rs | 10 +- .../src/rpc_client/client_impl.rs | 32 +++---- .../src/rpc_client/cold_wallet_client.rs | 10 +- 17 files changed, 193 insertions(+), 167 deletions(-) diff --git a/chainstate/src/rpc/mod.rs b/chainstate/src/rpc/mod.rs index 4ac716b98e..91cc1f60db 100644 --- a/chainstate/src/rpc/mod.rs +++ b/chainstate/src/rpc/mod.rs @@ -24,14 +24,14 @@ use std::{ sync::Arc, }; -use self::types::{block::RpcBlock, event::RpcEvent, output::RpcPoolData}; +use self::types::{block::RpcBlock, event::RpcEvent}; use crate::{Block, BlockSource, ChainInfo, GenBlock}; use chainstate_types::BlockIndex; use common::{ address::{dehexify::to_dehexified_json, Address}, chain::{ tokens::{RPCTokenInfo, TokenId}, - ChainConfig, DelegationId, OrderId, PoolId, RpcOrderInfo, TxOutput, + ChainConfig, DelegationId, Destination, OrderId, PoolId, RpcOrderInfo, TxOutput, }, primitives::{Amount, BlockHeight, Id}, }; @@ -144,11 +144,14 @@ trait ChainstateRpc { #[method(name = "staker_balance")] async fn staker_balance(&self, pool_address: String) -> RpcResult>; - /// Returns the pool data of the pool associated with the given pool address. + /// Returns the pool's decommission destination associated with the given pool address. /// /// Returns `None` (null) if the pool is not found. - #[method(name = "pool_data")] - async fn pool_data(&self, pool_address: String) -> RpcResult>; + #[method(name = "pool_decommission_destination")] + async fn pool_decommission_destination( + &self, + pool_address: String, + ) -> RpcResult>; /// Given a pool defined by a pool address, and a delegation address, /// returns the amount of coins owned by that delegation in that pool. @@ -344,19 +347,18 @@ impl ChainstateRpcServer for super::ChainstateHandle { ) } - async fn pool_data(&self, pool_address: String) -> RpcResult> { + async fn pool_decommission_destination( + &self, + pool_address: String, + ) -> RpcResult> { rpc::handle_result( self.call(move |this| { let chain_config = this.get_chain_config(); - let result: Result, _> = + let result: Result, _> = dynamize_err(Address::::from_string(chain_config, pool_address)) .map(|address| address.into_object()) .and_then(|pool_id| dynamize_err(this.get_stake_pool_data(pool_id))) - .and_then(|pool_data| { - dynamize_err( - pool_data.map(|d| RpcPoolData::new(chain_config, &d)).transpose(), - ) - }); + .map(|pool_data| pool_data.map(|d| d.decommission_destination().clone())); result }) diff --git a/chainstate/src/rpc/types/output.rs b/chainstate/src/rpc/types/output.rs index 3c67668561..ea7ef79075 100644 --- a/chainstate/src/rpc/types/output.rs +++ b/chainstate/src/rpc/types/output.rs @@ -23,7 +23,6 @@ use common::{ primitives::amount::{RpcAmountIn, RpcAmountOut}, }; use crypto::vrf::VRFPublicKey; -use pos_accounting::PoolData; use rpc::types::RpcHexString; use super::token::{RpcNftIssuance, RpcTokenIssuance}; @@ -68,36 +67,6 @@ impl RpcOutputValueOut { } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, rpc_description::HasValueHint)] -pub struct RpcPoolData { - pub pledge: RpcAmountOut, - pub rewards: RpcAmountOut, - pub vrf_public_key: RpcAddress, - pub decommission_key: RpcAddress, - pub margin_ratio_per_thousand: String, - pub cost_per_block: RpcAmountOut, -} - -impl RpcPoolData { - pub fn new(chain_config: &ChainConfig, data: &PoolData) -> Result { - let result = Self { - pledge: RpcAmountOut::from_amount(data.pledge_amount(), chain_config.coin_decimals()), - rewards: RpcAmountOut::from_amount(data.staker_rewards(), chain_config.coin_decimals()), - vrf_public_key: RpcAddress::new(chain_config, data.vrf_public_key().clone())?, - decommission_key: RpcAddress::new( - chain_config, - data.decommission_destination().clone(), - )?, - margin_ratio_per_thousand: data.margin_ratio_per_thousand().to_percentage_str(), - cost_per_block: RpcAmountOut::from_amount( - data.cost_per_block(), - chain_config.coin_decimals(), - ), - }; - Ok(result) - } -} - #[derive(Debug, Clone, serde::Serialize, rpc_description::HasValueHint)] pub struct RpcStakePoolData { pledge: RpcAmountOut, diff --git a/common/src/chain/tokens/rpc.rs b/common/src/chain/tokens/rpc.rs index 0585727656..1ed5495c99 100644 --- a/common/src/chain/tokens/rpc.rs +++ b/common/src/chain/tokens/rpc.rs @@ -52,10 +52,10 @@ impl RPCTokenInfo { } } - pub fn token_ticker(&self) -> Vec { + pub fn token_ticker(&self) -> &[u8] { match self { - Self::FungibleToken(info) => info.token_ticker.clone().into_bytes(), - Self::NonFungibleToken(info) => info.metadata.ticker.clone().into_bytes(), + Self::FungibleToken(info) => info.token_ticker.as_bytes(), + Self::NonFungibleToken(info) => info.metadata.ticker.as_bytes(), } } } diff --git a/common/src/chain/transaction/partially_signed_transaction.rs b/common/src/chain/transaction/partially_signed_transaction.rs index 6509dd5575..c1128a8c0b 100644 --- a/common/src/chain/transaction/partially_signed_transaction.rs +++ b/common/src/chain/transaction/partially_signed_transaction.rs @@ -33,12 +33,27 @@ pub enum UtxoAdditionalInfo { NoAdditionalInfo, } +#[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] +pub struct UtxoWithAdditionalInfo { + pub utxo: TxOutput, + pub additional_info: UtxoAdditionalInfo, +} + +impl UtxoWithAdditionalInfo { + pub fn new(utxo: TxOutput, additional_info: UtxoAdditionalInfo) -> Self { + Self { + utxo, + additional_info, + } + } +} + #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub struct PartiallySignedTransaction { tx: Transaction, witnesses: Vec>, - input_utxos: Vec>, + input_utxos: Vec>, destinations: Vec>, htlc_secrets: Vec>, @@ -48,7 +63,7 @@ impl PartiallySignedTransaction { pub fn new( tx: Transaction, witnesses: Vec>, - input_utxos: Vec>, + input_utxos: Vec>, destinations: Vec>, htlc_secrets: Option>>, ) -> Result { @@ -104,7 +119,7 @@ impl PartiallySignedTransaction { self.tx } - pub fn input_utxos(&self) -> &[Option<(TxOutput, UtxoAdditionalInfo)>] { + pub fn input_utxos(&self) -> &[Option] { self.input_utxos.as_ref() } diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index a93da98922..1f6566a6c5 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -18,7 +18,9 @@ use std::mem::take; use common::address::Address; use common::chain::output_value::OutputValue; -use common::chain::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; +use common::chain::partially_signed_transaction::{ + PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, +}; use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock::ForBlockCount; use common::chain::tokens::{Metadata, NftIssuance, TokenId, TokenIssuance}; @@ -336,7 +338,7 @@ impl SendRequest { UtxoAdditionalInfo::NoAdditionalInfo } }; - Ok((utxo, additional_info)) + Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) }) .transpose() }) diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index 5c413f4947..ee4dcea87d 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -263,7 +263,7 @@ impl Signer for SoftwareSigner { Vec, )> { let inputs_utxo_refs: Vec<_> = - ptx.input_utxos().iter().map(|u| u.as_ref().map(|(x, _)| x)).collect(); + ptx.input_utxos().iter().map(|u| u.as_ref().map(|x| &x.utxo)).collect(); let (witnesses, prev_statuses, new_statuses) = ptx .witnesses() diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index df2a2d7db8..92e8ec10ec 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -243,7 +243,7 @@ impl Signer for TrezorSigner { .map_err(TrezorError::DeviceError)?; let inputs_utxo_refs: Vec<_> = - ptx.input_utxos().iter().map(|u| u.as_ref().map(|(x, _)| x)).collect(); + ptx.input_utxos().iter().map(|u| u.as_ref().map(|x| &x.utxo)).collect(); let (witnesses, prev_statuses, new_statuses) = ptx .witnesses() @@ -485,7 +485,7 @@ fn to_trezor_input_msgs( .map(|((inp, utxo), dest)| match (inp, utxo, dest) { (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => Ok(to_trezor_utxo_input( outpoint, - &utxo.0, + &utxo.utxo, chain_config, dest, key_chain, @@ -737,7 +737,7 @@ fn to_trezor_utxo_msgs( OutPointSourceId::Transaction(id) => id.to_hash().0, OutPointSourceId::BlockReward(id) => id.to_hash().0, }; - let out = to_trezor_output_msg(chain_config, &utxo.0); + let out = to_trezor_output_msg(chain_config, &utxo.utxo); map.entry(id).or_default().insert(outpoint.output_index(), out); } (TxInput::Utxo(_), None) => unimplemented!("missing utxo"), diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 52f9886100..f048ad5674 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -1054,7 +1054,7 @@ where let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; let inputs_utxo_refs: Vec<_> = - ptx.input_utxos().iter().map(|u| u.as_ref().map(|(x, _)| x)).collect(); + ptx.input_utxos().iter().map(|u| u.as_ref().map(|x| &x.utxo)).collect(); let is_fully_signed = ptx.destinations().iter().enumerate().zip(ptx.witnesses()).all( |((i, destination), witness)| match (witness, destination) { @@ -2026,19 +2026,24 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult<(OrderId, SignedTransaction)> { let latest_median_time = self.latest_median_time; - let tx = self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.create_order_tx( - db_tx, - ask_value, - give_value, - conclude_key, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - })?; + let tx = self.for_account_rw_unlocked_and_check_tx( + account_index, + //FIXME + &BTreeMap::new(), + |account, db_tx| { + account.create_order_tx( + db_tx, + ask_value, + give_value, + conclude_key, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + )?; let input0_outpoint = crate::utils::get_first_utxo_outpoint(tx.transaction().inputs())?; let order_id = make_order_id(input0_outpoint); Ok((order_id, tx)) @@ -2054,19 +2059,23 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.create_conclude_order_tx( - db_tx, - order_id, - order_info, - output_address, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + self.for_account_rw_unlocked_and_check_tx( + account_index, + &BTreeMap::new(), + |account, db_tx| { + account.create_conclude_order_tx( + db_tx, + order_id, + order_info, + output_address, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } #[allow(clippy::too_many_arguments)] @@ -2081,20 +2090,24 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.create_fill_order_tx( - db_tx, - order_id, - order_info, - fill_amount_in_ask_currency, - output_address, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + self.for_account_rw_unlocked_and_check_tx( + account_index, + &BTreeMap::new(), + |account, db_tx| { + account.create_fill_order_tx( + db_tx, + order_id, + order_info, + fill_amount_in_ask_currency, + output_address, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn sign_raw_transaction( diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 5d6f25339d..e772d0d32e 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -34,7 +34,7 @@ use common::{ block::{consensus_data::PoSData, timestamp::BlockTimestamp, BlockReward, ConsensusData}, config::{create_mainnet, create_regtest, create_unit_test_config, Builder, ChainType}, output_value::{OutputValue, RpcOutputValue}, - partially_signed_transaction::UtxoAdditionalInfo, + partially_signed_transaction::{UtxoAdditionalInfo, UtxoWithAdditionalInfo}, signature::inputsig::InputWitness, timelock::OutputTimeLock, tokens::{RPCIsTokenFrozen, TokenData, TokenIssuanceV0, TokenIssuanceV1}, @@ -4355,7 +4355,10 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { let ptx = PartiallySignedTransaction::new( tx, vec![None; inps], - vec![Some((utxo, UtxoAdditionalInfo::NoAdditionalInfo))], + vec![Some(UtxoWithAdditionalInfo::new( + utxo, + UtxoAdditionalInfo::NoAdditionalInfo, + ))], vec![Some(addr.into_object())], None, ) @@ -4885,7 +4888,7 @@ fn test_add_standalone_multisig(#[case] seed: Seed) { let spend_multisig_tx = PartiallySignedTransaction::new( spend_multisig_tx, vec![None; 1], - vec![Some(( + vec![Some(UtxoWithAdditionalInfo::new( tx.outputs()[0].clone(), UtxoAdditionalInfo::NoAdditionalInfo, ))], @@ -5040,7 +5043,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { .outputs() .first() .cloned() - .map(|out| (out, UtxoAdditionalInfo::NoAdditionalInfo))]; + .map(|out| UtxoWithAdditionalInfo::new(out, UtxoAdditionalInfo::NoAdditionalInfo))]; let spend_ptx = PartiallySignedTransaction::new( spend_tx, vec![None], @@ -5142,7 +5145,7 @@ fn create_htlc_and_refund(#[case] seed: Seed) { .outputs() .first() .cloned() - .map(|out| (out, UtxoAdditionalInfo::NoAdditionalInfo))]; + .map(|out| UtxoWithAdditionalInfo::new(out, UtxoAdditionalInfo::NoAdditionalInfo))]; let refund_ptx = PartiallySignedTransaction::new( refund_tx, vec![None], @@ -5282,8 +5285,9 @@ fn create_order(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let token_amount_to_mint = Amount::from_atoms(rng.gen_range(2..100)); let mint_transaction = wallet @@ -5399,8 +5403,9 @@ fn create_order_and_conclude(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let token_amount_to_mint = Amount::from_atoms(rng.gen_range(2..100)); let mint_transaction = wallet @@ -5560,8 +5565,9 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet1.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet1 + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let token_amount_to_mint = Amount::from_atoms(100); let mint_transaction = wallet1 @@ -5864,8 +5870,9 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { token_issuance.authority, ); - let unconfirmed_token_info = - wallet1.get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, &token_info).unwrap(); + let unconfirmed_token_info = wallet1 + .get_token_unconfirmed_info(DEFAULT_ACCOUNT_INDEX, token_info.clone()) + .unwrap(); let token_amount_to_mint = Amount::from_atoms(100); let mint_transaction = wallet1 diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index f3771a2143..0883e35b23 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -21,7 +21,9 @@ use common::{ address::RpcAddress, chain::{ output_value::OutputValue, - partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, + partially_signed_transaction::{ + PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + }, tokens::{RPCTokenInfo, TokenId}, ChainConfig, Destination, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, }, @@ -103,10 +105,9 @@ pub async fn fetch_utxo_with_destination( let pool_id = pool_id_from_txo(&utxo); let dest = if let Some(pool_id) = pool_id { rpc_client - .get_pool_data(pool_id) + .get_pool_decommission_destination(pool_id) .await .map_err(ControllerError::NodeCallError)? - .map(|data| data.decommission_destination().clone()) } else { // FIXME get_tx_output_destination(&utxo, &|_| None, HtlcSpendingCondition::Skip) @@ -139,7 +140,7 @@ fn pool_id_from_txo(utxo: &TxOutput) -> Option { pub async fn fetch_utxo_exra_info( rpc_client: &T, utxo: TxOutput, -) -> Result<(TxOutput, UtxoAdditionalInfo), ControllerError> +) -> Result> where T: NodeInterface, { @@ -148,31 +149,33 @@ where | TxOutput::Transfer(value, _) | TxOutput::LockThenTransfer(value, _, _) | TxOutput::Htlc(value, _) => match value { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => { - Ok((utxo, UtxoAdditionalInfo::NoAdditionalInfo)) - } + OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(UtxoWithAdditionalInfo::new( + utxo, + UtxoAdditionalInfo::NoAdditionalInfo, + )), OutputValue::TokenV1(token_id, _) => { let info = fetch_token_info(rpc_client, *token_id).await?; - Ok(( + Ok(UtxoWithAdditionalInfo::new( utxo, UtxoAdditionalInfo::TokenInfo { num_decimals: info.token_number_of_decimals(), - ticker: info.token_ticker(), + ticker: info.token_ticker().to_vec(), }, )) } }, TxOutput::AnyoneCanTake(order) => match order.ask() { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => { - Ok((utxo, UtxoAdditionalInfo::NoAdditionalInfo)) - } + OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(UtxoWithAdditionalInfo::new( + utxo, + UtxoAdditionalInfo::NoAdditionalInfo, + )), OutputValue::TokenV1(token_id, _) => { let info = fetch_token_info(rpc_client, *token_id).await?; - Ok(( + Ok(UtxoWithAdditionalInfo::new( utxo, UtxoAdditionalInfo::TokenInfo { num_decimals: info.token_number_of_decimals(), - ticker: info.token_ticker(), + ticker: info.token_ticker().to_vec(), }, )) } @@ -183,14 +186,20 @@ where .await .map_err(ControllerError::NodeCallError)? .ok_or(WalletError::UnknownPoolId(*pool_id))?; - Ok((utxo, UtxoAdditionalInfo::PoolInfo { staker_balance })) + Ok(UtxoWithAdditionalInfo::new( + utxo, + UtxoAdditionalInfo::PoolInfo { staker_balance }, + )) } TxOutput::IssueNft(_, _, _) | TxOutput::IssueFungibleToken(_) | TxOutput::CreateStakePool(_, _) | TxOutput::DelegateStaking(_, _) | TxOutput::CreateDelegationId(_, _) - | TxOutput::DataDeposit(_) => Ok((utxo, UtxoAdditionalInfo::NoAdditionalInfo)), + | TxOutput::DataDeposit(_) => Ok(UtxoWithAdditionalInfo::new( + utxo, + UtxoAdditionalInfo::NoAdditionalInfo, + )), } } @@ -250,7 +259,7 @@ async fn into_utxo_and_destination( rpc_client: &T, wallet: &WalletType2, tx_inp: &TxInput, -) -> Result<(Option<(TxOutput, UtxoAdditionalInfo)>, Option), ControllerError> { +) -> Result<(Option, Option), ControllerError> { Ok(match tx_inp { TxInput::Utxo(outpoint) => { let (utxo, dest) = fetch_utxo_with_destination(rpc_client, outpoint, wallet).await?; diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 1b4f7f7437..bbf0d0be25 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -56,7 +56,7 @@ use common::{ chain::{ block::timestamp::BlockTimestamp, htlc::HtlcSecret, - partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, + partially_signed_transaction::{PartiallySignedTransaction, UtxoWithAdditionalInfo}, signature::{inputsig::InputWitness, DestinationSigError, Transactable}, tokens::{RPCTokenInfo, TokenId}, Block, ChainConfig, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, @@ -980,10 +980,13 @@ where ptx: PartiallySignedTransaction, ) -> Result> { let input_utxos: Vec<_> = - ptx.input_utxos().iter().flatten().map(|(utxo, _)| utxo).cloned().collect(); + ptx.input_utxos().iter().flatten().map(|utxo| &utxo.utxo).cloned().collect(); let fees = self.get_fees(&input_utxos, ptx.tx().outputs()).await?; - let inputs_utxos_refs: Vec<_> = - ptx.input_utxos().iter().map(|out| out.as_ref().map(|(utxo, _)| utxo)).collect(); + let inputs_utxos_refs: Vec<_> = ptx + .input_utxos() + .iter() + .map(|out| out.as_ref().map(|utxo| &utxo.utxo)) + .collect(); let signature_statuses: Vec<_> = ptx .witnesses() .iter() @@ -1212,12 +1215,12 @@ where async fn fetch_utxos_extra_info( &self, inputs: Vec, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { let tasks: FuturesOrdered<_> = inputs .into_iter() .map(|input| fetch_utxo_exra_info(&self.rpc_client, input)) .collect(); - let input_utxos: Vec<(TxOutput, UtxoAdditionalInfo)> = tasks.try_collect().await?; + let input_utxos: Vec = tasks.try_collect().await?; Ok(input_utxos) } diff --git a/wallet/wallet-controller/src/sync/tests/mod.rs b/wallet/wallet-controller/src/sync/tests/mod.rs index 0a7e3a085c..61f77b1893 100644 --- a/wallet/wallet-controller/src/sync/tests/mod.rs +++ b/wallet/wallet-controller/src/sync/tests/mod.rs @@ -40,7 +40,6 @@ use node_comm::{ rpc_client::NodeRpcError, }; use p2p_types::{bannable_address::BannableAddress, socket_address::SocketAddress}; -use pos_accounting::PoolData; use randomness::{seq::IteratorRandom, CryptoRng, Rng}; use rstest::rstest; use test_utils::random::{make_seedable_rng, Seed}; @@ -276,7 +275,10 @@ impl NodeInterface for MockNode { unreachable!() } - async fn get_pool_data(&self, _pool_id: PoolId) -> Result, Self::Error> { + async fn get_pool_decommission_destination( + &self, + _pool_id: PoolId, + ) -> Result, Self::Error> { unreachable!() } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index f538177614..3c2a0103f2 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -194,7 +194,7 @@ where PoolOrTokenId::TokenId(token_info.token_id()), UtxoAdditionalInfo::TokenInfo { num_decimals: token_info.token_number_of_decimals(), - ticker: token_info.token_ticker(), + ticker: token_info.token_ticker().to_vec(), }, ); } diff --git a/wallet/wallet-node-client/src/handles_client/mod.rs b/wallet/wallet-node-client/src/handles_client/mod.rs index fd6b918205..16388ddf44 100644 --- a/wallet/wallet-node-client/src/handles_client/mod.rs +++ b/wallet/wallet-node-client/src/handles_client/mod.rs @@ -20,8 +20,8 @@ use chainstate::{BlockSource, ChainInfo, ChainstateError, ChainstateHandle}; use common::{ chain::{ tokens::{RPCTokenInfo, TokenId}, - Block, DelegationId, GenBlock, OrderId, PoolId, RpcOrderInfo, SignedTransaction, - Transaction, + Block, DelegationId, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, + SignedTransaction, Transaction, }, primitives::{time::Time, Amount, BlockHeight, Id}, }; @@ -36,7 +36,6 @@ use p2p::{ types::{bannable_address::BannableAddress, peer_id::PeerId, socket_address::SocketAddress}, P2pHandle, }; -use pos_accounting::PoolData; use serialization::hex::HexError; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -197,8 +196,15 @@ impl NodeInterface for WalletHandlesClient { Ok(result) } - async fn get_pool_data(&self, pool_id: PoolId) -> Result, Self::Error> { - let result = self.chainstate.call(move |this| this.get_stake_pool_data(pool_id)).await??; + async fn get_pool_decommission_destination( + &self, + pool_id: PoolId, + ) -> Result, Self::Error> { + let result = self + .chainstate + .call(move |this| this.get_stake_pool_data(pool_id)) + .await?? + .map(|data| data.decommission_destination().clone()); Ok(result) } diff --git a/wallet/wallet-node-client/src/node_traits.rs b/wallet/wallet-node-client/src/node_traits.rs index 369f064e49..bf90fcb426 100644 --- a/wallet/wallet-node-client/src/node_traits.rs +++ b/wallet/wallet-node-client/src/node_traits.rs @@ -19,8 +19,8 @@ use chainstate::ChainInfo; use common::{ chain::{ tokens::{RPCTokenInfo, TokenId}, - Block, DelegationId, GenBlock, OrderId, PoolId, RpcOrderInfo, SignedTransaction, - Transaction, TxOutput, UtxoOutPoint, + Block, DelegationId, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, + SignedTransaction, Transaction, TxOutput, UtxoOutPoint, }, primitives::{time::Time, Amount, BlockHeight, Id}, }; @@ -30,7 +30,6 @@ use crypto::ephemeral_e2e::EndToEndPublicKey; use mempool::{tx_accumulator::PackingStrategy, tx_options::TxOptionsOverrides, FeeRate}; use p2p::types::{bannable_address::BannableAddress, socket_address::SocketAddress}; pub use p2p::{interface::types::ConnectedPeer, types::peer_id::PeerId}; -use pos_accounting::PoolData; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -66,7 +65,10 @@ pub trait NodeInterface { ) -> Result, BlockHeight)>, Self::Error>; async fn get_stake_pool_balance(&self, pool_id: PoolId) -> Result, Self::Error>; async fn get_staker_balance(&self, pool_id: PoolId) -> Result, Self::Error>; - async fn get_pool_data(&self, pool_id: PoolId) -> Result, Self::Error>; + async fn get_pool_decommission_destination( + &self, + pool_id: PoolId, + ) -> Result, Self::Error>; async fn get_delegation_share( &self, pool_id: PoolId, diff --git a/wallet/wallet-node-client/src/rpc_client/client_impl.rs b/wallet/wallet-node-client/src/rpc_client/client_impl.rs index 63f4dc28a7..0140653d27 100644 --- a/wallet/wallet-node-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-node-client/src/rpc_client/client_impl.rs @@ -21,10 +21,10 @@ use common::{ address::Address, chain::{ tokens::{RPCTokenInfo, TokenId}, - Block, DelegationId, GenBlock, OrderId, PoolId, RpcOrderInfo, SignedTransaction, - Transaction, TxOutput, UtxoOutPoint, + Block, DelegationId, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, + SignedTransaction, Transaction, TxOutput, UtxoOutPoint, }, - primitives::{per_thousand::PerThousand, time::Time, Amount, BlockHeight, Id}, + primitives::{time::Time, Amount, BlockHeight, Id}, }; use consensus::GenerateBlockInputData; use crypto::ephemeral_e2e::EndToEndPublicKey; @@ -36,7 +36,6 @@ use p2p::{ rpc::P2pRpcClient, types::{bannable_address::BannableAddress, peer_id::PeerId, socket_address::SocketAddress}, }; -use pos_accounting::PoolData; use serialization::hex_encoded::HexEncoded; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -142,22 +141,17 @@ impl NodeInterface for NodeRpcClient { .map_err(NodeRpcError::ResponseError) } - async fn get_pool_data(&self, pool_id: PoolId) -> Result, Self::Error> { + async fn get_pool_decommission_destination( + &self, + pool_id: PoolId, + ) -> Result, Self::Error> { let pool_address = Address::new(&self.chain_config, pool_id)?; - ChainstateRpcClient::pool_data(&self.http_client, pool_address.into_string()) - .await - .map_err(NodeRpcError::ResponseError)? - .map(|d| { - Ok(PoolData::new( - d.decommission_key.decode_object(&self.chain_config)?, - d.pledge.amount(), - d.rewards.amount(), - d.vrf_public_key.decode_object(&self.chain_config)?, - PerThousand::from_decimal_str(&d.margin_ratio_per_thousand)?, - d.cost_per_block.amount(), - )) - }) - .transpose() + ChainstateRpcClient::pool_decommission_destination( + &self.http_client, + pool_address.into_string(), + ) + .await + .map_err(NodeRpcError::ResponseError) } async fn get_delegation_share( diff --git a/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs b/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs index 2b240fcf31..0ace8356a8 100644 --- a/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs +++ b/wallet/wallet-node-client/src/rpc_client/cold_wallet_client.rs @@ -20,8 +20,8 @@ use chainstate::ChainInfo; use common::{ chain::{ tokens::{RPCTokenInfo, TokenId}, - Block, DelegationId, GenBlock, OrderId, PoolId, RpcOrderInfo, SignedTransaction, - Transaction, + Block, DelegationId, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, + SignedTransaction, Transaction, }, primitives::{time::Time, Amount, BlockHeight, Id}, }; @@ -32,7 +32,6 @@ use p2p::{ interface::types::ConnectedPeer, types::{bannable_address::BannableAddress, socket_address::SocketAddress, PeerId}, }; -use pos_accounting::PoolData; use utils_networking::IpOrSocketAddress; use wallet_types::wallet_type::WalletControllerMode; @@ -120,7 +119,10 @@ impl NodeInterface for ColdWalletClient { Err(ColdWalletRpcError::NotAvailable) } - async fn get_pool_data(&self, _pool_id: PoolId) -> Result, Self::Error> { + async fn get_pool_decommission_destination( + &self, + _pool_id: PoolId, + ) -> Result, Self::Error> { Err(ColdWalletRpcError::NotAvailable) } From 1c1432617378f3a34ba0ceb222c759720e72fae6 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Fri, 16 Aug 2024 11:18:24 +0200 Subject: [PATCH 23/48] update rpc docs --- node-daemon/docs/RPC.md | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/node-daemon/docs/RPC.md b/node-daemon/docs/RPC.md index d202ef5185..95ae1711c3 100644 --- a/node-daemon/docs/RPC.md +++ b/node-daemon/docs/RPC.md @@ -347,9 +347,9 @@ EITHER OF 2) null ``` -### Method `chainstate_pool_data` +### Method `chainstate_pool_decommission_destination` -Returns the pool data of the pool associated with the given pool address. +Returns the pool's decommission destination associated with the given pool address. Returns `None` (null) if the pool is not found. @@ -362,23 +362,7 @@ Parameters: Returns: ``` EITHER OF - 1) { - "pledge": { - "atoms": number string, - "decimal": decimal string, - }, - "rewards": { - "atoms": number string, - "decimal": decimal string, - }, - "vrf_public_key": bech32 string, - "decommission_key": bech32 string, - "margin_ratio_per_thousand": string, - "cost_per_block": { - "atoms": number string, - "decimal": decimal string, - }, - } + 1) bech32 string 2) null ``` From 8c5932e147fb2bddcb52ab2b12296503a12107f0 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 20 Aug 2024 12:51:25 +0200 Subject: [PATCH 24/48] Add additional utxo info for tx outputs --- common/src/chain/transaction/mod.rs | 2 + .../partially_signed_transaction.rs | 12 + wallet/src/send_request/mod.rs | 83 ++++--- wallet/src/signer/mod.rs | 4 + wallet/src/signer/trezor_signer/mod.rs | 209 +++++++++--------- wallet/src/wallet/mod.rs | 35 ++- wallet/src/wallet/tests.rs | 8 + wallet/wallet-controller/src/helpers.rs | 17 +- wallet/wallet-controller/src/lib.rs | 11 +- 9 files changed, 224 insertions(+), 157 deletions(-) diff --git a/common/src/chain/transaction/mod.rs b/common/src/chain/transaction/mod.rs index 238913cd29..05d919594f 100644 --- a/common/src/chain/transaction/mod.rs +++ b/common/src/chain/transaction/mod.rs @@ -113,6 +113,8 @@ pub enum TransactionCreationError { InvalidHtlcSecretsCount, #[error("Failed to convert partially signed tx to signed")] FailedToConvertPartiallySignedTx(PartiallySignedTransaction), + #[error("The number of output additional infos does not match the number of outputs")] + InvalidOutputAdditionalInfoCount, } impl Transaction { diff --git a/common/src/chain/transaction/partially_signed_transaction.rs b/common/src/chain/transaction/partially_signed_transaction.rs index c1128a8c0b..656bf1f002 100644 --- a/common/src/chain/transaction/partially_signed_transaction.rs +++ b/common/src/chain/transaction/partially_signed_transaction.rs @@ -57,6 +57,7 @@ pub struct PartiallySignedTransaction { destinations: Vec>, htlc_secrets: Vec>, + output_additional_infos: Vec, } impl PartiallySignedTransaction { @@ -66,6 +67,7 @@ impl PartiallySignedTransaction { input_utxos: Vec>, destinations: Vec>, htlc_secrets: Option>>, + output_additional_infos: Vec, ) -> Result { let htlc_secrets = htlc_secrets.unwrap_or_else(|| vec![None; tx.inputs().len()]); @@ -75,6 +77,7 @@ impl PartiallySignedTransaction { input_utxos, destinations, htlc_secrets, + output_additional_infos, }; this.ensure_consistency()?; @@ -103,6 +106,11 @@ impl PartiallySignedTransaction { TransactionCreationError::InvalidHtlcSecretsCount ); + ensure!( + self.tx.outputs().len() == self.output_additional_infos.len(), + TransactionCreationError::InvalidOutputAdditionalInfoCount + ); + Ok(()) } @@ -139,6 +147,10 @@ impl PartiallySignedTransaction { self.tx.inputs().len() } + pub fn output_additional_infos(&self) -> &[UtxoAdditionalInfo] { + &self.output_additional_infos + } + pub fn all_signatures_available(&self) -> bool { self.witnesses .iter() diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 1f6566a6c5..4e4edf194e 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -301,56 +301,73 @@ impl SendRequest { additional_info: &BTreeMap, ) -> WalletResult { let num_inputs = self.inputs.len(); - let tx = Transaction::new(self.flags, self.inputs, self.outputs)?; let destinations = self.destinations.into_iter().map(Some).collect(); let utxos = self .utxos .into_iter() .map(|utxo| { utxo.map(|utxo| { - let additional_info = match &utxo { - TxOutput::Burn(value) - | TxOutput::Htlc(value, _) - | TxOutput::Transfer(value, _) - | TxOutput::LockThenTransfer(value, _, _) => { - find_additional_info(value, additional_info)? - } - TxOutput::AnyoneCanTake(data) => { - find_additional_info(data.as_ref().ask(), additional_info)? - } - TxOutput::IssueNft(_, data, _) => UtxoAdditionalInfo::TokenInfo { - num_decimals: 0, - ticker: match data.as_ref() { - NftIssuance::V0(data) => data.metadata.ticker().clone(), - }, - }, - TxOutput::CreateStakePool(_, data) => UtxoAdditionalInfo::PoolInfo { - staker_balance: data.pledge(), - }, - TxOutput::ProduceBlockFromStake(_, pool_id) => additional_info - .get(&PoolOrTokenId::PoolId(*pool_id)) - .ok_or(WalletError::MissingPoolAdditionalData(*pool_id))? - .clone(), - TxOutput::DataDeposit(_) - | TxOutput::IssueFungibleToken(_) - | TxOutput::DelegateStaking(_, _) - | TxOutput::CreateDelegationId(_, _) => { - UtxoAdditionalInfo::NoAdditionalInfo - } - }; + let additional_info = find_additional_info(&utxo, additional_info)?; Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) }) .transpose() }) .collect::>>()?; + let output_additional_infos = self + .outputs + .iter() + .map(|utxo| find_additional_info(utxo, additional_info)) + .collect::>>()?; + let tx = Transaction::new(self.flags, self.inputs, self.outputs)?; - let ptx = - PartiallySignedTransaction::new(tx, vec![None; num_inputs], utxos, destinations, None)?; + let ptx = PartiallySignedTransaction::new( + tx, + vec![None; num_inputs], + utxos, + destinations, + None, + output_additional_infos, + )?; Ok(ptx) } } fn find_additional_info( + utxo: &TxOutput, + additional_info: &BTreeMap, +) -> Result { + let additional_info = match utxo { + TxOutput::Burn(value) + | TxOutput::Htlc(value, _) + | TxOutput::Transfer(value, _) + | TxOutput::LockThenTransfer(value, _, _) => { + find_additional_info_output_value(value, additional_info)? + } + TxOutput::AnyoneCanTake(data) => { + find_additional_info_output_value(data.as_ref().ask(), additional_info)? + } + TxOutput::IssueNft(_, data, _) => UtxoAdditionalInfo::TokenInfo { + num_decimals: 0, + ticker: match data.as_ref() { + NftIssuance::V0(data) => data.metadata.ticker().clone(), + }, + }, + TxOutput::CreateStakePool(_, data) => UtxoAdditionalInfo::PoolInfo { + staker_balance: data.pledge(), + }, + TxOutput::ProduceBlockFromStake(_, pool_id) => additional_info + .get(&PoolOrTokenId::PoolId(*pool_id)) + .ok_or(WalletError::MissingPoolAdditionalData(*pool_id))? + .clone(), + TxOutput::DataDeposit(_) + | TxOutput::IssueFungibleToken(_) + | TxOutput::DelegateStaking(_, _) + | TxOutput::CreateDelegationId(_, _) => UtxoAdditionalInfo::NoAdditionalInfo, + }; + Ok(additional_info) +} + +fn find_additional_info_output_value( value: &OutputValue, additional_info: &BTreeMap, ) -> WalletResult { diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 52a38ec8fd..9138b7cbb4 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -74,6 +74,10 @@ pub enum SignerError { MissingDestinationInTransaction, #[error("Partially signed tx is missing UTXO type input's UTXO")] MissingUtxo, + #[error("Partially signed tx is missing extra info for UTXO")] + MissingUtxoExtraInfo, + #[error("Tokens V0 are not supported")] + UnsupportedTokensV0, } type SignerResult = Result; diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 92e8ec10ec..114da5599f 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -22,7 +22,9 @@ use common::{ address::Address, chain::{ output_value::OutputValue, - partially_signed_transaction::PartiallySignedTransaction, + partially_signed_transaction::{ + PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + }, signature::{ inputsig::{ arbitrary_message::ArbitraryMessageSignature, @@ -63,9 +65,9 @@ use trezor_client::{ MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFreezeToken, MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, MintlayerLockThenTransferTxOutput, MintlayerLockTokenSupply, MintlayerMintTokens, - MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, MintlayerTokenTotalSupply, - MintlayerTokenTotalSupplyType, MintlayerTxInput, MintlayerTxOutput, MintlayerUnfreezeToken, - MintlayerUnmintTokens, MintlayerUtxoType, + MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, MintlayerTokenOutputValue, + MintlayerTokenTotalSupply, MintlayerTokenTotalSupplyType, MintlayerTxInput, + MintlayerTxOutput, MintlayerUnfreezeToken, MintlayerUnmintTokens, MintlayerUtxoType, }, }; #[allow(clippy::all)] @@ -209,12 +211,18 @@ impl TrezorSigner { } } - fn to_trezor_output_msgs(&self, ptx: &PartiallySignedTransaction) -> Vec { + fn to_trezor_output_msgs( + &self, + ptx: &PartiallySignedTransaction, + ) -> SignerResult> { let outputs = ptx .tx() .outputs() .iter() - .map(|out| to_trezor_output_msg(&self.chain_config, out)) + .zip(ptx.output_additional_infos()) + .map(|(out, additional_info)| { + to_trezor_output_msg(&self.chain_config, out, additional_info) + }) .collect(); outputs } @@ -232,8 +240,8 @@ impl Signer for TrezorSigner { Vec, )> { let inputs = to_trezor_input_msgs(&ptx, key_chain, &self.chain_config)?; - let outputs = self.to_trezor_output_msgs(&ptx); - let utxos = to_trezor_utxo_msgs(&ptx, &self.chain_config); + let outputs = self.to_trezor_output_msgs(&ptx)?; + let utxos = to_trezor_utxo_msgs(&ptx, &self.chain_config)?; let new_signatures = self .client @@ -463,8 +471,8 @@ fn tx_output_value(out: &TxOutput) -> OutputValue { TxOutput::IssueNft(token_id, _, _) => { OutputValue::TokenV1(*token_id, Amount::from_atoms(1)) } - TxOutput::CreateStakePool(_, _) - | TxOutput::CreateDelegationId(_, _) + TxOutput::CreateStakePool(_, data) => OutputValue::Coin(data.pledge()), + TxOutput::CreateDelegationId(_, _) | TxOutput::ProduceBlockFromStake(_, _) | TxOutput::IssueFungibleToken(_) | TxOutput::CreateOrder(_) @@ -483,13 +491,9 @@ fn to_trezor_input_msgs( .zip(ptx.input_utxos()) .zip(ptx.destinations()) .map(|((inp, utxo), dest)| match (inp, utxo, dest) { - (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => Ok(to_trezor_utxo_input( - outpoint, - &utxo.utxo, - chain_config, - dest, - key_chain, - )), + (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => { + to_trezor_utxo_input(outpoint, utxo, chain_config, dest, key_chain) + } (TxInput::Account(outpoint), _, Some(dest)) => Ok(to_trezor_account_input( chain_config, dest, @@ -636,11 +640,11 @@ fn to_trezor_account_input( fn to_trezor_utxo_input( outpoint: &common::chain::UtxoOutPoint, - utxo: &TxOutput, + utxo: &UtxoWithAdditionalInfo, chain_config: &ChainConfig, dest: &Destination, key_chain: &impl AccountKeyChains, -) -> MintlayerTxInput { +) -> SignerResult { let mut inp_req = MintlayerUtxoTxInput::new(); let id = match outpoint.source_id() { OutPointSourceId::Transaction(id) => { @@ -654,22 +658,13 @@ fn to_trezor_utxo_input( }; inp_req.set_prev_hash(id.to_vec()); inp_req.set_prev_index(outpoint.output_index()); - match tx_output_value(utxo) { - OutputValue::Coin(amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - inp_req.value = Some(value).into(); - } - OutputValue::TokenV1(token_id, amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - value.set_token_id(token_id.to_hash().as_bytes().to_vec()); - inp_req.value = Some(value).into(); - } - OutputValue::TokenV0(_) => { - panic!("token v0 unsuported"); - } - } + + let output_value = tx_output_value(&utxo.utxo); + inp_req.value = Some(to_trezor_output_value( + &output_value, + &utxo.additional_info, + )?) + .into(); inp_req .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); @@ -721,61 +716,80 @@ fn to_trezor_utxo_input( let mut inp = MintlayerTxInput::new(); inp.utxo = Some(inp_req).into(); - inp + Ok(inp) } -fn to_trezor_utxo_msgs( - ptx: &PartiallySignedTransaction, - chain_config: &ChainConfig, -) -> BTreeMap<[u8; 32], BTreeMap> { - let utxos = ptx.input_utxos().iter().zip(ptx.tx().inputs()).fold( - BTreeMap::new(), - |mut map: BTreeMap<[u8; 32], BTreeMap>, (utxo, inp)| { - match (inp, utxo) { - (TxInput::Utxo(outpoint), Some(utxo)) => { - let id = match outpoint.source_id() { - OutPointSourceId::Transaction(id) => id.to_hash().0, - OutPointSourceId::BlockReward(id) => id.to_hash().0, - }; - let out = to_trezor_output_msg(chain_config, &utxo.utxo); - map.entry(id).or_default().insert(outpoint.output_index(), out); - } - (TxInput::Utxo(_), None) => unimplemented!("missing utxo"), - (TxInput::Account(_) | TxInput::AccountCommand(_, _), Some(_)) => { - panic!("can't have accounts as UTXOs") - } - (TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => {} - } - map - }, - ); - utxos -} - -fn set_value(value: &OutputValue, out_req: &mut MintlayerTransferTxOutput) { - match value { +fn to_trezor_output_value( + output_value: &OutputValue, + additional_info: &UtxoAdditionalInfo, +) -> SignerResult { + let value = match output_value { OutputValue::Coin(amount) => { let mut value = MintlayerOutputValue::new(); value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - out_req.value = Some(value).into(); + value } OutputValue::TokenV1(token_id, amount) => { let mut value = MintlayerOutputValue::new(); value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - value.set_token_id(token_id.to_hash().as_bytes().to_vec()); - out_req.value = Some(value).into(); - } - OutputValue::TokenV0(_) => { - panic!("token v0 unsuported"); + let mut token_value = MintlayerTokenOutputValue::new(); + token_value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + match additional_info { + UtxoAdditionalInfo::TokenInfo { + num_decimals, + ticker, + } => { + token_value.set_number_of_decimals(*num_decimals as u32); + token_value.set_token_ticker(ticker.clone()); + } + UtxoAdditionalInfo::PoolInfo { staker_balance: _ } + | UtxoAdditionalInfo::NoAdditionalInfo => { + return Err(SignerError::MissingUtxoExtraInfo) + } + } + value.token = Some(token_value).into(); + value } + OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), }; + Ok(value) } -fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> MintlayerTxOutput { - match out { +fn to_trezor_utxo_msgs( + ptx: &PartiallySignedTransaction, + chain_config: &ChainConfig, +) -> SignerResult>> { + let mut utxos: BTreeMap<[u8; 32], BTreeMap> = BTreeMap::new(); + for (utxo, inp) in ptx.input_utxos().iter().zip(ptx.tx().inputs()) { + match (inp, utxo) { + (TxInput::Utxo(outpoint), Some(utxo)) => { + let id = match outpoint.source_id() { + OutPointSourceId::Transaction(id) => id.to_hash().0, + OutPointSourceId::BlockReward(id) => id.to_hash().0, + }; + let out = to_trezor_output_msg(chain_config, &utxo.utxo, &utxo.additional_info)?; + utxos.entry(id).or_default().insert(outpoint.output_index(), out); + } + (TxInput::Utxo(_), None) => unimplemented!("missing utxo"), + (TxInput::Account(_) | TxInput::AccountCommand(_, _), Some(_)) => { + panic!("can't have accounts as UTXOs") + } + (TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => {} + } + } + + Ok(utxos) +} + +fn to_trezor_output_msg( + chain_config: &ChainConfig, + out: &TxOutput, + additional_info: &UtxoAdditionalInfo, +) -> SignerResult { + let res = match out { TxOutput::Transfer(value, dest) => { let mut out_req = MintlayerTransferTxOutput::new(); - set_value(value, &mut out_req); + out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); out_req.set_address( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -786,22 +800,11 @@ fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> Mintlayer } TxOutput::LockThenTransfer(value, dest, lock) => { let mut out_req = MintlayerLockThenTransferTxOutput::new(); - match value { - OutputValue::Coin(amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - out_req.value = Some(value).into(); - } - OutputValue::TokenV1(token_id, amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - value.set_token_id(token_id.to_hash().as_bytes().to_vec()); - out_req.value = Some(value).into(); - } - OutputValue::TokenV0(_) => { - panic!("token v0 unsuported"); - } - }; + out_req.value = Some(to_trezor_output_value( + value, + &UtxoAdditionalInfo::NoAdditionalInfo, + )?) + .into(); out_req.set_address( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -829,22 +832,11 @@ fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> Mintlayer } TxOutput::Burn(value) => { let mut out_req = MintlayerBurnTxOutput::new(); - match value { - OutputValue::Coin(amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - out_req.value = Some(value).into(); - } - OutputValue::TokenV1(token_id, amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - value.set_token_id(token_id.to_hash().as_bytes().to_vec()); - out_req.value = Some(value).into(); - } - OutputValue::TokenV0(_) => { - panic!("token v0 unsuported"); - } - }; + out_req.value = Some(to_trezor_output_value( + value, + &UtxoAdditionalInfo::NoAdditionalInfo, + )?) + .into(); let mut out = MintlayerTxOutput::new(); out.burn = Some(out_req).into(); @@ -995,7 +987,8 @@ fn to_trezor_output_msg(chain_config: &ChainConfig, out: &TxOutput) -> Mintlayer } TxOutput::Htlc(_, _) => unimplemented!("HTLC"), TxOutput::CreateOrder(_) => unimplemented!("CreateOrder"), - } + }; + Ok(res) } #[derive(Clone)] diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index f048ad5674..3cf3bbe6d2 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -1809,18 +1809,29 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - self.for_account_rw_unlocked_and_check_tx(account_index, |account, db_tx| { - account.change_token_metadata_uri( - db_tx, - token_info, - metadata_uri, - latest_median_time, - CurrentFeeRate { - current_fee_rate, - consolidate_fee_rate, - }, - ) - }) + let additional_utxo_infos = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + )]); + self.for_account_rw_unlocked_and_check_tx( + account_index, + &additional_utxo_infos, + |account, db_tx| { + account.change_token_metadata_uri( + db_tx, + token_info, + metadata_uri, + latest_median_time, + CurrentFeeRate { + current_fee_rate, + consolidate_fee_rate, + }, + ) + }, + ) } pub fn find_used_tokens( diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index e772d0d32e..8ac88636f0 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -4352,6 +4352,7 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { // remove the signatures and try to sign it again let tx = stake_pool_transaction.transaction().clone(); let inps = tx.inputs().len(); + let outs = tx.outputs().len(); let ptx = PartiallySignedTransaction::new( tx, vec![None; inps], @@ -4361,6 +4362,7 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { ))], vec![Some(addr.into_object())], None, + vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], ) .unwrap(); let stake_pool_transaction = wallet @@ -4885,6 +4887,7 @@ fn test_add_standalone_multisig(#[case] seed: Seed) { )], ) .unwrap(); + let outs = tx.outputs().len(); let spend_multisig_tx = PartiallySignedTransaction::new( spend_multisig_tx, vec![None; 1], @@ -4894,6 +4897,7 @@ fn test_add_standalone_multisig(#[case] seed: Seed) { ))], vec![Some(multisig_address.as_object().clone())], None, + vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], ) .unwrap(); @@ -5044,12 +5048,14 @@ fn create_htlc_and_spend(#[case] seed: Seed) { .first() .cloned() .map(|out| UtxoWithAdditionalInfo::new(out, UtxoAdditionalInfo::NoAdditionalInfo))]; + let outs = create_htlc_tx.outputs().len(); let spend_ptx = PartiallySignedTransaction::new( spend_tx, vec![None], spend_utxos, vec![Some(spend_key.into_object())], Some(vec![Some(secret)]), + vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], ) .unwrap(); @@ -5146,12 +5152,14 @@ fn create_htlc_and_refund(#[case] seed: Seed) { .first() .cloned() .map(|out| UtxoWithAdditionalInfo::new(out, UtxoAdditionalInfo::NoAdditionalInfo))]; + let outs = create_htlc_tx.outputs().len(); let refund_ptx = PartiallySignedTransaction::new( refund_tx, vec![None], refund_utxos, vec![Some(refund_key)], None, + vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], ) .unwrap(); diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index 0883e35b23..af907bf8a5 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -137,7 +137,7 @@ fn pool_id_from_txo(utxo: &TxOutput) -> Option { } } -pub async fn fetch_utxo_exra_info( +pub async fn fetch_utxo_extra_info( rpc_client: &T, utxo: TxOutput, ) -> Result> @@ -244,12 +244,25 @@ pub async fn tx_to_partially_signed_tx( let (input_utxos, destinations) = tasks.try_collect::>().await?.into_iter().unzip(); let num_inputs = tx.inputs().len(); + let tasks: FuturesOrdered<_> = tx + .outputs() + .iter() + .map(|out| fetch_utxo_extra_info(rpc_client, out.clone())) + .collect(); + let output_additional_infos = tasks + .try_collect::>() + .await? + .into_iter() + .map(|x| x.additional_info) + .collect(); + let ptx = PartiallySignedTransaction::new( tx, vec![None; num_inputs], input_utxos, destinations, None, + output_additional_infos, ) .map_err(WalletError::TransactionCreation)?; Ok(ptx) @@ -263,7 +276,7 @@ async fn into_utxo_and_destination( Ok(match tx_inp { TxInput::Utxo(outpoint) => { let (utxo, dest) = fetch_utxo_with_destination(rpc_client, outpoint, wallet).await?; - let utxo_with_extra_info = fetch_utxo_exra_info(rpc_client, utxo).await?; + let utxo_with_extra_info = fetch_utxo_extra_info(rpc_client, utxo).await?; (Some(utxo_with_extra_info), Some(dest)) } TxInput::Account(acc_outpoint) => { diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index bbf0d0be25..faaefa7bd4 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -30,7 +30,7 @@ use chainstate::tx_verifier::{ self, error::ScriptError, input_check::signature_only_check::SignatureOnlyVerifiable, }; use futures::{never::Never, stream::FuturesOrdered, TryStreamExt}; -use helpers::{fetch_token_info, fetch_utxo, fetch_utxo_exra_info, into_balances}; +use helpers::{fetch_token_info, fetch_utxo, fetch_utxo_extra_info, into_balances}; use node_comm::rpc_client::ColdWalletClient; use std::{ collections::{BTreeMap, BTreeSet}, @@ -1124,12 +1124,19 @@ where .map_err(ControllerError::WalletError)?; let input_utxos = self.fetch_utxos_extra_info(input_utxos).await?; + let output_additional_infos = self + .fetch_utxos_extra_info(tx.outputs().to_vec()) + .await? + .into_iter() + .map(|x| x.additional_info) + .collect(); let tx = PartiallySignedTransaction::new( tx, vec![None; num_inputs], input_utxos.into_iter().map(Option::Some).collect(), destinations.into_iter().map(Option::Some).collect(), htlc_secrets, + output_additional_infos, ) .map_err(WalletError::TransactionCreation)?; @@ -1218,7 +1225,7 @@ where ) -> Result, ControllerError> { let tasks: FuturesOrdered<_> = inputs .into_iter() - .map(|input| fetch_utxo_exra_info(&self.rpc_client, input)) + .map(|input| fetch_utxo_extra_info(&self.rpc_client, input)) .collect(); let input_utxos: Vec = tasks.try_collect().await?; Ok(input_utxos) From ad379362cd02d3811f29e257e94ab0641d7a50a8 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 20 Aug 2024 14:23:04 +0200 Subject: [PATCH 25/48] move PartiallySignedTx to wallet --- Cargo.lock | 3 +- .../input_check/signature_only_check.rs | 2 - common/src/chain/transaction/mod.rs | 12 ----- test-rpc-functions/Cargo.toml | 1 + test-rpc-functions/src/rpc.rs | 2 +- wallet/src/account/mod.rs | 2 +- wallet/src/send_request/mod.rs | 6 +-- wallet/src/signer/mod.rs | 6 ++- wallet/src/signer/software_signer/mod.rs | 6 ++- wallet/src/signer/trezor_signer/mod.rs | 10 ++-- wallet/src/wallet/mod.rs | 12 +++-- wallet/src/wallet/tests.rs | 7 ++- wallet/types/Cargo.toml | 1 + wallet/types/src/lib.rs | 1 + .../src}/partially_signed_transaction.rs | 53 +++++++++++++------ .../src/command_handler/mod.rs | 6 +-- wallet/wallet-controller/src/helpers.rs | 8 +-- wallet/wallet-controller/src/lib.rs | 4 +- .../src/synced_controller.rs | 2 +- .../src/types/transaction.rs | 8 +-- wallet/wallet-node-client/Cargo.toml | 1 - .../src/handles_client/mod.rs | 4 +- .../src/rpc_client/client_impl.rs | 4 +- .../src/wallet_rpc_traits.rs | 4 +- wallet/wallet-rpc-lib/src/rpc/interface.rs | 4 +- wallet/wallet-rpc-lib/src/rpc/mod.rs | 9 ++-- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 4 +- wallet/wallet-rpc-lib/src/rpc/types.rs | 5 +- 28 files changed, 106 insertions(+), 81 deletions(-) rename {common/src/chain/transaction => wallet/types/src}/partially_signed_transaction.rs (73%) diff --git a/Cargo.lock b/Cargo.lock index 67def8cc7d..47a6f607a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4771,7 +4771,6 @@ dependencies = [ "mempool", "node-lib", "p2p", - "pos-accounting", "rpc", "serde_json", "serialization", @@ -7883,6 +7882,7 @@ dependencies = [ "subsystem", "thiserror", "tokio", + "wallet-types", ] [[package]] @@ -9084,6 +9084,7 @@ dependencies = [ "storage", "test-utils", "thiserror", + "tx-verifier", "utils", "zeroize", ] diff --git a/chainstate/tx-verifier/src/transaction_verifier/input_check/signature_only_check.rs b/chainstate/tx-verifier/src/transaction_verifier/input_check/signature_only_check.rs index 537c6b6d5a..1f4c96c0fc 100644 --- a/chainstate/tx-verifier/src/transaction_verifier/input_check/signature_only_check.rs +++ b/chainstate/tx-verifier/src/transaction_verifier/input_check/signature_only_check.rs @@ -16,7 +16,6 @@ use std::convert::Infallible; use common::chain::{ - partially_signed_transaction::PartiallySignedTransaction, signature::{inputsig::InputWitness, DestinationSigError, Transactable}, tokens::TokenId, ChainConfig, DelegationId, Destination, PoolId, SignedTransaction, TxInput, TxOutput, @@ -102,7 +101,6 @@ impl InputInfoProvider for InputVerifyContextSignature<'_, T> { // Prevent BlockRewardTransactable from being used here pub trait SignatureOnlyVerifiable {} impl SignatureOnlyVerifiable for SignedTransaction {} -impl SignatureOnlyVerifiable for PartiallySignedTransaction {} pub fn verify_tx_signature( chain_config: &ChainConfig, diff --git a/common/src/chain/transaction/mod.rs b/common/src/chain/transaction/mod.rs index 05d919594f..8ca38c9981 100644 --- a/common/src/chain/transaction/mod.rs +++ b/common/src/chain/transaction/mod.rs @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use partially_signed_transaction::PartiallySignedTransaction; use thiserror::Error; use serialization::{DirectDecode, DirectEncode}; @@ -34,7 +33,6 @@ pub use account_nonce::*; pub mod utxo_outpoint; pub use utxo_outpoint::*; -pub mod partially_signed_transaction; pub mod signed_transaction; pub mod signed_transaction_intent; @@ -105,16 +103,6 @@ impl Eq for WithId {} pub enum TransactionCreationError { #[error("The number of signatures does not match the number of inputs")] InvalidWitnessCount, - #[error("The number of input utxos does not match the number of inputs")] - InvalidInputUtxosCount, - #[error("The number of destinations does not match the number of inputs")] - InvalidDestinationsCount, - #[error("The number of htlc secrets does not match the number of inputs")] - InvalidHtlcSecretsCount, - #[error("Failed to convert partially signed tx to signed")] - FailedToConvertPartiallySignedTx(PartiallySignedTransaction), - #[error("The number of output additional infos does not match the number of outputs")] - InvalidOutputAdditionalInfoCount, } impl Transaction { diff --git a/test-rpc-functions/Cargo.toml b/test-rpc-functions/Cargo.toml index 608b31801c..731751a3b5 100644 --- a/test-rpc-functions/Cargo.toml +++ b/test-rpc-functions/Cargo.toml @@ -16,6 +16,7 @@ randomness = { path = "../randomness/" } rpc = { path = "../rpc/" } serialization = { path = "../serialization" } subsystem = { path = "../subsystem/" } +wallet-types = { path = "../wallet/types" } async-trait.workspace = true futures.workspace = true diff --git a/test-rpc-functions/src/rpc.rs b/test-rpc-functions/src/rpc.rs index dbd2ea10ec..fa3fb1e7cd 100644 --- a/test-rpc-functions/src/rpc.rs +++ b/test-rpc-functions/src/rpc.rs @@ -28,7 +28,6 @@ use common::{ EpochIndex, }, output_value::OutputValue, - partially_signed_transaction::PartiallySignedTransaction, signature::inputsig::{ arbitrary_message, authorize_hashed_timelock_contract_spend::AuthorizedHashedTimelockContractSpend, @@ -46,6 +45,7 @@ use serialization::{ hex_encoded::HexEncoded, Encode as _, }; +use wallet_types::partially_signed_transaction::PartiallySignedTransaction; use crate::{RpcTestFunctionsError, RpcTestFunctionsHandle}; diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index 92c1e233b2..b8c331b690 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -22,7 +22,6 @@ use common::address::pubkeyhash::PublicKeyHash; use common::chain::block::timestamp::BlockTimestamp; use common::chain::classic_multisig::ClassicMultisigChallenge; use common::chain::htlc::HashedTimelockContract; -use common::chain::partially_signed_transaction::PartiallySignedTransaction; use common::chain::{AccountCommand, AccountOutPoint, AccountSpending, OrderId, RpcOrderInfo}; use common::primitives::id::WithId; use common::primitives::{Idable, H256}; @@ -39,6 +38,7 @@ use utils::ensure; pub use utxo_selector::UtxoSelectorError; use wallet_types::account_id::AccountPrefixedId; use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; +use wallet_types::partially_signed_transaction::PartiallySignedTransaction; use wallet_types::with_locked::WithLocked; use crate::account::utxo_selector::{select_coins, OutputGroup}; diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 4e4edf194e..72f292a3b7 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -18,9 +18,6 @@ use std::mem::take; use common::address::Address; use common::chain::output_value::OutputValue; -use common::chain::partially_signed_transaction::{ - PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, -}; use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock::ForBlockCount; use common::chain::tokens::{Metadata, NftIssuance, TokenId, TokenIssuance}; @@ -32,6 +29,9 @@ use common::primitives::{Amount, BlockHeight}; use crypto::vrf::VRFPublicKey; use utils::ensure; use wallet_types::currency::Currency; +use wallet_types::partially_signed_transaction::{ + PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, +}; use crate::account::PoolData; use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 9138b7cbb4..2a111fa098 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -16,7 +16,6 @@ use std::sync::Arc; use common::chain::{ - partially_signed_transaction::PartiallySignedTransaction, signature::{ inputsig::{ arbitrary_message::{ArbitraryMessageSignature, SignArbitraryMessageError}, @@ -30,7 +29,10 @@ use crypto::key::hdkd::{derivable::DerivationError, u31::U31}; use wallet_storage::{ WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, }; -use wallet_types::{signature_status::SignatureStatus, AccountId}; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, signature_status::SignatureStatus, + AccountId, +}; use crate::{ key_chain::{AccountKeyChains, KeyChainError}, diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index ee4dcea87d..dad8908f92 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -17,7 +17,6 @@ use std::sync::Arc; use common::chain::{ htlc::HtlcSecret, - partially_signed_transaction::PartiallySignedTransaction, signature::{ inputsig::{ arbitrary_message::ArbitraryMessageSignature, @@ -48,7 +47,10 @@ use wallet_storage::{ StoreTxRwUnlocked, WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, }; -use wallet_types::{seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, AccountId}; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, seed_phrase::StoreSeedPhrase, + signature_status::SignatureStatus, AccountId, +}; use crate::{ key_chain::{ diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 114da5599f..794130240c 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -22,9 +22,6 @@ use common::{ address::Address, chain::{ output_value::OutputValue, - partially_signed_transaction::{ - PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, - }, signature::{ inputsig::{ arbitrary_message::ArbitraryMessageSignature, @@ -80,7 +77,12 @@ use wallet_storage::{ WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, }; use wallet_types::{ - account_info::DEFAULT_ACCOUNT_INDEX, signature_status::SignatureStatus, AccountId, + account_info::DEFAULT_ACCOUNT_INDEX, + partially_signed_transaction::{ + PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + }, + signature_status::SignatureStatus, + AccountId, }; use crate::{ diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 3cf3bbe6d2..36d78fdea9 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -39,7 +39,6 @@ use common::chain::block::timestamp::BlockTimestamp; use common::chain::classic_multisig::ClassicMultisigChallenge; use common::chain::htlc::HashedTimelockContract; use common::chain::output_value::OutputValue; -use common::chain::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; use common::chain::signature::inputsig::arbitrary_message::{ ArbitraryMessageSignature, SignArbitraryMessageError, }; @@ -75,6 +74,9 @@ use wallet_storage::{ }; use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; use wallet_types::chain_info::ChainInfo; +use wallet_types::partially_signed_transaction::{ + PartiallySignedTransaction, PartiallySignedTransactionCreationError, UtxoAdditionalInfo, +}; use wallet_types::seed_phrase::SerializableSeedPhrase; use wallet_types::signature_status::SignatureStatus; use wallet_types::utxo_types::{UtxoStates, UtxoTypes}; @@ -158,6 +160,8 @@ pub enum WalletError { UnknownOrderId(OrderId), #[error("Transaction creation error: {0}")] TransactionCreation(#[from] TransactionCreationError), + #[error("Transaction creation error: {0}")] + PartiallySignedTransactionCreation(#[from] PartiallySignedTransactionCreationError), #[error("Transaction signing error: {0}")] TransactionSig(#[from] DestinationSigError), #[error("Delegation not found with id {0}")] @@ -1078,9 +1082,9 @@ where ))); } - let tx = ptx - .into_signed_tx() - .map_err(|e| error_mapper(WalletError::TransactionCreation(e)))?; + let tx = ptx.into_signed_tx().map_err(|e| { + error_mapper(WalletError::PartiallySignedTransactionCreation(e)) + })?; check_transaction(chain_config, block_height.next_height(), &tx)?; Ok((tx, additional_data)) diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 8ac88636f0..fa40b45a46 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -34,7 +34,6 @@ use common::{ block::{consensus_data::PoSData, timestamp::BlockTimestamp, BlockReward, ConsensusData}, config::{create_mainnet, create_regtest, create_unit_test_config, Builder, ChainType}, output_value::{OutputValue, RpcOutputValue}, - partially_signed_transaction::{UtxoAdditionalInfo, UtxoWithAdditionalInfo}, signature::inputsig::InputWitness, timelock::OutputTimeLock, tokens::{RPCIsTokenFrozen, TokenData, TokenIssuanceV0, TokenIssuanceV1}, @@ -55,6 +54,10 @@ use test_utils::random::{make_seedable_rng, Seed}; use wallet_storage::{schema, WalletStorageEncryptionRead}; use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, + partially_signed_transaction::{ + PartiallySignedTransaction, PartiallySignedTransactionCreationError, UtxoAdditionalInfo, + UtxoWithAdditionalInfo, + }, seed_phrase::{PassPhrase, StoreSeedPhrase}, utxo_types::{UtxoState, UtxoType}, Currency, @@ -4298,7 +4301,7 @@ fn decommission_pool_request_wrong_account(#[case] seed: Seed) { assert!(!decommission_partial_tx.all_signatures_available()); matches!( decommission_partial_tx.into_signed_tx().unwrap_err(), - TransactionCreationError::FailedToConvertPartiallySignedTx(_) + PartiallySignedTransactionCreationError::FailedToConvertPartiallySignedTx(_) ); } diff --git a/wallet/types/Cargo.toml b/wallet/types/Cargo.toml index a1141ddf60..90d5761755 100644 --- a/wallet/types/Cargo.toml +++ b/wallet/types/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true [dependencies] common = { path = "../../common/" } crypto = { path = "../../crypto/" } +tx-verifier = { path = "../../chainstate/tx-verifier" } rpc-description = { path = "../../rpc/description" } randomness = { path = "../../randomness" } serialization = { path = "../../serialization" } diff --git a/wallet/types/src/lib.rs b/wallet/types/src/lib.rs index 00fed549c2..aecc3aa015 100644 --- a/wallet/types/src/lib.rs +++ b/wallet/types/src/lib.rs @@ -18,6 +18,7 @@ pub mod account_info; pub mod chain_info; pub mod currency; pub mod keys; +pub mod partially_signed_transaction; pub mod seed_phrase; pub mod signature_status; pub mod utxo_types; diff --git a/common/src/chain/transaction/partially_signed_transaction.rs b/wallet/types/src/partially_signed_transaction.rs similarity index 73% rename from common/src/chain/transaction/partially_signed_transaction.rs rename to wallet/types/src/partially_signed_transaction.rs index 656bf1f002..73348ae72c 100644 --- a/common/src/chain/transaction/partially_signed_transaction.rs +++ b/wallet/types/src/partially_signed_transaction.rs @@ -13,18 +13,35 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::{ - htlc::HtlcSecret, - signature::{inputsig::InputWitness, Signable, Transactable}, - Destination, Transaction, TxOutput, -}; -use crate::{ - chain::{SignedTransaction, TransactionCreationError, TxInput}, +use common::{ + chain::{ + htlc::HtlcSecret, + signature::{inputsig::InputWitness, Signable, Transactable}, + Destination, SignedTransaction, Transaction, TransactionCreationError, TxInput, TxOutput, + }, primitives::Amount, }; use serialization::{Decode, Encode}; +use thiserror::Error; +use tx_verifier::input_check::signature_only_check::SignatureOnlyVerifiable; use utils::ensure; +#[derive(Error, Debug, Clone, PartialEq, Eq)] +pub enum PartiallySignedTransactionCreationError { + #[error("Failed to convert partially signed tx to signed")] + FailedToConvertPartiallySignedTx(PartiallySignedTransaction), + #[error("The number of output additional infos does not match the number of outputs")] + InvalidOutputAdditionalInfoCount, + #[error("Failed to create transaction: {0}")] + TxCreationError(#[from] TransactionCreationError), + #[error("The number of input utxos does not match the number of inputs")] + InvalidInputUtxosCount, + #[error("The number of destinations does not match the number of inputs")] + InvalidDestinationsCount, + #[error("The number of htlc secrets does not match the number of inputs")] + InvalidHtlcSecretsCount, +} + /// Additional info for UTXOs #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub enum UtxoAdditionalInfo { @@ -68,7 +85,7 @@ impl PartiallySignedTransaction { destinations: Vec>, htlc_secrets: Option>>, output_additional_infos: Vec, - ) -> Result { + ) -> Result { let htlc_secrets = htlc_secrets.unwrap_or_else(|| vec![None; tx.inputs().len()]); let this = Self { @@ -85,7 +102,7 @@ impl PartiallySignedTransaction { Ok(this) } - pub fn ensure_consistency(&self) -> Result<(), TransactionCreationError> { + pub fn ensure_consistency(&self) -> Result<(), PartiallySignedTransactionCreationError> { ensure!( self.tx.inputs().len() == self.witnesses.len(), TransactionCreationError::InvalidWitnessCount @@ -93,22 +110,22 @@ impl PartiallySignedTransaction { ensure!( self.tx.inputs().len() == self.input_utxos.len(), - TransactionCreationError::InvalidInputUtxosCount, + PartiallySignedTransactionCreationError::InvalidInputUtxosCount, ); ensure!( self.tx.inputs().len() == self.destinations.len(), - TransactionCreationError::InvalidDestinationsCount + PartiallySignedTransactionCreationError::InvalidDestinationsCount ); ensure!( self.tx.inputs().len() == self.htlc_secrets.len(), - TransactionCreationError::InvalidHtlcSecretsCount + PartiallySignedTransactionCreationError::InvalidHtlcSecretsCount ); ensure!( self.tx.outputs().len() == self.output_additional_infos.len(), - TransactionCreationError::InvalidOutputAdditionalInfoCount + PartiallySignedTransactionCreationError::InvalidOutputAdditionalInfoCount ); Ok(()) @@ -165,14 +182,14 @@ impl PartiallySignedTransaction { }) } - pub fn into_signed_tx(self) -> Result { + pub fn into_signed_tx( + self, + ) -> Result { if self.all_signatures_available() { let witnesses = self.witnesses.into_iter().map(|w| w.expect("cannot fail")).collect(); Ok(SignedTransaction::new(self.tx, witnesses)?) } else { - Err(TransactionCreationError::FailedToConvertPartiallySignedTx( - self, - )) + Err(PartiallySignedTransactionCreationError::FailedToConvertPartiallySignedTx(self)) } } } @@ -200,3 +217,5 @@ impl Transactable for PartiallySignedTransaction { self.witnesses.clone() } } + +impl SignatureOnlyVerifiable for PartiallySignedTransaction {} diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index 037dbab366..5d077b507f 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -20,9 +20,8 @@ use std::{fmt::Write, str::FromStr}; use common::{ address::Address, chain::{ - config::checkpoints_data::print_block_heights_ids_as_checkpoints_data, - partially_signed_transaction::PartiallySignedTransaction, ChainConfig, Destination, - SignedTransaction, TxOutput, UtxoOutPoint, + config::checkpoints_data::print_block_heights_ids_as_checkpoints_data, ChainConfig, + Destination, SignedTransaction, TxOutput, UtxoOutPoint, }, primitives::{Idable as _, H256}, text_summary::TextSummary, @@ -44,6 +43,7 @@ use wallet_rpc_lib::types::{ #[cfg(feature = "trezor")] use wallet_rpc_lib::types::HardwareWalletType; +use wallet_types::partially_signed_transaction::PartiallySignedTransaction; use crate::{ errors::WalletCliCommandError, helper_types::parse_generic_token_transfer, diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index af907bf8a5..8d547834a5 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -21,9 +21,6 @@ use common::{ address::RpcAddress, chain::{ output_value::OutputValue, - partially_signed_transaction::{ - PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, - }, tokens::{RPCTokenInfo, TokenId}, ChainConfig, Destination, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, }, @@ -39,6 +36,9 @@ use wallet::{ destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, WalletError, }; +use wallet_types::partially_signed_transaction::{ + PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, +}; use crate::{types::Balances, ControllerError, WalletType2}; @@ -264,7 +264,7 @@ pub async fn tx_to_partially_signed_tx( None, output_additional_infos, ) - .map_err(WalletError::TransactionCreation)?; + .map_err(WalletError::PartiallySignedTransactionCreation)?; Ok(ptx) } diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index faaefa7bd4..73659c6010 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -56,7 +56,6 @@ use common::{ chain::{ block::timestamp::BlockTimestamp, htlc::HtlcSecret, - partially_signed_transaction::{PartiallySignedTransaction, UtxoWithAdditionalInfo}, signature::{inputsig::InputWitness, DestinationSigError, Transactable}, tokens::{RPCTokenInfo, TokenId}, Block, ChainConfig, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, @@ -99,6 +98,7 @@ pub use wallet_types::{ utxo_types::{UtxoState, UtxoStates, UtxoType, UtxoTypes}, }; use wallet_types::{ + partially_signed_transaction::{PartiallySignedTransaction, UtxoWithAdditionalInfo}, seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, wallet_type::{WalletControllerMode, WalletType}, @@ -1138,7 +1138,7 @@ where htlc_secrets, output_additional_infos, ) - .map_err(WalletError::TransactionCreation)?; + .map_err(WalletError::PartiallySignedTransactionCreation)?; TransactionToSign::Partial(tx) }; diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 3c2a0103f2..ec9fe5af7b 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -21,7 +21,6 @@ use common::{ classic_multisig::ClassicMultisigChallenge, htlc::HashedTimelockContract, output_value::OutputValue, - partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, signature::inputsig::arbitrary_message::ArbitraryMessageSignature, tokens::{ IsTokenFreezable, IsTokenUnfreezable, Metadata, RPCFungibleTokenInfo, RPCTokenInfo, @@ -56,6 +55,7 @@ use wallet::{ WalletError, WalletResult, }; use wallet_types::{ + partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, signature_status::SignatureStatus, utxo_types::{UtxoState, UtxoType}, with_locked::WithLocked, diff --git a/wallet/wallet-controller/src/types/transaction.rs b/wallet/wallet-controller/src/types/transaction.rs index a1aab80247..df7d953ec1 100644 --- a/wallet/wallet-controller/src/types/transaction.rs +++ b/wallet/wallet-controller/src/types/transaction.rs @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use common::chain::{ - partially_signed_transaction::PartiallySignedTransaction, SignedTransaction, Transaction, -}; +use common::chain::{SignedTransaction, Transaction}; use serialization::hex_encoded::HexEncoded; -use wallet_types::signature_status::SignatureStatus; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, signature_status::SignatureStatus, +}; use super::Balances; diff --git a/wallet/wallet-node-client/Cargo.toml b/wallet/wallet-node-client/Cargo.toml index 8d8741ee86..8970753a39 100644 --- a/wallet/wallet-node-client/Cargo.toml +++ b/wallet/wallet-node-client/Cargo.toml @@ -17,7 +17,6 @@ logging = { path = "../../logging" } mempool = { path = "../../mempool" } node-lib = { path = "../../node-lib" } p2p = { path = "../../p2p" } -pos-accounting = { path = "../../pos-accounting" } rpc = { path = "../../rpc" } serialization = { path = "../../serialization" } subsystem = { path = "../../subsystem" } diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 9952b18368..7c60805ba4 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -53,8 +53,8 @@ use wallet_rpc_lib::{ RpcError, WalletRpc, }; use wallet_types::{ - seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, utxo_types::UtxoTypes, - with_locked::WithLocked, + partially_signed_transaction::PartiallySignedTransaction, seed_phrase::StoreSeedPhrase, + signature_status::SignatureStatus, utxo_types::UtxoTypes, with_locked::WithLocked, }; use crate::wallet_rpc_traits::{ diff --git a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs index 59dbd00b74..38010f1fcf 100644 --- a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs @@ -53,7 +53,9 @@ use wallet_rpc_lib::{ }, ColdWalletRpcClient, WalletRpcClient, }; -use wallet_types::with_locked::WithLocked; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, with_locked::WithLocked, +}; #[async_trait::async_trait] impl WalletInterface for ClientWalletRpc { diff --git a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs index 09fbf05f6a..0d99a2270e 100644 --- a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs +++ b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs @@ -41,7 +41,9 @@ use wallet_rpc_lib::types::{ RpcTokenId, SendTokensFromMultisigAddressResult, StakePoolBalance, StakingStatus, StandaloneAddressWithDetails, TokenMetadata, TxOptionsOverrides, UtxoInfo, VrfPublicKeyInfo, }; -use wallet_types::with_locked::WithLocked; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, with_locked::WithLocked, +}; pub enum PartialOrSignedTx { Partial(PartiallySignedTransaction), diff --git a/wallet/wallet-rpc-lib/src/rpc/interface.rs b/wallet/wallet-rpc-lib/src/rpc/interface.rs index 0d13886cdc..ab4596308e 100644 --- a/wallet/wallet-rpc-lib/src/rpc/interface.rs +++ b/wallet/wallet-rpc-lib/src/rpc/interface.rs @@ -34,7 +34,9 @@ use wallet_controller::{ types::{BlockInfo, CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo}, ConnectedPeer, }; -use wallet_types::with_locked::WithLocked; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, with_locked::WithLocked, +}; use crate::types::{ AccountArg, AddressInfo, AddressWithUsageInfo, Balances, ChainInfo, ComposedTransaction, diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index c1c7a16985..edf1607cd4 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -49,7 +49,6 @@ use common::{ classic_multisig::ClassicMultisigChallenge, htlc::{HashedTimelockContract, HtlcSecret, HtlcSecretHash}, output_value::{OutputValue, RpcOutputValue}, - partially_signed_transaction::PartiallySignedTransaction, signature::inputsig::arbitrary_message::{ produce_message_challenge, ArbitraryMessageSignature, }, @@ -75,14 +74,12 @@ use wallet_controller::{ UtxoType, UtxoTypes, DEFAULT_ACCOUNT_INDEX, }; use wallet_types::{ - account_info::StandaloneAddressDetails, seed_phrase::StoreSeedPhrase, + account_info::StandaloneAddressDetails, + partially_signed_transaction::PartiallySignedTransaction, seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, wallet_tx::TxData, with_locked::WithLocked, Currency, }; -use crate::{ - service::{CreatedWallet, WalletController}, - WalletHandle, WalletRpcConfig, -}; +use crate::{service::WalletController, WalletHandle, WalletRpcConfig}; #[cfg(feature = "trezor")] use wallet_types::wallet_type::WalletType; diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index 7c4f0752ab..72627c191c 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -20,7 +20,6 @@ use common::{ address::dehexify::dehexify_all_addresses, chain::{ block::timestamp::BlockTimestamp, - partially_signed_transaction::PartiallySignedTransaction, tokens::{IsTokenUnfreezable, TokenId}, Block, DelegationId, Destination, GenBlock, OrderId, PoolId, SignedTransaction, SignedTransactionIntent, Transaction, TxOutput, @@ -41,7 +40,8 @@ use wallet_controller::{ ConnectedPeer, ControllerConfig, NodeInterface, UtxoState, UtxoStates, UtxoType, UtxoTypes, }; use wallet_types::{ - seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, with_locked::WithLocked, + partially_signed_transaction::PartiallySignedTransaction, seed_phrase::StoreSeedPhrase, + signature_status::SignatureStatus, with_locked::WithLocked, }; use crate::{ diff --git a/wallet/wallet-rpc-lib/src/rpc/types.rs b/wallet/wallet-rpc-lib/src/rpc/types.rs index 18bd4fa197..6df103beee 100644 --- a/wallet/wallet-rpc-lib/src/rpc/types.rs +++ b/wallet/wallet-rpc-lib/src/rpc/types.rs @@ -20,7 +20,6 @@ use common::{ chain::{ block::timestamp::BlockTimestamp, classic_multisig::ClassicMultisigChallengeError, - partially_signed_transaction::PartiallySignedTransaction, signature::DestinationSigError, timelock::OutputTimeLock, tokens::{self, IsTokenFreezable, Metadata, TokenCreator, TokenId}, @@ -58,7 +57,9 @@ pub use wallet_controller::types::{ }; pub use wallet_controller::{ControllerConfig, NodeInterface}; use wallet_controller::{UtxoState, UtxoType}; -use wallet_types::signature_status::SignatureStatus; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, signature_status::SignatureStatus, +}; use crate::service::SubmitError; From e236789dc8f549cc12014227dc401eef7aab58cb Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 21 Aug 2024 17:12:15 +0200 Subject: [PATCH 26/48] refactor review comments --- wallet/src/account/mod.rs | 2 +- wallet/src/account/output_cache/mod.rs | 101 +++++++++++------- wallet/src/send_request/mod.rs | 24 +++-- wallet/src/signer/trezor_signer/mod.rs | 23 ++-- wallet/src/wallet/tests.rs | 22 ++-- .../types/src/partially_signed_transaction.rs | 11 +- wallet/wallet-controller/src/helpers.rs | 29 +++-- .../src/synced_controller.rs | 2 +- 8 files changed, 111 insertions(+), 103 deletions(-) diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index b8c331b690..eb2c723867 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -85,7 +85,7 @@ use wallet_types::{ }; pub use self::output_cache::{ - DelegationData, FungibleTokenInfo, PoolData, TxInfo, UnconfirmedTokenInfo, UtxoWithTxOutput, + DelegationData, OwnFungibleTokenInfo, PoolData, TxInfo, UnconfirmedTokenInfo, UtxoWithTxOutput, }; use self::output_cache::{OutputCache, TokenIssuanceData}; use self::transaction_list::{get_transaction_list, TransactionList}; diff --git a/wallet/src/account/output_cache/mod.rs b/wallet/src/account/output_cache/mod.rs index e70f2ef936..023e85c8dd 100644 --- a/wallet/src/account/output_cache/mod.rs +++ b/wallet/src/account/output_cache/mod.rs @@ -261,62 +261,90 @@ impl TokenCurrentSupplyState { } } -pub struct FungibleTokenInfo { +pub struct OwnFungibleTokenInfo { frozen: TokenFreezableState, last_nonce: Option, total_supply: TokenCurrentSupplyState, authority: Destination, + num_decimals: u8, + ticker: Vec, +} + +pub struct FungibleTokenInfo { + frozen: TokenFreezableState, + num_decimals: u8, + ticker: Vec, +} + +impl From for FungibleTokenInfo { + fn from(value: RPCFungibleTokenInfo) -> Self { + Self { + frozen: value.frozen.into(), + num_decimals: value.number_of_decimals, + ticker: value.token_ticker.into_bytes(), + } + } +} + +pub struct NonFungibleTokenInfo { + ticker: Vec, +} + +impl From<&RPCNonFungibleTokenInfo> for NonFungibleTokenInfo { + fn from(value: &RPCNonFungibleTokenInfo) -> Self { + Self { + ticker: value.metadata.ticker.as_bytes().to_vec(), + } + } } /// Token info from the Node + any unconfirmed Txs from this wallet pub enum UnconfirmedTokenInfo { /// Token info owned by this wallet - OwnFungibleToken(TokenId, FungibleTokenInfo, RPCFungibleTokenInfo), + OwnFungibleToken(TokenId, OwnFungibleTokenInfo), /// Token info not owned by this wallet - FungibleToken(TokenId, TokenFreezableState, RPCFungibleTokenInfo), + FungibleToken(TokenId, FungibleTokenInfo), /// NFT info - NonFungibleToken(TokenId, Box), + NonFungibleToken(TokenId, NonFungibleTokenInfo), } impl UnconfirmedTokenInfo { pub fn token_id(&self) -> TokenId { match self { - Self::OwnFungibleToken(token_id, _, _) - | Self::FungibleToken(token_id, _, _) + Self::OwnFungibleToken(token_id, _) + | Self::FungibleToken(token_id, _) | Self::NonFungibleToken(token_id, _) => *token_id, } } pub fn num_decimals(&self) -> u8 { match self { - Self::OwnFungibleToken(_, _, info) | Self::FungibleToken(_, _, info) => { - info.number_of_decimals - } + Self::OwnFungibleToken(_, info) => info.num_decimals, + Self::FungibleToken(_, info) => info.num_decimals, Self::NonFungibleToken(_, _) => 0, } } pub fn token_ticker(&self) -> &[u8] { match self { - Self::OwnFungibleToken(_, _, info) | Self::FungibleToken(_, _, info) => { - info.token_ticker.as_bytes() - } - Self::NonFungibleToken(_, info) => info.metadata.ticker.as_bytes(), + Self::OwnFungibleToken(_, info) => &info.ticker, + Self::FungibleToken(_, info) => &info.ticker, + Self::NonFungibleToken(_, info) => &info.ticker, } } pub fn check_can_be_used(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state, _) => state.frozen.check_can_be_used(), - Self::FungibleToken(_, state, _) => state.check_can_be_used(), + Self::OwnFungibleToken(_, state) => state.frozen.check_can_be_used(), + Self::FungibleToken(_, state) => state.frozen.check_can_be_used(), Self::NonFungibleToken(_, _) => Ok(()), } } pub fn check_can_freeze(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state, _) => state.frozen.check_can_freeze(), - Self::FungibleToken(token_id, _, _) => { + Self::OwnFungibleToken(_, state) => state.frozen.check_can_freeze(), + Self::FungibleToken(token_id, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } Self::NonFungibleToken(token_id, _) => { @@ -327,8 +355,8 @@ impl UnconfirmedTokenInfo { pub fn check_can_unfreeze(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state, _) => state.frozen.check_can_unfreeze(), - Self::FungibleToken(token_id, _, _) => { + Self::OwnFungibleToken(_, state) => state.frozen.check_can_unfreeze(), + Self::FungibleToken(token_id, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } Self::NonFungibleToken(token_id, _) => { @@ -339,11 +367,11 @@ impl UnconfirmedTokenInfo { pub fn get_next_nonce(&self) -> WalletResult { match self { - Self::OwnFungibleToken(token_id, state, _) => state + Self::OwnFungibleToken(token_id, state) => state .last_nonce .map_or(Some(AccountNonce::new(0)), |nonce| nonce.increment()) .ok_or(WalletError::TokenIssuanceNonceOverflow(*token_id)), - Self::FungibleToken(token_id, _, _) => { + Self::FungibleToken(token_id, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } Self::NonFungibleToken(token_id, _) => { @@ -354,8 +382,8 @@ impl UnconfirmedTokenInfo { pub fn authority(&self) -> WalletResult<&Destination> { match self { - Self::OwnFungibleToken(_, state, _) => Ok(&state.authority), - Self::FungibleToken(token_id, _, _) => { + Self::OwnFungibleToken(_, state) => Ok(&state.authority), + Self::FungibleToken(token_id, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } Self::NonFungibleToken(token_id, _) => { @@ -366,8 +394,8 @@ impl UnconfirmedTokenInfo { pub fn check_can_mint(&self, amount: Amount) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state, _) => state.total_supply.check_can_mint(amount), - Self::FungibleToken(token_id, _, _) => { + Self::OwnFungibleToken(_, state) => state.total_supply.check_can_mint(amount), + Self::FungibleToken(token_id, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } Self::NonFungibleToken(token_id, _) => { @@ -378,8 +406,8 @@ impl UnconfirmedTokenInfo { pub fn check_can_unmint(&self, amount: Amount) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state, _) => state.total_supply.check_can_unmint(amount), - Self::FungibleToken(token_id, _, _) => { + Self::OwnFungibleToken(_, state) => state.total_supply.check_can_unmint(amount), + Self::FungibleToken(token_id, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } Self::NonFungibleToken(token_id, _) => { @@ -390,8 +418,8 @@ impl UnconfirmedTokenInfo { pub fn check_can_lock(&self) -> WalletResult<()> { match self { - Self::OwnFungibleToken(_, state, _) => state.total_supply.check_can_lock(), - Self::FungibleToken(token_id, _, _) => { + Self::OwnFungibleToken(_, state) => state.total_supply.check_can_lock(), + Self::FungibleToken(token_id, _) => { Err(WalletError::CannotChangeNotOwnedToken(*token_id)) } Self::NonFungibleToken(token_id, _) => { @@ -403,8 +431,8 @@ impl UnconfirmedTokenInfo { #[cfg(test)] pub fn current_supply(&self) -> Option { match self { - Self::OwnFungibleToken(_, state, _) => Some(state.total_supply.current_supply()), - Self::FungibleToken(_, _, _) => None, + Self::OwnFungibleToken(_, state) => Some(state.total_supply.current_supply()), + Self::FungibleToken(_, _) => None, Self::NonFungibleToken(_, _) => None, } } @@ -657,8 +685,7 @@ impl OutputCache { if !is_mine(&token_data.authority) { return Ok(UnconfirmedTokenInfo::FungibleToken( token_info.token_id, - token_info.frozen.into(), - token_info, + token_info.into(), )); } token_data @@ -667,8 +694,7 @@ impl OutputCache { None => { return Ok(UnconfirmedTokenInfo::FungibleToken( token_info.token_id, - token_info.frozen.into(), - token_info, + token_info.into(), )); } }; @@ -695,13 +721,14 @@ impl OutputCache { Ok(UnconfirmedTokenInfo::OwnFungibleToken( token_info.token_id, - FungibleTokenInfo { + OwnFungibleTokenInfo { frozen: frozen_state, last_nonce: token_data.last_nonce, total_supply, authority: token_data.authority.clone(), + num_decimals: token_info.number_of_decimals, + ticker: token_info.token_ticker.into_bytes(), }, - token_info, )) } diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 72f292a3b7..2774775352 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -335,7 +335,7 @@ impl SendRequest { fn find_additional_info( utxo: &TxOutput, additional_info: &BTreeMap, -) -> Result { +) -> Result, WalletError> { let additional_info = match utxo { TxOutput::Burn(value) | TxOutput::Htlc(value, _) @@ -346,23 +346,24 @@ fn find_additional_info( TxOutput::AnyoneCanTake(data) => { find_additional_info_output_value(data.as_ref().ask(), additional_info)? } - TxOutput::IssueNft(_, data, _) => UtxoAdditionalInfo::TokenInfo { + TxOutput::IssueNft(_, data, _) => Some(UtxoAdditionalInfo::TokenInfo { num_decimals: 0, ticker: match data.as_ref() { NftIssuance::V0(data) => data.metadata.ticker().clone(), }, - }, - TxOutput::CreateStakePool(_, data) => UtxoAdditionalInfo::PoolInfo { + }), + TxOutput::CreateStakePool(_, data) => Some(UtxoAdditionalInfo::PoolInfo { staker_balance: data.pledge(), - }, + }), TxOutput::ProduceBlockFromStake(_, pool_id) => additional_info .get(&PoolOrTokenId::PoolId(*pool_id)) - .ok_or(WalletError::MissingPoolAdditionalData(*pool_id))? - .clone(), + .ok_or(WalletError::MissingPoolAdditionalData(*pool_id)) + .map(Some)? + .cloned(), TxOutput::DataDeposit(_) | TxOutput::IssueFungibleToken(_) | TxOutput::DelegateStaking(_, _) - | TxOutput::CreateDelegationId(_, _) => UtxoAdditionalInfo::NoAdditionalInfo, + | TxOutput::CreateDelegationId(_, _) => None, }; Ok(additional_info) } @@ -370,13 +371,14 @@ fn find_additional_info( fn find_additional_info_output_value( value: &OutputValue, additional_info: &BTreeMap, -) -> WalletResult { +) -> WalletResult> { match value { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(UtxoAdditionalInfo::NoAdditionalInfo), + OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(None), OutputValue::TokenV1(token_id, _) => additional_info .get(&PoolOrTokenId::TokenId(*token_id)) .ok_or(WalletError::MissingTokenAdditionalData(*token_id)) - .cloned(), + .cloned() + .map(Some), } } diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 794130240c..de0128557a 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -723,7 +723,7 @@ fn to_trezor_utxo_input( fn to_trezor_output_value( output_value: &OutputValue, - additional_info: &UtxoAdditionalInfo, + additional_info: &Option, ) -> SignerResult { let value = match output_value { OutputValue::Coin(amount) => { @@ -737,15 +737,14 @@ fn to_trezor_output_value( let mut token_value = MintlayerTokenOutputValue::new(); token_value.set_token_id(token_id.to_hash().as_bytes().to_vec()); match additional_info { - UtxoAdditionalInfo::TokenInfo { + Some(UtxoAdditionalInfo::TokenInfo { num_decimals, ticker, - } => { + }) => { token_value.set_number_of_decimals(*num_decimals as u32); token_value.set_token_ticker(ticker.clone()); } - UtxoAdditionalInfo::PoolInfo { staker_balance: _ } - | UtxoAdditionalInfo::NoAdditionalInfo => { + Some(UtxoAdditionalInfo::PoolInfo { staker_balance: _ }) | None => { return Err(SignerError::MissingUtxoExtraInfo) } } @@ -786,7 +785,7 @@ fn to_trezor_utxo_msgs( fn to_trezor_output_msg( chain_config: &ChainConfig, out: &TxOutput, - additional_info: &UtxoAdditionalInfo, + additional_info: &Option, ) -> SignerResult { let res = match out { TxOutput::Transfer(value, dest) => { @@ -802,11 +801,7 @@ fn to_trezor_output_msg( } TxOutput::LockThenTransfer(value, dest, lock) => { let mut out_req = MintlayerLockThenTransferTxOutput::new(); - out_req.value = Some(to_trezor_output_value( - value, - &UtxoAdditionalInfo::NoAdditionalInfo, - )?) - .into(); + out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); out_req.set_address( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -834,11 +829,7 @@ fn to_trezor_output_msg( } TxOutput::Burn(value) => { let mut out_req = MintlayerBurnTxOutput::new(); - out_req.value = Some(to_trezor_output_value( - value, - &UtxoAdditionalInfo::NoAdditionalInfo, - )?) - .into(); + out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); let mut out = MintlayerTxOutput::new(); out.burn = Some(out_req).into(); diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index fa40b45a46..0590a6347c 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -4359,13 +4359,10 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { let ptx = PartiallySignedTransaction::new( tx, vec![None; inps], - vec![Some(UtxoWithAdditionalInfo::new( - utxo, - UtxoAdditionalInfo::NoAdditionalInfo, - ))], + vec![Some(UtxoWithAdditionalInfo::new(utxo, None))], vec![Some(addr.into_object())], None, - vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], + vec![None; outs], ) .unwrap(); let stake_pool_transaction = wallet @@ -4894,13 +4891,10 @@ fn test_add_standalone_multisig(#[case] seed: Seed) { let spend_multisig_tx = PartiallySignedTransaction::new( spend_multisig_tx, vec![None; 1], - vec![Some(UtxoWithAdditionalInfo::new( - tx.outputs()[0].clone(), - UtxoAdditionalInfo::NoAdditionalInfo, - ))], + vec![Some(UtxoWithAdditionalInfo::new(tx.outputs()[0].clone(), None))], vec![Some(multisig_address.as_object().clone())], None, - vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], + vec![None; outs], ) .unwrap(); @@ -5050,7 +5044,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { .outputs() .first() .cloned() - .map(|out| UtxoWithAdditionalInfo::new(out, UtxoAdditionalInfo::NoAdditionalInfo))]; + .map(|out| UtxoWithAdditionalInfo::new(out, None))]; let outs = create_htlc_tx.outputs().len(); let spend_ptx = PartiallySignedTransaction::new( spend_tx, @@ -5058,7 +5052,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { spend_utxos, vec![Some(spend_key.into_object())], Some(vec![Some(secret)]), - vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], + vec![None; outs], ) .unwrap(); @@ -5154,7 +5148,7 @@ fn create_htlc_and_refund(#[case] seed: Seed) { .outputs() .first() .cloned() - .map(|out| UtxoWithAdditionalInfo::new(out, UtxoAdditionalInfo::NoAdditionalInfo))]; + .map(|out| UtxoWithAdditionalInfo::new(out, None))]; let outs = create_htlc_tx.outputs().len(); let refund_ptx = PartiallySignedTransaction::new( refund_tx, @@ -5162,7 +5156,7 @@ fn create_htlc_and_refund(#[case] seed: Seed) { refund_utxos, vec![Some(refund_key)], None, - vec![UtxoAdditionalInfo::NoAdditionalInfo; outs], + vec![None; outs], ) .unwrap(); diff --git a/wallet/types/src/partially_signed_transaction.rs b/wallet/types/src/partially_signed_transaction.rs index 73348ae72c..610f53e186 100644 --- a/wallet/types/src/partially_signed_transaction.rs +++ b/wallet/types/src/partially_signed_transaction.rs @@ -47,17 +47,16 @@ pub enum PartiallySignedTransactionCreationError { pub enum UtxoAdditionalInfo { TokenInfo { num_decimals: u8, ticker: Vec }, PoolInfo { staker_balance: Amount }, - NoAdditionalInfo, } #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub struct UtxoWithAdditionalInfo { pub utxo: TxOutput, - pub additional_info: UtxoAdditionalInfo, + pub additional_info: Option, } impl UtxoWithAdditionalInfo { - pub fn new(utxo: TxOutput, additional_info: UtxoAdditionalInfo) -> Self { + pub fn new(utxo: TxOutput, additional_info: Option) -> Self { Self { utxo, additional_info, @@ -74,7 +73,7 @@ pub struct PartiallySignedTransaction { destinations: Vec>, htlc_secrets: Vec>, - output_additional_infos: Vec, + output_additional_infos: Vec>, } impl PartiallySignedTransaction { @@ -84,7 +83,7 @@ impl PartiallySignedTransaction { input_utxos: Vec>, destinations: Vec>, htlc_secrets: Option>>, - output_additional_infos: Vec, + output_additional_infos: Vec>, ) -> Result { let htlc_secrets = htlc_secrets.unwrap_or_else(|| vec![None; tx.inputs().len()]); @@ -164,7 +163,7 @@ impl PartiallySignedTransaction { self.tx.inputs().len() } - pub fn output_additional_infos(&self) -> &[UtxoAdditionalInfo] { + pub fn output_additional_infos(&self) -> &[Option] { &self.output_additional_infos } diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index 8d547834a5..2a4143e019 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -149,34 +149,32 @@ where | TxOutput::Transfer(value, _) | TxOutput::LockThenTransfer(value, _, _) | TxOutput::Htlc(value, _) => match value { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(UtxoWithAdditionalInfo::new( - utxo, - UtxoAdditionalInfo::NoAdditionalInfo, - )), + OutputValue::Coin(_) | OutputValue::TokenV0(_) => { + Ok(UtxoWithAdditionalInfo::new(utxo, None)) + } OutputValue::TokenV1(token_id, _) => { let info = fetch_token_info(rpc_client, *token_id).await?; Ok(UtxoWithAdditionalInfo::new( utxo, - UtxoAdditionalInfo::TokenInfo { + Some(UtxoAdditionalInfo::TokenInfo { num_decimals: info.token_number_of_decimals(), ticker: info.token_ticker().to_vec(), - }, + }), )) } }, TxOutput::AnyoneCanTake(order) => match order.ask() { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(UtxoWithAdditionalInfo::new( - utxo, - UtxoAdditionalInfo::NoAdditionalInfo, - )), + OutputValue::Coin(_) | OutputValue::TokenV0(_) => { + Ok(UtxoWithAdditionalInfo::new(utxo, None)) + } OutputValue::TokenV1(token_id, _) => { let info = fetch_token_info(rpc_client, *token_id).await?; Ok(UtxoWithAdditionalInfo::new( utxo, - UtxoAdditionalInfo::TokenInfo { + Some(UtxoAdditionalInfo::TokenInfo { num_decimals: info.token_number_of_decimals(), ticker: info.token_ticker().to_vec(), - }, + }), )) } }, @@ -188,7 +186,7 @@ where .ok_or(WalletError::UnknownPoolId(*pool_id))?; Ok(UtxoWithAdditionalInfo::new( utxo, - UtxoAdditionalInfo::PoolInfo { staker_balance }, + Some(UtxoAdditionalInfo::PoolInfo { staker_balance }), )) } TxOutput::IssueNft(_, _, _) @@ -196,10 +194,7 @@ where | TxOutput::CreateStakePool(_, _) | TxOutput::DelegateStaking(_, _) | TxOutput::CreateDelegationId(_, _) - | TxOutput::DataDeposit(_) => Ok(UtxoWithAdditionalInfo::new( - utxo, - UtxoAdditionalInfo::NoAdditionalInfo, - )), + | TxOutput::DataDeposit(_) => Ok(UtxoWithAdditionalInfo::new(utxo, None)), } } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index ec9fe5af7b..4c0d22137d 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -1655,7 +1655,7 @@ where } .map_err(ControllerError::WalletError)?, RPCTokenInfo::NonFungibleToken(info) => { - UnconfirmedTokenInfo::NonFungibleToken(info.token_id, info) + UnconfirmedTokenInfo::NonFungibleToken(info.token_id, info.as_ref().into()) } }; From aba9987e23c941fbac40eec9c4ccf114e55ecb8f Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Sat, 24 Aug 2024 19:28:11 +0200 Subject: [PATCH 27/48] refactor wallet utxo token_id uses --- chainstate/src/rpc/types/output.rs | 2 +- common/src/chain/tokens/tokens_utils.rs | 20 ----- wallet/src/account/currency_grouper/mod.rs | 2 +- wallet/src/account/mod.rs | 48 +++++------- wallet/src/account/output_cache/mod.rs | 55 +++++-------- wallet/src/send_request/mod.rs | 32 +++++++- wallet/src/wallet/mod.rs | 20 ++--- wallet/src/wallet/tests.rs | 10 ++- wallet/wallet-controller/src/lib.rs | 2 +- wallet/wallet-controller/src/read.rs | 3 +- .../src/synced_controller.rs | 77 +++++++++++-------- 11 files changed, 131 insertions(+), 140 deletions(-) diff --git a/chainstate/src/rpc/types/output.rs b/chainstate/src/rpc/types/output.rs index ea7ef79075..814c4487dc 100644 --- a/chainstate/src/rpc/types/output.rs +++ b/chainstate/src/rpc/types/output.rs @@ -67,7 +67,7 @@ impl RpcOutputValueOut { } } -#[derive(Debug, Clone, serde::Serialize, rpc_description::HasValueHint)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, rpc_description::HasValueHint)] pub struct RpcStakePoolData { pledge: RpcAmountOut, staker: RpcAddress, diff --git a/common/src/chain/tokens/tokens_utils.rs b/common/src/chain/tokens/tokens_utils.rs index 626cc0c7fb..ffbaa60486 100644 --- a/common/src/chain/tokens/tokens_utils.rs +++ b/common/src/chain/tokens/tokens_utils.rs @@ -88,23 +88,3 @@ pub fn is_token_or_nft_issuance(output: &TxOutput) -> bool { TxOutput::IssueFungibleToken(_) | TxOutput::IssueNft(_, _, _) => true, } } - -pub fn get_token_id_for_tx_output(output: &TxOutput, inputs: &[TxInput]) -> Option { - match output { - TxOutput::Transfer(v, _) | TxOutput::LockThenTransfer(v, _, _) | TxOutput::Burn(v) => { - match v { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => None, - OutputValue::TokenV1(token_id, _) => Some(*token_id), - } - } - TxOutput::CreateStakePool(_, _) - | TxOutput::ProduceBlockFromStake(_, _) - | TxOutput::CreateDelegationId(_, _) - | TxOutput::DelegateStaking(_, _) - | TxOutput::DataDeposit(_) - | TxOutput::Htlc(_, _) - | TxOutput::IssueFungibleToken(_) - | TxOutput::CreateOrder(_) => None, - TxOutput::IssueNft(_, _, _) => make_token_id(inputs), - } -} diff --git a/wallet/src/account/currency_grouper/mod.rs b/wallet/src/account/currency_grouper/mod.rs index 1139e22f19..c525e0fc44 100644 --- a/wallet/src/account/currency_grouper/mod.rs +++ b/wallet/src/account/currency_grouper/mod.rs @@ -25,7 +25,7 @@ use wallet_types::currency::Currency; use super::UtxoSelectorError; -pub(crate) fn group_outputs( +pub fn group_outputs( outputs: impl Iterator, get_tx_output: impl Fn(&T) -> &TxOutput, mut combiner: impl FnMut(&mut Grouped, &T, Amount) -> WalletResult<()>, diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index eb2c723867..fa861c3ab6 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -271,10 +271,7 @@ impl Account { ) } SelectedInputs::Inputs(ref inputs) => ( - inputs - .iter() - .map(|(outpoint, utxo)| (outpoint.clone(), (utxo, None))) - .collect(), + inputs.iter().map(|(outpoint, utxo)| (outpoint.clone(), utxo)).collect(), selection_algo, ), } @@ -445,7 +442,7 @@ impl Account { &self, fee_rates: CurrentFeeRate, pay_fee_with_currency: &Currency, - utxos: Vec<(UtxoOutPoint, (&TxOutput, Option))>, + utxos: Vec<(UtxoOutPoint, &TxOutput)>, ) -> Result>, WalletError> { let utxo_to_output_group = |(outpoint, txo): (UtxoOutPoint, TxOutput)| -> WalletResult { @@ -473,9 +470,9 @@ impl Account { currency_grouper::group_utxos_for_input( utxos.into_iter(), - |(_, (tx_output, _))| tx_output, + |(_, tx_output)| tx_output, |grouped: &mut Vec<(UtxoOutPoint, TxOutput)>, element, _| -> WalletResult<()> { - grouped.push((element.0.clone(), element.1 .0.clone())); + grouped.push((element.0.clone(), element.1.clone())); Ok(()) }, vec![], @@ -1286,7 +1283,7 @@ impl Account { let nonce = token_info.get_next_nonce()?; let tx_input = TxInput::AccountCommand( nonce, - AccountCommand::ChangeTokenMetadataUri(*token_info.token_id(), metadata_uri), + AccountCommand::ChangeTokenMetadataUri(token_info.token_id(), metadata_uri), ); let authority = token_info.authority()?.clone(); @@ -1372,8 +1369,7 @@ impl Account { outpoint: &UtxoOutPoint, current_block_info: BlockInfo, ) -> WalletResult<(TxOutput, Destination)> { - let (txo, _) = - self.output_cache.find_unspent_unlocked_utxo(outpoint, current_block_info)?; + let txo = self.output_cache.find_unspent_unlocked_utxo(outpoint, current_block_info)?; Ok(( txo.clone(), @@ -1492,14 +1488,14 @@ impl Account { }; let amounts_by_currency = currency_grouper::group_utxos_for_input( self.output_cache - .utxos_with_token_ids( + .utxos( current_block_info, UtxoState::Confirmed.into(), WithLocked::Unlocked, |txo| get_utxo_type(txo).is_some() && self.is_watched_by(txo, &address), ) .into_iter(), - |(_, (tx_output, _))| tx_output, + |(_, tx_output)| tx_output, |total: &mut Amount, _, amount| -> WalletResult<()> { *total = (*total + amount).ok_or(WalletError::OutputAmountOverflow)?; Ok(()) @@ -1690,7 +1686,7 @@ impl Account { with_locked, ) .into_iter(), - |(_, (tx_output, _))| tx_output, + |(_, tx_output)| tx_output, |total: &mut Amount, _, amount| -> WalletResult<()> { *total = (*total + amount).ok_or(WalletError::OutputAmountOverflow)?; Ok(()) @@ -1706,20 +1702,15 @@ impl Account { median_time: BlockTimestamp, utxo_states: UtxoStates, with_locked: WithLocked, - ) -> Vec<(UtxoOutPoint, (&TxOutput, Option))> { + ) -> Vec<(UtxoOutPoint, &TxOutput)> { let current_block_info = BlockInfo { height: self.account_info.best_block_height(), timestamp: median_time, }; - self.output_cache.utxos_with_token_ids( - current_block_info, - utxo_states, - with_locked, - |txo| { - self.is_watched_multisig_output(txo) - && get_utxo_type(txo).is_some_and(|v| utxo_types.contains(v)) - }, - ) + self.output_cache.utxos(current_block_info, utxo_states, with_locked, |txo| { + self.is_watched_multisig_output(txo) + && get_utxo_type(txo).is_some_and(|v| utxo_types.contains(v)) + }) } pub fn get_utxos( @@ -1728,17 +1719,14 @@ impl Account { median_time: BlockTimestamp, utxo_states: UtxoStates, with_locked: WithLocked, - ) -> Vec<(UtxoOutPoint, (&TxOutput, Option))> { + ) -> Vec<(UtxoOutPoint, &TxOutput)> { let current_block_info = BlockInfo { height: self.account_info.best_block_height(), timestamp: median_time, }; - self.output_cache.utxos_with_token_ids( - current_block_info, - utxo_states, - with_locked, - |txo| self.is_mine(txo) && get_utxo_type(txo).is_some_and(|v| utxo_types.contains(v)), - ) + self.output_cache.utxos(current_block_info, utxo_states, with_locked, |txo| { + self.is_mine(txo) && get_utxo_type(txo).is_some_and(|v| utxo_types.contains(v)) + }) } pub fn get_transaction_list(&self, skip: usize, count: usize) -> WalletResult { diff --git a/wallet/src/account/output_cache/mod.rs b/wallet/src/account/output_cache/mod.rs index 023e85c8dd..a4ef5f8758 100644 --- a/wallet/src/account/output_cache/mod.rs +++ b/wallet/src/account/output_cache/mod.rs @@ -26,9 +26,9 @@ use common::{ output_value::OutputValue, stakelock::StakePoolData, tokens::{ - get_token_id_for_tx_output, make_token_id, IsTokenFreezable, IsTokenUnfreezable, - RPCFungibleTokenInfo, RPCIsTokenFrozen, RPCNonFungibleTokenInfo, RPCTokenTotalSupply, - TokenId, TokenIssuance, TokenTotalSupply, + make_token_id, IsTokenFreezable, IsTokenUnfreezable, RPCFungibleTokenInfo, + RPCIsTokenFrozen, RPCNonFungibleTokenInfo, RPCTokenTotalSupply, TokenId, TokenIssuance, + TokenTotalSupply, }, AccountCommand, AccountNonce, AccountSpending, DelegationId, Destination, GenBlock, OrderId, OutPointSourceId, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, @@ -49,9 +49,12 @@ use wallet_types::{ AccountWalletTxId, BlockInfo, WalletTx, }; -use crate::{destination_getters::get_all_tx_output_destinations, WalletError, WalletResult}; +use crate::{ + destination_getters::get_all_tx_output_destinations, send_request::get_referenced_token_ids, + WalletError, WalletResult, +}; -pub type UtxoWithTxOutput<'a> = (UtxoOutPoint, (&'a TxOutput, Option)); +pub type UtxoWithTxOutput<'a> = (UtxoOutPoint, &'a TxOutput); #[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize, HasValueHint)] pub struct TxInfo { @@ -1227,7 +1230,7 @@ impl OutputCache { &self, utxo: &UtxoOutPoint, current_block_info: BlockInfo, - ) -> WalletResult<(&TxOutput, Option)> { + ) -> WalletResult<&TxOutput> { let tx = self .txs .get(&utxo.source_id()) @@ -1262,14 +1265,7 @@ impl OutputCache { WalletError::TokenV0Utxo(utxo.clone()) ); - let token_id = match tx { - WalletTx::Tx(tx_data) => { - get_token_id_for_tx_output(output, tx_data.get_transaction().inputs()) - } - WalletTx::Block(_) => None, - }; - - Ok((output, token_id)) + Ok(output) } pub fn find_used_tokens( @@ -1277,14 +1273,14 @@ impl OutputCache { current_block_info: BlockInfo, inputs: &[UtxoOutPoint], ) -> WalletResult> { - inputs - .iter() - .filter_map(|utxo| { - self.find_unspent_unlocked_utxo(utxo, current_block_info) - .map(|(_, token_id)| token_id) - .transpose() - }) - .collect() + inputs.iter().try_fold(BTreeSet::new(), |mut token_ids, utxo| { + let new_ids = self + .find_unspent_unlocked_utxo(utxo, current_block_info) + .map(get_referenced_token_ids)?; + token_ids.extend(new_ids); + + Ok(token_ids) + }) } pub fn find_utxos( @@ -1301,13 +1297,13 @@ impl OutputCache { .collect() } - pub fn utxos_with_token_ids bool>( + pub fn utxos bool>( &self, current_block_info: BlockInfo, utxo_states: UtxoStates, locked_state: WithLocked, output_filter: F, - ) -> Vec<(UtxoOutPoint, (&TxOutput, Option))> { + ) -> Vec<(UtxoOutPoint, &TxOutput)> { let output_filter = &output_filter; self.txs .values() @@ -1331,16 +1327,7 @@ impl OutputCache { && !is_v0_token_output(output) && output_filter(output) }) - .map(move |(output, outpoint)| { - let token_id = match tx { - WalletTx::Tx(tx_data) => get_token_id_for_tx_output( - output, - tx_data.get_transaction().inputs(), - ), - WalletTx::Block(_) => None, - }; - (outpoint, (output, token_id)) - }) + .map(|(output, outpoint)| (outpoint, output)) }) .collect() } diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 2774775352..9f3481c7b2 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::BTreeMap; +use std::collections::{BTreeMap, BTreeSet}; use std::mem::take; use common::address::Address; @@ -382,6 +382,36 @@ fn find_additional_info_output_value( } } +/// Get any referenced token by this output +/// ignore tokens V0 +pub fn get_referenced_token_ids(output: &TxOutput) -> BTreeSet { + match output { + TxOutput::Transfer(v, _) + | TxOutput::LockThenTransfer(v, _, _) + | TxOutput::Burn(v) + | TxOutput::Htlc(v, _) => referenced_token_id(v), + | TxOutput::AnyoneCanTake(data) => { + let mut tokens = referenced_token_id(data.ask()); + tokens.extend(referenced_token_id(data.give())); + tokens + } + TxOutput::CreateStakePool(_, _) + | TxOutput::ProduceBlockFromStake(_, _) + | TxOutput::CreateDelegationId(_, _) + | TxOutput::DelegateStaking(_, _) + | TxOutput::DataDeposit(_) + | TxOutput::IssueFungibleToken(_) => BTreeSet::new(), + TxOutput::IssueNft(token_id, _, _) => BTreeSet::from_iter([*token_id]), + } +} + +fn referenced_token_id(v: &OutputValue) -> BTreeSet { + match v { + OutputValue::Coin(_) | OutputValue::TokenV0(_) => BTreeSet::new(), + OutputValue::TokenV1(token_id, _) => BTreeSet::from_iter([*token_id]), + } +} + pub enum SelectedInputs { Utxos(Vec), Inputs(Vec<(UtxoOutPoint, TxOutput)>), diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 36d78fdea9..3d6a3b4e35 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -1142,7 +1142,7 @@ where utxo_types: UtxoTypes, utxo_states: UtxoStates, with_locked: WithLocked, - ) -> WalletResult)>> { + ) -> WalletResult> { let account = self.get_account(account_index)?; let utxos = account.get_multisig_utxos( utxo_types, @@ -1150,10 +1150,7 @@ where utxo_states, with_locked, ); - let utxos = utxos - .into_iter() - .map(|(outpoint, (txo, token_id))| (outpoint, txo.clone(), token_id)) - .collect(); + let utxos = utxos.into_iter().map(|(outpoint, txo)| (outpoint, txo.clone())).collect(); Ok(utxos) } @@ -1163,7 +1160,7 @@ where utxo_types: UtxoTypes, utxo_states: UtxoStates, with_locked: WithLocked, - ) -> WalletResult)>> { + ) -> WalletResult> { let account = self.get_account(account_index)?; let utxos = account.get_utxos( utxo_types, @@ -1171,10 +1168,7 @@ where utxo_states, with_locked, ); - let utxos = utxos - .into_iter() - .map(|(outpoint, (txo, token_id))| (outpoint, txo.clone(), token_id)) - .collect(); + let utxos = utxos.into_iter().map(|(outpoint, txo)| (outpoint, txo.clone())).collect(); Ok(utxos) } @@ -1551,14 +1545,12 @@ where &mut self, account_index: U31, destination: Destination, - inputs: Vec<(UtxoOutPoint, TxOutput, Option)>, + inputs: Vec<(UtxoOutPoint, TxOutput)>, current_fee_rate: FeeRate, additional_utxo_infos: &BTreeMap, ) -> WalletResult { let request = SendRequest::new().with_inputs( - inputs - .into_iter() - .map(|(outpoint, output, _)| (TxInput::Utxo(outpoint), output)), + inputs.into_iter().map(|(outpoint, output)| (TxInput::Utxo(outpoint), output)), &|_| None, )?; diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 0590a6347c..cdf3434e9d 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -1502,7 +1502,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { let selected_utxos = utxos .iter() - .map(|(outpoint, _, _)| outpoint) + .map(|(outpoint, _)| outpoint) .take(rng.gen_range(1..utxos.len())) .cloned() .collect_vec(); @@ -1636,7 +1636,7 @@ fn create_stake_pool_and_list_pool_ids(#[case] seed: Seed) { ) .unwrap(); assert_eq!(create_stake_pool_utxos.len(), 1); - let (_, output, _) = create_stake_pool_utxos.pop().unwrap(); + let (_, output) = create_stake_pool_utxos.pop().unwrap(); match output { TxOutput::CreateStakePool(id, data) => { assert_eq!(id, *pool_id); @@ -2266,6 +2266,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); wallet @@ -2330,6 +2331,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); (issued_token_id, vec![nft_issuance_transaction, transfer_tx]) @@ -4704,7 +4706,7 @@ fn sign_send_request_cold_wallet(#[case] seed: Seed) { .unwrap(); assert_eq!(utxos.len(), 1); - let (_, output, _) = utxos.pop().unwrap(); + let (_, output) = utxos.pop().unwrap(); matches!(output, TxOutput::Transfer(OutputValue::Coin(value), dest) if value == balance && dest == cold_wallet_address.into_object()); @@ -5023,7 +5025,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { ) .unwrap(); assert_eq!(wallet2_utxos.len(), 1); - let (_, output, _) = wallet2_utxos.pop().unwrap(); + let (_, output) = wallet2_utxos.pop().unwrap(); match output { TxOutput::Htlc(actual_output_value, actual_htlc) => { assert_eq!(actual_output_value, output_value); diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 73659c6010..0b67ad2c9c 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -789,7 +789,7 @@ where ), } .map_err(ControllerError::WalletError)?; - let pool_ids = stake_pool_utxos.into_iter().filter_map(|(_, utxo, _)| match utxo { + let pool_ids = stake_pool_utxos.into_iter().filter_map(|(_, utxo)| match utxo { TxOutput::ProduceBlockFromStake(_, pool_id) | TxOutput::CreateStakePool(pool_id, _) => { Some(pool_id) } diff --git a/wallet/wallet-controller/src/read.rs b/wallet/wallet-controller/src/read.rs index 14194a626c..0c6a8bf3bc 100644 --- a/wallet/wallet-controller/src/read.rs +++ b/wallet/wallet-controller/src/read.rs @@ -119,7 +119,7 @@ where w.get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) } } - .map(|utxos| utxos.into_iter().map(|(outpoint, output, _)| (outpoint, output)).collect()) + .map(|utxos| utxos.into_iter().collect()) .map_err(ControllerError::WalletError) } @@ -138,7 +138,6 @@ where w.get_utxos(self.account_index, utxo_types, utxo_states, with_locked) } } - .map(|utxos| utxos.into_iter().map(|(outpoint, output, _)| (outpoint, output)).collect()) .map_err(ControllerError::WalletError) } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 4c0d22137d..0351c8ac0a 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -47,8 +47,9 @@ use wallet::{ account::{CoinSelectionAlgo, TransactionToSign, UnconfirmedTokenInfo}, destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, send_request::{ - make_address_output, make_address_output_token, make_create_delegation_output, - make_data_deposit_output, PoolOrTokenId, SelectedInputs, StakePoolDataArguments, + get_referenced_token_ids, make_address_output, make_address_output_token, + make_create_delegation_output, make_data_deposit_output, PoolOrTokenId, SelectedInputs, + StakePoolDataArguments, }, wallet::WalletPoolsFilter, wallet_events::WalletEvents, @@ -159,10 +160,10 @@ where /// Filter out utxos that contain tokens that are frozen and can't be used async fn filter_out_utxos_with_frozen_tokens( &self, - input_utxos: Vec<(UtxoOutPoint, TxOutput, Option)>, + input_utxos: Vec<(UtxoOutPoint, TxOutput)>, ) -> Result< ( - Vec<(UtxoOutPoint, TxOutput, Option)>, + Vec<(UtxoOutPoint, TxOutput)>, BTreeMap, ), ControllerError, @@ -170,36 +171,48 @@ where let mut result = vec![]; let mut additional_utxo_infos = BTreeMap::new(); for utxo in input_utxos { - if let Some(token_id) = utxo.2 { - let token_info = fetch_token_info(&self.rpc_client, token_id).await?; + let token_ids = get_referenced_token_ids(&utxo.1); + if token_ids.is_empty() { + result.push(utxo); + } else { + let token_infos = self.fetch_token_infos(token_ids).await?; + let ok_to_use = token_infos.iter().try_fold( + true, + |all_ok, token_info| -> Result> { + let all_ok = all_ok + && match &token_info { + RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { + WalletType2::Software(w) => w.get_token_unconfirmed_info( + self.account_index, + token_info.clone(), + ), + #[cfg(feature = "trezor")] + WalletType2::Trezor(w) => w.get_token_unconfirmed_info( + self.account_index, + token_info.clone(), + ), + } + .map_err(ControllerError::WalletError)? + .check_can_be_used() + .is_ok(), + RPCTokenInfo::NonFungibleToken(_) => true, + }; + Ok(all_ok) + }, + )?; - let ok_to_use = match &token_info { - RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { - WalletType2::Software(w) => { - w.get_token_unconfirmed_info(self.account_index, token_info.clone()) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.get_token_unconfirmed_info(self.account_index, token_info.clone()) - } - } - .map_err(ControllerError::WalletError)? - .check_can_be_used() - .is_ok(), - RPCTokenInfo::NonFungibleToken(_) => true, - }; if ok_to_use { result.push(utxo); - additional_utxo_infos.insert( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { - num_decimals: token_info.token_number_of_decimals(), - ticker: token_info.token_ticker().to_vec(), - }, - ); + for token_info in token_infos { + additional_utxo_infos.insert( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo { + num_decimals: token_info.token_number_of_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + ); + } } - } else { - result.push(utxo); } } @@ -742,7 +755,7 @@ where let filtered_inputs = inputs .into_iter() - .filter(|(_, output, _)| { + .filter(|(_, output)| { get_tx_output_destination(output, &|_| None, HtlcSpendingCondition::Skip) .map_or(false, |dest| from_addresses.contains(&dest)) }) @@ -970,7 +983,7 @@ where let all_coin_utxos = all_utxos .into_iter() - .filter_map(|(o, txo, _)| { + .filter_map(|(o, txo)| { let (val, dest) = match &txo { TxOutput::Transfer(val, dest) | TxOutput::LockThenTransfer(val, dest, _) => (val, dest), From fdc3715b9c519af1d77404369317d57ac776c429 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 26 Aug 2024 22:36:46 +0200 Subject: [PATCH 28/48] add separate additional data for anyonecanstake --- wallet/src/send_request/mod.rs | 36 ++++++---- wallet/src/signer/trezor_signer/mod.rs | 14 ++-- wallet/src/wallet/mod.rs | 65 +++++++------------ wallet/src/wallet/tests.rs | 8 +-- .../types/src/partially_signed_transaction.rs | 16 ++++- wallet/wallet-controller/src/helpers.rs | 63 +++++++++--------- .../src/synced_controller.rs | 12 ++-- 7 files changed, 111 insertions(+), 103 deletions(-) diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 9f3481c7b2..613078a853 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -30,7 +30,7 @@ use crypto::vrf::VRFPublicKey; use utils::ensure; use wallet_types::currency::Currency; use wallet_types::partially_signed_transaction::{ - PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, }; use crate::account::PoolData; @@ -332,6 +332,7 @@ impl SendRequest { } } +/// Find aditional data for TxOutput, mainly for UI purposes fn find_additional_info( utxo: &TxOutput, additional_info: &BTreeMap, @@ -341,17 +342,22 @@ fn find_additional_info( | TxOutput::Htlc(value, _) | TxOutput::Transfer(value, _) | TxOutput::LockThenTransfer(value, _, _) => { - find_additional_info_output_value(value, additional_info)? + find_token_additional_info(value, additional_info)?.map(UtxoAdditionalInfo::TokenInfo) } TxOutput::AnyoneCanTake(data) => { - find_additional_info_output_value(data.as_ref().ask(), additional_info)? + let ask = find_token_additional_info(data.ask(), additional_info)?; + let give = find_token_additional_info(data.give(), additional_info)?; + + Some(UtxoAdditionalInfo::AnyoneCanTake { ask, give }) + } + TxOutput::IssueNft(_, data, _) => { + Some(UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: 0, + ticker: match data.as_ref() { + NftIssuance::V0(data) => data.metadata.ticker().clone(), + }, + })) } - TxOutput::IssueNft(_, data, _) => Some(UtxoAdditionalInfo::TokenInfo { - num_decimals: 0, - ticker: match data.as_ref() { - NftIssuance::V0(data) => data.metadata.ticker().clone(), - }, - }), TxOutput::CreateStakePool(_, data) => Some(UtxoAdditionalInfo::PoolInfo { staker_balance: data.pledge(), }), @@ -368,17 +374,23 @@ fn find_additional_info( Ok(additional_info) } -fn find_additional_info_output_value( +fn find_token_additional_info( value: &OutputValue, additional_info: &BTreeMap, -) -> WalletResult> { +) -> WalletResult> { match value { OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(None), OutputValue::TokenV1(token_id, _) => additional_info .get(&PoolOrTokenId::TokenId(*token_id)) .ok_or(WalletError::MissingTokenAdditionalData(*token_id)) .cloned() - .map(Some), + .map(|data| match data { + UtxoAdditionalInfo::TokenInfo(data) => Ok(Some(data.clone())), + UtxoAdditionalInfo::PoolInfo { staker_balance: _ } + | UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ } => { + Err(WalletError::MissmatchedTokenAdditionalData(*token_id)) + } + })?, } } diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index de0128557a..7ac784ad7d 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -79,7 +79,7 @@ use wallet_storage::{ use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, partially_signed_transaction::{ - PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, }, signature_status::SignatureStatus, AccountId, @@ -737,16 +737,18 @@ fn to_trezor_output_value( let mut token_value = MintlayerTokenOutputValue::new(); token_value.set_token_id(token_id.to_hash().as_bytes().to_vec()); match additional_info { - Some(UtxoAdditionalInfo::TokenInfo { + Some(UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals, ticker, - }) => { + })) => { token_value.set_number_of_decimals(*num_decimals as u32); token_value.set_token_ticker(ticker.clone()); } - Some(UtxoAdditionalInfo::PoolInfo { staker_balance: _ }) | None => { - return Err(SignerError::MissingUtxoExtraInfo) - } + Some( + UtxoAdditionalInfo::PoolInfo { staker_balance: _ } + | UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ }, + ) + | None => return Err(SignerError::MissingUtxoExtraInfo), } value.token = Some(token_value).into(); value diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 3d6a3b4e35..8af67c3c72 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -75,7 +75,8 @@ use wallet_storage::{ use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; use wallet_types::chain_info::ChainInfo; use wallet_types::partially_signed_transaction::{ - PartiallySignedTransaction, PartiallySignedTransactionCreationError, UtxoAdditionalInfo, + PartiallySignedTransaction, PartiallySignedTransactionCreationError, TokenAdditionalInfo, + UtxoAdditionalInfo, }; use wallet_types::seed_phrase::SerializableSeedPhrase; use wallet_types::signature_status::SignatureStatus; @@ -262,6 +263,8 @@ pub enum WalletError { MissingPoolAdditionalData(PoolId), #[error("Missing additional data for Token {0}")] MissingTokenAdditionalData(TokenId), + #[error("Missmatched additional data for token {0}")] + MissmatchedTokenAdditionalData(TokenId), } /// Result type used for the wallet @@ -1604,13 +1607,7 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { - num_decimals: token_info.num_decimals(), - ticker: token_info.token_ticker().to_vec(), - }, - )]); + let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, &additional_utxo_infos, @@ -1639,13 +1636,7 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { - num_decimals: token_info.num_decimals(), - ticker: token_info.token_ticker().to_vec(), - }, - )]); + let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, &additional_utxo_infos, @@ -1672,13 +1663,7 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { - num_decimals: token_info.num_decimals(), - ticker: token_info.token_ticker().to_vec(), - }, - )]); + let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, &additional_utxo_infos, @@ -1705,13 +1690,7 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { - num_decimals: token_info.num_decimals(), - ticker: token_info.token_ticker().to_vec(), - }, - )]); + let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, &additional_utxo_infos, @@ -1738,13 +1717,7 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { - num_decimals: token_info.num_decimals(), - ticker: token_info.token_ticker().to_vec(), - }, - )]); + let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, &additional_utxo_infos, @@ -1771,13 +1744,7 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { - num_decimals: token_info.num_decimals(), - ticker: token_info.token_ticker().to_vec(), - }, - )]); + let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, &additional_utxo_infos, @@ -2323,6 +2290,18 @@ where } } +fn to_token_additional_info( + token_info: &UnconfirmedTokenInfo, +) -> BTreeMap { + BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }), + )]) +} + impl Wallet where B: storage::Backend + 'static, diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index cdf3434e9d..dbcb0a8ee6 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -2371,10 +2371,10 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { let additional_info = BTreeMap::from_iter([( PoolOrTokenId::TokenId(*token_id), - UtxoAdditionalInfo::TokenInfo { + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: number_of_decimals, ticker: token_ticker.clone(), - }, + }), )]); let transfer_tokens_transaction = wallet .create_transaction_to_addresses( @@ -2722,10 +2722,10 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { let additional_info = BTreeMap::from_iter([( PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo { + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }, + }), )]); let transfer_tokens_transaction = wallet .create_transaction_to_addresses( diff --git a/wallet/types/src/partially_signed_transaction.rs b/wallet/types/src/partially_signed_transaction.rs index 610f53e186..9b17a5c3c5 100644 --- a/wallet/types/src/partially_signed_transaction.rs +++ b/wallet/types/src/partially_signed_transaction.rs @@ -42,11 +42,23 @@ pub enum PartiallySignedTransactionCreationError { InvalidHtlcSecretsCount, } +#[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] +pub struct TokenAdditionalInfo { + pub num_decimals: u8, + pub ticker: Vec, +} + /// Additional info for UTXOs #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub enum UtxoAdditionalInfo { - TokenInfo { num_decimals: u8, ticker: Vec }, - PoolInfo { staker_balance: Amount }, + TokenInfo(TokenAdditionalInfo), + PoolInfo { + staker_balance: Amount, + }, + AnyoneCanTake { + ask: Option, + give: Option, + }, } #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index 2a4143e019..dc856ff7e7 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -37,7 +37,7 @@ use wallet::{ WalletError, }; use wallet_types::partially_signed_transaction::{ - PartiallySignedTransaction, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, }; use crate::{types::Balances, ControllerError, WalletType2}; @@ -137,6 +137,25 @@ fn pool_id_from_txo(utxo: &TxOutput) -> Option { } } +async fn fetch_token_extra_info( + rpc_client: &T, + value: &OutputValue, +) -> Result, ControllerError> +where + T: NodeInterface, +{ + match value { + OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(None), + OutputValue::TokenV1(token_id, _) => { + let info = fetch_token_info(rpc_client, *token_id).await?; + Ok(Some(TokenAdditionalInfo { + num_decimals: info.token_number_of_decimals(), + ticker: info.token_ticker().to_vec(), + })) + } + } +} + pub async fn fetch_utxo_extra_info( rpc_client: &T, utxo: TxOutput, @@ -148,36 +167,18 @@ where TxOutput::Burn(value) | TxOutput::Transfer(value, _) | TxOutput::LockThenTransfer(value, _, _) - | TxOutput::Htlc(value, _) => match value { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => { - Ok(UtxoWithAdditionalInfo::new(utxo, None)) - } - OutputValue::TokenV1(token_id, _) => { - let info = fetch_token_info(rpc_client, *token_id).await?; - Ok(UtxoWithAdditionalInfo::new( - utxo, - Some(UtxoAdditionalInfo::TokenInfo { - num_decimals: info.token_number_of_decimals(), - ticker: info.token_ticker().to_vec(), - }), - )) - } - }, - TxOutput::AnyoneCanTake(order) => match order.ask() { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => { - Ok(UtxoWithAdditionalInfo::new(utxo, None)) - } - OutputValue::TokenV1(token_id, _) => { - let info = fetch_token_info(rpc_client, *token_id).await?; - Ok(UtxoWithAdditionalInfo::new( - utxo, - Some(UtxoAdditionalInfo::TokenInfo { - num_decimals: info.token_number_of_decimals(), - ticker: info.token_ticker().to_vec(), - }), - )) - } - }, + | TxOutput::Htlc(value, _) => { + let additional_info = fetch_token_extra_info(rpc_client, value) + .await? + .map(UtxoAdditionalInfo::TokenInfo); + Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) + } + TxOutput::AnyoneCanTake(order) => { + let ask = fetch_token_extra_info(rpc_client, order.ask()).await?; + let give = fetch_token_extra_info(rpc_client, order.ask()).await?; + let additional_info = Some(UtxoAdditionalInfo::AnyoneCanTake { ask, give }); + Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) + } TxOutput::ProduceBlockFromStake(_, pool_id) => { let staker_balance = rpc_client .get_staker_balance(*pool_id) diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 0351c8ac0a..9756c0994a 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -56,7 +56,9 @@ use wallet::{ WalletError, WalletResult, }; use wallet_types::{ - partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}, + partially_signed_transaction::{ + PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, + }, signature_status::SignatureStatus, utxo_types::{UtxoState, UtxoType}, with_locked::WithLocked, @@ -206,10 +208,10 @@ where for token_info in token_infos { additional_utxo_infos.insert( PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.token_number_of_decimals(), ticker: token_info.token_ticker().to_vec(), - }, + }), ); } } @@ -1211,10 +1213,10 @@ where token_info.check_can_be_used()?; let additional_info = BTreeMap::from_iter([( PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), - }, + }), )]); match wallet { WalletType2::Software(w) => w.create_transaction_to_addresses( From 2ad94fdc03ffe1d3f6bab2804d9b5b0a68f00ff3 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 28 Aug 2024 01:08:20 +0200 Subject: [PATCH 29/48] add support for signing HTLC outputs with trezor --- wallet/src/signer/trezor_signer/mod.rs | 35 +++++++++++++++++++------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 7ac784ad7d..dd6760ba5d 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -21,10 +21,12 @@ use std::{ use common::{ address::Address, chain::{ + htlc::HtlcSecret, output_value::OutputValue, signature::{ inputsig::{ arbitrary_message::ArbitraryMessageSignature, + authorize_hashed_timelock_contract_spend::AuthorizedHashedTimelockContractSpend, authorize_pubkey_spend::AuthorizedPublicKeySpend, authorize_pubkeyhash_spend::AuthorizedPublicKeyHashSpend, classical_multisig::{ @@ -120,8 +122,25 @@ impl TrezorSigner { destination: &Destination, sighash_type: SigHashType, sighash: H256, + secret: Option, key_chain: &impl AccountKeyChains, ) -> SignerResult<(Option, SignatureStatus)> { + let add_secret = |sig: StandardInputSignature| { + let sig = if let Some(htlc_secret) = secret { + let sig_with_secret = AuthorizedHashedTimelockContractSpend::Secret( + htlc_secret, + sig.raw_signature().to_owned(), + ); + let serialized_sig = sig_with_secret.encode(); + + StandardInputSignature::new(sig.sighash_type(), serialized_sig) + } else { + sig + }; + + InputWitness::Standard(sig) + }; + match destination { Destination::AnyoneCanSpend => Ok(( Some(InputWitness::NoSignature(None)), @@ -135,10 +154,7 @@ impl TrezorSigner { signature.insert(0, 0); let sig = Signature::from_data(signature)?; let sig = AuthorizedPublicKeyHashSpend::new(pk, sig); - let sig = InputWitness::Standard(StandardInputSignature::new( - sighash_type, - sig.encode(), - )); + let sig = add_secret(StandardInputSignature::new(sighash_type, sig.encode())); Ok((Some(sig), SignatureStatus::FullySigned)) } else { @@ -151,10 +167,7 @@ impl TrezorSigner { signature.insert(0, 0); let sig = Signature::from_data(signature)?; let sig = AuthorizedPublicKeySpend::new(sig); - let sig = InputWitness::Standard(StandardInputSignature::new( - sighash_type, - sig.encode(), - )); + let sig = add_secret(StandardInputSignature::new(sighash_type, sig.encode())); Ok((Some(sig), SignatureStatus::FullySigned)) } else { @@ -200,7 +213,7 @@ impl TrezorSigner { } }; - let sig = InputWitness::Standard(StandardInputSignature::new( + let sig = add_secret(StandardInputSignature::new( sighash_type, current_signatures.encode(), )); @@ -364,6 +377,9 @@ impl Signer for TrezorSigner { }, None => match (destination, new_signatures.get(i)) { (Some(destination), Some(sig)) => { + // TODO: when HTLC PR is merged get secret from the ptx + let secret = None; + let sighash_type = SigHashType::try_from(SigHashType::ALL).expect("Should not fail"); let sighash = signature_hash(sighash_type, ptx.tx(), &inputs_utxo_refs, i)?; @@ -372,6 +388,7 @@ impl Signer for TrezorSigner { destination, sighash_type, sighash, + secret, key_chain, )?; Ok((sig, SignatureStatus::NotSigned, status)) From 7589749f123c11181b5064ffc8cbcc515b23fa77 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Fri, 30 Aug 2024 00:10:00 +0200 Subject: [PATCH 30/48] fix comments --- build-tools/codecheck/codecheck.py | 2 +- crypto/src/key/extended.rs | 2 +- crypto/src/key/secp256k1/extended_keys.rs | 2 +- wallet/src/signer/trezor_signer/mod.rs | 23 +++++++++++-------- .../src/command_handler/mod.rs | 14 +++++------ .../wallet-cli-commands/src/helper_types.rs | 2 +- wallet/wallet-cli-commands/src/lib.rs | 8 +++---- wallet/wallet-controller/src/types/mod.rs | 2 +- 8 files changed, 29 insertions(+), 26 deletions(-) diff --git a/build-tools/codecheck/codecheck.py b/build-tools/codecheck/codecheck.py index f23b420fa6..c17de5fc99 100755 --- a/build-tools/codecheck/codecheck.py +++ b/build-tools/codecheck/codecheck.py @@ -268,7 +268,7 @@ def check_local_licenses(): template = re.compile('(?:' + r')\n(?:'.join(LICENSE_TEMPLATE) + ')') ok = True - for path in rs_sources(['wallet/trezor-client']): + for path in rs_sources(): if any(fnmatch.fnmatch(os.path.abspath(path), os.path.abspath(exempted)) for exempted in exempted_files): continue diff --git a/crypto/src/key/extended.rs b/crypto/src/key/extended.rs index 34d67905ad..2caac2bc9b 100644 --- a/crypto/src/key/extended.rs +++ b/crypto/src/key/extended.rs @@ -122,7 +122,7 @@ impl ExtendedPublicKey { } } - pub fn from_hardware_public_key(public_key: Secp256k1ExtendedPublicKey) -> Self { + pub fn new(public_key: Secp256k1ExtendedPublicKey) -> Self { Self { pub_key: ExtendedPublicKeyHolder::Secp256k1Schnorr(public_key), } diff --git a/crypto/src/key/secp256k1/extended_keys.rs b/crypto/src/key/secp256k1/extended_keys.rs index d639f44f34..e41186ebf1 100644 --- a/crypto/src/key/secp256k1/extended_keys.rs +++ b/crypto/src/key/secp256k1/extended_keys.rs @@ -201,7 +201,7 @@ impl Secp256k1ExtendedPublicKey { } } - pub fn from_hardware_wallet( + pub fn new( derivation_path: DerivationPath, chain_code: ChainCode, public_key: Secp256k1PublicKey, diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index dd6760ba5d..ae54826ccf 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -69,7 +69,6 @@ use trezor_client::{ MintlayerTxOutput, MintlayerUnfreezeToken, MintlayerUnmintTokens, MintlayerUtxoType, }, }; -#[allow(clippy::all)] use trezor_client::{ protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, Trezor, @@ -118,7 +117,7 @@ impl TrezorSigner { fn make_signature( &self, - signature: &Vec, + signature: &[MintlayerSignature], destination: &Destination, sighash_type: SigHashType, sighash: H256, @@ -282,12 +281,13 @@ impl Signer for TrezorSigner { )), InputWitness::Standard(sig) => match destination { Some(destination) => { - let sighash = - signature_hash(sig.sighash_type(), ptx.tx(), &inputs_utxo_refs, i)?; - - if sig - .verify_signature(&self.chain_config, destination, &sighash) - .is_ok() + if tx_verifier::input_check::signature_only_check::verify_tx_signature( + &self.chain_config, + destination, + &ptx, + &inputs_utxo_refs, + i, + ).is_ok() { Ok(( Some(w.clone()), @@ -295,6 +295,9 @@ impl Signer for TrezorSigner { SignatureStatus::FullySigned, )) } else if let Destination::ClassicMultisig(_) = destination { + let sighash = + signature_hash(sig.sighash_type(), ptx.tx(), &inputs_utxo_refs, i)?; + let mut current_signatures = AuthorizedClassicalMultisigSpend::from_data( sig.raw_signature(), )?; @@ -1053,12 +1056,12 @@ impl TrezorSignerProvider { .mintlayer_get_public_key(account_path) .map_err(|e| SignerError::TrezorError(TrezorError::DeviceError(e)))?; let chain_code = ChainCode::from(xpub.chain_code.0); - let account_pubkey = Secp256k1ExtendedPublicKey::from_hardware_wallet( + let account_pubkey = Secp256k1ExtendedPublicKey::new( derivation_path, chain_code, Secp256k1PublicKey::from_bytes(&xpub.public_key.serialize()).expect(""), ); - let account_pubkey = ExtendedPublicKey::from_hardware_public_key(account_pubkey); + let account_pubkey = ExtendedPublicKey::new(account_pubkey); Ok(account_pubkey) } } diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index 5d077b507f..9f647036d7 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -47,7 +47,7 @@ use wallet_types::partially_signed_transaction::PartiallySignedTransaction; use crate::{ errors::WalletCliCommandError, helper_types::parse_generic_token_transfer, - helper_types::CLIHardwareWalletType, ManageableWalletCommand, WalletManagementCommand, + helper_types::CliHardwareWalletType, ManageableWalletCommand, WalletManagementCommand, }; use self::local_state::WalletWithState; @@ -152,8 +152,8 @@ where } => { let hardware_wallet = hardware_wallet.and_then(|t| match t { #[cfg(feature = "trezor")] - CLIHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), - CLIHardwareWalletType::None => None, + CliHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), + CliHardwareWalletType::None => None, }); let newly_generated_mnemonic = self @@ -208,8 +208,8 @@ where } => { let hardware_wallet = hardware_wallet.and_then(|t| match t { #[cfg(feature = "trezor")] - CLIHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), - CLIHardwareWalletType::None => None, + CliHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), + CliHardwareWalletType::None => None, }); let newly_generated_mnemonic = self @@ -263,8 +263,8 @@ where } => { let hardware_wallet = hardware_wallet.and_then(|t| match t { #[cfg(feature = "trezor")] - CLIHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), - CLIHardwareWalletType::None => None, + CliHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), + CliHardwareWalletType::None => None, }); self.wallet() .await? diff --git a/wallet/wallet-cli-commands/src/helper_types.rs b/wallet/wallet-cli-commands/src/helper_types.rs index c3d7abe044..b484102d96 100644 --- a/wallet/wallet-cli-commands/src/helper_types.rs +++ b/wallet/wallet-cli-commands/src/helper_types.rs @@ -435,7 +435,7 @@ impl YesNo { } #[derive(Debug, Clone, Copy, ValueEnum)] -pub enum CLIHardwareWalletType { +pub enum CliHardwareWalletType { None, #[cfg(feature = "trezor")] Trezor, diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index d74644f133..c30385e080 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -19,7 +19,7 @@ mod helper_types; pub use command_handler::CommandHandler; pub use errors::WalletCliCommandError; -use helper_types::{CLIHardwareWalletType, YesNo}; +use helper_types::{CliHardwareWalletType, YesNo}; use rpc::description::{Described, Module}; use wallet_rpc_lib::{types::NodeInterface, ColdWalletRpcDescription, WalletRpcDescription}; @@ -66,7 +66,7 @@ pub enum WalletManagementCommand { /// Create a wallet using a connected hardware wallet. Only the public keys will be kept in /// the software wallet #[arg(long, conflicts_with_all(["mnemonic", "passphrase"]))] - hardware_wallet: Option, + hardware_wallet: Option, }, #[clap(name = "wallet-recover")] @@ -91,7 +91,7 @@ pub enum WalletManagementCommand { /// Create a wallet using a connected hardware wallet. Only the public keys will be kept in /// the software wallet #[arg(long, conflicts_with_all(["mnemonic", "passphrase"]))] - hardware_wallet: Option, + hardware_wallet: Option, }, #[clap(name = "wallet-open")] @@ -106,7 +106,7 @@ pub enum WalletManagementCommand { /// Open a wallet file related to a connected hardware wallet. #[arg(long)] - hardware_wallet: Option, + hardware_wallet: Option, }, #[clap(name = "wallet-close")] diff --git a/wallet/wallet-controller/src/types/mod.rs b/wallet/wallet-controller/src/types/mod.rs index e346b3ccc5..ed6e307316 100644 --- a/wallet/wallet-controller/src/types/mod.rs +++ b/wallet/wallet-controller/src/types/mod.rs @@ -176,7 +176,7 @@ impl WalletTypeArgs { Self::Trezor => WalletType::Trezor, } } - pub fn user_supplied_menmonic(&self) -> bool { + pub fn user_supplied_mnemonic(&self) -> bool { match self { Self::Software { mnemonic, From 1e18f522908d58b98a5f99df04a6580eb489c851 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Fri, 30 Aug 2024 16:57:35 +0200 Subject: [PATCH 31/48] extract runtime wallet functionality --- wallet/src/wallet/mod.rs | 2 + wallet/wallet-controller/src/helpers.rs | 27 +- wallet/wallet-controller/src/lib.rs | 196 +-- wallet/wallet-controller/src/read.rs | 199 ++- .../wallet-controller/src/runtime_wallet.rs | 1088 +++++++++++++++++ .../src/synced_controller.rs | 889 +++++--------- 6 files changed, 1507 insertions(+), 894 deletions(-) create mode 100644 wallet/wallet-controller/src/runtime_wallet.rs diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 8af67c3c72..04d1c624cb 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -265,6 +265,8 @@ pub enum WalletError { MissingTokenAdditionalData(TokenId), #[error("Missmatched additional data for token {0}")] MissmatchedTokenAdditionalData(TokenId), + #[error("Unsupported operation for a Hardware wallet")] + UnsupportedHardwareWalletOperation, } /// Result type used for the wallet diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index dc856ff7e7..b8a25aee1e 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -40,7 +40,7 @@ use wallet_types::partially_signed_transaction::{ PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, }; -use crate::{types::Balances, ControllerError, WalletType2}; +use crate::{runtime_wallet::RuntimeWallet, types::Balances, ControllerError}; pub async fn fetch_token_info( rpc_client: &T, @@ -58,13 +58,13 @@ pub async fn fetch_token_info( pub async fn fetch_utxo( rpc_client: &T, input: &UtxoOutPoint, - wallet: &WalletType2, + wallet: &RuntimeWallet, ) -> Result> { // search locally for the unspent utxo if let Some(out) = match &wallet { - WalletType2::Software(w) => w.find_unspent_utxo_with_destination(input), + RuntimeWallet::Software(w) => w.find_unspent_utxo_with_destination(input), #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.find_unspent_utxo_with_destination(input), + RuntimeWallet::Trezor(w) => w.find_unspent_utxo_with_destination(input), } { return Ok(out.0); } @@ -82,13 +82,13 @@ pub async fn fetch_utxo( pub async fn fetch_utxo_with_destination( rpc_client: &T, input: &UtxoOutPoint, - wallet: &WalletType2, + wallet: &RuntimeWallet, ) -> Result<(TxOutput, Destination), ControllerError> { // search locally for the unspent utxo if let Some(out) = match &wallet { - WalletType2::Software(w) => w.find_unspent_utxo_with_destination(input), + RuntimeWallet::Software(w) => w.find_unspent_utxo_with_destination(input), #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.find_unspent_utxo_with_destination(input), + RuntimeWallet::Trezor(w) => w.find_unspent_utxo_with_destination(input), } { return Ok(out); } @@ -109,7 +109,6 @@ pub async fn fetch_utxo_with_destination( .await .map_err(ControllerError::NodeCallError)? } else { - // FIXME get_tx_output_destination(&utxo, &|_| None, HtlcSpendingCondition::Skip) } .ok_or(ControllerError::WalletError(WalletError::CannotFindUtxo( @@ -229,7 +228,7 @@ pub async fn into_balances( pub async fn tx_to_partially_signed_tx( rpc_client: &T, - wallet: &WalletType2, + wallet: &RuntimeWallet, tx: Transaction, ) -> Result> { let tasks: FuturesOrdered<_> = tx @@ -266,7 +265,7 @@ pub async fn tx_to_partially_signed_tx( async fn into_utxo_and_destination( rpc_client: &T, - wallet: &WalletType2, + wallet: &RuntimeWallet, tx_inp: &TxInput, ) -> Result<(Option, Option), ControllerError> { Ok(match tx_inp { @@ -278,18 +277,18 @@ async fn into_utxo_and_destination( TxInput::Account(acc_outpoint) => { // find delegation destination let dest = match &wallet { - WalletType2::Software(w) => w.find_account_destination(acc_outpoint), + RuntimeWallet::Software(w) => w.find_account_destination(acc_outpoint), #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.find_account_destination(acc_outpoint), + RuntimeWallet::Trezor(w) => w.find_account_destination(acc_outpoint), }; (None, dest) } TxInput::AccountCommand(_, cmd) => { // find authority of the token let dest = match &wallet { - WalletType2::Software(w) => w.find_account_command_destination(cmd), + RuntimeWallet::Software(w) => w.find_account_command_destination(cmd), #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.find_account_command_destination(cmd), + RuntimeWallet::Trezor(w) => w.find_account_command_destination(cmd), }; (None, dest) } diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 0b67ad2c9c..6556a03051 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -18,6 +18,7 @@ mod helpers; pub mod mnemonic; pub mod read; +mod runtime_wallet; mod sync; pub mod synced_controller; pub mod types; @@ -32,6 +33,7 @@ use chainstate::tx_verifier::{ use futures::{never::Never, stream::FuturesOrdered, TryStreamExt}; use helpers::{fetch_token_info, fetch_utxo, fetch_utxo_extra_info, into_balances}; use node_comm::rpc_client::ColdWalletClient; +use runtime_wallet::RuntimeWallet; use std::{ collections::{BTreeMap, BTreeSet}, fs, @@ -90,7 +92,7 @@ use wallet::{ signer::software_signer::SoftwareSignerProvider, wallet::WalletPoolsFilter, wallet_events::WalletEvents, - Wallet, WalletError, WalletResult, + WalletError, WalletResult, }; pub use wallet_types::{ @@ -150,8 +152,6 @@ pub enum ControllerError { InvalidTxOutput(GenericCurrencyTransferToTxOutputConversionError), #[error("The specified token {0} is not a fungible token")] NotFungibleToken(TokenId), - #[error("Unsupported operation for a Hardware wallet")] - UnsupportedHardwareWalletOperation, } #[derive(Clone, Copy)] @@ -166,18 +166,12 @@ pub struct ControllerConfig { pub broadcast_to_mempool: bool, } -pub enum WalletType2 { - Software(Wallet), - #[cfg(feature = "trezor")] - Trezor(Wallet), -} - pub struct Controller { chain_config: Arc, rpc_client: T, - wallet: WalletType2, + wallet: RuntimeWallet, staking_started: BTreeSet, @@ -203,7 +197,7 @@ where pub async fn new( chain_config: Arc, rpc_client: T, - wallet: WalletType2, + wallet: RuntimeWallet, wallet_events: W, ) -> Result> { let mut controller = Self { @@ -223,7 +217,7 @@ where pub fn new_unsynced( chain_config: Arc, rpc_client: T, - wallet: WalletType2, + wallet: RuntimeWallet, wallet_events: W, ) -> Self { Self { @@ -241,7 +235,7 @@ where args: WalletTypeArgsComputed, best_block: (BlockHeight, Id), wallet_type: WalletType, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { utils::ensure!( !file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -276,7 +270,7 @@ where }, ) .map_err(ControllerError::WalletError)?; - Ok(WalletType2::Software(wallet)) + Ok(RuntimeWallet::Software(wallet)) } #[cfg(feature = "trezor")] WalletTypeArgsComputed::Trezor => { @@ -288,7 +282,7 @@ where |_db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), ) .map_err(ControllerError::WalletError)?; - Ok(WalletType2::Trezor(wallet)) + Ok(RuntimeWallet::Trezor(wallet)) } } } @@ -298,7 +292,7 @@ where file_path: impl AsRef, args: WalletTypeArgsComputed, wallet_type: WalletType, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { utils::ensure!( !file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -333,7 +327,7 @@ where }, ) .map_err(ControllerError::WalletError)?; - Ok(WalletType2::Software(wallet)) + Ok(RuntimeWallet::Software(wallet)) } #[cfg(feature = "trezor")] WalletTypeArgsComputed::Trezor => { @@ -344,7 +338,7 @@ where |_db_tx| Ok(TrezorSignerProvider::new().map_err(SignerError::TrezorError)?), ) .map_err(ControllerError::WalletError)?; - Ok(WalletType2::Trezor(wallet)) + Ok(RuntimeWallet::Trezor(wallet)) } } } @@ -383,7 +377,7 @@ where current_controller_mode: WalletControllerMode, force_change_wallet_type: bool, open_as_wallet_type: WalletType, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { utils::ensure!( file_path.as_ref().exists(), ControllerError::WalletFileError( @@ -407,7 +401,7 @@ where |db_tx| SoftwareSignerProvider::load_from_database(chain_config.clone(), db_tx), ) .map_err(ControllerError::WalletError)?; - Ok(WalletType2::Software(wallet)) + Ok(RuntimeWallet::Software(wallet)) } #[cfg(feature = "trezor")] WalletType::Trezor => { @@ -421,41 +415,30 @@ where |db_tx| TrezorSignerProvider::load_from_database(chain_config.clone(), db_tx), ) .map_err(ControllerError::WalletError)?; - Ok(WalletType2::Trezor(wallet)) + Ok(RuntimeWallet::Trezor(wallet)) } } } pub fn seed_phrase(&self) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.seed_phrase(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.seed_phrase(), - } - .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) - .map_err(ControllerError::WalletError) + self.wallet + .seed_phrase() + .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) + .map_err(ControllerError::WalletError) } /// Delete the seed phrase if stored in the database pub fn delete_seed_phrase(&self) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.delete_seed_phrase(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.delete_seed_phrase(), - } - .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) - .map_err(ControllerError::WalletError) + self.wallet + .delete_seed_phrase() + .map(|opt| opt.map(SeedWithPassPhrase::from_serializable_seed_phrase)) + .map_err(ControllerError::WalletError) } /// Rescan the blockchain /// Resets the wallet to the genesis block pub fn reset_wallet_to_genesis(&mut self) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.reset_wallet_to_genesis(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.reset_wallet_to_genesis(), - } - .map_err(ControllerError::WalletError) + self.wallet.reset_wallet_to_genesis().map_err(ControllerError::WalletError) } /// Encrypts the wallet using the specified `password`, or removes the existing encryption if `password` is `None`. @@ -468,12 +451,7 @@ where /// /// This method returns an error if the wallet is locked pub fn encrypt_wallet(&mut self, password: &Option) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.encrypt_wallet(password), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.encrypt_wallet(password), - } - .map_err(ControllerError::WalletError) + self.wallet.encrypt_wallet(password).map_err(ControllerError::WalletError) } /// Unlocks the wallet using the specified password. @@ -486,12 +464,7 @@ where /// /// This method returns an error if the password is incorrect pub fn unlock_wallet(&mut self, password: &String) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.unlock_wallet(password), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.unlock_wallet(password), - } - .map_err(ControllerError::WalletError) + self.wallet.unlock_wallet(password).map_err(ControllerError::WalletError) } /// Locks the wallet by making the encrypted private keys inaccessible. @@ -504,12 +477,7 @@ where self.staking_started.is_empty(), ControllerError::StakingRunning ); - match &mut self.wallet { - WalletType2::Software(w) => w.lock_wallet(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.lock_wallet(), - } - .map_err(ControllerError::WalletError) + self.wallet.lock_wallet().map_err(ControllerError::WalletError) } /// Sets the lookahead size for key generation @@ -524,20 +492,13 @@ where ) -> Result<(), ControllerError> { utils::ensure!(lookahead_size > 0, ControllerError::InvalidLookaheadSize); - match &mut self.wallet { - WalletType2::Software(w) => w.set_lookahead_size(lookahead_size, force_reduce), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.set_lookahead_size(lookahead_size, force_reduce), - } - .map_err(ControllerError::WalletError) + self.wallet + .set_lookahead_size(lookahead_size, force_reduce) + .map_err(ControllerError::WalletError) } pub fn wallet_info(&self) -> WalletInfo { - let (wallet_id, account_names) = match &self.wallet { - WalletType2::Software(w) => w.wallet_info(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.wallet_info(), - }; + let (wallet_id, account_names) = self.wallet.wallet_info(); WalletInfo { wallet_id, account_names, @@ -579,14 +540,10 @@ where transaction_ids: Vec>, packing_strategy: PackingStrategy, ) -> Result> { - let pos_data = match &self.wallet { - WalletType2::Software(w) => w.get_pos_gen_block_data(account_index, pool_id), - #[cfg(feature = "trezor")] - WalletType2::Trezor(_) => { - return Err(ControllerError::UnsupportedHardwareWalletOperation) - } - } - .map_err(ControllerError::WalletError)?; + let pos_data = self + .wallet + .get_pos_gen_block_data(account_index, pool_id) + .map_err(ControllerError::WalletError)?; let public_key = self .rpc_client @@ -623,12 +580,10 @@ where transaction_ids: Vec>, packing_strategy: PackingStrategy, ) -> Result> { - let pools = match &self.wallet { - WalletType2::Software(w) => w.get_pool_ids(account_index, WalletPoolsFilter::Stake), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_pool_ids(account_index, WalletPoolsFilter::Stake), - } - .map_err(ControllerError::WalletError)?; + let pools = self + .wallet + .get_pool_ids(account_index, WalletPoolsFilter::Stake) + .map_err(ControllerError::WalletError)?; let mut last_error = ControllerError::NoStakingPool; for (pool_id, _) in pools { @@ -694,14 +649,10 @@ where seconds_to_check_for_height: u64, check_all_timestamps_between_blocks: bool, ) -> Result>, ControllerError> { - let pos_data = match &self.wallet { - WalletType2::Software(w) => w.get_pos_gen_block_data_by_pool_id(pool_id), - #[cfg(feature = "trezor")] - WalletType2::Trezor(_) => { - return Err(ControllerError::UnsupportedHardwareWalletOperation) - } - } - .map_err(ControllerError::WalletError)?; + let pos_data = self + .wallet + .get_pos_gen_block_data_by_pool_id(pool_id) + .map_err(ControllerError::WalletError)?; let input_data = PoSTimestampSearchInputData::new(pool_id, pos_data.vrf_private_key().clone()); @@ -727,12 +678,7 @@ where &mut self, name: Option, ) -> Result<(U31, Option), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.create_next_account(name), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_next_account(name), - } - .map_err(ControllerError::WalletError) + self.wallet.create_next_account(name).map_err(ControllerError::WalletError) } pub fn update_account_name( @@ -740,12 +686,9 @@ where account_index: U31, name: Option, ) -> Result<(U31, Option), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.set_account_name(account_index, name), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.set_account_name(account_index, name), - } - .map_err(ControllerError::WalletError) + self.wallet + .set_account_name(account_index, name) + .map_err(ControllerError::WalletError) } pub fn stop_staking(&mut self, account_index: U31) -> Result<(), ControllerError> { @@ -759,36 +702,27 @@ where } pub fn best_block(&self) -> (Id, BlockHeight) { - *match &self.wallet { - WalletType2::Software(w) => w.get_best_block(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_best_block(), - } - .values() - .min_by_key(|(_block_id, block_height)| block_height) - .expect("there must be at least one account") + *self + .wallet + .get_best_block() + .values() + .min_by_key(|(_block_id, block_height)| block_height) + .expect("there must be at least one account") } pub async fn get_stake_pool_balances( &self, account_index: U31, ) -> Result, ControllerError> { - let stake_pool_utxos = match &self.wallet { - WalletType2::Software(w) => w.get_utxos( - account_index, - UtxoType::CreateStakePool | UtxoType::ProduceBlockFromStake, - UtxoState::Confirmed.into(), - WithLocked::Unlocked, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_utxos( + let stake_pool_utxos = self + .wallet + .get_utxos( account_index, UtxoType::CreateStakePool | UtxoType::ProduceBlockFromStake, UtxoState::Confirmed.into(), WithLocked::Unlocked, - ), - } - .map_err(ControllerError::WalletError)?; + ) + .map_err(ControllerError::WalletError)?; let pool_ids = stake_pool_utxos.into_iter().filter_map(|(_, utxo)| match utxo { TxOutput::ProduceBlockFromStake(_, pool_id) | TxOutput::CreateStakePool(pool_id, _) => { Some(pool_id) @@ -821,11 +755,11 @@ where /// Synchronize the wallet to the current node tip height and return pub async fn sync_once(&mut self) -> Result<(), ControllerError> { let res = match &mut self.wallet { - WalletType2::Software(w) => { + RuntimeWallet::Software(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events).await } #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { + RuntimeWallet::Trezor(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events).await } }?; @@ -838,12 +772,12 @@ where pub async fn try_sync_once(&mut self) -> Result<(), ControllerError> { match &mut self.wallet { - WalletType2::Software(w) => { + RuntimeWallet::Software(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events) .await?; } #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { + RuntimeWallet::Trezor(w) => { sync::sync_once(&self.chain_config, &self.rpc_client, w, &self.wallet_events) .await?; } @@ -1292,11 +1226,7 @@ where /// Rebroadcast not confirmed transactions async fn rebroadcast_txs(&mut self, rebroadcast_txs_again_at: &mut Time) { if get_time() >= *rebroadcast_txs_again_at { - let txs = match &self.wallet { - WalletType2::Software(w) => w.get_transactions_to_be_broadcast(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_transactions_to_be_broadcast(), - }; + let txs = self.wallet.get_transactions_to_be_broadcast(); match txs { Err(error) => { log::error!("Fetching transactions for rebroadcasting failed: {error}"); diff --git a/wallet/wallet-controller/src/read.rs b/wallet/wallet-controller/src/read.rs index 0c6a8bf3bc..0ac5d48e84 100644 --- a/wallet/wallet-controller/src/read.rs +++ b/wallet/wallet-controller/src/read.rs @@ -45,12 +45,13 @@ use wallet_types::{ }; use crate::{ + runtime_wallet::RuntimeWallet, types::{AccountStandaloneKeyDetails, Balances, CreatedBlockInfo}, - ControllerError, WalletType2, + ControllerError, }; pub struct ReadOnlyController<'a, T, B: storage::Backend + 'static> { - wallet: &'a WalletType2, + wallet: &'a RuntimeWallet, rpc_client: T, chain_config: &'a ChainConfig, account_index: U31, @@ -65,7 +66,7 @@ where B: storage::Backend + 'static, { pub fn new( - wallet: &'a WalletType2, + wallet: &'a RuntimeWallet, rpc_client: T, chain_config: &'a ChainConfig, account_index: U31, @@ -87,12 +88,9 @@ where utxo_states: UtxoStates, with_locked: WithLocked, ) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.get_balance(self.account_index, utxo_states, with_locked), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_balance(self.account_index, utxo_states, with_locked), - } - .map_err(ControllerError::WalletError) + self.wallet + .get_balance(self.account_index, utxo_states, with_locked) + .map_err(ControllerError::WalletError) } pub async fn get_decimal_balance( @@ -110,17 +108,10 @@ where utxo_states: UtxoStates, with_locked: WithLocked, ) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => { - w.get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) - } - } - .map(|utxos| utxos.into_iter().collect()) - .map_err(ControllerError::WalletError) + self.wallet + .get_multisig_utxos(self.account_index, utxo_types, utxo_states, with_locked) + .map(|utxos| utxos.into_iter().collect()) + .map_err(ControllerError::WalletError) } pub fn get_utxos( @@ -129,25 +120,15 @@ where utxo_states: UtxoStates, with_locked: WithLocked, ) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => { - w.get_utxos(self.account_index, utxo_types, utxo_states, with_locked) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.get_utxos(self.account_index, utxo_types, utxo_states, with_locked) - } - } - .map_err(ControllerError::WalletError) + self.wallet + .get_utxos(self.account_index, utxo_types, utxo_states, with_locked) + .map_err(ControllerError::WalletError) } pub fn pending_transactions(&self) -> Result>, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.pending_transactions(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.pending_transactions(self.account_index), - } - .map_err(ControllerError::WalletError) + self.wallet + .pending_transactions(self.account_index) + .map_err(ControllerError::WalletError) } pub fn mainchain_transactions( @@ -155,16 +136,9 @@ where destination: Option, limit: usize, ) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => { - w.mainchain_transactions(self.account_index, destination, limit) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.mainchain_transactions(self.account_index, destination, limit) - } - } - .map_err(ControllerError::WalletError) + self.wallet + .mainchain_transactions(self.account_index, destination, limit) + .map_err(ControllerError::WalletError) } pub fn get_transaction_list( @@ -172,68 +146,46 @@ where skip: usize, count: usize, ) -> Result> { - match &self.wallet { - WalletType2::Software(w) => w.get_transaction_list(self.account_index, skip, count), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_transaction_list(self.account_index, skip, count), - } - .map_err(ControllerError::WalletError) + self.wallet + .get_transaction_list(self.account_index, skip, count) + .map_err(ControllerError::WalletError) } pub fn get_transaction( &self, transaction_id: Id, ) -> Result<&TxData, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.get_transaction(self.account_index, transaction_id), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_transaction(self.account_index, transaction_id), - } - .map_err(ControllerError::WalletError) + self.wallet + .get_transaction(self.account_index, transaction_id) + .map_err(ControllerError::WalletError) } pub fn get_all_issued_addresses( &self, ) -> Result>, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.get_all_issued_addresses(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_all_issued_addresses(self.account_index), - } - .map_err(ControllerError::WalletError) + self.wallet + .get_all_issued_addresses(self.account_index) + .map_err(ControllerError::WalletError) } pub fn get_all_issued_vrf_public_keys( &self, ) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.get_all_issued_vrf_public_keys(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(_) => { - return Err(ControllerError::UnsupportedHardwareWalletOperation) - } - } - .map_err(ControllerError::WalletError) + self.wallet + .get_all_issued_vrf_public_keys(self.account_index) + .map_err(ControllerError::WalletError) } pub fn get_legacy_vrf_public_key(&self) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.get_legacy_vrf_public_key(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(_) => { - return Err(ControllerError::UnsupportedHardwareWalletOperation) - } - } - .map_err(ControllerError::WalletError) + self.wallet + .get_legacy_vrf_public_key(self.account_index) + .map_err(ControllerError::WalletError) } pub fn get_addresses_usage(&self) -> Result<&'a KeychainUsageState, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.get_addresses_usage(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_addresses_usage(self.account_index), - } - .map_err(ControllerError::WalletError) + self.wallet + .get_addresses_usage(self.account_index) + .map_err(ControllerError::WalletError) } /// Get all addresses with usage information @@ -258,12 +210,9 @@ where /// Get all standalone addresses with their labels pub fn get_standalone_addresses(&self) -> Result> { - match &self.wallet { - WalletType2::Software(w) => w.get_all_standalone_addresses(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_all_standalone_addresses(self.account_index), - } - .map_err(ControllerError::WalletError) + self.wallet + .get_all_standalone_addresses(self.account_index) + .map_err(ControllerError::WalletError) } /// Get all standalone addresses with their labels and balances @@ -271,16 +220,10 @@ where &self, address: Destination, ) -> Result> { - let (address, balances, details) = match &self.wallet { - WalletType2::Software(w) => { - w.get_all_standalone_address_details(self.account_index, address) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.get_all_standalone_address_details(self.account_index, address) - } - } - .map_err(ControllerError::WalletError)?; + let (address, balances, details) = self + .wallet + .get_all_standalone_address_details(self.account_index, address) + .map_err(ControllerError::WalletError)?; let balances = super::into_balances(&self.rpc_client, self.chain_config, balances).await?; @@ -320,12 +263,10 @@ where &self, filter: WalletPoolsFilter, ) -> Result, ControllerError> { - let pools = match &self.wallet { - WalletType2::Software(w) => w.get_pool_ids(self.account_index, filter), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_pool_ids(self.account_index, filter), - } - .map_err(ControllerError::WalletError)?; + let pools = self + .wallet + .get_pool_ids(self.account_index, filter) + .map_err(ControllerError::WalletError)?; let tasks: FuturesUnordered<_> = pools .into_iter() @@ -371,7 +312,7 @@ where &self, ) -> Result, ControllerError> { let delegations = match &self.wallet { - WalletType2::Software(w) => { + RuntimeWallet::Software(w) => { let delegations = w.get_delegations(self.account_index).map_err(ControllerError::WalletError)?; let tasks: FuturesUnordered<_> = delegations @@ -390,7 +331,7 @@ where tasks.try_collect::>().await?.into_iter().flatten().collect() } #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { + RuntimeWallet::Trezor(w) => { let delegations = w.get_delegations(self.account_index).map_err(ControllerError::WalletError)?; let tasks: FuturesUnordered<_> = delegations @@ -414,26 +355,24 @@ where } pub fn get_created_blocks(&self) -> Result, ControllerError> { - match &self.wallet { - WalletType2::Software(w) => w.get_created_blocks(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_created_blocks(self.account_index), - } - .map_err(ControllerError::WalletError) - .map(|blocks| { - blocks - .into_iter() - .map(|(height, id, pool_id)| { - let pool_id = Address::new(self.chain_config, pool_id).expect("addressable"); - - CreatedBlockInfo { - height, - id, - pool_id: pool_id.to_string(), - } - }) - .collect() - }) + self.wallet + .get_created_blocks(self.account_index) + .map_err(ControllerError::WalletError) + .map(|blocks| { + blocks + .into_iter() + .map(|(height, id, pool_id)| { + let pool_id = + Address::new(self.chain_config, pool_id).expect("addressable"); + + CreatedBlockInfo { + height, + id, + pool_id: pool_id.to_string(), + } + }) + .collect() + }) } async fn get_delegation_share( diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs new file mode 100644 index 0000000000..406cb0471f --- /dev/null +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -0,0 +1,1088 @@ +// Copyright (c) 2023 RBB S.r.l +// opensource@mintlayer.org +// SPDX-License-Identifier: MIT +// Licensed under the MIT License; +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::collections::{BTreeMap, BTreeSet}; + +use common::address::pubkeyhash::PublicKeyHash; +use common::address::Address; +use common::chain::classic_multisig::ClassicMultisigChallenge; +use common::chain::htlc::HashedTimelockContract; +use common::chain::output_value::OutputValue; +use common::chain::signature::inputsig::arbitrary_message::ArbitraryMessageSignature; +use common::chain::tokens::{ + IsTokenUnfreezable, Metadata, RPCFungibleTokenInfo, TokenId, TokenIssuance, +}; +use common::chain::{ + DelegationId, Destination, GenBlock, PoolId, SignedTransaction, Transaction, TxOutput, + UtxoOutPoint, +}; +use common::primitives::id::WithId; +use common::primitives::{Amount, BlockHeight, Id, H256}; +use crypto::key::hdkd::child_number::ChildNumber; +use crypto::key::hdkd::u31::U31; +use crypto::key::{PrivateKey, PublicKey}; +use crypto::vrf::VRFPublicKey; +use mempool::FeeRate; +use wallet::account::currency_grouper::Currency; +use wallet::account::transaction_list::TransactionList; +use wallet::account::{CoinSelectionAlgo, DelegationData, PoolData, TxInfo, UnconfirmedTokenInfo}; +use wallet::send_request::{PoolOrTokenId, SelectedInputs, StakePoolDataArguments}; +use wallet::signer::software_signer::SoftwareSignerProvider; + +use wallet::wallet::WalletPoolsFilter; +use wallet::wallet_events::WalletEvents; +use wallet::{Wallet, WalletError, WalletResult}; +use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; +use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; +use wallet_types::seed_phrase::SerializableSeedPhrase; +use wallet_types::signature_status::SignatureStatus; +use wallet_types::utxo_types::{UtxoStates, UtxoTypes}; +use wallet_types::wallet_tx::TxData; +use wallet_types::with_locked::WithLocked; +use wallet_types::KeychainUsageState; + +#[cfg(feature = "trezor")] +use wallet::signer::trezor_signer::TrezorSignerProvider; + +pub enum RuntimeWallet { + Software(Wallet), + #[cfg(feature = "trezor")] + Trezor(Wallet), +} + +impl RuntimeWallet { + pub fn seed_phrase(&self) -> Result, WalletError> { + match self { + RuntimeWallet::Software(w) => w.seed_phrase(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.seed_phrase(), + } + } + + pub fn delete_seed_phrase(&self) -> Result, WalletError> { + match self { + RuntimeWallet::Software(w) => w.delete_seed_phrase(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.delete_seed_phrase(), + } + } + + pub fn reset_wallet_to_genesis(&mut self) -> Result<(), WalletError> { + match self { + RuntimeWallet::Software(w) => w.reset_wallet_to_genesis(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.reset_wallet_to_genesis(), + } + } + + pub fn encrypt_wallet(&mut self, password: &Option) -> Result<(), WalletError> { + match self { + RuntimeWallet::Software(w) => w.encrypt_wallet(password), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.encrypt_wallet(password), + } + } + + pub fn unlock_wallet(&mut self, password: &String) -> Result<(), WalletError> { + match self { + RuntimeWallet::Software(w) => w.unlock_wallet(password), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.unlock_wallet(password), + } + } + + pub fn lock_wallet(&mut self) -> Result<(), WalletError> { + match self { + RuntimeWallet::Software(w) => w.lock_wallet(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.lock_wallet(), + } + } + + pub fn set_lookahead_size( + &mut self, + lookahead_size: u32, + force_reduce: bool, + ) -> Result<(), WalletError> { + match self { + RuntimeWallet::Software(w) => w.set_lookahead_size(lookahead_size, force_reduce), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.set_lookahead_size(lookahead_size, force_reduce), + } + } + + pub fn wallet_info(&self) -> (H256, Vec>) { + match self { + RuntimeWallet::Software(w) => w.wallet_info(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.wallet_info(), + } + } + + pub fn create_next_account( + &mut self, + name: Option, + ) -> Result<(U31, Option), WalletError> { + match self { + RuntimeWallet::Software(w) => w.create_next_account(name), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_next_account(name), + } + } + + pub fn set_account_name( + &mut self, + account_index: U31, + name: Option, + ) -> Result<(U31, Option), WalletError> { + match self { + RuntimeWallet::Software(w) => w.set_account_name(account_index, name), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.set_account_name(account_index, name), + } + } + + pub fn get_pos_gen_block_data( + &self, + account_index: U31, + pool_id: PoolId, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.get_pos_gen_block_data(account_index, pool_id), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(_) => Err(WalletError::UnsupportedHardwareWalletOperation), + } + } + + pub fn get_pos_gen_block_data_by_pool_id( + &self, + pool_id: PoolId, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.get_pos_gen_block_data_by_pool_id(pool_id), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(_) => Err(WalletError::UnsupportedHardwareWalletOperation), + } + } + + pub fn get_pool_ids( + &self, + account_index: U31, + filter: WalletPoolsFilter, + ) -> WalletResult> { + match self { + RuntimeWallet::Software(w) => w.get_pool_ids(account_index, filter), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_pool_ids(account_index, filter), + } + } + + pub fn get_best_block(&self) -> BTreeMap, BlockHeight)> { + match self { + RuntimeWallet::Software(w) => w.get_best_block(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_best_block(), + } + } + + pub fn is_locked(&self) -> bool { + match self { + RuntimeWallet::Software(w) => w.is_locked(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.is_locked(), + } + } + + pub fn get_utxos( + &self, + account_index: U31, + utxo_types: UtxoTypes, + utxo_states: UtxoStates, + with_locked: WithLocked, + ) -> Result, WalletError> { + match self { + RuntimeWallet::Software(w) => { + w.get_utxos(account_index, utxo_types, utxo_states, with_locked) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => { + w.get_utxos(account_index, utxo_types, utxo_states, with_locked) + } + } + } + + pub fn get_transactions_to_be_broadcast( + &mut self, + ) -> Result, WalletError> { + match self { + RuntimeWallet::Software(w) => w.get_transactions_to_be_broadcast(), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_transactions_to_be_broadcast(), + } + } + + pub fn get_balance( + &self, + account_index: U31, + utxo_states: UtxoStates, + with_locked: WithLocked, + ) -> WalletResult> { + match self { + RuntimeWallet::Software(w) => w.get_balance(account_index, utxo_states, with_locked), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_balance(account_index, utxo_states, with_locked), + } + } + + pub fn get_multisig_utxos( + &self, + account_index: U31, + utxo_types: UtxoTypes, + utxo_states: UtxoStates, + with_locked: WithLocked, + ) -> WalletResult> { + match self { + RuntimeWallet::Software(w) => { + w.get_multisig_utxos(account_index, utxo_types, utxo_states, with_locked) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => { + w.get_multisig_utxos(account_index, utxo_types, utxo_states, with_locked) + } + } + } + + pub fn pending_transactions( + &self, + account_index: U31, + ) -> WalletResult>> { + match self { + RuntimeWallet::Software(w) => w.pending_transactions(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.pending_transactions(account_index), + } + } + + pub fn mainchain_transactions( + &self, + account_index: U31, + destination: Option, + limit: usize, + ) -> WalletResult> { + match self { + RuntimeWallet::Software(w) => { + w.mainchain_transactions(account_index, destination, limit) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.mainchain_transactions(account_index, destination, limit), + } + } + + pub fn get_transaction_list( + &self, + account_index: U31, + skip: usize, + count: usize, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.get_transaction_list(account_index, skip, count), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_transaction_list(account_index, skip, count), + } + } + + pub fn get_transaction( + &self, + account_index: U31, + transaction_id: Id, + ) -> WalletResult<&TxData> { + match self { + RuntimeWallet::Software(w) => w.get_transaction(account_index, transaction_id), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_transaction(account_index, transaction_id), + } + } + + pub fn get_all_issued_addresses( + &self, + account_index: U31, + ) -> WalletResult>> { + match self { + RuntimeWallet::Software(w) => w.get_all_issued_addresses(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_all_issued_addresses(account_index), + } + } + + pub fn get_all_issued_vrf_public_keys( + &self, + account_index: U31, + ) -> WalletResult, bool)>> { + match self { + RuntimeWallet::Software(w) => w.get_all_issued_vrf_public_keys(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(_) => Err(WalletError::UnsupportedHardwareWalletOperation), + } + } + + pub fn get_legacy_vrf_public_key( + &self, + account_index: U31, + ) -> WalletResult> { + match self { + RuntimeWallet::Software(w) => w.get_legacy_vrf_public_key(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(_) => Err(WalletError::UnsupportedHardwareWalletOperation), + } + } + + pub fn get_addresses_usage(&self, account_index: U31) -> WalletResult<&KeychainUsageState> { + match self { + RuntimeWallet::Software(w) => w.get_addresses_usage(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_addresses_usage(account_index), + } + } + + pub fn get_all_standalone_addresses( + &self, + account_index: U31, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.get_all_standalone_addresses(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_all_standalone_addresses(account_index), + } + } + + pub fn get_all_standalone_address_details( + &self, + account_index: U31, + address: Destination, + ) -> WalletResult<( + Destination, + BTreeMap, + StandaloneAddressDetails, + )> { + match self { + RuntimeWallet::Software(w) => { + w.get_all_standalone_address_details(account_index, address) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => { + w.get_all_standalone_address_details(account_index, address) + } + } + } + + pub fn get_created_blocks( + &self, + account_index: U31, + ) -> WalletResult, PoolId)>> { + match self { + RuntimeWallet::Software(w) => w.get_created_blocks(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_created_blocks(account_index), + } + } + + pub fn find_used_tokens( + &self, + account_index: U31, + input_utxos: &[UtxoOutPoint], + ) -> WalletResult> { + match self { + RuntimeWallet::Software(w) => w.find_used_tokens(account_index, input_utxos), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.find_used_tokens(account_index, input_utxos), + } + } + + pub fn get_token_unconfirmed_info( + &self, + account_index: U31, + token_info: RPCFungibleTokenInfo, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.get_token_unconfirmed_info(account_index, token_info), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_token_unconfirmed_info(account_index, token_info), + } + } + + pub fn abandon_transaction( + &mut self, + account_index: U31, + tx_id: Id, + ) -> WalletResult<()> { + match self { + RuntimeWallet::Software(w) => w.abandon_transaction(account_index, tx_id), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.abandon_transaction(account_index, tx_id), + } + } + + pub fn standalone_address_label_rename( + &mut self, + account_index: U31, + address: Destination, + label: Option, + ) -> WalletResult<()> { + match self { + RuntimeWallet::Software(w) => { + w.standalone_address_label_rename(account_index, address, label) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => { + w.standalone_address_label_rename(account_index, address, label) + } + } + } + + pub fn add_standalone_address( + &mut self, + account_index: U31, + address: PublicKeyHash, + label: Option, + ) -> WalletResult<()> { + match self { + RuntimeWallet::Software(w) => w.add_standalone_address(account_index, address, label), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.add_standalone_address(account_index, address, label), + } + } + + pub fn add_standalone_private_key( + &mut self, + account_index: U31, + private_key: PrivateKey, + label: Option, + ) -> WalletResult<()> { + match self { + RuntimeWallet::Software(w) => { + w.add_standalone_private_key(account_index, private_key, label) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => { + w.add_standalone_private_key(account_index, private_key, label) + } + } + } + + pub fn add_standalone_multisig( + &mut self, + account_index: U31, + challenge: ClassicMultisigChallenge, + label: Option, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => { + w.add_standalone_multisig(account_index, challenge, label) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.add_standalone_multisig(account_index, challenge, label), + } + } + + pub fn get_new_address( + &mut self, + account_index: U31, + ) -> WalletResult<(ChildNumber, Address)> { + match self { + RuntimeWallet::Software(w) => w.get_new_address(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_new_address(account_index), + } + } + + pub fn find_public_key( + &mut self, + account_index: U31, + address: Destination, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.find_public_key(account_index, address), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.find_public_key(account_index, address), + } + } + + pub fn get_vrf_key( + &mut self, + account_index: U31, + ) -> WalletResult<(ChildNumber, Address)> { + match self { + RuntimeWallet::Software(w) => w.get_vrf_key(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(_) => Err(WalletError::UnsupportedHardwareWalletOperation), + } + } + + pub fn issue_new_token( + &mut self, + account_index: U31, + token_issuance: TokenIssuance, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> WalletResult<(TokenId, SignedTransaction)> { + match self { + RuntimeWallet::Software(w) => w.issue_new_token( + account_index, + token_issuance, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.issue_new_token( + account_index, + token_issuance, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn issue_new_nft( + &mut self, + account_index: U31, + address: Address, + metadata: Metadata, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> WalletResult<(TokenId, SignedTransaction)> { + match self { + RuntimeWallet::Software(w) => w.issue_new_nft( + account_index, + address, + metadata, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.issue_new_nft( + account_index, + address, + metadata, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn mint_tokens( + &mut self, + account_index: U31, + token_info: &UnconfirmedTokenInfo, + amount: Amount, + address: Address, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.mint_tokens( + account_index, + token_info, + amount, + address, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.mint_tokens( + account_index, + token_info, + amount, + address, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn unmint_tokens( + &mut self, + account_index: U31, + token_info: &UnconfirmedTokenInfo, + amount: Amount, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.unmint_tokens( + account_index, + token_info, + amount, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.unmint_tokens( + account_index, + token_info, + amount, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn lock_token_supply( + &mut self, + account_index: U31, + token_info: &UnconfirmedTokenInfo, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.lock_token_supply( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.lock_token_supply( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn freeze_token( + &mut self, + account_index: U31, + token_info: &UnconfirmedTokenInfo, + is_token_unfreezable: IsTokenUnfreezable, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.freeze_token( + account_index, + token_info, + is_token_unfreezable, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.freeze_token( + account_index, + token_info, + is_token_unfreezable, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn unfreeze_token( + &mut self, + account_index: U31, + token_info: &UnconfirmedTokenInfo, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.unfreeze_token( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.unfreeze_token( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn change_token_authority( + &mut self, + account_index: U31, + token_info: &UnconfirmedTokenInfo, + address: Address, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.change_token_authority( + account_index, + token_info, + address, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.change_token_authority( + account_index, + token_info, + address, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + #[allow(clippy::too_many_arguments)] + pub fn create_transaction_to_addresses( + &mut self, + account_index: U31, + outputs: impl IntoIterator, + inputs: SelectedInputs, + change_addresses: BTreeMap>, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_transaction_to_addresses( + account_index, + outputs, + inputs, + change_addresses, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_transaction_to_addresses( + account_index, + outputs, + inputs, + change_addresses, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + } + } + + pub fn create_sweep_transaction( + &mut self, + account_index: U31, + destination_address: Destination, + filtered_inputs: Vec<(UtxoOutPoint, TxOutput)>, + current_fee_rate: FeeRate, + additional_utxo_infos: BTreeMap, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_sweep_transaction( + account_index, + destination_address, + filtered_inputs, + current_fee_rate, + &additional_utxo_infos, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_sweep_transaction( + account_index, + destination_address, + filtered_inputs, + current_fee_rate, + &additional_utxo_infos, + ), + } + } + + pub fn get_delegation( + &self, + account_index: U31, + delegation_id: DelegationId, + ) -> WalletResult<&DelegationData> { + match self { + RuntimeWallet::Software(w) => w.get_delegation(account_index, delegation_id), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_delegation(account_index, delegation_id), + } + } + + pub fn create_sweep_from_delegation_transaction( + &mut self, + account_index: U31, + destination_address: Address, + delegation_id: DelegationId, + delegation_share: Amount, + current_fee_rate: FeeRate, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_sweep_from_delegation_transaction( + account_index, + destination_address, + delegation_id, + delegation_share, + current_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_sweep_from_delegation_transaction( + account_index, + destination_address, + delegation_id, + delegation_share, + current_fee_rate, + ), + } + } + + #[allow(clippy::too_many_arguments)] + pub fn create_unsigned_transaction_to_addresses( + &mut self, + account_index: U31, + outputs: impl IntoIterator, + selected_inputs: SelectedInputs, + selection_algo: Option, + change_addresses: BTreeMap>, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { + match self { + RuntimeWallet::Software(w) => w.create_unsigned_transaction_to_addresses( + account_index, + outputs, + selected_inputs, + selection_algo, + change_addresses, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_unsigned_transaction_to_addresses( + account_index, + outputs, + selected_inputs, + selection_algo, + change_addresses, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn create_delegation( + &mut self, + account_index: U31, + output: TxOutput, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> WalletResult<(DelegationId, SignedTransaction)> { + match self { + RuntimeWallet::Software(w) => w.create_delegation( + account_index, + vec![output], + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_delegation( + account_index, + vec![output], + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn create_transaction_to_addresses_from_delegation( + &mut self, + account_index: U31, + address: Address, + amount: Amount, + delegation_id: DelegationId, + delegation_share: Amount, + current_fee_rate: FeeRate, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_transaction_to_addresses_from_delegation( + account_index, + address, + amount, + delegation_id, + delegation_share, + current_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_transaction_to_addresses_from_delegation( + account_index, + address, + amount, + delegation_id, + delegation_share, + current_fee_rate, + ), + } + } + + pub fn create_stake_pool_tx( + &mut self, + account_index: U31, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + stake_pool_arguments: StakePoolDataArguments, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_stake_pool_tx( + account_index, + current_fee_rate, + consolidate_fee_rate, + stake_pool_arguments, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(_) => Err(WalletError::UnsupportedHardwareWalletOperation), + } + } + + pub fn decommission_stake_pool( + &mut self, + account_index: U31, + pool_id: PoolId, + staker_balance: Amount, + output_address: Option, + current_fee_rate: FeeRate, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.decommission_stake_pool( + account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.decommission_stake_pool( + account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ), + } + } + + pub fn decommission_stake_pool_request( + &mut self, + account_index: U31, + pool_id: PoolId, + staker_balance: Amount, + output_address: Option, + current_fee_rate: FeeRate, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.decommission_stake_pool_request( + account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.decommission_stake_pool_request( + account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ), + } + } + + pub fn create_htlc_tx( + &mut self, + account_index: U31, + output_value: OutputValue, + htlc: HashedTimelockContract, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_htlc_tx( + account_index, + output_value, + htlc, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_htlc_tx( + account_index, + output_value, + htlc, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + + pub fn sign_raw_transaction( + &mut self, + account_index: U31, + ptx: PartiallySignedTransaction, + ) -> WalletResult<( + PartiallySignedTransaction, + Vec, + Vec, + )> { + match self { + RuntimeWallet::Software(w) => w.sign_raw_transaction(account_index, ptx), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.sign_raw_transaction(account_index, ptx), + } + } + + pub fn sign_challenge( + &mut self, + account_index: U31, + challenge: Vec, + destination: Destination, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.sign_challenge(account_index, challenge, destination), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.sign_challenge(account_index, challenge, destination), + } + } + + pub fn add_unconfirmed_tx( + &mut self, + tx: SignedTransaction, + wallet_events: &impl WalletEvents, + ) -> WalletResult<()> { + match self { + RuntimeWallet::Software(w) => w.add_unconfirmed_tx(tx, wallet_events), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.add_unconfirmed_tx(tx, wallet_events), + } + } + + pub fn add_account_unconfirmed_tx( + &mut self, + account_index: U31, + tx: &SignedTransaction, + wallet_events: &impl WalletEvents, + ) -> WalletResult<()> { + match self { + RuntimeWallet::Software(w) => { + w.add_account_unconfirmed_tx(account_index, tx.clone(), wallet_events) + } + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => { + w.add_account_unconfirmed_tx(account_index, tx.clone(), wallet_events) + } + } + } +} diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 9756c0994a..a538b8f625 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -67,12 +67,13 @@ use wallet_types::{ use crate::{ helpers::{fetch_token_info, fetch_utxo, into_balances, tx_to_partially_signed_tx}, + runtime_wallet::RuntimeWallet, types::{Balances, GenericCurrencyTransfer}, - ControllerConfig, ControllerError, WalletType2, + ControllerConfig, ControllerError, }; pub struct SyncedController<'a, T, W, B: storage::Backend + 'static> { - wallet: &'a mut WalletType2, + wallet: &'a mut RuntimeWallet, rpc_client: T, chain_config: &'a ChainConfig, wallet_events: &'a W, @@ -88,7 +89,7 @@ where W: WalletEvents, { pub fn new( - wallet: &'a mut WalletType2, + wallet: &'a mut RuntimeWallet, rpc_client: T, chain_config: &'a ChainConfig, wallet_events: &'a W, @@ -123,12 +124,10 @@ where &self, input_utxos: &[UtxoOutPoint], ) -> Result<(), ControllerError> { - let token_ids = match &self.wallet { - WalletType2::Software(w) => w.find_used_tokens(self.account_index, input_utxos), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.find_used_tokens(self.account_index, input_utxos), - } - .map_err(ControllerError::WalletError)?; + let token_ids = self + .wallet + .find_used_tokens(self.account_index, input_utxos) + .map_err(ControllerError::WalletError)?; for token_info in self.fetch_token_infos(token_ids).await? { match token_info { @@ -145,16 +144,11 @@ where &self, token_info: RPCFungibleTokenInfo, ) -> Result<(), ControllerError> { - match &self.wallet { - WalletType2::Software(w) => { - w.get_token_unconfirmed_info(self.account_index, token_info) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_token_unconfirmed_info(self.account_index, token_info), - } - .map_err(ControllerError::WalletError)? - .check_can_be_used() - .map_err(ControllerError::WalletError)?; + self.wallet + .get_token_unconfirmed_info(self.account_index, token_info) + .map_err(ControllerError::WalletError)? + .check_can_be_used() + .map_err(ControllerError::WalletError)?; Ok(()) } @@ -183,20 +177,15 @@ where |all_ok, token_info| -> Result> { let all_ok = all_ok && match &token_info { - RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { - WalletType2::Software(w) => w.get_token_unconfirmed_info( + RPCTokenInfo::FungibleToken(token_info) => self + .wallet + .get_token_unconfirmed_info( self.account_index, token_info.clone(), - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_token_unconfirmed_info( - self.account_index, - token_info.clone(), - ), - } - .map_err(ControllerError::WalletError)? - .check_can_be_used() - .is_ok(), + ) + .map_err(ControllerError::WalletError)? + .check_can_be_used() + .is_ok(), RPCTokenInfo::NonFungibleToken(_) => true, }; Ok(all_ok) @@ -225,12 +214,9 @@ where &mut self, tx_id: Id, ) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.abandon_transaction(self.account_index, tx_id), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.abandon_transaction(self.account_index, tx_id), - } - .map_err(ControllerError::WalletError) + self.wallet + .abandon_transaction(self.account_index, tx_id) + .map_err(ControllerError::WalletError) } pub fn standalone_address_label_rename( @@ -238,16 +224,9 @@ where address: Destination, label: Option, ) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => { - w.standalone_address_label_rename(self.account_index, address, label) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.standalone_address_label_rename(self.account_index, address, label) - } - } - .map_err(ControllerError::WalletError) + self.wallet + .standalone_address_label_rename(self.account_index, address, label) + .map_err(ControllerError::WalletError) } pub fn add_standalone_address( @@ -255,14 +234,9 @@ where address: PublicKeyHash, label: Option, ) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => { - w.add_standalone_address(self.account_index, address, label) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.add_standalone_address(self.account_index, address, label), - } - .map_err(ControllerError::WalletError) + self.wallet + .add_standalone_address(self.account_index, address, label) + .map_err(ControllerError::WalletError) } pub fn add_standalone_private_key( @@ -270,16 +244,9 @@ where private_key: PrivateKey, label: Option, ) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => { - w.add_standalone_private_key(self.account_index, private_key, label) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.add_standalone_private_key(self.account_index, private_key, label) - } - } - .map_err(ControllerError::WalletError) + self.wallet + .add_standalone_private_key(self.account_index, private_key, label) + .map_err(ControllerError::WalletError) } pub fn add_standalone_multisig( @@ -287,51 +254,34 @@ where challenge: ClassicMultisigChallenge, label: Option, ) -> Result> { - match &mut self.wallet { - WalletType2::Software(w) => { - w.add_standalone_multisig(self.account_index, challenge, label) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.add_standalone_multisig(self.account_index, challenge, label) - } - } - .map_err(ControllerError::WalletError) + self.wallet + .add_standalone_multisig(self.account_index, challenge, label) + .map_err(ControllerError::WalletError) } pub fn new_address( &mut self, ) -> Result<(ChildNumber, Address), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.get_new_address(self.account_index), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_new_address(self.account_index), - } - .map_err(ControllerError::WalletError) + self.wallet + .get_new_address(self.account_index) + .map_err(ControllerError::WalletError) } pub fn find_public_key( &mut self, address: Destination, ) -> Result> { - match &mut self.wallet { - WalletType2::Software(w) => w.find_public_key(self.account_index, address), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.find_public_key(self.account_index, address), - } - .map_err(ControllerError::WalletError) + self.wallet + .find_public_key(self.account_index, address) + .map_err(ControllerError::WalletError) } pub fn new_vrf_key( &mut self, ) -> Result<(ChildNumber, Address), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => { - w.get_vrf_key(self.account_index).map_err(ControllerError::WalletError) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(_) => Err(ControllerError::UnsupportedHardwareWalletOperation), - } + self.wallet + .get_vrf_key(self.account_index) + .map_err(ControllerError::WalletError) } pub async fn issue_new_token( @@ -346,37 +296,21 @@ where self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.issue_new_token( - account_index, - TokenIssuance::V1(TokenIssuanceV1 { - token_ticker, - number_of_decimals, - metadata_uri, - total_supply: token_total_supply, - authority: address.into_object(), - is_freezable, - }), - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.issue_new_token( - account_index, - TokenIssuance::V1(TokenIssuanceV1 { - token_ticker, - number_of_decimals, - metadata_uri, - total_supply: token_total_supply, - authority: address.into_object(), - is_freezable, - }), - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.issue_new_token( + account_index, + TokenIssuance::V1(TokenIssuanceV1 { + token_ticker, + number_of_decimals, + metadata_uri, + total_supply: token_total_supply, + authority: address.into_object(), + is_freezable, + }), + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -390,25 +324,15 @@ where self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.issue_new_nft( - account_index, - address, - metadata, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.issue_new_nft( - account_index, - address, - metadata, - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.issue_new_nft( + account_index, + address, + metadata, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -424,29 +348,18 @@ where token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - match wallet { - WalletType2::Software(w) => w.mint_tokens( - account_index, - token_info, - amount, - address, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.mint_tokens( - account_index, - token_info, - amount, - address, - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.mint_tokens( + account_index, + token_info, + amount, + address, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -460,27 +373,17 @@ where token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - match wallet { - WalletType2::Software(w) => w.unmint_tokens( - account_index, - token_info, - amount, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.unmint_tokens( - account_index, - token_info, - amount, - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.unmint_tokens( + account_index, + token_info, + amount, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -494,25 +397,16 @@ where token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - match wallet { - WalletType2::Software(w) => w.lock_token_supply( - account_index, - token_info, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.lock_token_supply( - account_index, - token_info, - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.lock_token_supply( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -529,26 +423,16 @@ where token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { - match wallet { - WalletType2::Software(w) => w.freeze_token( - account_index, - token_info, - is_token_unfreezable, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.freeze_token( - account_index, - token_info, - is_token_unfreezable, - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.freeze_token( + account_index, + token_info, + is_token_unfreezable, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -563,24 +447,15 @@ where token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { - match wallet { - WalletType2::Software(w) => w.unfreeze_token( - account_index, - token_info, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.unfreeze_token( - account_index, - token_info, - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.unfreeze_token( + account_index, + token_info, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -597,26 +472,16 @@ where token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { - match wallet { - WalletType2::Software(w) => w.change_token_authority( - account_index, - token_info, - address, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.change_token_authority( - account_index, - token_info, - address, - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.change_token_authority( + account_index, + token_info, + address, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -656,29 +521,17 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.create_transaction_to_addresses( - account_index, - outputs, - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &BTreeMap::new(), - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_transaction_to_addresses( - account_index, - outputs, - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &BTreeMap::new(), - ), - } + wallet.create_transaction_to_addresses( + account_index, + outputs, + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + &BTreeMap::new(), + ) }, ) .await @@ -700,29 +553,17 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(selected_utxos), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &BTreeMap::new(), - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(selected_utxos), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &BTreeMap::new(), - ), - } + wallet.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(selected_utxos), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + &BTreeMap::new(), + ) }, ) .await @@ -735,22 +576,12 @@ where destination_address: Destination, from_addresses: BTreeSet, ) -> Result> { - let selected_utxos = match &self.wallet { - WalletType2::Software(w) => w.get_utxos( - self.account_index, - UtxoType::Transfer | UtxoType::LockThenTransfer | UtxoType::IssueNft, - UtxoState::Confirmed | UtxoState::Inactive, - WithLocked::Unlocked, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_utxos( - self.account_index, - UtxoType::Transfer | UtxoType::LockThenTransfer | UtxoType::IssueNft, - UtxoState::Confirmed | UtxoState::Inactive, - WithLocked::Unlocked, - ), - } - .map_err(ControllerError::WalletError)?; + let selected_utxos = self.wallet.get_utxos( + self.account_index, + UtxoType::Transfer | UtxoType::LockThenTransfer | UtxoType::IssueNft, + UtxoState::Confirmed | UtxoState::Inactive, + WithLocked::Unlocked, + )?; let (inputs, additional_utxo_infos) = self.filter_out_utxos_with_frozen_tokens(selected_utxos).await?; @@ -766,25 +597,15 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.create_sweep_transaction( - account_index, - destination_address, - filtered_inputs, - current_fee_rate, - &additional_utxo_infos, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_sweep_transaction( - account_index, - destination_address, - filtered_inputs, - current_fee_rate, - &additional_utxo_infos, - ), - } + wallet.create_sweep_transaction( + account_index, + destination_address, + filtered_inputs, + current_fee_rate, + additional_utxo_infos, + ) }, ) .await @@ -797,13 +618,11 @@ where destination_address: Address, delegation_id: DelegationId, ) -> Result> { - let pool_id = match &self.wallet { - WalletType2::Software(w) => w.get_delegation(self.account_index, delegation_id), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_delegation(self.account_index, delegation_id), - } - .map_err(ControllerError::WalletError)? - .pool_id; + let pool_id = self + .wallet + .get_delegation(self.account_index, delegation_id) + .map_err(ControllerError::WalletError)? + .pool_id; let delegation_share = self .rpc_client @@ -817,25 +636,15 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.create_sweep_from_delegation_transaction( - account_index, - destination_address, - delegation_id, - delegation_share, - current_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_sweep_from_delegation_transaction( - account_index, - destination_address, - delegation_id, - delegation_share, - current_fee_rate, - ), - } + wallet.create_sweep_from_delegation_transaction( + account_index, + destination_address, + delegation_id, + delegation_share, + current_fee_rate, + ) }, ) .await @@ -874,8 +683,9 @@ where let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; - let (req, fees) = match &mut self.wallet { - WalletType2::Software(w) => w.create_unsigned_transaction_to_addresses( + let (req, fees) = self + .wallet + .create_unsigned_transaction_to_addresses( self.account_index, [output], selected_inputs, @@ -883,19 +693,8 @@ where [(Currency::Coin, change_address)].into(), current_fee_rate, consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_unsigned_transaction_to_addresses( - self.account_index, - [output], - selected_inputs, - None, - [(Currency::Coin, change_address)].into(), - current_fee_rate, - consolidate_fee_rate, - ), - } - .map_err(ControllerError::WalletError)?; + ) + .map_err(ControllerError::WalletError)?; let fees = into_balances(&self.rpc_client, self.chain_config, fees).await?; @@ -966,22 +765,12 @@ where let mut inputs = inputs; let mut change_addresses = change_addresses; - let all_utxos = match &self.wallet { - WalletType2::Software(w) => w.get_utxos( - self.account_index, - UtxoType::Transfer | UtxoType::LockThenTransfer, - UtxoState::Confirmed | UtxoState::InMempool | UtxoState::Inactive, - WithLocked::Unlocked, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_utxos( - self.account_index, - UtxoType::Transfer | UtxoType::LockThenTransfer, - UtxoState::Confirmed | UtxoState::InMempool | UtxoState::Inactive, - WithLocked::Unlocked, - ), - } - .map_err(ControllerError::WalletError)?; + let all_utxos = self.wallet.get_utxos( + self.account_index, + UtxoType::Transfer | UtxoType::LockThenTransfer, + UtxoState::Confirmed | UtxoState::InMempool | UtxoState::Inactive, + WithLocked::Unlocked, + )?; let all_coin_utxos = all_utxos .into_iter() @@ -1039,28 +828,15 @@ where let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; - let (tx, fees) = match &mut self.wallet { - WalletType2::Software(w) => w.create_unsigned_transaction_to_addresses( - self.account_index, - outputs, - selected_inputs, - Some(CoinSelectionAlgo::Randomize), - change_addresses, - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_unsigned_transaction_to_addresses( - self.account_index, - outputs, - selected_inputs, - Some(CoinSelectionAlgo::Randomize), - change_addresses, - current_fee_rate, - consolidate_fee_rate, - ), - } - .map_err(ControllerError::WalletError)?; + let (tx, fees) = self.wallet.create_unsigned_transaction_to_addresses( + self.account_index, + outputs, + selected_inputs, + Some(CoinSelectionAlgo::Randomize), + change_addresses, + current_fee_rate, + consolidate_fee_rate, + )?; let fees = into_balances(&self.rpc_client, self.chain_config, fees).await?; @@ -1079,23 +855,14 @@ where self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.create_delegation( - account_index, - vec![output], - current_fee_rate, - consolidate_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_delegation( - account_index, - vec![output], - current_fee_rate, - consolidate_fee_rate, - ), - } + wallet.create_delegation( + account_index, + output, + current_fee_rate, + consolidate_fee_rate, + ) }, ) .await @@ -1112,29 +879,17 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &BTreeMap::new(), - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &BTreeMap::new(), - ), - } + wallet.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + &BTreeMap::new(), + ) }, ) .await @@ -1148,13 +903,7 @@ where amount: Amount, delegation_id: DelegationId, ) -> Result> { - let pool_id = match &self.wallet { - WalletType2::Software(w) => w.get_delegation(self.account_index, delegation_id), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_delegation(self.account_index, delegation_id), - } - .map_err(ControllerError::WalletError)? - .pool_id; + let pool_id = self.wallet.get_delegation(self.account_index, delegation_id)?.pool_id; let delegation_share = self .rpc_client @@ -1168,27 +917,16 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.create_transaction_to_addresses_from_delegation( - account_index, - address, - amount, - delegation_id, - delegation_share, - current_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_transaction_to_addresses_from_delegation( - account_index, - address, - amount, - delegation_id, - delegation_share, - current_fee_rate, - ), - } + wallet.create_transaction_to_addresses_from_delegation( + account_index, + address, + amount, + delegation_id, + delegation_share, + current_fee_rate, + ) }, ) .await @@ -1207,7 +945,7 @@ where token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; @@ -1218,27 +956,15 @@ where ticker: token_info.token_ticker().to_vec(), }), )]); - match wallet { - WalletType2::Software(w) => w.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &additional_info, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_transaction_to_addresses( - account_index, - [output], - SelectedInputs::Utxos(vec![]), - BTreeMap::new(), - current_fee_rate, - consolidate_fee_rate, - &additional_info, - ), - } + wallet.create_transaction_to_addresses( + account_index, + [output], + SelectedInputs::Utxos(vec![]), + BTreeMap::new(), + current_fee_rate, + consolidate_fee_rate, + &additional_info, + ) }, ) .await @@ -1286,27 +1012,19 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w - .create_stake_pool_tx( - account_index, - current_fee_rate, - consolidate_fee_rate, - StakePoolDataArguments { - amount, - margin_ratio_per_thousand, - cost_per_block, - decommission_key, - }, - ) - .map_err(ControllerError::WalletError), - #[cfg(feature = "trezor")] - WalletType2::Trezor(_) => { - Err(ControllerError::UnsupportedHardwareWalletOperation) - } - } + wallet.create_stake_pool_tx( + account_index, + current_fee_rate, + consolidate_fee_rate, + StakePoolDataArguments { + amount, + margin_ratio_per_thousand, + cost_per_block, + decommission_key, + }, + ) }, ) .await @@ -1330,25 +1048,15 @@ where self.create_and_send_tx( move |current_fee_rate: FeeRate, _consolidate_fee_rate: FeeRate, - wallet: &mut WalletType2, + wallet: &mut RuntimeWallet, account_index: U31| { - match wallet { - WalletType2::Software(w) => w.decommission_stake_pool( - account_index, - pool_id, - staker_balance, - output_address, - current_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.decommission_stake_pool( - account_index, - pool_id, - staker_balance, - output_address, - current_fee_rate, - ), - } + wallet.decommission_stake_pool( + account_index, + pool_id, + staker_balance, + output_address, + current_fee_rate, + ) }, ) .await @@ -1371,24 +1079,15 @@ where let (current_fee_rate, _) = self.get_current_and_consolidation_fee_rate().await?; - match &mut self.wallet { - WalletType2::Software(w) => w.decommission_stake_pool_request( - self.account_index, - pool_id, - staker_balance, - output_address, - current_fee_rate, - ), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.decommission_stake_pool_request( + self.wallet + .decommission_stake_pool_request( self.account_index, pool_id, staker_balance, output_address, current_fee_rate, - ), - } - .map_err(ControllerError::WalletError) + ) + .map_err(ControllerError::WalletError) } pub async fn create_htlc_tx( @@ -1399,23 +1098,13 @@ where let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; - let result = match self.wallet { - WalletType2::Software(w) => w.create_htlc_tx( - self.account_index, - output_value, - htlc, - current_fee_rate, - consolidate_fee_rate, - )?, - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.create_htlc_tx( - self.account_index, - output_value, - htlc, - current_fee_rate, - consolidate_fee_rate, - )?, - }; + let result = self.wallet.create_htlc_tx( + self.account_index, + output_value, + htlc, + current_fee_rate, + consolidate_fee_rate, + )?; Ok(result) } @@ -1495,23 +1184,9 @@ where /// Checks if the wallet has stake pools and marks this account for staking. pub fn start_staking(&mut self) -> Result<(), ControllerError> { - utils::ensure!( - !match &self.wallet { - WalletType2::Software(w) => w.is_locked(), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.is_locked(), - }, - ControllerError::WalletIsLocked - ); + utils::ensure!(!self.wallet.is_locked(), ControllerError::WalletIsLocked); // Make sure that account_index is valid and that pools exist - let pool_ids = match &mut self.wallet { - WalletType2::Software(w) => { - w.get_pool_ids(self.account_index, WalletPoolsFilter::Stake) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.get_pool_ids(self.account_index, WalletPoolsFilter::Stake), - } - .map_err(ControllerError::WalletError)?; + let pool_ids = self.wallet.get_pool_ids(self.account_index, WalletPoolsFilter::Stake)?; utils::ensure!(!pool_ids.is_empty(), ControllerError::NoStakingPool); log::info!("Start staking, account_index: {}", self.account_index); self.staking_started.insert(self.account_index); @@ -1538,12 +1213,9 @@ where } }; - match &mut self.wallet { - WalletType2::Software(w) => w.sign_raw_transaction(self.account_index, ptx), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.sign_raw_transaction(self.account_index, ptx), - } - .map_err(ControllerError::WalletError) + self.wallet + .sign_raw_transaction(self.account_index, ptx) + .map_err(ControllerError::WalletError) } pub fn sign_challenge( @@ -1551,23 +1223,15 @@ where challenge: &[u8], destination: &Destination, ) -> Result> { - match &mut self.wallet { - WalletType2::Software(w) => { - w.sign_challenge(self.account_index, challenge, destination) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.sign_challenge(self.account_index, challenge, destination), - } - .map_err(ControllerError::WalletError) + self.wallet + .sign_challenge(self.account_index, challenge, destination) + .map_err(ControllerError::WalletError) } pub fn add_unconfirmed_tx(&mut self, tx: SignedTransaction) -> Result<(), ControllerError> { - match &mut self.wallet { - WalletType2::Software(w) => w.add_unconfirmed_tx(tx, self.wallet_events), - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => w.add_unconfirmed_tx(tx, self.wallet_events), - } - .map_err(ControllerError::WalletError) + self.wallet + .add_unconfirmed_tx(tx, self.wallet_events) + .map_err(ControllerError::WalletError) } async fn get_current_and_consolidation_fee_rate( @@ -1588,16 +1252,9 @@ where &mut self, tx: SignedTransaction, ) -> Result> { - match &mut self.wallet { - WalletType2::Software(w) => { - w.add_account_unconfirmed_tx(self.account_index, tx.clone(), self.wallet_events) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.add_account_unconfirmed_tx(self.account_index, tx.clone(), self.wallet_events) - } - } - .map_err(ControllerError::WalletError)?; + self.wallet + .add_account_unconfirmed_tx(self.account_index, &tx, self.wallet_events) + .map_err(ControllerError::WalletError)?; self.rpc_client .submit_transaction(tx.clone(), Default::default()) @@ -1626,7 +1283,7 @@ where tx_maker: F, ) -> Result> where - F: FnOnce(FeeRate, FeeRate, &mut WalletType2, U31) -> Result, + F: FnOnce(FeeRate, FeeRate, &mut RuntimeWallet, U31) -> Result, ControllerError: From, { let (current_fee_rate, consolidate_fee_rate) = @@ -1652,23 +1309,16 @@ where F: FnOnce( FeeRate, FeeRate, - &mut WalletType2, + &mut RuntimeWallet, U31, &UnconfirmedTokenInfo, ) -> WalletResult, { // make sure we can use the token before create an tx using it let token_freezable_info = match token_info { - RPCTokenInfo::FungibleToken(token_info) => match &self.wallet { - WalletType2::Software(w) => { - w.get_token_unconfirmed_info(self.account_index, token_info) - } - #[cfg(feature = "trezor")] - WalletType2::Trezor(w) => { - w.get_token_unconfirmed_info(self.account_index, token_info) - } + RPCTokenInfo::FungibleToken(token_info) => { + self.wallet.get_token_unconfirmed_info(self.account_index, token_info)? } - .map_err(ControllerError::WalletError)?, RPCTokenInfo::NonFungibleToken(info) => { UnconfirmedTokenInfo::NonFungibleToken(info.token_id, info.as_ref().into()) } @@ -1712,7 +1362,12 @@ where /// e.g. newly issued token, nft or delegation id async fn create_and_send_tx_with_id< ID, - F: FnOnce(FeeRate, FeeRate, &mut WalletType2, U31) -> WalletResult<(ID, SignedTransaction)>, + F: FnOnce( + FeeRate, + FeeRate, + &mut RuntimeWallet, + U31, + ) -> WalletResult<(ID, SignedTransaction)>, >( &mut self, tx_maker: F, From d00d161e05ead3366a48d19b21a7a425369d9bc5 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Sun, 1 Sep 2024 01:05:34 +0200 Subject: [PATCH 32/48] fix functional tests --- test/functional/test_framework/__init__.py | 28 ++++++++++++++++++- test/functional/wallet_htlc_refund.py | 14 ++++++---- wallet/src/account/mod.rs | 8 ++++-- wallet/src/wallet/mod.rs | 9 ++++-- wallet/src/wallet/tests.rs | 3 ++ .../wallet-controller/src/runtime_wallet.rs | 6 ++++ .../src/synced_controller.rs | 16 +++++++++-- wallet/wallet-rpc-lib/src/rpc/mod.rs | 21 ++++++++++++-- 8 files changed, 88 insertions(+), 17 deletions(-) diff --git a/test/functional/test_framework/__init__.py b/test/functional/test_framework/__init__.py index 15a2934604..674e1210b4 100644 --- a/test/functional/test_framework/__init__.py +++ b/test/functional/test_framework/__init__.py @@ -198,6 +198,31 @@ def init_mintlayer_types(): ], }, + "TokenAdditionalInfo": { + "type": "struct", + "type_mapping": [ + ["num_decimals", "u8"], + ["ticker", "Vec"], + ] + }, + + "UtxoAdditionalInfo": { + "type": "enum", + "type_mapping": [ + ["TokenInfo", "TokenAdditionalInfo"], + ["PoolInfo", "(Amount)"], + ["AnyoneCanTake", ""], # TODO + ], + }, + + "UtxoWithAdditionalInfo": { + "type": "struct", + "type_mapping": [ + ["utxo", "TxOutput"], + ["additional_info", "Option"], + ] + }, + "StandardInputSignature": { "type": "struct", "type_mapping": [ @@ -219,9 +244,10 @@ def init_mintlayer_types(): "type_mapping": [ ["tx", "TransactionV1"], ["witnesses", "Vec>"], - ["input_utxos", "Vec>"], + ["input_utxos", "Vec>"], ["destinations", "Vec>"], ["htlc_secrets", "Vec>"], + ["output_additional_infos", "Vec>"], ] }, diff --git a/test/functional/wallet_htlc_refund.py b/test/functional/wallet_htlc_refund.py index 9c8931fb31..8cf4309d71 100644 --- a/test/functional/wallet_htlc_refund.py +++ b/test/functional/wallet_htlc_refund.py @@ -132,7 +132,9 @@ async def async_test(self): assert_not_in("Tokens", balance) # issue a valid token - token_id, _ = (await wallet.issue_new_token("XXXX", 2, "http://uri", alice_address)) + token_ticker = "XXXX" + token_number_of_decimals = 2 + token_id, _ = (await wallet.issue_new_token(token_ticker, token_number_of_decimals, "http://uri", alice_address)) assert token_id is not None self.log.info(f"new token id: {token_id}") token_id_hex = node.test_functions_reveal_token_id(token_id) @@ -182,9 +184,10 @@ async def async_test(self): alice_refund_ptx = { 'tx': tx['transaction'], 'witnesses': [None, None], - 'input_utxos': alice_htlc_outputs, + 'input_utxos': [{'utxo': out, 'additional_info': None} for out in alice_htlc_outputs], 'destinations': [refund_dest_obj, alice_htlc_change_dest], - 'htlc_secrets': [None, None] + 'htlc_secrets': [None, None], + 'output_additional_infos': [None] } alice_refund_tx_hex = scalecodec.base.RuntimeConfiguration().create_scale_object('PartiallySignedTransaction').encode(alice_refund_ptx).to_hex()[2:] @@ -210,9 +213,10 @@ async def async_test(self): bob_refund_ptx = { 'tx': tx['transaction'], 'witnesses': [None, None], - 'input_utxos': bob_htlc_outputs, + 'input_utxos': [{'utxo': out, 'additional_info': None} for out in bob_htlc_outputs], 'destinations': [refund_dest_obj, bob_htlc_change_dest], - 'htlc_secrets': [None, None] + 'htlc_secrets': [None, None], + 'output_additional_infos': [None] } bob_refund_tx_hex = scalecodec.base.RuntimeConfiguration().create_scale_object('PartiallySignedTransaction').encode(bob_refund_ptx).to_hex()[2:] diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index fa861c3ab6..0b8254d613 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -38,7 +38,7 @@ use utils::ensure; pub use utxo_selector::UtxoSelectorError; use wallet_types::account_id::AccountPrefixedId; use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; -use wallet_types::partially_signed_transaction::PartiallySignedTransaction; +use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; use wallet_types::with_locked::WithLocked; use crate::account::utxo_selector::{select_coins, OutputGroup}; @@ -47,7 +47,8 @@ use crate::key_chain::{AccountKeyChains, KeyChainError, VRFAccountKeyChains}; use crate::send_request::{ make_address_output, make_address_output_from_delegation, make_address_output_token, make_decommission_stake_pool_output, make_mint_token_outputs, make_stake_output, - make_unmint_token_outputs, IssueNftArguments, SelectedInputs, StakePoolDataArguments, + make_unmint_token_outputs, IssueNftArguments, PoolOrTokenId, SelectedInputs, + StakePoolDataArguments, }; use crate::wallet::WalletPoolsFilter; use crate::wallet_events::{WalletEvents, WalletEventsNoOp}; @@ -632,6 +633,7 @@ impl Account { change_addresses: BTreeMap>, median_time: BlockTimestamp, fee_rate: CurrentFeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { let mut request = self.select_inputs_for_send_request( request, @@ -645,7 +647,7 @@ impl Account { )?; let fees = request.get_fees(); - let ptx = request.into_partially_signed_tx(&BTreeMap::new())?; + let ptx = request.into_partially_signed_tx(additional_utxo_infos)?; Ok((ptx, fees)) } diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 04d1c624cb..ad21ea29f6 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -1527,6 +1527,7 @@ where change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { let request = SendRequest::new().with_outputs(outputs); let latest_median_time = self.latest_median_time; @@ -1542,6 +1543,7 @@ where current_fee_rate, consolidate_fee_rate, }, + additional_utxo_infos, ) }) } @@ -1776,10 +1778,10 @@ where let latest_median_time = self.latest_median_time; let additional_utxo_infos = BTreeMap::from_iter([( PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo { + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), - }, + }), )]); self.for_account_rw_unlocked_and_check_tx( account_index, @@ -1972,11 +1974,12 @@ where htlc: HashedTimelockContract, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - &BTreeMap::new(), + additional_utxo_infos, |account, db_tx| { account.create_htlc_tx( db_tx, diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index dbcb0a8ee6..893e4e7621 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -4653,6 +4653,7 @@ fn sign_send_request_cold_wallet(#[case] seed: Seed) { [(Currency::Coin, cold_wallet_address.clone())].into(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); @@ -4990,6 +4991,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { htlc.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); let create_htlc_tx_id = create_htlc_tx.transaction().get_id(); @@ -5135,6 +5137,7 @@ fn create_htlc_and_refund(#[case] seed: Seed) { htlc.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &BTreeMap::new(), ) .unwrap(); let create_htlc_tx_id = create_htlc_tx.transaction().get_id(); diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs index 406cb0471f..fa0bed8d24 100644 --- a/wallet/wallet-controller/src/runtime_wallet.rs +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -850,6 +850,7 @@ impl RuntimeWallet { change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { match self { RuntimeWallet::Software(w) => w.create_unsigned_transaction_to_addresses( @@ -860,6 +861,7 @@ impl RuntimeWallet { change_addresses, current_fee_rate, consolidate_fee_rate, + additional_utxo_infos, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_unsigned_transaction_to_addresses( @@ -870,6 +872,7 @@ impl RuntimeWallet { change_addresses, current_fee_rate, consolidate_fee_rate, + additional_utxo_infos, ), } } @@ -1008,6 +1011,7 @@ impl RuntimeWallet { htlc: HashedTimelockContract, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_htlc_tx( @@ -1016,6 +1020,7 @@ impl RuntimeWallet { htlc, current_fee_rate, consolidate_fee_rate, + additional_utxo_infos, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_htlc_tx( @@ -1024,6 +1029,7 @@ impl RuntimeWallet { htlc, current_fee_rate, consolidate_fee_rate, + additional_utxo_infos, ), } } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index a538b8f625..7a4e884774 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -693,6 +693,7 @@ where [(Currency::Coin, change_address)].into(), current_fee_rate, consolidate_fee_rate, + &BTreeMap::new(), ) .map_err(ControllerError::WalletError)?; @@ -736,11 +737,19 @@ where ControllerError::::ExpectingNonEmptyOutputs ); - let outputs = { + let (outputs, additional_utxo_infos) = { let mut result = Vec::new(); + let mut additional_utxo_infos = BTreeMap::new(); for (token_id, outputs_vec) in outputs { let token_info = fetch_token_info(&self.rpc_client, token_id).await?; + additional_utxo_infos.insert( + PoolOrTokenId::TokenId(token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: token_info.token_number_of_decimals(), + ticker: token_info.token_ticker().to_vec(), + }), + ); match &token_info { RPCTokenInfo::FungibleToken(token_info) => { @@ -758,7 +767,7 @@ where .map_err(ControllerError::InvalidTxOutput)?; } - result + (result, additional_utxo_infos) }; let (inputs, change_addresses) = { @@ -836,6 +845,7 @@ where change_addresses, current_fee_rate, consolidate_fee_rate, + &additional_utxo_infos, )?; let fees = into_balances(&self.rpc_client, self.chain_config, fees).await?; @@ -1094,6 +1104,7 @@ where &mut self, output_value: OutputValue, htlc: HashedTimelockContract, + additional_utxo_infos: &BTreeMap, ) -> Result> { let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; @@ -1104,6 +1115,7 @@ where htlc, current_fee_rate, consolidate_fee_rate, + additional_utxo_infos, )?; Ok(result) } diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index edf1607cd4..4449a361c4 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -39,6 +39,7 @@ use utils::{ensure, shallow_clone::ShallowClone}; use utils_networking::IpOrSocketAddress; use wallet::{ account::{transaction_list::TransactionList, PoolData, TransactionToSign, TxInfo}, + send_request::PoolOrTokenId, WalletError, }; @@ -75,8 +76,14 @@ use wallet_controller::{ }; use wallet_types::{ account_info::StandaloneAddressDetails, - partially_signed_transaction::PartiallySignedTransaction, seed_phrase::StoreSeedPhrase, - signature_status::SignatureStatus, wallet_tx::TxData, with_locked::WithLocked, Currency, + partially_signed_transaction::{ + PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, + }, + seed_phrase::StoreSeedPhrase, + signature_status::SignatureStatus, + wallet_tx::TxData, + with_locked::WithLocked, + Currency, }; use crate::{service::WalletController, WalletHandle, WalletRpcConfig}; @@ -1493,12 +1500,20 @@ where self.wallet .call_async(move |controller| { Box::pin(async move { + let mut additional_utxo_infos = BTreeMap::new(); let value = match token_id { Some(token_id) => { let token_info = controller.get_token_info(token_id).await?; let amount = amount .to_amount(token_info.token_number_of_decimals()) .ok_or(RpcError::InvalidCoinAmount)?; + additional_utxo_infos.insert( + PoolOrTokenId::TokenId(token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: token_info.token_number_of_decimals(), + ticker: token_info.token_ticker().to_vec(), + }), + ); OutputValue::TokenV1(token_id, amount) } None => { @@ -1512,7 +1527,7 @@ where controller .synced_controller(account_index, config) .await? - .create_htlc_tx(value, htlc) + .create_htlc_tx(value, htlc, &additional_utxo_infos) .await .map_err(RpcError::Controller) }) From 35b4db965f9df2f60ba5b575c477d9acef6c6216 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 10 Sep 2024 23:42:22 +0200 Subject: [PATCH 33/48] fix trezor test --- wallet/Cargo.toml | 3 +-- wallet/src/signer/trezor_signer/tests.rs | 14 ++++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 9a7decec39..5b49378959 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -26,8 +26,7 @@ utils-networking = { path = "../utils/networking" } utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } -# trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer", features = ["bitcoin", "mintlayer"], optional = true } -trezor-client = { path = "../../trezor-firmware/rust/trezor-client", features = ["bitcoin", "mintlayer"], optional = true } +trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } hex.workspace = true diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index d2503c5379..bb59a46c09 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -16,7 +16,6 @@ use std::ops::{Add, Div, Mul, Sub}; use super::*; -use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; @@ -194,6 +193,7 @@ fn sign_transaction(#[case] seed: Seed) { Destination::AnyoneCanSpend, PoolId::new(H256::random_using(&mut rng)), ), + TxOutput::DataDeposit(vec![1, 2, 3]), TxOutput::DelegateStaking( Amount::from_atoms(200), DelegationId::new(H256::random_using(&mut rng)), @@ -205,6 +205,7 @@ fn sign_transaction(#[case] seed: Seed) { .unwrap() .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); + let destinations = req.destinations().to_vec(); let ptx = req.into_partially_signed_tx(&BTreeMap::default()).unwrap(); let mut devices = find_devices(false); @@ -222,17 +223,10 @@ fn sign_transaction(#[case] seed: Seed) { let utxos_ref = utxos.iter().map(Some).chain(acc_dests.iter().map(|_| None)).collect::>(); - for i in 0..sig_tx.inputs().len() { - let destination = get_tx_output_destination( - utxos_ref[i].unwrap(), - &|_| None, - HtlcSpendingCondition::Skip, - ) - .unwrap(); - + for (i, dest) in destinations.iter().enumerate() { tx_verifier::input_check::signature_only_check::verify_tx_signature( &chain_config, - &destination, + dest, &sig_tx, &utxos_ref, i, From 955fd6c6ee3a07f8d12b3552c06d0241be512ff5 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 11 Sep 2024 00:31:15 +0200 Subject: [PATCH 34/48] add ChangeTokenMetadataUri to trezor singer --- Cargo.lock | 1 + wallet/Cargo.toml | 2 +- wallet/src/signer/trezor_signer/mod.rs | 6 +-- wallet/src/wallet/mod.rs | 8 +--- .../wallet-controller/src/runtime_wallet.rs | 38 +++++++++++++++++++ .../src/synced_controller.rs | 4 +- 6 files changed, 46 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 47a6f607a0..97fa94491a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8377,6 +8377,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#a3bda3f11444dd8008e4e5d7a70c2a16c731d8d5" dependencies = [ "bitcoin", "byteorder", diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 5b49378959..0828513199 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -26,7 +26,7 @@ utils-networking = { path = "../utils/networking" } utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } -trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer", features = ["bitcoin", "mintlayer"], optional = true } +trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer-pk", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } hex.workspace = true diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index ae54826ccf..b8049924d1 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -59,7 +59,7 @@ use trezor_client::{ find_devices, protos::{ MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerAddressPath, - MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerChangeTokenMediaUri, + MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerChangeTokenMetadataUri, MintlayerCreateDelegationIdTxOutput, MintlayerCreateStakePoolTxOutput, MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFreezeToken, MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, @@ -603,9 +603,9 @@ fn to_trezor_account_command_input( inp_req.change_token_authority = Some(req).into(); } AccountCommand::ChangeTokenMetadataUri(token_id, uri) => { - let mut req = MintlayerChangeTokenMediaUri::new(); + let mut req = MintlayerChangeTokenMetadataUri::new(); req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - req.set_media_uri(uri.clone()); + req.set_metadata_uri(uri.clone()); inp_req.change_token_metadata_uri = Some(req).into(); } diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index ad21ea29f6..6a034944a8 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -1776,13 +1776,7 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { - num_decimals: token_info.num_decimals(), - ticker: token_info.token_ticker().to_vec(), - }), - )]); + let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, &additional_utxo_infos, diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs index fa0bed8d24..ac22c9b91f 100644 --- a/wallet/wallet-controller/src/runtime_wallet.rs +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -197,6 +197,17 @@ impl RuntimeWallet { } } + pub fn get_best_block_for_account( + &self, + account_index: U31, + ) -> WalletResult<(Id, BlockHeight)> { + match self { + RuntimeWallet::Software(w) => w.get_best_block_for_account(account_index), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.get_best_block_for_account(account_index), + } + } + pub fn is_locked(&self) -> bool { match self { RuntimeWallet::Software(w) => w.is_locked(), @@ -740,6 +751,33 @@ impl RuntimeWallet { } } + pub fn change_token_metadata_uri( + &mut self, + account_index: U31, + token_info: &UnconfirmedTokenInfo, + metadata_uri: Vec, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> Result { + match self { + RuntimeWallet::Software(w) => w.change_token_metadata_uri( + account_index, + token_info, + metadata_uri, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.change_token_metadata_uri( + account_index, + token_info, + metadata_uri, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + #[allow(clippy::too_many_arguments)] pub fn create_transaction_to_addresses( &mut self, diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 7a4e884774..105d1677be 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -493,10 +493,10 @@ where metadata_uri: Vec, ) -> Result> { self.create_and_send_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { wallet.change_token_metadata_uri( From c4b6bca47dcc5a2e5dac2f2db043a833580080ff Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 11 Sep 2024 18:54:57 +0200 Subject: [PATCH 35/48] Convert TrezorError to string --- Cargo.lock | 2 +- wallet/src/signer/trezor_signer/mod.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97fa94491a..2647bc4027 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8377,7 +8377,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#a3bda3f11444dd8008e4e5d7a70c2a16c731d8d5" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#c929c9a8f71ed9edfc679b96e3d4815fd8f3316b" dependencies = [ "bitcoin", "byteorder", diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index b8049924d1..7501ec17e6 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -99,7 +99,7 @@ pub enum TrezorError { #[error("No connected Trezor device found")] NoDeviceFound, #[error("Trezor device error: {0}")] - DeviceError(#[from] trezor_client::Error), + DeviceError(String), } pub struct TrezorSigner { @@ -262,7 +262,7 @@ impl Signer for TrezorSigner { .lock() .expect("poisoned lock") .mintlayer_sign_tx(inputs, outputs, utxos) - .map_err(TrezorError::DeviceError)?; + .map_err(|err| TrezorError::DeviceError(err.to_string()))?; let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref().map(|x| &x.utxo)).collect(); @@ -433,7 +433,7 @@ impl Signer for TrezorSigner { .lock() .expect("poisoned lock") .mintlayer_sign_message(address_n, addr, message.to_vec()) - .map_err(TrezorError::DeviceError)?; + .map_err(|err| TrezorError::DeviceError(err.to_string()))?; let mut signature = sig; signature.insert(0, 0); let signature = Signature::from_data(signature)?; @@ -1019,7 +1019,8 @@ impl std::fmt::Debug for TrezorSignerProvider { impl TrezorSignerProvider { pub fn new() -> Result { - let client = find_trezor_device()?; + let client = + find_trezor_device().map_err(|err| TrezorError::DeviceError(err.to_string()))?; Ok(Self { client: Arc::new(Mutex::new(client)), @@ -1054,7 +1055,7 @@ impl TrezorSignerProvider { .lock() .expect("poisoned lock") .mintlayer_get_public_key(account_path) - .map_err(|e| SignerError::TrezorError(TrezorError::DeviceError(e)))?; + .map_err(|e| SignerError::TrezorError(TrezorError::DeviceError(e.to_string())))?; let chain_code = ChainCode::from(xpub.chain_code.0); let account_pubkey = Secp256k1ExtendedPublicKey::new( derivation_path, @@ -1093,7 +1094,7 @@ fn check_public_keys( fn find_trezor_device() -> Result { let mut devices = find_devices(false); let device = devices.pop().ok_or(TrezorError::NoDeviceFound)?; - let client = device.connect()?; + let client = device.connect().map_err(|e| TrezorError::DeviceError(e.to_string()))?; Ok(client) } From d7775a2a18231219b955f13a8d996d335ff24e9a Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 17 Sep 2024 18:00:18 +0200 Subject: [PATCH 36/48] Add support for orders in trezor --- wallet/src/signer/trezor_signer/mod.rs | 221 +++++++++++++++++-------- 1 file changed, 153 insertions(+), 68 deletions(-) diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 7501ec17e6..b6b87faee1 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -59,14 +59,16 @@ use trezor_client::{ find_devices, protos::{ MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerAddressPath, - MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerChangeTokenMetadataUri, + MintlayerAnyoneCanTakeTxOutput, MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, + MintlayerChangeTokenMetadataUri, MintlayerConcludeOrder, MintlayerCreateDelegationIdTxOutput, MintlayerCreateStakePoolTxOutput, - MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFreezeToken, - MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, - MintlayerLockThenTransferTxOutput, MintlayerLockTokenSupply, MintlayerMintTokens, - MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, MintlayerTokenOutputValue, - MintlayerTokenTotalSupply, MintlayerTokenTotalSupplyType, MintlayerTxInput, - MintlayerTxOutput, MintlayerUnfreezeToken, MintlayerUnmintTokens, MintlayerUtxoType, + MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFillOrder, + MintlayerFreezeToken, MintlayerHtlcTxOutput, MintlayerIssueFungibleTokenTxOutput, + MintlayerIssueNftTxOutput, MintlayerLockThenTransferTxOutput, MintlayerLockTokenSupply, + MintlayerMintTokens, MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, + MintlayerTokenOutputValue, MintlayerTokenTotalSupply, MintlayerTokenTotalSupplyType, + MintlayerTxInput, MintlayerTxOutput, MintlayerUnfreezeToken, MintlayerUnmintTokens, + MintlayerUtxoType, }, }; use trezor_client::{ @@ -272,7 +274,8 @@ impl Signer for TrezorSigner { .iter() .enumerate() .zip(ptx.destinations()) - .map(|((i, witness), destination)| match witness { + .zip(ptx.htlc_secrets()) + .map(|(((i, witness), destination), secret)| match witness { Some(w) => match w { InputWitness::NoSignature(_) => Ok(( Some(w.clone()), @@ -380,9 +383,6 @@ impl Signer for TrezorSigner { }, None => match (destination, new_signatures.get(i)) { (Some(destination), Some(sig)) => { - // TODO: when HTLC PR is merged get secret from the ptx - let secret = None; - let sighash_type = SigHashType::try_from(SigHashType::ALL).expect("Should not fail"); let sighash = signature_hash(sighash_type, ptx.tx(), &inputs_utxo_refs, i)?; @@ -391,7 +391,7 @@ impl Signer for TrezorSigner { destination, sighash_type, sighash, - secret, + secret.clone(), key_chain, )?; Ok((sig, SignatureStatus::NotSigned, status)) @@ -494,6 +494,7 @@ fn tx_output_value(out: &TxOutput) -> OutputValue { OutputValue::TokenV1(*token_id, Amount::from_atoms(1)) } TxOutput::CreateStakePool(_, data) => OutputValue::Coin(data.pledge()), + TxOutput::AnyoneCanTake(data) => data.give().clone(), TxOutput::CreateDelegationId(_, _) | TxOutput::ProduceBlockFromStake(_, _) | TxOutput::IssueFungibleToken(_) @@ -522,9 +523,9 @@ fn to_trezor_input_msgs( key_chain, outpoint, )), - (TxInput::AccountCommand(nonce, command), _, Some(dest)) => Ok( - to_trezor_account_command_input(chain_config, dest, key_chain, nonce, command), - ), + (TxInput::AccountCommand(nonce, command), _, Some(dest)) => { + to_trezor_account_command_input(chain_config, dest, key_chain, nonce, command) + } (_, _, None) => Err(SignerError::MissingDestinationInTransaction), (TxInput::Utxo(_), _, _) => Err(SignerError::MissingUtxo), }) @@ -537,7 +538,7 @@ fn to_trezor_account_command_input( key_chain: &impl AccountKeyChains, nonce: &common::chain::AccountNonce, command: &AccountCommand, -) -> MintlayerTxInput { +) -> SignerResult { let mut inp_req = MintlayerAccountCommandTxInput::new(); inp_req .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); @@ -609,14 +610,36 @@ fn to_trezor_account_command_input( inp_req.change_token_metadata_uri = Some(req).into(); } - AccountCommand::ConcludeOrder(_) | AccountCommand::FillOrder(_, _, _) => { - unimplemented!("order commands") + AccountCommand::ConcludeOrder(order_id) => { + let mut req = MintlayerConcludeOrder::new(); + req.set_order_id(order_id.to_hash().as_bytes().to_vec()); + + inp_req.conclude_order = Some(req).into(); + } + AccountCommand::FillOrder(order_id, value, dest) => { + let mut req = MintlayerFillOrder::new(); + req.set_order_id(order_id.to_hash().as_bytes().to_vec()); + match value { + OutputValue::Coin(amount) => { + req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + } + OutputValue::TokenV1(token_id, amount) => { + req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + } + OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), + } + req.set_destination( + Address::new(chain_config, dest.clone()).expect("addressable").into_string(), + ); + + inp_req.fill_order = Some(req).into(); } AccountCommand::ChangeTokenMetadataUri(_, _) => unimplemented!("FIXME"), } let mut inp = MintlayerTxInput::new(); inp.account_command = Some(inp_req).into(); - inp + Ok(inp) } fn to_trezor_account_input( @@ -745,37 +768,13 @@ fn to_trezor_output_value( output_value: &OutputValue, additional_info: &Option, ) -> SignerResult { - let value = match output_value { - OutputValue::Coin(amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - value - } - OutputValue::TokenV1(token_id, amount) => { - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - let mut token_value = MintlayerTokenOutputValue::new(); - token_value.set_token_id(token_id.to_hash().as_bytes().to_vec()); - match additional_info { - Some(UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { - num_decimals, - ticker, - })) => { - token_value.set_number_of_decimals(*num_decimals as u32); - token_value.set_token_ticker(ticker.clone()); - } - Some( - UtxoAdditionalInfo::PoolInfo { staker_balance: _ } - | UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ }, - ) - | None => return Err(SignerError::MissingUtxoExtraInfo), - } - value.token = Some(token_value).into(); - value - } - OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), - }; - Ok(value) + let token_info = additional_info.as_ref().and_then(|info| match info { + UtxoAdditionalInfo::TokenInfo(token_info) => Some(token_info), + UtxoAdditionalInfo::PoolInfo { staker_balance: _ } + | UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ } => None, + }); + + to_trezor_output_value_with_token_info(output_value, &token_info) } fn to_trezor_utxo_msgs( @@ -828,22 +827,7 @@ fn to_trezor_output_msg( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); - let mut lock_req = trezor_client::protos::MintlayerOutputTimeLock::new(); - match lock { - OutputTimeLock::UntilTime(time) => { - lock_req.set_until_time(time.as_int_seconds()); - } - OutputTimeLock::UntilHeight(height) => { - lock_req.set_until_height(height.into_int()); - } - OutputTimeLock::ForSeconds(sec) => { - lock_req.set_for_seconds(*sec); - } - OutputTimeLock::ForBlockCount(count) => { - lock_req.set_for_block_count(*count); - } - } - out_req.lock = Some(lock_req).into(); + out_req.lock = Some(to_trezor_output_lock(lock)).into(); let mut out = MintlayerTxOutput::new(); out.lock_then_transfer = Some(out_req).into(); @@ -1000,12 +984,113 @@ fn to_trezor_output_msg( out.data_deposit = Some(out_req).into(); out } - TxOutput::Htlc(_, _) => unimplemented!("HTLC"), - TxOutput::CreateOrder(_) => unimplemented!("CreateOrder"), + TxOutput::Htlc(value, lock) => { + let mut out_req = MintlayerHtlcTxOutput::new(); + out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); + out_req.secret_hash = Some(lock.secret_hash.as_bytes().to_vec()); + + out_req.set_spend_key( + Address::new(chain_config, lock.spend_key.clone()) + .expect("addressable") + .into_string(), + ); + out_req.set_refund_key( + Address::new(chain_config, lock.refund_key.clone()) + .expect("addressable") + .into_string(), + ); + + out_req.refund_timelock = Some(to_trezor_output_lock(&lock.refund_timelock)).into(); + + let mut out = MintlayerTxOutput::new(); + out.htlc = Some(out_req).into(); + out + } + TxOutput::CreateOrder(data) => { + let mut out_req = MintlayerAnyoneCanTakeTxOutput::new(); + + out_req.set_conclude_key( + Address::new(chain_config, data.conclude_key().clone()) + .expect("addressable") + .into_string(), + ); + + match additional_info { + Some(UtxoAdditionalInfo::AnyoneCanTake { ask, give }) => { + out_req.ask = Some(to_trezor_output_value_with_token_info( + data.ask(), + &ask.as_ref(), + )?) + .into(); + out_req.give = Some(to_trezor_output_value_with_token_info( + data.give(), + &give.as_ref(), + )?) + .into(); + } + Some( + UtxoAdditionalInfo::PoolInfo { staker_balance: _ } + | UtxoAdditionalInfo::TokenInfo(_), + ) + | None => return Err(SignerError::MissingUtxoExtraInfo), + } + + let mut out = MintlayerTxOutput::new(); + out.anyone_can_take = Some(out_req).into(); + out + } }; Ok(res) } +fn to_trezor_output_value_with_token_info( + value: &OutputValue, + token_info: &Option<&TokenAdditionalInfo>, +) -> Result { + match value { + OutputValue::Coin(amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + Ok(value) + } + OutputValue::TokenV1(token_id, amount) => { + let mut value = MintlayerOutputValue::new(); + value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + let mut token_value = MintlayerTokenOutputValue::new(); + token_value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + match &token_info { + Some(info) => { + token_value.set_number_of_decimals(info.num_decimals as u32); + token_value.set_token_ticker(info.ticker.clone()); + } + None => return Err(SignerError::MissingUtxoExtraInfo), + } + value.token = Some(token_value).into(); + Ok(value) + } + OutputValue::TokenV0(_) => Err(SignerError::UnsupportedTokensV0), + } +} + +fn to_trezor_output_lock(lock: &OutputTimeLock) -> trezor_client::protos::MintlayerOutputTimeLock { + let mut lock_req = trezor_client::protos::MintlayerOutputTimeLock::new(); + match lock { + OutputTimeLock::UntilTime(time) => { + lock_req.set_until_time(time.as_int_seconds()); + } + OutputTimeLock::UntilHeight(height) => { + lock_req.set_until_height(height.into_int()); + } + OutputTimeLock::ForSeconds(sec) => { + lock_req.set_for_seconds(*sec); + } + OutputTimeLock::ForBlockCount(count) => { + lock_req.set_for_block_count(*count); + } + } + lock_req +} + #[derive(Clone)] pub struct TrezorSignerProvider { client: Arc>, From cbdffea98ed4d21616b434724cf5d05eeb2227b1 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 17 Sep 2024 21:24:49 +0200 Subject: [PATCH 37/48] fix trezor produce from stake additional info --- wallet/src/signer/mod.rs | 2 ++ wallet/src/signer/trezor_signer/mod.rs | 37 +++++++++++++++++--------- wallet/wallet-cli-commands/src/lib.rs | 2 +- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 2a111fa098..a057932bea 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -80,6 +80,8 @@ pub enum SignerError { MissingUtxoExtraInfo, #[error("Tokens V0 are not supported")] UnsupportedTokensV0, + #[error("Invalid TxOutput type as UTXO, cannot be spent")] + InvalidUtxo, } type SignerResult = Result; diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index b6b87faee1..f981ad3dbd 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -70,6 +70,7 @@ use trezor_client::{ MintlayerTxInput, MintlayerTxOutput, MintlayerUnfreezeToken, MintlayerUnmintTokens, MintlayerUtxoType, }, + Model, }; use trezor_client::{ protos::{MintlayerTransferTxOutput, MintlayerUtxoTxInput}, @@ -483,23 +484,31 @@ impl Signer for TrezorSigner { } } -fn tx_output_value(out: &TxOutput) -> OutputValue { - match out { +fn utxo_output_value(out: &UtxoWithAdditionalInfo) -> SignerResult { + match &out.utxo { TxOutput::Transfer(value, _) | TxOutput::Htlc(value, _) - | TxOutput::LockThenTransfer(value, _, _) - | TxOutput::Burn(value) => value.clone(), - TxOutput::DelegateStaking(amount, _) => OutputValue::Coin(*amount), + | TxOutput::LockThenTransfer(value, _, _) => Ok(value.clone()), TxOutput::IssueNft(token_id, _, _) => { - OutputValue::TokenV1(*token_id, Amount::from_atoms(1)) + Ok(OutputValue::TokenV1(*token_id, Amount::from_atoms(1))) } - TxOutput::CreateStakePool(_, data) => OutputValue::Coin(data.pledge()), - TxOutput::AnyoneCanTake(data) => data.give().clone(), + TxOutput::CreateStakePool(_, data) => Ok(OutputValue::Coin(data.pledge())), + TxOutput::ProduceBlockFromStake(_, _) => match out.additional_info { + Some(UtxoAdditionalInfo::PoolInfo { staker_balance }) => { + Ok(OutputValue::Coin(staker_balance)) + } + Some( + UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ } + | UtxoAdditionalInfo::TokenInfo(_), + ) + | None => Err(SignerError::MissingUtxoExtraInfo), + }, TxOutput::CreateDelegationId(_, _) - | TxOutput::ProduceBlockFromStake(_, _) | TxOutput::IssueFungibleToken(_) + | TxOutput::Burn(_) | TxOutput::CreateOrder(_) - | TxOutput::DataDeposit(_) => OutputValue::Coin(Amount::ZERO), + | TxOutput::DelegateStaking(_, _) + | TxOutput::DataDeposit(_) => Err(SignerError::InvalidUtxo), } } @@ -704,7 +713,7 @@ fn to_trezor_utxo_input( inp_req.set_prev_hash(id.to_vec()); inp_req.set_prev_index(outpoint.output_index()); - let output_value = tx_output_value(&utxo.utxo); + let output_value = utxo_output_value(utxo)?; inp_req.value = Some(to_trezor_output_value( &output_value, &utxo.additional_info, @@ -1177,8 +1186,10 @@ fn check_public_keys( } fn find_trezor_device() -> Result { - let mut devices = find_devices(false); - let device = devices.pop().ok_or(TrezorError::NoDeviceFound)?; + let device = find_devices(false) + .into_iter() + .find(|device| device.model == Model::Trezor) + .ok_or(TrezorError::NoDeviceFound)?; let client = device.connect().map_err(|e| TrezorError::DeviceError(e.to_string()))?; Ok(client) } diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index c30385e080..1668d3905b 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -105,7 +105,7 @@ pub enum WalletManagementCommand { force_change_wallet_type: bool, /// Open a wallet file related to a connected hardware wallet. - #[arg(long)] + #[arg(long, conflicts_with_all(["force_change_wallet_type"]))] hardware_wallet: Option, }, From b3b9ce382a872a384bfa12788a2bd90eb4d6bf24 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Fri, 20 Sep 2024 19:58:13 +0200 Subject: [PATCH 38/48] add all inputs/outputs to trezor test --- wallet/src/signer/trezor_signer/tests.rs | 137 +++++++++++++++++++++-- 1 file changed, 126 insertions(+), 11 deletions(-) diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index bb59a46c09..101bc03d94 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -19,14 +19,17 @@ use super::*; use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; +use common::chain::htlc::HashedTimelockContract; use common::chain::output_value::OutputValue; use common::chain::signature::inputsig::arbitrary_message::produce_message_challenge; +use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock; -use common::chain::tokens::TokenId; +use common::chain::tokens::{NftIssuanceV0, TokenId}; use common::chain::{ - AccountNonce, AccountOutPoint, DelegationId, GenBlock, PoolId, Transaction, TxInput, + AccountNonce, AccountOutPoint, DelegationId, GenBlock, OrderData, PoolId, Transaction, TxInput, }; -use common::primitives::{Amount, Id, H256}; +use common::primitives::per_thousand::PerThousand; +use common::primitives::{Amount, BlockHeight, Id, H256}; use crypto::key::{KeyKind, PrivateKey}; use randomness::{Rng, RngCore}; use rstest::rstest; @@ -83,6 +86,13 @@ fn sign_message(#[case] seed: Seed) { #[trace] #[case(Seed::from_entropy())] fn sign_transaction(#[case] seed: Seed) { + use common::chain::{ + tokens::{IsTokenUnfreezable, Metadata, TokenIssuanceV1}, + OrderId, + }; + use crypto::vrf::VRFPrivateKey; + use serialization::extras::non_empty_vec::DataOrNoVec; + let mut rng = make_seedable_rng(seed); let chain_config = Arc::new(create_regtest()); @@ -145,10 +155,58 @@ fn sign_transaction(#[case] seed: Seed) { Amount::from_atoms(rng.next_u32() as u128), ), )), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::MintTokens( + TokenId::new(H256::random_using(&mut rng)), + Amount::from_atoms(100), + ), + ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), AccountCommand::UnmintTokens(TokenId::new(H256::random_using(&mut rng))), ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::LockTokenSupply(TokenId::new(H256::random_using(&mut rng))), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::FreezeToken( + TokenId::new(H256::random_using(&mut rng)), + IsTokenUnfreezable::Yes, + ), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::UnfreezeToken(TokenId::new(H256::random_using(&mut rng))), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::ChangeTokenAuthority( + TokenId::new(H256::random_using(&mut rng)), + Destination::AnyoneCanSpend, + ), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::ConcludeOrder(OrderId::new(H256::random_using(&mut rng))), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::FillOrder( + OrderId::new(H256::random_using(&mut rng)), + OutputValue::Coin(Amount::from_atoms(123)), + Destination::AnyoneCanSpend, + ), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::ChangeTokenMetadataUri( + TokenId::new(H256::random_using(&mut rng)), + "http://uri".as_bytes().to_vec(), + ), + ), ]; let acc_dests: Vec = acc_inputs .iter() @@ -173,6 +231,53 @@ fn sign_transaction(#[case] seed: Seed) { let _fee_amount = total_amount.sub(outputs_amounts_sum).unwrap(); let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); + let (_, vrf_public_key) = VRFPrivateKey::new_from_entropy(crypto::vrf::VRFKeyKind::Schnorrkel); + + let pool_id = PoolId::new(H256::random()); + let delegation_id = DelegationId::new(H256::random()); + let pool_data = StakePoolData::new( + Amount::from_atoms(5000000), + Destination::PublicKey(dest_pub.clone()), + vrf_public_key, + Destination::PublicKey(dest_pub.clone()), + PerThousand::new_from_rng(&mut rng), + Amount::from_atoms(100), + ); + let token_issuance = TokenIssuance::V1(TokenIssuanceV1 { + token_ticker: "XXXX".as_bytes().to_vec(), + number_of_decimals: rng.gen_range(1..18), + metadata_uri: "http://uri".as_bytes().to_vec(), + total_supply: common::chain::tokens::TokenTotalSupply::Unlimited, + authority: Destination::PublicKey(dest_pub.clone()), + is_freezable: common::chain::tokens::IsTokenFreezable::No, + }); + + let nft_issuance = NftIssuance::V0(NftIssuanceV0 { + metadata: Metadata { + creator: None, + name: "Name".as_bytes().to_vec(), + description: "SomeNFT".as_bytes().to_vec(), + ticker: "NFTX".as_bytes().to_vec(), + icon_uri: DataOrNoVec::from(None), + additional_metadata_uri: DataOrNoVec::from(None), + media_uri: DataOrNoVec::from(None), + media_hash: "123456".as_bytes().to_vec(), + }, + }); + let nft_id = TokenId::new(H256::random()); + + let hash_lock = HashedTimelockContract { + secret_hash: common::chain::htlc::HtlcSecretHash([1; 20]), + spend_key: Destination::PublicKey(dest_pub.clone()), + refund_timelock: OutputTimeLock::UntilHeight(BlockHeight::new(123)), + refund_key: Destination::AnyoneCanSpend, + }; + + let order_data = OrderData::new( + Destination::PublicKey(dest_pub.clone()), + OutputValue::Coin(Amount::from_atoms(100)), + OutputValue::Coin(total_amount), + ); let outputs = vec![ TxOutput::Transfer( @@ -185,28 +290,38 @@ fn sign_transaction(#[case] seed: Seed) { OutputTimeLock::ForSeconds(rng.next_u64()), ), TxOutput::Burn(OutputValue::Coin(burn_amount)), - TxOutput::Transfer( - OutputValue::Coin(Amount::from_atoms(100_000_000_000)), - account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), - ), + TxOutput::CreateStakePool(pool_id, Box::new(pool_data)), TxOutput::CreateDelegationId( Destination::AnyoneCanSpend, PoolId::new(H256::random_using(&mut rng)), ), + TxOutput::DelegateStaking(burn_amount, delegation_id), + TxOutput::IssueFungibleToken(Box::new(token_issuance)), + TxOutput::IssueNft( + nft_id, + Box::new(nft_issuance.clone()), + Destination::AnyoneCanSpend, + ), TxOutput::DataDeposit(vec![1, 2, 3]), - TxOutput::DelegateStaking( - Amount::from_atoms(200), - DelegationId::new(H256::random_using(&mut rng)), + TxOutput::Htlc(OutputValue::Coin(burn_amount), Box::new(hash_lock)), + TxOutput::AnyoneCanTake(Box::new(order_data)), + TxOutput::Transfer( + OutputValue::Coin(Amount::from_atoms(100_000_000_000)), + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), ), ]; + let nft = TxOutput::IssueNft(nft_id, Box::new(nft_issuance), Destination::AnyoneCanSpend); + eprintln!("encoded nft: {:?}", nft.encode()); + let req = SendRequest::new() .with_inputs(inputs.clone().into_iter().zip(utxos.clone()), &|_| None) .unwrap() .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); let destinations = req.destinations().to_vec(); - let ptx = req.into_partially_signed_tx(&BTreeMap::default()).unwrap(); + let additional_info = BTreeMap::new(); + let ptx = req.into_partially_signed_tx(&additional_info).unwrap(); let mut devices = find_devices(false); assert!(!devices.is_empty()); From 66a3bc723edea9ffa4a8c42391dabf4a5faa8e42 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 14 Oct 2024 20:14:32 +0200 Subject: [PATCH 39/48] fix fill order change after rebase --- .github/workflows/build.yml | 24 +-- .github/workflows/release_linux.yml | 2 +- .github/workflows/release_macos.yml | 4 +- .github/workflows/release_windows.yml | 4 +- Cargo.lock | 2 +- build-tools/code-docs/build-rpc-docs.sh | 2 +- .../chain/transaction/output/output_value.rs | 7 + node-gui/backend/src/backend_impl.rs | 2 +- test/functional/wallet_generate_addresses.py | 2 +- test/functional/wallet_get_address_usage.py | 2 +- test/functional/wallet_recover_accounts.py | 2 +- wallet/src/send_request/mod.rs | 8 +- wallet/src/signer/trezor_signer/mod.rs | 86 +++------ wallet/src/signer/trezor_signer/tests.rs | 79 ++++++-- wallet/src/wallet/mod.rs | 17 +- wallet/src/wallet/tests.rs | 80 ++++++++ .../types/src/partially_signed_transaction.rs | 2 +- wallet/types/src/wallet_type.rs | 2 +- .../src/command_handler/mod.rs | 51 ++---- .../wallet-cli-commands/src/helper_types.rs | 1 - wallet/wallet-cli-commands/src/lib.rs | 6 +- .../tests/cli_test_framework.rs | 2 +- wallet/wallet-controller/src/helpers.rs | 14 +- wallet/wallet-controller/src/lib.rs | 1 - wallet/wallet-controller/src/read.rs | 5 +- .../wallet-controller/src/runtime_wallet.rs | 172 ++++++++++++++++-- .../wallet-controller/src/sync/tests/mod.rs | 2 +- .../src/synced_controller.rs | 72 ++++++-- .../src/handles_client/mod.rs | 5 +- .../src/rpc_client/client_impl.rs | 5 +- .../src/wallet_rpc_traits.rs | 5 +- wallet/wallet-rpc-daemon/docs/RPC.md | 12 +- wallet/wallet-rpc-lib/Cargo.toml | 2 +- wallet/wallet-rpc-lib/src/rpc/interface.rs | 7 +- wallet/wallet-rpc-lib/src/rpc/mod.rs | 73 ++++++-- wallet/wallet-rpc-lib/src/rpc/types.rs | 2 +- wallet/wallet-rpc-lib/src/service/worker.rs | 1 - 37 files changed, 527 insertions(+), 238 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2785476a8..8cd9a2d0b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,14 +27,14 @@ jobs: - name: Install rust run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $(python3 ./build-tools/rust-version-extractor/rust-version-extractor.py) - name: Build - run: cargo build --release --locked + run: cargo build --release --locked --features trezor - name: Run tests - run: cargo test --release --workspace + run: cargo test --release --workspace --features trezor - name: Run doc tests - run: cargo test --release --doc + run: cargo test --release --doc --features trezor # This test is ignored, so it needs to run separately. - name: Run mixed_sighash_types test - run: cargo test --release mixed_sighash_types + run: cargo test --release mixed_sighash_types --features trezor # This test is ignored, so it needs to run separately. - name: Run test_4opc_sequences test run: cargo test --release test_4opc_sequences -- --ignored @@ -65,14 +65,14 @@ jobs: - name: Install rust run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $(python3 ./build-tools/rust-version-extractor/rust-version-extractor.py) - name: Build - run: cargo build --release --locked + run: cargo build --release --locked --features trezor - name: Run tests - run: cargo test --release --workspace + run: cargo test --release --workspace --features trezor - name: Run doc tests - run: cargo test --release --doc + run: cargo test --release --doc --features trezor # This test is ignored, so it needs to run separately. - name: Run mixed_sighash_types test - run: cargo test --release mixed_sighash_types + run: cargo test --release mixed_sighash_types --features trezor # This test is ignored, so it needs to run separately. - name: Run test_4opc_sequences test run: cargo test --release test_4opc_sequences @@ -97,14 +97,14 @@ jobs: - name: Install rust run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $(python3 ./build-tools/rust-version-extractor/rust-version-extractor.py) - name: Build - run: cargo build --release --locked + run: cargo build --release --locked --features trezor - name: Run tests - run: cargo test --release --workspace + run: cargo test --release --workspace --features trezor - name: Run doc tests - run: cargo test --release --doc + run: cargo test --release --doc --features trezor # This test is ignored, so it needs to run separately. - name: Run mixed_sighash_types test - run: cargo test --release mixed_sighash_types + run: cargo test --release mixed_sighash_types --features trezor # This test is ignored, so it needs to run separately. - name: Run test_4opc_sequences test run: cargo test --release test_4opc_sequences diff --git a/.github/workflows/release_linux.yml b/.github/workflows/release_linux.yml index 15800f9d56..cb7c9a75c0 100644 --- a/.github/workflows/release_linux.yml +++ b/.github/workflows/release_linux.yml @@ -46,7 +46,7 @@ jobs: - name: Build run: | - cargo build --release --target ${{ matrix.arch }}-unknown-linux-gnu + cargo build --release --target ${{ matrix.arch }}-unknown-linux-gnu --features trezor - name: Create Debian package for GUI run: | diff --git a/.github/workflows/release_macos.yml b/.github/workflows/release_macos.yml index 1a57394ebf..4df2d2b769 100644 --- a/.github/workflows/release_macos.yml +++ b/.github/workflows/release_macos.yml @@ -34,7 +34,7 @@ jobs: - name: Build run: | - cargo build --release --target ${{ matrix.arch }}-apple-darwin + cargo build --release --target ${{ matrix.arch }}-apple-darwin --features trezor - name: Sign and Notarize GUI env: @@ -67,4 +67,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: Mintlayer_Node_macos_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }} - path: Mintlayer_Node_macos_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.zip \ No newline at end of file + path: Mintlayer_Node_macos_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.zip diff --git a/.github/workflows/release_windows.yml b/.github/workflows/release_windows.yml index b4a34e2ed3..023cb73688 100644 --- a/.github/workflows/release_windows.yml +++ b/.github/workflows/release_windows.yml @@ -29,7 +29,7 @@ jobs: toolchain: stable - name: Build Mintlayer Node and GUI - run: cargo build --release + run: cargo build --release --features trezor - name: Package Mintlayer Node run: | @@ -99,4 +99,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: Mintlayer_Node_GUI_win_${{ steps.get_version.outputs.VERSION }}_Setup - path: Mintlayer_Node_GUI_win_${{ steps.get_version.outputs.VERSION }}_Setup.exe \ No newline at end of file + path: Mintlayer_Node_GUI_win_${{ steps.get_version.outputs.VERSION }}_Setup.exe diff --git a/Cargo.lock b/Cargo.lock index 2647bc4027..1363f486ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8377,7 +8377,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#c929c9a8f71ed9edfc679b96e3d4815fd8f3316b" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#1e4b2959ea0b230f7a4102b2eaec57ed2b66b8f4" dependencies = [ "bitcoin", "byteorder", diff --git a/build-tools/code-docs/build-rpc-docs.sh b/build-tools/code-docs/build-rpc-docs.sh index e0a8e2c2b1..242db4ab86 100755 --- a/build-tools/code-docs/build-rpc-docs.sh +++ b/build-tools/code-docs/build-rpc-docs.sh @@ -5,4 +5,4 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd ${SCRIPT_DIR}/../../ UPDATE_EXPECT=1 cargo test -p node-daemon --test rpc_docs -UPDATE_EXPECT=1 cargo test -p wallet-rpc-daemon --test rpc_docs +UPDATE_EXPECT=1 cargo test -p wallet-rpc-daemon --test rpc_docs --features trezor diff --git a/common/src/chain/transaction/output/output_value.rs b/common/src/chain/transaction/output/output_value.rs index 378d2d2b26..167c9954b4 100644 --- a/common/src/chain/transaction/output/output_value.rs +++ b/common/src/chain/transaction/output/output_value.rs @@ -99,4 +99,11 @@ impl RpcOutputValue { RpcOutputValue::Coin { amount } | RpcOutputValue::Token { id: _, amount } => *amount, } } + + pub fn token_id(&self) -> Option { + match self { + RpcOutputValue::Coin { amount: _ } => None, + RpcOutputValue::Token { id, amount: _ } => Some(*id), + } + } } diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index ff5a3afa06..25eb460535 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -428,7 +428,7 @@ impl Backend { let wallet_rpc = WalletRpc::new(wallet_handle, node_rpc.clone(), chain_config.clone()); wallet_rpc - .create_wallet(file_path, wallet_args, true, import.scan_blokchain()) + .create_wallet(file_path, wallet_args, true, !import.skip_syncing()) .await .map_err(|err| BackendError::WalletError(err.to_string()))?; tokio::spawn(forward_events( diff --git a/test/functional/wallet_generate_addresses.py b/test/functional/wallet_generate_addresses.py index e1242b4b28..19a9734c64 100644 --- a/test/functional/wallet_generate_addresses.py +++ b/test/functional/wallet_generate_addresses.py @@ -154,7 +154,7 @@ async def async_test(self): # close this wallet and create a new one with the new seed phrase await wallet.close_wallet() - assert_in("New wallet created successfully", await wallet.recover_wallet(seed_phrase)) + assert_in("Wallet recovered successfully", await wallet.recover_wallet(seed_phrase)) assert_in("Success", await wallet.sync()) assert_in(f"Coins amount: {len(addresses)}", await wallet.get_balance()) diff --git a/test/functional/wallet_get_address_usage.py b/test/functional/wallet_get_address_usage.py index 41ab21386a..3d4fc23ca3 100644 --- a/test/functional/wallet_get_address_usage.py +++ b/test/functional/wallet_get_address_usage.py @@ -75,7 +75,7 @@ async def async_test(self): # new wallet async with WalletCliController(node, self.config, self.log) as wallet: mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" - assert_in("New wallet created successfully", await wallet.recover_wallet(mnemonic, "wallet")) + assert_in("Wallet recovered successfully", await wallet.recover_wallet(mnemonic, "wallet")) # check it is on genesis best_block_height = await wallet.get_best_block_height() diff --git a/test/functional/wallet_recover_accounts.py b/test/functional/wallet_recover_accounts.py index bfca507e84..41a6544150 100644 --- a/test/functional/wallet_recover_accounts.py +++ b/test/functional/wallet_recover_accounts.py @@ -137,7 +137,7 @@ async def async_test(self): mnemonic = await wallet.show_seed_phrase() assert mnemonic is not None assert_in("Successfully closed the wallet", await wallet.close_wallet()) - assert_in("New wallet created successfully", await wallet.recover_wallet(mnemonic)) + assert_in("Wallet recovered successfully", await wallet.recover_wallet(mnemonic)) # sync and check that accounts are now present and with correct balances assert_in("Success", await wallet.sync()) diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 613078a853..098e9fc896 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -344,11 +344,11 @@ fn find_additional_info( | TxOutput::LockThenTransfer(value, _, _) => { find_token_additional_info(value, additional_info)?.map(UtxoAdditionalInfo::TokenInfo) } - TxOutput::AnyoneCanTake(data) => { + TxOutput::CreateOrder(data) => { let ask = find_token_additional_info(data.ask(), additional_info)?; let give = find_token_additional_info(data.give(), additional_info)?; - Some(UtxoAdditionalInfo::AnyoneCanTake { ask, give }) + Some(UtxoAdditionalInfo::CreateOrder { ask, give }) } TxOutput::IssueNft(_, data, _) => { Some(UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { @@ -387,7 +387,7 @@ fn find_token_additional_info( .map(|data| match data { UtxoAdditionalInfo::TokenInfo(data) => Ok(Some(data.clone())), UtxoAdditionalInfo::PoolInfo { staker_balance: _ } - | UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ } => { + | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => { Err(WalletError::MissmatchedTokenAdditionalData(*token_id)) } })?, @@ -402,7 +402,7 @@ pub fn get_referenced_token_ids(output: &TxOutput) -> BTreeSet { | TxOutput::LockThenTransfer(v, _, _) | TxOutput::Burn(v) | TxOutput::Htlc(v, _) => referenced_token_id(v), - | TxOutput::AnyoneCanTake(data) => { + | TxOutput::CreateOrder(data) => { let mut tokens = referenced_token_id(data.ask()); tokens.extend(referenced_token_id(data.give())); tokens diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index f981ad3dbd..a88450ed54 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -498,7 +498,7 @@ fn utxo_output_value(out: &UtxoWithAdditionalInfo) -> SignerResult Ok(OutputValue::Coin(staker_balance)) } Some( - UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ } + UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } | UtxoAdditionalInfo::TokenInfo(_), ) | None => Err(SignerError::MissingUtxoExtraInfo), @@ -551,24 +551,7 @@ fn to_trezor_account_command_input( let mut inp_req = MintlayerAccountCommandTxInput::new(); inp_req .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); - match key_chain.find_public_key(dest) { - Some(FoundPubKey::Hierarchy(xpub)) => { - let address_n = xpub - .get_derivation_path() - .as_slice() - .iter() - .map(|c| c.into_encoded_index()) - .collect(); - inp_req.address_n = vec![MintlayerAddressPath { - address_n, - ..Default::default() - }]; - } - Some(FoundPubKey::Standalone(_)) => { - unimplemented!("standalone keys with trezor") - } - None => {} - }; + inp_req.address_n = destination_to_address_paths(key_chain, dest); inp_req.set_nonce(nonce.value()); match command { AccountCommand::MintTokens(token_id, amount) => { @@ -625,26 +608,16 @@ fn to_trezor_account_command_input( inp_req.conclude_order = Some(req).into(); } - AccountCommand::FillOrder(order_id, value, dest) => { + AccountCommand::FillOrder(order_id, amount, dest) => { let mut req = MintlayerFillOrder::new(); req.set_order_id(order_id.to_hash().as_bytes().to_vec()); - match value { - OutputValue::Coin(amount) => { - req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - } - OutputValue::TokenV1(token_id, amount) => { - req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); - } - OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), - } + req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); req.set_destination( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); inp_req.fill_order = Some(req).into(); } - AccountCommand::ChangeTokenMetadataUri(_, _) => unimplemented!("FIXME"), } let mut inp = MintlayerTxInput::new(); inp.account_command = Some(inp_req).into(); @@ -660,24 +633,7 @@ fn to_trezor_account_input( let mut inp_req = MintlayerAccountTxInput::new(); inp_req .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); - match key_chain.find_public_key(dest) { - Some(FoundPubKey::Hierarchy(xpub)) => { - let address_n = xpub - .get_derivation_path() - .as_slice() - .iter() - .map(|c| c.into_encoded_index()) - .collect(); - inp_req.address_n = vec![MintlayerAddressPath { - address_n, - ..Default::default() - }]; - } - Some(FoundPubKey::Standalone(_)) => { - unimplemented!("standalone keys with trezor") - } - None => {} - }; + inp_req.address_n = destination_to_address_paths(key_chain, dest); inp_req.set_nonce(outpoint.nonce().value()); match outpoint.account() { AccountSpending::DelegationBalance(delegation_id, amount) => { @@ -722,6 +678,18 @@ fn to_trezor_utxo_input( inp_req .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); + inp_req.address_n = destination_to_address_paths(key_chain, dest); + + let mut inp = MintlayerTxInput::new(); + inp.utxo = Some(inp_req).into(); + Ok(inp) +} + +/// Find the derivation paths to the key in the destination, or multiple in the case of a multisig +fn destination_to_address_paths( + key_chain: &impl AccountKeyChains, + dest: &Destination, +) -> Vec { match key_chain.find_public_key(dest) { Some(FoundPubKey::Hierarchy(xpub)) => { let address_n = xpub @@ -730,17 +698,17 @@ fn to_trezor_utxo_input( .iter() .map(|c| c.into_encoded_index()) .collect(); - inp_req.address_n = vec![MintlayerAddressPath { + vec![MintlayerAddressPath { address_n, ..Default::default() - }]; + }] } Some(FoundPubKey::Standalone(_)) => { unimplemented!("standalone keys with trezor") } None => { if let Some(challenge) = key_chain.find_multisig_challenge(dest) { - inp_req.address_n = challenge + challenge .public_keys() .iter() .enumerate() @@ -763,14 +731,12 @@ fn to_trezor_utxo_input( None => None, } }) - .collect(); + .collect() + } else { + vec![] } } - }; - - let mut inp = MintlayerTxInput::new(); - inp.utxo = Some(inp_req).into(); - Ok(inp) + } } fn to_trezor_output_value( @@ -780,7 +746,7 @@ fn to_trezor_output_value( let token_info = additional_info.as_ref().and_then(|info| match info { UtxoAdditionalInfo::TokenInfo(token_info) => Some(token_info), UtxoAdditionalInfo::PoolInfo { staker_balance: _ } - | UtxoAdditionalInfo::AnyoneCanTake { ask: _, give: _ } => None, + | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => None, }); to_trezor_output_value_with_token_info(output_value, &token_info) @@ -1025,7 +991,7 @@ fn to_trezor_output_msg( ); match additional_info { - Some(UtxoAdditionalInfo::AnyoneCanTake { ask, give }) => { + Some(UtxoAdditionalInfo::CreateOrder { ask, give }) => { out_req.ask = Some(to_trezor_output_value_with_token_info( data.ask(), &ask.as_ref(), diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 101bc03d94..26cd47d4c2 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use core::panic; use std::ops::{Add, Div, Mul, Sub}; use super::*; @@ -26,7 +27,8 @@ use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock; use common::chain::tokens::{NftIssuanceV0, TokenId}; use common::chain::{ - AccountNonce, AccountOutPoint, DelegationId, GenBlock, OrderData, PoolId, Transaction, TxInput, + AccountNonce, AccountOutPoint, DelegationId, Destination, GenBlock, OrderData, PoolId, + Transaction, TxInput, }; use common::primitives::per_thousand::PerThousand; use common::primitives::{Amount, BlockHeight, Id, H256}; @@ -86,9 +88,15 @@ fn sign_message(#[case] seed: Seed) { #[trace] #[case(Seed::from_entropy())] fn sign_transaction(#[case] seed: Seed) { - use common::chain::{ - tokens::{IsTokenUnfreezable, Metadata, TokenIssuanceV1}, - OrderId, + use std::num::NonZeroU8; + + use common::{ + chain::{ + classic_multisig::ClassicMultisigChallenge, + tokens::{IsTokenUnfreezable, Metadata, TokenIssuanceV1}, + OrderId, + }, + primitives::amount::UnsignedIntType, }; use crypto::vrf::VRFPrivateKey; use serialization::extras::non_empty_vec::DataOrNoVec; @@ -113,9 +121,8 @@ fn sign_transaction(#[case] seed: Seed) { .unwrap(); let mut account = Account::new(chain_config.clone(), &mut db_tx, key_chain, None).unwrap(); - let amounts: Vec = (0..3) //(0..(2 + rng.next_u32() % 5)) - // .map(|_| Amount::from_atoms(rng.next_u32() as UnsignedIntType)) - .map(|_| Amount::from_atoms(1)) + let amounts: Vec = (0..(2 + rng.next_u32() % 5)) + .map(|_| Amount::from_atoms(rng.gen_range(1..10) as UnsignedIntType)) .collect(); let total_amount = amounts.iter().fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); @@ -147,6 +154,40 @@ fn sign_transaction(#[case] seed: Seed) { }) .collect(); + let (_dest_prv, pub_key1) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); + let pub_key2 = if let Destination::PublicKeyHash(pkh) = + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object() + { + account.find_corresponding_pub_key(&pkh).unwrap() + } else { + panic!("not a public key hash") + }; + let pub_key3 = if let Destination::PublicKeyHash(pkh) = + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object() + { + account.find_corresponding_pub_key(&pkh).unwrap() + } else { + panic!("not a public key hash") + }; + let min_required_signatures = 2; + let challenge = ClassicMultisigChallenge::new( + &chain_config, + NonZeroU8::new(min_required_signatures).unwrap(), + vec![pub_key1, pub_key2, pub_key3], + ) + .unwrap(); + let multisig_hash = account.add_standalone_multisig(&mut db_tx, challenge, None).unwrap(); + + let multisig_dest = Destination::ClassicMultisig(multisig_hash); + + let source_id = if rng.gen_bool(0.5) { + Id::::new(H256::random_using(&mut rng)).into() + } else { + Id::::new(H256::random_using(&mut rng)).into() + }; + let multisig_input = TxInput::from_utxo(source_id, rng.next_u32()); + let multisig_utxo = TxOutput::Transfer(OutputValue::Coin(Amount::from_atoms(1)), multisig_dest); + let acc_inputs = vec![ TxInput::Account(AccountOutPoint::new( AccountNonce::new(1), @@ -196,7 +237,7 @@ fn sign_transaction(#[case] seed: Seed) { AccountNonce::new(rng.next_u64()), AccountCommand::FillOrder( OrderId::new(H256::random_using(&mut rng)), - OutputValue::Coin(Amount::from_atoms(123)), + Amount::from_atoms(123), Destination::AnyoneCanSpend, ), ), @@ -304,19 +345,21 @@ fn sign_transaction(#[case] seed: Seed) { ), TxOutput::DataDeposit(vec![1, 2, 3]), TxOutput::Htlc(OutputValue::Coin(burn_amount), Box::new(hash_lock)), - TxOutput::AnyoneCanTake(Box::new(order_data)), + TxOutput::CreateOrder(Box::new(order_data)), TxOutput::Transfer( OutputValue::Coin(Amount::from_atoms(100_000_000_000)), account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), ), ]; - let nft = TxOutput::IssueNft(nft_id, Box::new(nft_issuance), Destination::AnyoneCanSpend); - eprintln!("encoded nft: {:?}", nft.encode()); - let req = SendRequest::new() .with_inputs(inputs.clone().into_iter().zip(utxos.clone()), &|_| None) .unwrap() + .with_inputs( + [multisig_input.clone()].into_iter().zip([multisig_utxo.clone()]), + &|_| None, + ) + .unwrap() .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); let destinations = req.destinations().to_vec(); @@ -333,16 +376,18 @@ fn sign_transaction(#[case] seed: Seed) { eprintln!("num inputs in tx: {} {:?}", inputs.len(), ptx.witnesses()); assert!(ptx.all_signatures_available()); - let sig_tx = ptx.into_signed_tx().unwrap(); - - let utxos_ref = - utxos.iter().map(Some).chain(acc_dests.iter().map(|_| None)).collect::>(); + let utxos_ref = utxos + .iter() + .map(Some) + .chain([Some(&multisig_utxo)]) + .chain(acc_dests.iter().map(|_| None)) + .collect::>(); for (i, dest) in destinations.iter().enumerate() { tx_verifier::input_check::signature_only_check::verify_tx_signature( &chain_config, dest, - &sig_tx, + &ptx, &utxos_ref, i, ) diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 6a034944a8..c74fba6488 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -1435,6 +1435,7 @@ where current_fee_rate, consolidate_fee_rate, |_s| (), + additional_utxo_infos, )? .0) } @@ -1460,6 +1461,7 @@ where current_fee_rate, consolidate_fee_rate, |send_request| send_request.destinations().to_owned(), + &BTreeMap::new(), // FIXME )?; let signed_intent = self.for_account_rw_unlocked( @@ -1491,6 +1493,7 @@ where current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, additional_data_getter: impl Fn(&SendRequest) -> AddlData, + additional_utxo_infos: &BTreeMap, ) -> WalletResult<(SignedTransaction, AddlData)> { let request = SendRequest::new().with_outputs(outputs); let latest_median_time = self.latest_median_time; @@ -1912,7 +1915,7 @@ where account.decommission_stake_pool( db_tx, pool_id, - pool_balance, + staker_balance, output_address, current_fee_rate, )?, @@ -1989,6 +1992,7 @@ where ) } + #[allow(clippy::too_many_arguments)] pub fn create_order_tx( &mut self, account_index: U31, @@ -1997,12 +2001,12 @@ where conclude_key: Address, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult<(OrderId, SignedTransaction)> { let latest_median_time = self.latest_median_time; let tx = self.for_account_rw_unlocked_and_check_tx( account_index, - //FIXME - &BTreeMap::new(), + additional_utxo_infos, |account, db_tx| { account.create_order_tx( db_tx, @@ -2022,6 +2026,7 @@ where Ok((order_id, tx)) } + #[allow(clippy::too_many_arguments)] pub fn create_conclude_order_tx( &mut self, account_index: U31, @@ -2030,11 +2035,12 @@ where output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - &BTreeMap::new(), + additional_utxo_infos, |account, db_tx| { account.create_conclude_order_tx( db_tx, @@ -2061,11 +2067,12 @@ where output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - &BTreeMap::new(), + additional_utxo_infos, |account, db_tx| { account.create_fill_order_tx( db_tx, diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 893e4e7621..7cbaf29456 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -5330,6 +5330,13 @@ fn create_order(#[case] seed: Seed) { // Create an order selling tokens for coins let ask_value = OutputValue::Coin(Amount::from_atoms(111)); let give_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let (_, create_order_tx) = wallet .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5338,6 +5345,7 @@ fn create_order(#[case] seed: Seed) { address2.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); @@ -5448,6 +5456,13 @@ fn create_order_and_conclude(#[case] seed: Seed) { // Create an order selling tokens for coins let ask_value = OutputValue::Coin(Amount::from_atoms(111)); let give_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let (order_id, create_order_tx) = wallet .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5456,6 +5471,7 @@ fn create_order_and_conclude(#[case] seed: Seed) { address2.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); let order_info = RpcOrderInfo { @@ -5484,6 +5500,13 @@ fn create_order_and_conclude(#[case] seed: Seed) { assert_eq!(coin_balance, expected_balance); assert!(token_balances.is_empty()); + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let conclude_order_tx = wallet .create_conclude_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5492,6 +5515,7 @@ fn create_order_and_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); @@ -5621,6 +5645,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { let ask_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); let sell_amount = Amount::from_atoms(1000); let give_value = OutputValue::Coin(sell_amount); + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let (order_id, create_order_tx) = wallet1 .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5629,6 +5660,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { address1.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); let order_info = RpcOrderInfo { @@ -5671,6 +5703,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { Some(&(issued_token_id, token_amount_to_mint)) ); } + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); // Fill order partially let fill_order_tx_1 = wallet2 @@ -5682,6 +5721,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); @@ -5729,6 +5769,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { nonce: Some(AccountNonce::new(0)), }; + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let fill_order_tx_2 = wallet2 .create_fill_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5738,6 +5785,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); @@ -5778,6 +5826,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { ask_balance: Amount::ZERO, nonce: Some(AccountNonce::new(1)), }; + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let conclude_order_tx = wallet1 .create_conclude_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5786,6 +5841,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); @@ -5926,6 +5982,13 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { let ask_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); let sell_amount = Amount::from_atoms(1000); let give_value = OutputValue::Coin(sell_amount); + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let (order_id, create_order_tx) = wallet1 .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5934,6 +5997,7 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { address1.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); let order_info = RpcOrderInfo { @@ -5977,6 +6041,13 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { ); } + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); // Fill order partially let fill_order_tx_1 = wallet2 .create_fill_order_tx( @@ -5987,6 +6058,7 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); @@ -6034,6 +6106,13 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { nonce: Some(AccountNonce::new(0)), }; + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(issued_token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: unconfirmed_token_info.num_decimals(), + ticker: unconfirmed_token_info.token_ticker().to_vec(), + }), + )]); let conclude_order_tx = wallet1 .create_conclude_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -6042,6 +6121,7 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), + &additional_info, ) .unwrap(); diff --git a/wallet/types/src/partially_signed_transaction.rs b/wallet/types/src/partially_signed_transaction.rs index 9b17a5c3c5..44e7336f09 100644 --- a/wallet/types/src/partially_signed_transaction.rs +++ b/wallet/types/src/partially_signed_transaction.rs @@ -55,7 +55,7 @@ pub enum UtxoAdditionalInfo { PoolInfo { staker_balance: Amount, }, - AnyoneCanTake { + CreateOrder { ask: Option, give: Option, }, diff --git a/wallet/types/src/wallet_type.rs b/wallet/types/src/wallet_type.rs index 99d3110f9e..2b84a0a3b5 100644 --- a/wallet/types/src/wallet_type.rs +++ b/wallet/types/src/wallet_type.rs @@ -43,7 +43,7 @@ impl Display for WalletControllerMode { } impl WalletType { - /// Check if current Wallet type is compatible to be oppened as the other wallet type + /// Check if current Wallet type is compatible to be opened as the other wallet type pub fn is_compatible(&self, other: WalletControllerMode) -> bool { match (*self, other) { (Self::Hot, WalletControllerMode::Hot) | (Self::Cold, WalletControllerMode::Cold) => { diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index 9f647036d7..de8378c37a 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -41,13 +41,15 @@ use wallet_rpc_lib::types::{ RpcValidatedSignatures, TokenMetadata, }; +#[cfg(feature = "trezor")] +use crate::helper_types::CliHardwareWalletType; #[cfg(feature = "trezor")] use wallet_rpc_lib::types::HardwareWalletType; use wallet_types::partially_signed_transaction::PartiallySignedTransaction; use crate::{ errors::WalletCliCommandError, helper_types::parse_generic_token_transfer, - helper_types::CliHardwareWalletType, ManageableWalletCommand, WalletManagementCommand, + ManageableWalletCommand, WalletManagementCommand, }; use self::local_state::WalletWithState; @@ -150,10 +152,9 @@ where passphrase, hardware_wallet, } => { - let hardware_wallet = hardware_wallet.and_then(|t| match t { + let hardware_wallet = hardware_wallet.map(|t| match t { #[cfg(feature = "trezor")] - CliHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), - CliHardwareWalletType::None => None, + CliHardwareWalletType::Trezor => HardwareWalletType::Trezor, }); let newly_generated_mnemonic = self @@ -161,7 +162,7 @@ where .await? .create_wallet( wallet_path, - whether_to_store_seed_phrase.to_bool(), + whether_to_store_seed_phrase.map_or(false, |x| x.to_bool()), mnemonic, passphrase, hardware_wallet, @@ -206,18 +207,16 @@ where passphrase, hardware_wallet, } => { - let hardware_wallet = hardware_wallet.and_then(|t| match t { + let hardware_wallet = hardware_wallet.map(|t| match t { #[cfg(feature = "trezor")] - CliHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), - CliHardwareWalletType::None => None, + CliHardwareWalletType::Trezor => HardwareWalletType::Trezor, }); - let newly_generated_mnemonic = self - .wallet() + self.wallet() .await? .recover_wallet( wallet_path, - whether_to_store_seed_phrase.to_bool(), + whether_to_store_seed_phrase.map_or(false, |x| x.to_bool()), mnemonic, passphrase, hardware_wallet, @@ -226,32 +225,11 @@ where self.wallet.update_wallet::().await; - let msg = match newly_generated_mnemonic.mnemonic { - MnemonicInfo::NewlyGenerated { - mnemonic, - passphrase, - } => { - let passphrase = if let Some(passphrase) = passphrase { - format!("passphrase: {passphrase}\n") - } else { - String::new() - }; - format!( - "New wallet created successfully\nYour mnemonic: {}\n{passphrase}\ - Please write it somewhere safe to be able to restore your wallet. \ - It's recommended that you attempt to recover the wallet now as practice\ - to check that you arrive at the same addresses, \ - to ensure that you have done everything correctly. - ", - mnemonic - ) - } - MnemonicInfo::UserProvided => "New wallet created successfully".to_owned(), - }; + let msg = "Wallet recovered successfully"; Ok(ConsoleCommand::SetStatus { status: self.repl_status().await?, - print_message: msg, + print_message: msg.to_owned(), }) } @@ -261,10 +239,9 @@ where force_change_wallet_type, hardware_wallet, } => { - let hardware_wallet = hardware_wallet.and_then(|t| match t { + let hardware_wallet = hardware_wallet.map(|t| match t { #[cfg(feature = "trezor")] - CliHardwareWalletType::Trezor => Some(HardwareWalletType::Trezor), - CliHardwareWalletType::None => None, + CliHardwareWalletType::Trezor => HardwareWalletType::Trezor, }); self.wallet() .await? diff --git a/wallet/wallet-cli-commands/src/helper_types.rs b/wallet/wallet-cli-commands/src/helper_types.rs index b484102d96..42c76cde4d 100644 --- a/wallet/wallet-cli-commands/src/helper_types.rs +++ b/wallet/wallet-cli-commands/src/helper_types.rs @@ -436,7 +436,6 @@ impl YesNo { #[derive(Debug, Clone, Copy, ValueEnum)] pub enum CliHardwareWalletType { - None, #[cfg(feature = "trezor")] Trezor, } diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index 1668d3905b..6109999224 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -54,7 +54,8 @@ pub enum WalletManagementCommand { /// Not storing the seed-phrase can be seen as a security measure /// to ensure sufficient secrecy in case that seed-phrase is reused /// elsewhere if this wallet is compromised. - whether_to_store_seed_phrase: CliStoreSeedPhrase, + #[arg(required_unless_present("hardware_wallet"))] + whether_to_store_seed_phrase: Option, /// Mnemonic phrase (12, 15, or 24 words as a single quoted argument). If not specified, a new mnemonic phrase is generated and printed. mnemonic: Option, @@ -79,7 +80,8 @@ pub enum WalletManagementCommand { /// Not storing the seed-phrase can be seen as a security measure /// to ensure sufficient secrecy in case that seed-phrase is reused /// elsewhere if this wallet is compromised. - whether_to_store_seed_phrase: CliStoreSeedPhrase, + #[arg(required_unless_present("hardware_wallet"))] + whether_to_store_seed_phrase: Option, /// Mnemonic phrase (12, 15, or 24 words as a single quoted argument). If not specified, a new mnemonic phrase is generated and printed. mnemonic: Option, diff --git a/wallet/wallet-cli-lib/tests/cli_test_framework.rs b/wallet/wallet-cli-lib/tests/cli_test_framework.rs index 0b88cd8406..2e559a08bf 100644 --- a/wallet/wallet-cli-lib/tests/cli_test_framework.rs +++ b/wallet/wallet-cli-lib/tests/cli_test_framework.rs @@ -201,7 +201,7 @@ impl CliTestFramework { "wallet-recover \"{}\" store-seed-phrase \"{}\"", file_name, MNEMONIC ); - assert_eq!(self.exec(&cmd), "New wallet created successfully"); + assert_eq!(self.exec(&cmd), "Wallet recovered successfully"); } #[allow(dead_code)] diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index b8a25aee1e..f0d3134b9c 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -32,12 +32,14 @@ use futures::{ }; use node_comm::node_traits::NodeInterface; use wallet::{ - account::currency_grouper::Currency, destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, WalletError, }; -use wallet_types::partially_signed_transaction::{ - PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, +use wallet_types::{ + partially_signed_transaction::{ + PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + }, + Currency, }; use crate::{runtime_wallet::RuntimeWallet, types::Balances, ControllerError}; @@ -127,7 +129,7 @@ fn pool_id_from_txo(utxo: &TxOutput) -> Option { | TxOutput::Transfer(_, _) | TxOutput::LockThenTransfer(_, _, _) | TxOutput::Htlc(_, _) - | TxOutput::AnyoneCanTake(_) + | TxOutput::CreateOrder(_) | TxOutput::IssueNft(_, _, _) | TxOutput::IssueFungibleToken(_) | TxOutput::DelegateStaking(_, _) @@ -172,10 +174,10 @@ where .map(UtxoAdditionalInfo::TokenInfo); Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) } - TxOutput::AnyoneCanTake(order) => { + TxOutput::CreateOrder(order) => { let ask = fetch_token_extra_info(rpc_client, order.ask()).await?; let give = fetch_token_extra_info(rpc_client, order.ask()).await?; - let additional_info = Some(UtxoAdditionalInfo::AnyoneCanTake { ask, give }); + let additional_info = Some(UtxoAdditionalInfo::CreateOrder { ask, give }); Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) } TxOutput::ProduceBlockFromStake(_, pool_id) => { diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 6556a03051..3674aa21cb 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -101,7 +101,6 @@ pub use wallet_types::{ }; use wallet_types::{ partially_signed_transaction::{PartiallySignedTransaction, UtxoWithAdditionalInfo}, - seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, wallet_type::{WalletControllerMode, WalletType}, with_locked::WithLocked, diff --git a/wallet/wallet-controller/src/read.rs b/wallet/wallet-controller/src/read.rs index 0ac5d48e84..bd0ee4220c 100644 --- a/wallet/wallet-controller/src/read.rs +++ b/wallet/wallet-controller/src/read.rs @@ -30,10 +30,7 @@ use futures::{stream::FuturesUnordered, FutureExt, TryStreamExt}; use node_comm::node_traits::NodeInterface; use utils::tap_log::TapLog; use wallet::{ - account::{ - currency_grouper::Currency, transaction_list::TransactionList, DelegationData, PoolData, - TxInfo, - }, + account::{transaction_list::TransactionList, DelegationData, PoolData, TxInfo}, wallet::WalletPoolsFilter, }; use wallet_types::{ diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs index ac22c9b91f..63ab0ae5eb 100644 --- a/wallet/wallet-controller/src/runtime_wallet.rs +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -15,27 +15,24 @@ use std::collections::{BTreeMap, BTreeSet}; -use common::address::pubkeyhash::PublicKeyHash; -use common::address::Address; -use common::chain::classic_multisig::ClassicMultisigChallenge; -use common::chain::htlc::HashedTimelockContract; -use common::chain::output_value::OutputValue; -use common::chain::signature::inputsig::arbitrary_message::ArbitraryMessageSignature; -use common::chain::tokens::{ - IsTokenUnfreezable, Metadata, RPCFungibleTokenInfo, TokenId, TokenIssuance, +use common::{ + address::{pubkeyhash::PublicKeyHash, Address}, + chain::{ + classic_multisig::ClassicMultisigChallenge, + htlc::HashedTimelockContract, + output_value::OutputValue, + signature::inputsig::arbitrary_message::ArbitraryMessageSignature, + tokens::{IsTokenUnfreezable, Metadata, RPCFungibleTokenInfo, TokenId, TokenIssuance}, + DelegationId, Destination, GenBlock, OrderId, PoolId, RpcOrderInfo, SignedTransaction, + SignedTransactionIntent, Transaction, TxOutput, UtxoOutPoint, + }, + primitives::{id::WithId, Amount, BlockHeight, Id, H256}, }; -use common::chain::{ - DelegationId, Destination, GenBlock, PoolId, SignedTransaction, Transaction, TxOutput, - UtxoOutPoint, -}; -use common::primitives::id::WithId; -use common::primitives::{Amount, BlockHeight, Id, H256}; use crypto::key::hdkd::child_number::ChildNumber; use crypto::key::hdkd::u31::U31; use crypto::key::{PrivateKey, PublicKey}; use crypto::vrf::VRFPublicKey; use mempool::FeeRate; -use wallet::account::currency_grouper::Currency; use wallet::account::transaction_list::TransactionList; use wallet::account::{CoinSelectionAlgo, DelegationData, PoolData, TxInfo, UnconfirmedTokenInfo}; use wallet::send_request::{PoolOrTokenId, SelectedInputs, StakePoolDataArguments}; @@ -51,7 +48,7 @@ use wallet_types::signature_status::SignatureStatus; use wallet_types::utxo_types::{UtxoStates, UtxoTypes}; use wallet_types::wallet_tx::TxData; use wallet_types::with_locked::WithLocked; -use wallet_types::KeychainUsageState; +use wallet_types::{Currency, KeychainUsageState}; #[cfg(feature = "trezor")] use wallet::signer::trezor_signer::TrezorSignerProvider; @@ -1072,6 +1069,111 @@ impl RuntimeWallet { } } + #[allow(clippy::too_many_arguments)] + pub fn create_order_tx( + &mut self, + account_index: U31, + ask_value: OutputValue, + give_value: OutputValue, + conclude_key: Address, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, + ) -> WalletResult<(OrderId, SignedTransaction)> { + match self { + RuntimeWallet::Software(w) => w.create_order_tx( + account_index, + ask_value, + give_value, + conclude_key, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_order_tx( + account_index, + ask_value, + give_value, + conclude_key, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + } + } + + #[allow(clippy::too_many_arguments)] + pub fn create_conclude_order_tx( + &mut self, + account_index: U31, + order_id: OrderId, + order_info: RpcOrderInfo, + output_address: Option, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_conclude_order_tx( + account_index, + order_id, + order_info, + output_address, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_conclude_order_tx( + account_index, + order_id, + order_info, + output_address, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + } + } + + #[allow(clippy::too_many_arguments)] + pub fn create_fill_order_tx( + &mut self, + account_index: U31, + order_id: OrderId, + order_info: RpcOrderInfo, + fill_amount_in_ask_currency: Amount, + output_address: Option, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, + ) -> WalletResult { + match self { + RuntimeWallet::Software(w) => w.create_fill_order_tx( + account_index, + order_id, + order_info, + fill_amount_in_ask_currency, + output_address, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_fill_order_tx( + account_index, + order_id, + order_info, + fill_amount_in_ask_currency, + output_address, + current_fee_rate, + consolidate_fee_rate, + additional_utxo_infos, + ), + } + } + pub fn sign_raw_transaction( &mut self, account_index: U31, @@ -1091,8 +1193,8 @@ impl RuntimeWallet { pub fn sign_challenge( &mut self, account_index: U31, - challenge: Vec, - destination: Destination, + challenge: &[u8], + destination: &Destination, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.sign_challenge(account_index, challenge, destination), @@ -1101,6 +1203,40 @@ impl RuntimeWallet { } } + #[allow(clippy::too_many_arguments)] + pub fn create_transaction_to_addresses_with_intent( + &mut self, + account_index: U31, + outputs: impl IntoIterator, + inputs: SelectedInputs, + change_addresses: BTreeMap>, + intent: String, + current_fee_rate: FeeRate, + consolidate_fee_rate: FeeRate, + ) -> WalletResult<(SignedTransaction, SignedTransactionIntent)> { + match self { + RuntimeWallet::Software(w) => w.create_transaction_to_addresses_with_intent( + account_index, + outputs, + inputs, + change_addresses, + intent, + current_fee_rate, + consolidate_fee_rate, + ), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w.create_transaction_to_addresses_with_intent( + account_index, + outputs, + inputs, + change_addresses, + intent, + current_fee_rate, + consolidate_fee_rate, + ), + } + } + pub fn add_unconfirmed_tx( &mut self, tx: SignedTransaction, diff --git a/wallet/wallet-controller/src/sync/tests/mod.rs b/wallet/wallet-controller/src/sync/tests/mod.rs index 61f77b1893..370fd2ee2d 100644 --- a/wallet/wallet-controller/src/sync/tests/mod.rs +++ b/wallet/wallet-controller/src/sync/tests/mod.rs @@ -25,7 +25,7 @@ use chainstate_test_framework::TestFramework; use common::{ chain::{ tokens::{RPCTokenInfo, TokenId}, - DelegationId, OrderId, PoolId, RpcOrderInfo, SignedTransaction, Transaction, + DelegationId, Destination, OrderId, PoolId, RpcOrderInfo, SignedTransaction, Transaction, }, primitives::{time::Time, Amount}, }; diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 105d1677be..3f959d16be 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -39,6 +39,7 @@ use crypto::{ vrf::VRFPublicKey, }; use futures::{stream::FuturesUnordered, TryStreamExt}; +use itertools::Itertools; use logging::log; use mempool::FeeRate; use node_comm::node_traits::NodeInterface; @@ -990,10 +991,10 @@ where ) -> Result<(SignedTransaction, SignedTransactionIntent), ControllerError> { let output = make_address_output_token(address, amount, token_info.token_id()); self.create_token_tx( - &token_info, + token_info, move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut RuntimeWallet, account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; @@ -1125,11 +1126,14 @@ where ask_value: OutputValue, give_value: OutputValue, conclude_key: Address, + token_infos: Vec, ) -> Result<(SignedTransaction, OrderId), ControllerError> { + let additional_info = self.additional_token_infos(token_infos)?; + self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut RuntimeWallet, account_index: U31| { wallet.create_order_tx( account_index, @@ -1138,6 +1142,7 @@ where conclude_key, current_fee_rate, consolidate_fee_rate, + &additional_info, ) }, ) @@ -1149,11 +1154,13 @@ where order_id: OrderId, order_info: RpcOrderInfo, output_address: Option, + token_infos: Vec, ) -> Result> { + let additional_info = self.additional_token_infos(token_infos)?; self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut RuntimeWallet, account_index: U31| { wallet.create_conclude_order_tx( account_index, @@ -1162,6 +1169,7 @@ where output_address, current_fee_rate, consolidate_fee_rate, + &additional_info, ) }, ) @@ -1174,11 +1182,13 @@ where order_info: RpcOrderInfo, fill_amount_in_ask_currency: Amount, output_address: Option, + token_infos: Vec, ) -> Result> { + let additional_info = self.additional_token_infos(token_infos)?; self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - wallet: &mut DefaultWallet, + wallet: &mut RuntimeWallet, account_index: U31| { wallet.create_fill_order_tx( account_index, @@ -1188,12 +1198,33 @@ where output_address, current_fee_rate, consolidate_fee_rate, + &additional_info, ) }, ) .await } + fn additional_token_infos( + &mut self, + token_infos: Vec, + ) -> Result, ControllerError> { + token_infos + .into_iter() + .map(|token_info| { + let token_info = self.unconfiremd_token_info(token_info)?; + + Ok(( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }), + )) + }) + .try_collect() + } + /// Checks if the wallet has stake pools and marks this account for staking. pub fn start_staking(&mut self) -> Result<(), ControllerError> { utils::ensure!(!self.wallet.is_locked(), ControllerError::WalletIsLocked); @@ -1314,7 +1345,7 @@ where /// Create a transaction that uses a token, check if that token can be used i.e. not frozen. async fn create_token_tx( &mut self, - token_info: &RPCTokenInfo, + token_info: RPCTokenInfo, tx_maker: F, ) -> Result> where @@ -1326,15 +1357,7 @@ where &UnconfirmedTokenInfo, ) -> WalletResult, { - // make sure we can use the token before create an tx using it - let token_freezable_info = match token_info { - RPCTokenInfo::FungibleToken(token_info) => { - self.wallet.get_token_unconfirmed_info(self.account_index, token_info)? - } - RPCTokenInfo::NonFungibleToken(info) => { - UnconfirmedTokenInfo::NonFungibleToken(info.token_id, info.as_ref().into()) - } - }; + let token_freezable_info = self.unconfiremd_token_info(token_info)?; let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; @@ -1357,19 +1380,34 @@ where F: FnOnce( FeeRate, FeeRate, - &mut DefaultWallet, + &mut RuntimeWallet, U31, &UnconfirmedTokenInfo, ) -> WalletResult, >( &mut self, - token_info: &RPCTokenInfo, + token_info: RPCTokenInfo, tx_maker: F, ) -> Result> { let tx = self.create_token_tx(token_info, tx_maker).await?; self.broadcast_to_mempool_if_needed(tx).await } + fn unconfiremd_token_info( + &mut self, + token_info: RPCTokenInfo, + ) -> Result> { + let token_freezable_info = match token_info { + RPCTokenInfo::FungibleToken(token_info) => { + self.wallet.get_token_unconfirmed_info(self.account_index, token_info)? + } + RPCTokenInfo::NonFungibleToken(info) => { + UnconfirmedTokenInfo::NonFungibleToken(info.token_id, info.as_ref().into()) + } + }; + Ok(token_freezable_info) + } + /// Similar to create_and_send_tx but some transactions also create an ID /// e.g. newly issued token, nft or delegation id async fn create_and_send_tx_with_id< diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 7c60805ba4..2a2fe37377 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -19,9 +19,8 @@ use chainstate::{rpc::RpcOutputValueIn, ChainInfo}; use common::{ address::{dehexify::dehexify_all_addresses, AddressError}, chain::{ - block::timestamp::BlockTimestamp, partially_signed_transaction::PartiallySignedTransaction, - tokens::IsTokenUnfreezable, Block, GenBlock, SignedTransaction, SignedTransactionIntent, - Transaction, TxOutput, UtxoOutPoint, + block::timestamp::BlockTimestamp, tokens::IsTokenUnfreezable, Block, GenBlock, + SignedTransaction, SignedTransactionIntent, Transaction, TxOutput, UtxoOutPoint, }, primitives::{BlockHeight, DecimalAmount, Id, Idable, H256}, }; diff --git a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs index 38010f1fcf..c51502d8e0 100644 --- a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs @@ -24,9 +24,8 @@ use super::{ClientWalletRpc, WalletRpcError}; use chainstate::{rpc::RpcOutputValueIn, ChainInfo}; use common::{ chain::{ - block::timestamp::BlockTimestamp, partially_signed_transaction::PartiallySignedTransaction, - Block, GenBlock, SignedTransaction, SignedTransactionIntent, Transaction, TxOutput, - UtxoOutPoint, + block::timestamp::BlockTimestamp, Block, GenBlock, SignedTransaction, + SignedTransactionIntent, Transaction, TxOutput, UtxoOutPoint, }, primitives::{BlockHeight, DecimalAmount, Id}, }; diff --git a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs index 0d99a2270e..ff5c3a0f59 100644 --- a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs +++ b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs @@ -18,9 +18,8 @@ use std::{collections::BTreeMap, num::NonZeroUsize, path::PathBuf}; use chainstate::{rpc::RpcOutputValueIn, ChainInfo}; use common::{ chain::{ - block::timestamp::BlockTimestamp, partially_signed_transaction::PartiallySignedTransaction, - Block, GenBlock, SignedTransaction, SignedTransactionIntent, Transaction, TxOutput, - UtxoOutPoint, + block::timestamp::BlockTimestamp, Block, GenBlock, SignedTransaction, + SignedTransactionIntent, Transaction, TxOutput, UtxoOutPoint, }, primitives::{BlockHeight, DecimalAmount, Id}, }; diff --git a/wallet/wallet-rpc-daemon/docs/RPC.md b/wallet/wallet-rpc-daemon/docs/RPC.md index 6d6a589601..859101fe45 100644 --- a/wallet/wallet-rpc-daemon/docs/RPC.md +++ b/wallet/wallet-rpc-daemon/docs/RPC.md @@ -2707,7 +2707,9 @@ Parameters: "passphrase": EITHER OF 1) string 2) null, - "hardware_wallet": null, + "hardware_wallet": EITHER OF + 1) "Trezor" + 2) null, } ``` @@ -2742,7 +2744,9 @@ Parameters: "passphrase": EITHER OF 1) string 2) null, - "hardware_wallet": null, + "hardware_wallet": EITHER OF + 1) "Trezor" + 2) null, } ``` @@ -2776,7 +2780,9 @@ Parameters: "force_migrate_wallet_type": EITHER OF 1) bool 2) null, - "hardware_wallet": null, + "hardware_wallet": EITHER OF + 1) "Trezor" + 2) null, } ``` diff --git a/wallet/wallet-rpc-lib/Cargo.toml b/wallet/wallet-rpc-lib/Cargo.toml index c97addeafd..bc20422508 100644 --- a/wallet/wallet-rpc-lib/Cargo.toml +++ b/wallet/wallet-rpc-lib/Cargo.toml @@ -51,4 +51,4 @@ wallet-types = { path = "../types" } rstest.workspace = true [features] -trezor = ["wallet-types/trezor"] +trezor = ["wallet-types/trezor", "wallet/trezor", "wallet-controller/trezor"] diff --git a/wallet/wallet-rpc-lib/src/rpc/interface.rs b/wallet/wallet-rpc-lib/src/rpc/interface.rs index ab4596308e..3a05f146b4 100644 --- a/wallet/wallet-rpc-lib/src/rpc/interface.rs +++ b/wallet/wallet-rpc-lib/src/rpc/interface.rs @@ -19,10 +19,9 @@ use chainstate::rpc::RpcOutputValueIn; use common::{ address::RpcAddress, chain::{ - block::timestamp::BlockTimestamp, tokens::TokenId, - transaction::partially_signed_transaction::PartiallySignedTransaction, Block, DelegationId, - Destination, GenBlock, OrderId, PoolId, SignedTransaction, SignedTransactionIntent, - Transaction, TxOutput, + block::timestamp::BlockTimestamp, tokens::TokenId, Block, DelegationId, Destination, + GenBlock, OrderId, PoolId, SignedTransaction, SignedTransactionIntent, Transaction, + TxOutput, }, primitives::{BlockHeight, Id}, }; diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index 4449a361c4..d24f82edcf 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -53,7 +53,9 @@ use common::{ signature::inputsig::arbitrary_message::{ produce_message_challenge, ArbitraryMessageSignature, }, - tokens::{IsTokenFreezable, IsTokenUnfreezable, Metadata, TokenId, TokenTotalSupply}, + tokens::{ + IsTokenFreezable, IsTokenUnfreezable, Metadata, RPCTokenInfo, TokenId, TokenTotalSupply, + }, Block, ChainConfig, DelegationId, Destination, GenBlock, OrderId, PoolId, SignedTransaction, SignedTransactionIntent, Transaction, TxOutput, UtxoOutPoint, }, @@ -79,7 +81,6 @@ use wallet_types::{ partially_signed_transaction::{ PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, }, - seed_phrase::StoreSeedPhrase, signature_status::SignatureStatus, wallet_tx::TxData, with_locked::WithLocked, @@ -1540,19 +1541,19 @@ where currency: Currency, amount: RpcAmountIn, coin_decimals: u8, - ) -> Result> { + ) -> Result<(OutputValue, Option), RpcError> { match currency { Currency::Coin => { let amount = amount.to_amount(coin_decimals).ok_or(RpcError::::InvalidCoinAmount)?; - Ok::<_, RpcError>(OutputValue::Coin(amount)) + Ok::<_, RpcError>((OutputValue::Coin(amount), None)) } Currency::Token(token_id) => { let token_info = controller.get_token_info(token_id).await?; let amount = amount .to_amount(token_info.token_number_of_decimals()) .ok_or(RpcError::InvalidCoinAmount)?; - Ok(OutputValue::TokenV1(token_id, amount)) + Ok((OutputValue::TokenV1(token_id, amount), Some(token_info))) } } } @@ -1589,14 +1590,14 @@ where self.wallet .call_async(move |controller| { Box::pin(async move { - let ask_value = Self::convert_currency_to_output_value( + let (ask_value, ask_token_info) = Self::convert_currency_to_output_value( controller, ask_currency, ask_amount, coin_decimals, ) .await?; - let give_value = Self::convert_currency_to_output_value( + let (give_value, give_token_info) = Self::convert_currency_to_output_value( controller, give_currency, give_amount, @@ -1604,10 +1605,12 @@ where ) .await?; + let token_infos = ask_token_info.into_iter().chain(give_token_info).collect(); + controller .synced_controller(account_index, config) .await? - .create_order(ask_value, give_value, conclude_dest) + .create_order(ask_value, give_value, conclude_dest, token_infos) .await .map_err(RpcError::Controller) }) @@ -1639,9 +1642,23 @@ where Box::pin(async move { let order_info = w.get_order_info(order_id).await?; + let ask_token_info = + if let Some(token_id) = order_info.initially_asked.token_id() { + Some(w.get_token_info(token_id).await?) + } else { + None + }; + let give_token_info = + if let Some(token_id) = order_info.initially_given.token_id() { + Some(w.get_token_info(token_id).await?) + } else { + None + }; + let token_infos = ask_token_info.into_iter().chain(give_token_info).collect(); + w.synced_controller(account_index, config) .await? - .conclude_order(order_id, order_info, output_address) + .conclude_order(order_id, order_info, output_address, token_infos) .await .map_err(RpcError::Controller) .map(NewTransaction::new) @@ -1670,17 +1687,32 @@ where .call_async(move |w| { Box::pin(async move { let order_info = w.get_order_info(order_id).await?; - let fill_amount_in_ask_currency = match order_info.initially_asked { - RpcOutputValue::Coin { .. } => fill_amount_in_ask_currency - .to_amount(coin_decimals) - .ok_or(RpcError::::InvalidCoinAmount)?, - RpcOutputValue::Token { id, amount: _ } => { - let token_info = w.get_token_info(id).await?; - fill_amount_in_ask_currency - .to_amount(token_info.token_number_of_decimals()) - .ok_or(RpcError::InvalidCoinAmount)? - } - }; + let (fill_amount_in_ask_currency, ask_token_info) = + match order_info.initially_asked { + RpcOutputValue::Coin { .. } => ( + fill_amount_in_ask_currency + .to_amount(coin_decimals) + .ok_or(RpcError::::InvalidCoinAmount)?, + None, + ), + RpcOutputValue::Token { id, amount: _ } => { + let token_info = w.get_token_info(id).await?; + ( + fill_amount_in_ask_currency + .to_amount(token_info.token_number_of_decimals()) + .ok_or(RpcError::InvalidCoinAmount)?, + Some(token_info), + ) + } + }; + let give_token_info = + if let Some(token_id) = order_info.initially_given.token_id() { + Some(w.get_token_info(token_id).await?) + } else { + None + }; + + let token_infos = ask_token_info.into_iter().chain(give_token_info).collect(); w.synced_controller(account_index, config) .await? @@ -1689,6 +1721,7 @@ where order_info, fill_amount_in_ask_currency, output_address, + token_infos, ) .await .map_err(RpcError::Controller) diff --git a/wallet/wallet-rpc-lib/src/rpc/types.rs b/wallet/wallet-rpc-lib/src/rpc/types.rs index 6df103beee..13e2c63d2d 100644 --- a/wallet/wallet-rpc-lib/src/rpc/types.rs +++ b/wallet/wallet-rpc-lib/src/rpc/types.rs @@ -93,7 +93,7 @@ pub enum RpcError { #[error("Invalid mnemonic: {0}")] InvalidMnemonic(wallet_controller::mnemonic::Error), - #[error("Cannont recover a software wallet without providing a mnemonic")] + #[error("Cannot recover a software wallet without providing a mnemonic")] EmptyMnemonic, #[error("Cannot specify a mnemonic or passphrase when using a hardware wallet")] diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index 2fe7345185..8acfac81b4 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -191,7 +191,6 @@ where self.controller.is_none(), ControllerError::WalletFileAlreadyOpen ); - // let newly_generated_mnemonic = !args.user_supplied_menmonic(); let wallet_type = args.wallet_type(self.node_rpc.is_cold_wallet_node()); let (computed_args, wallet_created) = args.parse_mnemonic().map_err(RpcError::InvalidMnemonic)?; From 2e88f4b217b490d3ba775edcf076cae757bba1cc Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Thu, 31 Oct 2024 10:05:43 +0100 Subject: [PATCH 40/48] Update trezor dependency and new messages --- Cargo.lock | 2 +- wallet/src/signer/trezor_signer/mod.rs | 165 ++++++++++++++----------- 2 files changed, 93 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1363f486ed..5de63be111 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8377,7 +8377,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#1e4b2959ea0b230f7a4102b2eaec57ed2b66b8f4" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#4bcd130f1203a1f0d372c7bb7cb5ee656032dafc" dependencies = [ "bitcoin", "byteorder", diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index a88450ed54..c26255633e 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -44,7 +44,7 @@ use common::{ AccountCommand, AccountSpending, ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, TxOutput, }, - primitives::{Amount, H256}, + primitives::H256, }; use crypto::key::{ extended::ExtendedPublicKey, @@ -59,16 +59,15 @@ use trezor_client::{ find_devices, protos::{ MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerAddressPath, - MintlayerAnyoneCanTakeTxOutput, MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, - MintlayerChangeTokenMetadataUri, MintlayerConcludeOrder, - MintlayerCreateDelegationIdTxOutput, MintlayerCreateStakePoolTxOutput, - MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFillOrder, - MintlayerFreezeToken, MintlayerHtlcTxOutput, MintlayerIssueFungibleTokenTxOutput, - MintlayerIssueNftTxOutput, MintlayerLockThenTransferTxOutput, MintlayerLockTokenSupply, - MintlayerMintTokens, MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, - MintlayerTokenOutputValue, MintlayerTokenTotalSupply, MintlayerTokenTotalSupplyType, - MintlayerTxInput, MintlayerTxOutput, MintlayerUnfreezeToken, MintlayerUnmintTokens, - MintlayerUtxoType, + MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerChangeTokenMetadataUri, + MintlayerConcludeOrder, MintlayerCreateDelegationIdTxOutput, MintlayerCreateOrderTxOutput, + MintlayerCreateStakePoolTxOutput, MintlayerDataDepositTxOutput, + MintlayerDelegateStakingTxOutput, MintlayerFillOrder, MintlayerFreezeToken, + MintlayerHtlcTxOutput, MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, + MintlayerLockThenTransferTxOutput, MintlayerLockTokenSupply, MintlayerMintTokens, + MintlayerOutputValue, MintlayerProduceBlockFromStakeTxOutput, MintlayerTokenOutputValue, + MintlayerTokenTotalSupply, MintlayerTokenTotalSupplyType, MintlayerTxInput, + MintlayerTxOutput, MintlayerUnfreezeToken, MintlayerUnmintTokens, MintlayerUtxoType, }, Model, }; @@ -83,7 +82,7 @@ use wallet_storage::{ use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, partially_signed_transaction::{ - PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, }, signature_status::SignatureStatus, AccountId, @@ -484,34 +483,6 @@ impl Signer for TrezorSigner { } } -fn utxo_output_value(out: &UtxoWithAdditionalInfo) -> SignerResult { - match &out.utxo { - TxOutput::Transfer(value, _) - | TxOutput::Htlc(value, _) - | TxOutput::LockThenTransfer(value, _, _) => Ok(value.clone()), - TxOutput::IssueNft(token_id, _, _) => { - Ok(OutputValue::TokenV1(*token_id, Amount::from_atoms(1))) - } - TxOutput::CreateStakePool(_, data) => Ok(OutputValue::Coin(data.pledge())), - TxOutput::ProduceBlockFromStake(_, _) => match out.additional_info { - Some(UtxoAdditionalInfo::PoolInfo { staker_balance }) => { - Ok(OutputValue::Coin(staker_balance)) - } - Some( - UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } - | UtxoAdditionalInfo::TokenInfo(_), - ) - | None => Err(SignerError::MissingUtxoExtraInfo), - }, - TxOutput::CreateDelegationId(_, _) - | TxOutput::IssueFungibleToken(_) - | TxOutput::Burn(_) - | TxOutput::CreateOrder(_) - | TxOutput::DelegateStaking(_, _) - | TxOutput::DataDeposit(_) => Err(SignerError::InvalidUtxo), - } -} - fn to_trezor_input_msgs( ptx: &PartiallySignedTransaction, key_chain: &impl AccountKeyChains, @@ -523,8 +494,8 @@ fn to_trezor_input_msgs( .zip(ptx.input_utxos()) .zip(ptx.destinations()) .map(|((inp, utxo), dest)| match (inp, utxo, dest) { - (TxInput::Utxo(outpoint), Some(utxo), Some(dest)) => { - to_trezor_utxo_input(outpoint, utxo, chain_config, dest, key_chain) + (TxInput::Utxo(outpoint), Some(_), Some(dest)) => { + to_trezor_utxo_input(outpoint, chain_config, dest, key_chain) } (TxInput::Account(outpoint), _, Some(dest)) => Ok(to_trezor_account_input( chain_config, @@ -556,39 +527,51 @@ fn to_trezor_account_command_input( match command { AccountCommand::MintTokens(token_id, amount) => { let mut req = MintlayerMintTokens::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); inp_req.mint = Some(req).into(); } AccountCommand::UnmintTokens(token_id) => { let mut req = MintlayerUnmintTokens::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); inp_req.unmint = Some(req).into(); } AccountCommand::FreezeToken(token_id, unfreezable) => { let mut req = MintlayerFreezeToken::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); req.set_is_token_unfreezabe(unfreezable.as_bool()); inp_req.freeze_token = Some(req).into(); } AccountCommand::UnfreezeToken(token_id) => { let mut req = MintlayerUnfreezeToken::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); inp_req.unfreeze_token = Some(req).into(); } AccountCommand::LockTokenSupply(token_id) => { let mut req = MintlayerLockTokenSupply::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); inp_req.lock_token_supply = Some(req).into(); } AccountCommand::ChangeTokenAuthority(token_id, dest) => { let mut req = MintlayerChangeTokenAuhtority::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); req.set_destination( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -597,20 +580,26 @@ fn to_trezor_account_command_input( } AccountCommand::ChangeTokenMetadataUri(token_id, uri) => { let mut req = MintlayerChangeTokenMetadataUri::new(); - req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); req.set_metadata_uri(uri.clone()); inp_req.change_token_metadata_uri = Some(req).into(); } AccountCommand::ConcludeOrder(order_id) => { let mut req = MintlayerConcludeOrder::new(); - req.set_order_id(order_id.to_hash().as_bytes().to_vec()); + req.set_order_id( + Address::new(chain_config, *order_id).expect("addressable").into_string(), + ); inp_req.conclude_order = Some(req).into(); } AccountCommand::FillOrder(order_id, amount, dest) => { let mut req = MintlayerFillOrder::new(); - req.set_order_id(order_id.to_hash().as_bytes().to_vec()); + req.set_order_id( + Address::new(chain_config, *order_id).expect("addressable").into_string(), + ); req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); req.set_destination( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), @@ -637,7 +626,9 @@ fn to_trezor_account_input( inp_req.set_nonce(outpoint.nonce().value()); match outpoint.account() { AccountSpending::DelegationBalance(delegation_id, amount) => { - inp_req.set_delegation_id(delegation_id.to_hash().as_bytes().to_vec()); + inp_req.set_delegation_id( + Address::new(chain_config, *delegation_id).expect("addressable").into_string(), + ); let mut value = MintlayerOutputValue::new(); value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); inp_req.value = Some(value).into(); @@ -650,7 +641,6 @@ fn to_trezor_account_input( fn to_trezor_utxo_input( outpoint: &common::chain::UtxoOutPoint, - utxo: &UtxoWithAdditionalInfo, chain_config: &ChainConfig, dest: &Destination, key_chain: &impl AccountKeyChains, @@ -669,13 +659,6 @@ fn to_trezor_utxo_input( inp_req.set_prev_hash(id.to_vec()); inp_req.set_prev_index(outpoint.output_index()); - let output_value = utxo_output_value(utxo)?; - inp_req.value = Some(to_trezor_output_value( - &output_value, - &utxo.additional_info, - )?) - .into(); - inp_req .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); inp_req.address_n = destination_to_address_paths(key_chain, dest); @@ -742,6 +725,7 @@ fn destination_to_address_paths( fn to_trezor_output_value( output_value: &OutputValue, additional_info: &Option, + chain_config: &ChainConfig, ) -> SignerResult { let token_info = additional_info.as_ref().and_then(|info| match info { UtxoAdditionalInfo::TokenInfo(token_info) => Some(token_info), @@ -749,7 +733,7 @@ fn to_trezor_output_value( | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => None, }); - to_trezor_output_value_with_token_info(output_value, &token_info) + to_trezor_output_value_with_token_info(output_value, &token_info, chain_config) } fn to_trezor_utxo_msgs( @@ -786,7 +770,12 @@ fn to_trezor_output_msg( let res = match out { TxOutput::Transfer(value, dest) => { let mut out_req = MintlayerTransferTxOutput::new(); - out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); + out_req.value = Some(to_trezor_output_value( + value, + additional_info, + chain_config, + )?) + .into(); out_req.set_address( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -797,7 +786,12 @@ fn to_trezor_output_msg( } TxOutput::LockThenTransfer(value, dest, lock) => { let mut out_req = MintlayerLockThenTransferTxOutput::new(); - out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); + out_req.value = Some(to_trezor_output_value( + value, + additional_info, + chain_config, + )?) + .into(); out_req.set_address( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -810,7 +804,12 @@ fn to_trezor_output_msg( } TxOutput::Burn(value) => { let mut out_req = MintlayerBurnTxOutput::new(); - out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); + out_req.value = Some(to_trezor_output_value( + value, + additional_info, + chain_config, + )?) + .into(); let mut out = MintlayerTxOutput::new(); out.burn = Some(out_req).into(); @@ -818,7 +817,9 @@ fn to_trezor_output_msg( } TxOutput::CreateDelegationId(dest, pool_id) => { let mut out_req = MintlayerCreateDelegationIdTxOutput::new(); - out_req.set_pool_id(pool_id.to_hash().as_bytes().to_vec()); + out_req.set_pool_id( + Address::new(chain_config, *pool_id).expect("addressable").into_string(), + ); out_req.set_destination( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -828,7 +829,9 @@ fn to_trezor_output_msg( } TxOutput::DelegateStaking(amount, delegation_id) => { let mut out_req = MintlayerDelegateStakingTxOutput::new(); - out_req.set_delegation_id(delegation_id.to_hash().as_bytes().to_vec()); + out_req.set_delegation_id( + Address::new(chain_config, *delegation_id).expect("addressable").into_string(), + ); out_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); let mut out = MintlayerTxOutput::new(); out.delegate_staking = Some(out_req).into(); @@ -836,7 +839,9 @@ fn to_trezor_output_msg( } TxOutput::CreateStakePool(pool_id, pool_data) => { let mut out_req = MintlayerCreateStakePoolTxOutput::new(); - out_req.set_pool_id(pool_id.to_hash().as_bytes().to_vec()); + out_req.set_pool_id( + Address::new(chain_config, *pool_id).expect("addressable").into_string(), + ); out_req.set_pledge(pool_data.pledge().into_atoms().to_be_bytes().to_vec()); out_req.set_staker( @@ -866,7 +871,9 @@ fn to_trezor_output_msg( } TxOutput::ProduceBlockFromStake(dest, pool_id) => { let mut out_req = MintlayerProduceBlockFromStakeTxOutput::new(); - out_req.set_pool_id(pool_id.to_hash().as_bytes().to_vec()); + out_req.set_pool_id( + Address::new(chain_config, *pool_id).expect("addressable").into_string(), + ); out_req.set_destination( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -912,7 +919,9 @@ fn to_trezor_output_msg( } TxOutput::IssueNft(token_id, nft_data, dest) => { let mut out_req = MintlayerIssueNftTxOutput::new(); - out_req.set_token_id(token_id.to_hash().as_bytes().to_vec()); + out_req.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); out_req.set_destination( Address::new(chain_config, dest.clone()).expect("addressable").into_string(), ); @@ -961,7 +970,12 @@ fn to_trezor_output_msg( } TxOutput::Htlc(value, lock) => { let mut out_req = MintlayerHtlcTxOutput::new(); - out_req.value = Some(to_trezor_output_value(value, additional_info)?).into(); + out_req.value = Some(to_trezor_output_value( + value, + additional_info, + chain_config, + )?) + .into(); out_req.secret_hash = Some(lock.secret_hash.as_bytes().to_vec()); out_req.set_spend_key( @@ -982,7 +996,7 @@ fn to_trezor_output_msg( out } TxOutput::CreateOrder(data) => { - let mut out_req = MintlayerAnyoneCanTakeTxOutput::new(); + let mut out_req = MintlayerCreateOrderTxOutput::new(); out_req.set_conclude_key( Address::new(chain_config, data.conclude_key().clone()) @@ -995,11 +1009,13 @@ fn to_trezor_output_msg( out_req.ask = Some(to_trezor_output_value_with_token_info( data.ask(), &ask.as_ref(), + chain_config, )?) .into(); out_req.give = Some(to_trezor_output_value_with_token_info( data.give(), &give.as_ref(), + chain_config, )?) .into(); } @@ -1011,7 +1027,7 @@ fn to_trezor_output_msg( } let mut out = MintlayerTxOutput::new(); - out.anyone_can_take = Some(out_req).into(); + out.create_order = Some(out_req).into(); out } }; @@ -1021,6 +1037,7 @@ fn to_trezor_output_msg( fn to_trezor_output_value_with_token_info( value: &OutputValue, token_info: &Option<&TokenAdditionalInfo>, + chain_config: &ChainConfig, ) -> Result { match value { OutputValue::Coin(amount) => { @@ -1032,7 +1049,9 @@ fn to_trezor_output_value_with_token_info( let mut value = MintlayerOutputValue::new(); value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); let mut token_value = MintlayerTokenOutputValue::new(); - token_value.set_token_id(token_id.to_hash().as_bytes().to_vec()); + token_value.set_token_id( + Address::new(chain_config, *token_id).expect("addressable").into_string(), + ); match &token_info { Some(info) => { token_value.set_number_of_decimals(info.num_decimals as u32); From 722d70e679f357093fecb3a4196e7e2fae093edf Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Thu, 31 Oct 2024 17:15:46 +0100 Subject: [PATCH 41/48] Reuse referenced tokens util in API Server --- .../scanner-lib/src/blockchain_state/mod.rs | 86 ++++++------------- common/src/chain/tokens/tokens_utils.rs | 32 +++++++ wallet/src/account/output_cache/mod.rs | 11 +-- wallet/src/send_request/mod.rs | 32 +------ .../src/synced_controller.rs | 10 +-- 5 files changed, 70 insertions(+), 101 deletions(-) diff --git a/api-server/scanner-lib/src/blockchain_state/mod.rs b/api-server/scanner-lib/src/blockchain_state/mod.rs index d2348aba0e..c14bcb818b 100644 --- a/api-server/scanner-lib/src/blockchain_state/mod.rs +++ b/api-server/scanner-lib/src/blockchain_state/mod.rs @@ -31,7 +31,7 @@ use common::{ config::ChainConfig, make_order_id, output_value::OutputValue, - tokens::{make_token_id, IsTokenFrozen, TokenId, TokenIssuance}, + tokens::{get_referenced_token_ids, make_token_id, IsTokenFrozen, TokenId, TokenIssuance}, transaction::OutPointSourceId, AccountCommand, AccountNonce, AccountSpending, Block, DelegationId, Destination, GenBlock, Genesis, OrderData, OrderId, PoolId, SignedTransaction, Transaction, TxInput, TxOutput, @@ -594,63 +594,33 @@ async fn calculate_tx_fee_and_collect_token_info( let input_tasks: FuturesOrdered<_> = tx.inputs().iter().map(|input| fetch_utxo(input, db_tx)).collect(); let input_utxos: Vec> = input_tasks.try_collect().await?; - let token_ids = { - let mut token_ids = BTreeSet::new(); - for (inp, utxo) in tx.inputs().iter().zip(input_utxos.iter()) { - match inp { - TxInput::Utxo(_) => match utxo.as_ref().expect("must be present") { - TxOutput::Transfer(v, _) - | TxOutput::LockThenTransfer(v, _, _) - | TxOutput::Htlc(v, _) => match v { - OutputValue::TokenV1(token_id, _) => { - token_ids.insert(*token_id); - } - OutputValue::Coin(_) | OutputValue::TokenV0(_) => {} - }, - TxOutput::IssueNft(token_id, _, _) => { - token_ids.insert(*token_id); - } - TxOutput::CreateStakePool(_, _) - | TxOutput::Burn(_) - | TxOutput::DataDeposit(_) - | TxOutput::DelegateStaking(_, _) - | TxOutput::CreateDelegationId(_, _) - | TxOutput::IssueFungibleToken(_) - | TxOutput::ProduceBlockFromStake(_, _) - | TxOutput::CreateOrder(_) => {} - }, - TxInput::Account(_) => {} - TxInput::AccountCommand(_, cmd) => match cmd { - AccountCommand::MintTokens(token_id, _) - | AccountCommand::FreezeToken(token_id, _) - | AccountCommand::UnmintTokens(token_id) - | AccountCommand::UnfreezeToken(token_id) - | AccountCommand::LockTokenSupply(token_id) - | AccountCommand::ChangeTokenMetadataUri(token_id, _) - | AccountCommand::ChangeTokenAuthority(token_id, _) => { - token_ids.insert(*token_id); - } - AccountCommand::ConcludeOrder(order_id) - | AccountCommand::FillOrder(order_id, _, _) => { - let order = db_tx.get_order(*order_id).await?.expect("must exist"); - match order.ask_currency { - CoinOrTokenId::Coin => {} - CoinOrTokenId::TokenId(id) => { - token_ids.insert(id); - } - }; - match order.give_currency { - CoinOrTokenId::Coin => {} - CoinOrTokenId::TokenId(id) => { - token_ids.insert(id); - } - }; - } - }, - }; - } - token_ids - }; + + let token_ids: BTreeSet<_> = tx + .inputs() + .iter() + .zip(input_utxos.iter()) + .filter_map(|(inp, utxo)| match inp { + TxInput::Utxo(_) => Some(get_referenced_token_ids( + utxo.as_ref().expect("must be present"), + )), + TxInput::Account(_) => None, + TxInput::AccountCommand(_, cmd) => match cmd { + AccountCommand::MintTokens(token_id, _) + | AccountCommand::FreezeToken(token_id, _) + | AccountCommand::UnmintTokens(token_id) + | AccountCommand::UnfreezeToken(token_id) + | AccountCommand::LockTokenSupply(token_id) + | AccountCommand::ChangeTokenMetadataUri(token_id, _) + | AccountCommand::ChangeTokenAuthority(token_id, _) => { + Some(BTreeSet::from_iter([*token_id])) + } + AccountCommand::ConcludeOrder(_) | AccountCommand::FillOrder(_, _, _) => None, + }, + }) + .fold(BTreeSet::new(), |mut x, mut y| { + x.append(&mut y); + x + }); let token_tasks: FuturesOrdered<_> = token_ids .iter() diff --git a/common/src/chain/tokens/tokens_utils.rs b/common/src/chain/tokens/tokens_utils.rs index ffbaa60486..cd8c9fe570 100644 --- a/common/src/chain/tokens/tokens_utils.rs +++ b/common/src/chain/tokens/tokens_utils.rs @@ -13,6 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::collections::BTreeSet; + use super::{TokenData, TokenId}; use crate::{ chain::{output_value::OutputValue, AccountCommand, TxInput, TxOutput}, @@ -88,3 +90,33 @@ pub fn is_token_or_nft_issuance(output: &TxOutput) -> bool { TxOutput::IssueFungibleToken(_) | TxOutput::IssueNft(_, _, _) => true, } } + +/// Get any referenced token by this output +/// ignore tokens V0 +pub fn get_referenced_token_ids(output: &TxOutput) -> BTreeSet { + match output { + TxOutput::Transfer(v, _) + | TxOutput::LockThenTransfer(v, _, _) + | TxOutput::Burn(v) + | TxOutput::Htlc(v, _) => referenced_token_id(v), + | TxOutput::CreateOrder(data) => { + let mut tokens = referenced_token_id(data.ask()); + tokens.extend(referenced_token_id(data.give())); + tokens + } + TxOutput::CreateStakePool(_, _) + | TxOutput::ProduceBlockFromStake(_, _) + | TxOutput::CreateDelegationId(_, _) + | TxOutput::DelegateStaking(_, _) + | TxOutput::DataDeposit(_) + | TxOutput::IssueFungibleToken(_) => BTreeSet::new(), + TxOutput::IssueNft(token_id, _, _) => BTreeSet::from_iter([*token_id]), + } +} + +fn referenced_token_id(v: &OutputValue) -> BTreeSet { + match v { + OutputValue::Coin(_) | OutputValue::TokenV0(_) => BTreeSet::new(), + OutputValue::TokenV1(token_id, _) => BTreeSet::from_iter([*token_id]), + } +} diff --git a/wallet/src/account/output_cache/mod.rs b/wallet/src/account/output_cache/mod.rs index a4ef5f8758..6c81c008f8 100644 --- a/wallet/src/account/output_cache/mod.rs +++ b/wallet/src/account/output_cache/mod.rs @@ -26,9 +26,9 @@ use common::{ output_value::OutputValue, stakelock::StakePoolData, tokens::{ - make_token_id, IsTokenFreezable, IsTokenUnfreezable, RPCFungibleTokenInfo, - RPCIsTokenFrozen, RPCNonFungibleTokenInfo, RPCTokenTotalSupply, TokenId, TokenIssuance, - TokenTotalSupply, + get_referenced_token_ids, make_token_id, IsTokenFreezable, IsTokenUnfreezable, + RPCFungibleTokenInfo, RPCIsTokenFrozen, RPCNonFungibleTokenInfo, RPCTokenTotalSupply, + TokenId, TokenIssuance, TokenTotalSupply, }, AccountCommand, AccountNonce, AccountSpending, DelegationId, Destination, GenBlock, OrderId, OutPointSourceId, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, @@ -49,10 +49,7 @@ use wallet_types::{ AccountWalletTxId, BlockInfo, WalletTx, }; -use crate::{ - destination_getters::get_all_tx_output_destinations, send_request::get_referenced_token_ids, - WalletError, WalletResult, -}; +use crate::{destination_getters::get_all_tx_output_destinations, WalletError, WalletResult}; pub type UtxoWithTxOutput<'a> = (UtxoOutPoint, &'a TxOutput); diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 098e9fc896..0bf5c6aa7b 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeMap; use std::mem::take; use common::address::Address; @@ -394,36 +394,6 @@ fn find_token_additional_info( } } -/// Get any referenced token by this output -/// ignore tokens V0 -pub fn get_referenced_token_ids(output: &TxOutput) -> BTreeSet { - match output { - TxOutput::Transfer(v, _) - | TxOutput::LockThenTransfer(v, _, _) - | TxOutput::Burn(v) - | TxOutput::Htlc(v, _) => referenced_token_id(v), - | TxOutput::CreateOrder(data) => { - let mut tokens = referenced_token_id(data.ask()); - tokens.extend(referenced_token_id(data.give())); - tokens - } - TxOutput::CreateStakePool(_, _) - | TxOutput::ProduceBlockFromStake(_, _) - | TxOutput::CreateDelegationId(_, _) - | TxOutput::DelegateStaking(_, _) - | TxOutput::DataDeposit(_) - | TxOutput::IssueFungibleToken(_) => BTreeSet::new(), - TxOutput::IssueNft(token_id, _, _) => BTreeSet::from_iter([*token_id]), - } -} - -fn referenced_token_id(v: &OutputValue) -> BTreeSet { - match v { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => BTreeSet::new(), - OutputValue::TokenV1(token_id, _) => BTreeSet::from_iter([*token_id]), - } -} - pub enum SelectedInputs { Utxos(Vec), Inputs(Vec<(UtxoOutPoint, TxOutput)>), diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 3f959d16be..e5ed678afd 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -23,8 +23,9 @@ use common::{ output_value::OutputValue, signature::inputsig::arbitrary_message::ArbitraryMessageSignature, tokens::{ - IsTokenFreezable, IsTokenUnfreezable, Metadata, RPCFungibleTokenInfo, RPCTokenInfo, - TokenId, TokenIssuance, TokenIssuanceV1, TokenTotalSupply, + get_referenced_token_ids, IsTokenFreezable, IsTokenUnfreezable, Metadata, + RPCFungibleTokenInfo, RPCTokenInfo, TokenId, TokenIssuance, TokenIssuanceV1, + TokenTotalSupply, }, ChainConfig, DelegationId, Destination, OrderId, PoolId, RpcOrderInfo, SignedTransaction, SignedTransactionIntent, Transaction, TxOutput, UtxoOutPoint, @@ -48,9 +49,8 @@ use wallet::{ account::{CoinSelectionAlgo, TransactionToSign, UnconfirmedTokenInfo}, destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, send_request::{ - get_referenced_token_ids, make_address_output, make_address_output_token, - make_create_delegation_output, make_data_deposit_output, PoolOrTokenId, SelectedInputs, - StakePoolDataArguments, + make_address_output, make_address_output_token, make_create_delegation_output, + make_data_deposit_output, PoolOrTokenId, SelectedInputs, StakePoolDataArguments, }, wallet::WalletPoolsFilter, wallet_events::WalletEvents, From 6713e04542068677f8edc62d90fd6f3b6e3fc62a Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 13 Nov 2024 18:04:26 +0100 Subject: [PATCH 42/48] Add test with signatures from trezor --- Cargo.lock | 2 +- .../scanner-lib/src/blockchain_state/mod.rs | 1 + wallet/src/signer/software_signer/tests.rs | 535 +++++++++++++++++- 3 files changed, 509 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5de63be111..6951835bc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8377,7 +8377,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#4bcd130f1203a1f0d372c7bb7cb5ee656032dafc" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#554dbfd9f60afc879a033df07ca0a9ea321ac553" dependencies = [ "bitcoin", "byteorder", diff --git a/api-server/scanner-lib/src/blockchain_state/mod.rs b/api-server/scanner-lib/src/blockchain_state/mod.rs index c14bcb818b..a5548e3ed0 100644 --- a/api-server/scanner-lib/src/blockchain_state/mod.rs +++ b/api-server/scanner-lib/src/blockchain_state/mod.rs @@ -617,6 +617,7 @@ async fn calculate_tx_fee_and_collect_token_info( AccountCommand::ConcludeOrder(_) | AccountCommand::FillOrder(_, _, _) => None, }, }) + .chain(tx.outputs().iter().map(get_referenced_token_ids)) .fold(BTreeSet::new(), |mut x, mut y| { x.append(&mut y); x diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index b6df6062ee..2ba09d800b 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -17,19 +17,28 @@ use std::collections::BTreeMap; use std::ops::{Add, Div, Mul, Sub}; use super::*; -use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; use crate::{Account, SendRequest}; +use common::chain::block::timestamp::BlockTimestamp; use common::chain::config::create_regtest; +use common::chain::htlc::HashedTimelockContract; use common::chain::output_value::OutputValue; use common::chain::signature::inputsig::arbitrary_message::produce_message_challenge; +use common::chain::signature::inputsig::authorize_pubkeyhash_spend::AuthorizedPublicKeyHashSpend; +use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock; -use common::chain::{GenBlock, TxInput}; -use common::primitives::amount::UnsignedIntType; -use common::primitives::{Amount, Id, H256}; -use crypto::key::KeyKind; +use common::chain::tokens::{NftIssuance, NftIssuanceV0, TokenId, TokenIssuance}; +use common::chain::{ + AccountCommand, AccountNonce, AccountOutPoint, AccountSpending, DelegationId, GenBlock, + OrderData, OutPointSourceId, PoolId, TxInput, +}; +use common::primitives::per_thousand::PerThousand; +use common::primitives::{Amount, BlockHeight, Id, H256}; +use crypto::key::secp256k1::Secp256k1PublicKey; +use crypto::key::{KeyKind, PublicKey, Signature}; use randomness::{Rng, RngCore}; use rstest::rstest; +use serialization::Encode; use test_utils::random::{make_seedable_rng, Seed}; use wallet_storage::{DefaultBackend, Store, Transactional}; use wallet_types::account_info::DEFAULT_ACCOUNT_INDEX; @@ -78,14 +87,33 @@ fn sign_message(#[case] seed: Seed) { #[trace] #[case(Seed::from_entropy())] fn sign_transaction(#[case] seed: Seed) { + use std::num::NonZeroU8; + + use common::{ + chain::{ + classic_multisig::ClassicMultisigChallenge, + htlc::HashedTimelockContract, + stakelock::StakePoolData, + tokens::{ + IsTokenUnfreezable, Metadata, NftIssuance, NftIssuanceV0, TokenId, TokenIssuance, + TokenIssuanceV1, + }, + AccountCommand, AccountNonce, AccountOutPoint, AccountSpending, DelegationId, + OrderData, OrderId, PoolId, + }, + primitives::amount::UnsignedIntType, + }; + use crypto::vrf::VRFPrivateKey; + use serialization::extras::non_empty_vec::DataOrNoVec; + let mut rng = make_seedable_rng(seed); - let config = Arc::new(create_regtest()); + let chain_config = Arc::new(create_regtest()); let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); let master_key_chain = MasterKeyChain::new_from_mnemonic( - config.clone(), + chain_config.clone(), &mut db_tx, MNEMONIC, None, @@ -96,10 +124,10 @@ fn sign_transaction(#[case] seed: Seed) { let key_chain = master_key_chain .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) .unwrap(); - let mut account = Account::new(config.clone(), &mut db_tx, key_chain, None).unwrap(); + let mut account = Account::new(chain_config.clone(), &mut db_tx, key_chain, None).unwrap(); let amounts: Vec = (0..(2 + rng.next_u32() % 5)) - .map(|_| Amount::from_atoms(rng.next_u32() as UnsignedIntType)) + .map(|_| Amount::from_atoms(rng.gen_range(1..10) as UnsignedIntType)) .collect(); let total_amount = amounts.iter().fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); @@ -120,9 +148,8 @@ fn sign_transaction(#[case] seed: Seed) { }) .collect(); - let inputs: Vec = utxos - .iter() - .map(|_txo| { + let inputs: Vec = (0..utxos.len()) + .map(|_| { let source_id = if rng.gen_bool(0.5) { Id::::new(H256::random_using(&mut rng)).into() } else { @@ -132,6 +159,114 @@ fn sign_transaction(#[case] seed: Seed) { }) .collect(); + let (_dest_prv, pub_key1) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); + let pub_key2 = if let Destination::PublicKeyHash(pkh) = + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object() + { + account.find_corresponding_pub_key(&pkh).unwrap() + } else { + panic!("not a public key hash") + }; + let pub_key3 = if let Destination::PublicKeyHash(pkh) = + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object() + { + account.find_corresponding_pub_key(&pkh).unwrap() + } else { + panic!("not a public key hash") + }; + let min_required_signatures = 2; + let challenge = ClassicMultisigChallenge::new( + &chain_config, + NonZeroU8::new(min_required_signatures).unwrap(), + vec![pub_key1, pub_key2, pub_key3], + ) + .unwrap(); + let multisig_hash = account.add_standalone_multisig(&mut db_tx, challenge, None).unwrap(); + + let multisig_dest = Destination::ClassicMultisig(multisig_hash); + + let source_id = if rng.gen_bool(0.5) { + Id::::new(H256::random_using(&mut rng)).into() + } else { + Id::::new(H256::random_using(&mut rng)).into() + }; + let multisig_input = TxInput::from_utxo(source_id, rng.next_u32()); + let multisig_utxo = TxOutput::Transfer(OutputValue::Coin(Amount::from_atoms(1)), multisig_dest); + + let acc_inputs = vec![ + TxInput::Account(AccountOutPoint::new( + AccountNonce::new(0), + AccountSpending::DelegationBalance( + DelegationId::new(H256::random_using(&mut rng)), + Amount::from_atoms(rng.next_u32() as u128), + ), + )), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::MintTokens( + TokenId::new(H256::random_using(&mut rng)), + Amount::from_atoms(100), + ), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::UnmintTokens(TokenId::new(H256::random_using(&mut rng))), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::LockTokenSupply(TokenId::new(H256::random_using(&mut rng))), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::FreezeToken( + TokenId::new(H256::random_using(&mut rng)), + IsTokenUnfreezable::Yes, + ), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::UnfreezeToken(TokenId::new(H256::random_using(&mut rng))), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::ChangeTokenAuthority( + TokenId::new(H256::random_using(&mut rng)), + Destination::AnyoneCanSpend, + ), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::ConcludeOrder(OrderId::new(H256::random_using(&mut rng))), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::FillOrder( + OrderId::new(H256::random_using(&mut rng)), + Amount::from_atoms(123), + Destination::AnyoneCanSpend, + ), + ), + TxInput::AccountCommand( + AccountNonce::new(rng.next_u64()), + AccountCommand::ChangeTokenMetadataUri( + TokenId::new(H256::random_using(&mut rng)), + "http://uri".as_bytes().to_vec(), + ), + ), + ]; + let acc_dests: Vec = acc_inputs + .iter() + .map(|_| { + let purpose = if rng.gen_bool(0.5) { + ReceiveFunds + } else { + Change + }; + + account.get_new_address(&mut db_tx, purpose).unwrap().1.into_object() + }) + .collect(); + let dest_amount = total_amount.div(10).unwrap().mul(5).unwrap(); let lock_amount = total_amount.div(10).unwrap().mul(1).unwrap(); let burn_amount = total_amount.div(10).unwrap().mul(1).unwrap(); @@ -142,6 +277,53 @@ fn sign_transaction(#[case] seed: Seed) { let _fee_amount = total_amount.sub(outputs_amounts_sum).unwrap(); let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); + let (_, vrf_public_key) = VRFPrivateKey::new_from_entropy(crypto::vrf::VRFKeyKind::Schnorrkel); + + let pool_id = PoolId::new(H256::random()); + let delegation_id = DelegationId::new(H256::random()); + let pool_data = StakePoolData::new( + Amount::from_atoms(5000000), + Destination::PublicKey(dest_pub.clone()), + vrf_public_key, + Destination::PublicKey(dest_pub.clone()), + PerThousand::new_from_rng(&mut rng), + Amount::from_atoms(100), + ); + let token_issuance = TokenIssuance::V1(TokenIssuanceV1 { + token_ticker: "XXXX".as_bytes().to_vec(), + number_of_decimals: rng.gen_range(1..18), + metadata_uri: "http://uri".as_bytes().to_vec(), + total_supply: common::chain::tokens::TokenTotalSupply::Unlimited, + authority: Destination::PublicKey(dest_pub.clone()), + is_freezable: common::chain::tokens::IsTokenFreezable::No, + }); + + let nft_issuance = NftIssuance::V0(NftIssuanceV0 { + metadata: Metadata { + creator: None, + name: "Name".as_bytes().to_vec(), + description: "SomeNFT".as_bytes().to_vec(), + ticker: "NFTX".as_bytes().to_vec(), + icon_uri: DataOrNoVec::from(None), + additional_metadata_uri: DataOrNoVec::from(None), + media_uri: DataOrNoVec::from(None), + media_hash: "123456".as_bytes().to_vec(), + }, + }); + let nft_id = TokenId::new(H256::random()); + + let hash_lock = HashedTimelockContract { + secret_hash: common::chain::htlc::HtlcSecretHash([1; 20]), + spend_key: Destination::PublicKey(dest_pub.clone()), + refund_timelock: OutputTimeLock::UntilHeight(BlockHeight::new(123)), + refund_key: Destination::AnyoneCanSpend, + }; + + let order_data = OrderData::new( + Destination::PublicKey(dest_pub.clone()), + OutputValue::Coin(Amount::from_atoms(100)), + OutputValue::Coin(total_amount), + ); let outputs = vec![ TxOutput::Transfer( @@ -154,38 +336,335 @@ fn sign_transaction(#[case] seed: Seed) { OutputTimeLock::ForSeconds(rng.next_u64()), ), TxOutput::Burn(OutputValue::Coin(burn_amount)), + TxOutput::CreateStakePool(pool_id, Box::new(pool_data)), + TxOutput::CreateDelegationId( + Destination::AnyoneCanSpend, + PoolId::new(H256::random_using(&mut rng)), + ), + TxOutput::DelegateStaking(burn_amount, delegation_id), + TxOutput::IssueFungibleToken(Box::new(token_issuance)), + TxOutput::IssueNft( + nft_id, + Box::new(nft_issuance.clone()), + Destination::AnyoneCanSpend, + ), + TxOutput::DataDeposit(vec![1, 2, 3]), + TxOutput::Htlc(OutputValue::Coin(burn_amount), Box::new(hash_lock)), + TxOutput::CreateOrder(Box::new(order_data)), TxOutput::Transfer( - OutputValue::Coin(Amount::from_atoms(100)), + OutputValue::Coin(Amount::from_atoms(100_000_000_000)), account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), ), ]; - let tx = Transaction::new(0, inputs, outputs).unwrap(); - - let req = SendRequest::from_transaction(tx, utxos.clone(), &|_| None).unwrap(); - let ptx = req.into_partially_signed_tx(&BTreeMap::default()).unwrap(); + let req = SendRequest::new() + .with_inputs(inputs.clone().into_iter().zip(utxos.clone()), &|_| None) + .unwrap() + .with_inputs( + [multisig_input.clone()].into_iter().zip([multisig_utxo.clone()]), + &|_| None, + ) + .unwrap() + .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) + .with_outputs(outputs); + let destinations = req.destinations().to_vec(); + let additional_info = BTreeMap::new(); + let ptx = req.into_partially_signed_tx(&additional_info).unwrap(); - let mut signer = SoftwareSigner::new(config.clone(), DEFAULT_ACCOUNT_INDEX); + let mut signer = SoftwareSigner::new(chain_config.clone(), DEFAULT_ACCOUNT_INDEX); let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); + eprintln!("num inputs in tx: {} {:?}", inputs.len(), ptx.witnesses()); assert!(ptx.all_signatures_available()); - let sig_tx = ptx.into_signed_tx().unwrap(); + let utxos_ref = utxos + .iter() + .map(Some) + .chain([Some(&multisig_utxo)]) + .chain(acc_dests.iter().map(|_| None)) + .collect::>(); + + for (i, dest) in destinations.iter().enumerate() { + tx_verifier::input_check::signature_only_check::verify_tx_signature( + &chain_config, + dest, + &ptx, + &utxos_ref, + i, + ) + .unwrap(); + } +} + +#[rstest] +#[trace] +fn fixed_signatures() { + use std::num::NonZeroU8; + + use common::chain::{ + classic_multisig::ClassicMultisigChallenge, + tokens::{IsTokenUnfreezable, Metadata, TokenIssuanceV1}, + OrderId, + }; + use crypto::vrf::VRFPrivateKey; + use serialization::extras::non_empty_vec::DataOrNoVec; + + let chain_config = Arc::new(create_regtest()); + let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); + let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); + + let master_key_chain = MasterKeyChain::new_from_mnemonic( + chain_config.clone(), + &mut db_tx, + MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + ) + .unwrap(); + + let key_chain = master_key_chain + .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) + .unwrap(); + let mut account = Account::new(chain_config.clone(), &mut db_tx, key_chain, None).unwrap(); + + let amount_1 = Amount::from_atoms(1); + let random_pk = PublicKey::from( + Secp256k1PublicKey::from_bytes(&[ + 2, 2, 11, 98, 44, 24, 95, 8, 36, 172, 134, 193, 94, 60, 66, 115, 65, 190, 73, 45, 12, + 228, 65, 185, 175, 158, 4, 233, 125, 192, 84, 52, 242, + ]) + .unwrap(), + ); + + eprintln!("getting first address"); + let (num, addr) = account.get_new_address(&mut db_tx, ReceiveFunds).unwrap(); + eprintln!("num: {num:?}"); + + let wallet_pk0 = if let Destination::PublicKeyHash(pkh) = addr.into_object() { + account.find_corresponding_pub_key(&pkh).unwrap() + } else { + panic!("not a public key hash") + }; + + let wallet_pk1 = if let Destination::PublicKeyHash(pkh) = + account.get_new_address(&mut db_tx, ReceiveFunds).unwrap().1.into_object() + { + account.find_corresponding_pub_key(&pkh).unwrap() + } else { + panic!("not a public key hash") + }; + let min_required_signatures = 2; + let challenge = ClassicMultisigChallenge::new( + &chain_config, + NonZeroU8::new(min_required_signatures).unwrap(), + vec![wallet_pk0.clone(), random_pk, wallet_pk1], + ) + .unwrap(); + let multisig_hash = + account.add_standalone_multisig(&mut db_tx, challenge.clone(), None).unwrap(); + + let multisig_dest = Destination::ClassicMultisig(multisig_hash); + + let multisig_input = TxInput::from_utxo(Id::::new(H256::zero()).into(), 2); + let multisig_utxo = TxOutput::Transfer(OutputValue::Coin(amount_1), multisig_dest); + + let delegation_id = DelegationId::new(H256::zero()); + let token_id = TokenId::new(H256::zero()); + let order_id = OrderId::new(H256::zero()); + let pool_id = PoolId::new(H256::zero()); + + let uri = "http://uri.com".as_bytes().to_vec(); + + let wallet_dest0 = Destination::PublicKeyHash((&wallet_pk0).into()); + + let utxos = [TxOutput::Transfer(OutputValue::Coin(amount_1), wallet_dest0.clone())]; + + let inputs = [TxInput::from_utxo( + OutPointSourceId::Transaction(Id::::new(H256::zero())), + 1, + )]; + + let acc_inputs = vec![ + TxInput::Account(AccountOutPoint::new( + AccountNonce::new(0), + AccountSpending::DelegationBalance(delegation_id, amount_1), + )), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::MintTokens(token_id, amount_1), + ), + TxInput::AccountCommand(AccountNonce::new(0), AccountCommand::UnmintTokens(token_id)), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::LockTokenSupply(token_id), + ), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::FreezeToken(token_id, IsTokenUnfreezable::Yes), + ), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::UnfreezeToken(token_id), + ), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::ChangeTokenAuthority(token_id, Destination::AnyoneCanSpend), + ), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::ConcludeOrder(order_id), + ), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::FillOrder(order_id, amount_1, Destination::AnyoneCanSpend), + ), + TxInput::AccountCommand( + AccountNonce::new(0), + AccountCommand::ChangeTokenMetadataUri(token_id, uri.clone()), + ), + ]; + let acc_dests: Vec = vec![wallet_dest0.clone(); acc_inputs.len()]; + + let (_, vrf_public_key) = + VRFPrivateKey::new_using_random_bytes(&[0; 32], crypto::vrf::VRFKeyKind::Schnorrkel) + .unwrap(); + + let pool_data = StakePoolData::new( + amount_1, + Destination::AnyoneCanSpend, + vrf_public_key, + Destination::AnyoneCanSpend, + PerThousand::new(1).unwrap(), + amount_1, + ); + let token_issuance = TokenIssuance::V1(TokenIssuanceV1 { + token_ticker: "XXXX".as_bytes().to_vec(), + number_of_decimals: 2, + metadata_uri: uri.clone(), + total_supply: common::chain::tokens::TokenTotalSupply::Unlimited, + authority: Destination::AnyoneCanSpend, + is_freezable: common::chain::tokens::IsTokenFreezable::Yes, + }); - let utxos_ref = utxos.iter().map(Some).collect::>(); + let nft_issuance = NftIssuance::V0(NftIssuanceV0 { + metadata: Metadata { + creator: None, + name: "Name".as_bytes().to_vec(), + description: "SomeNFT".as_bytes().to_vec(), + ticker: "NFTX".as_bytes().to_vec(), + icon_uri: DataOrNoVec::from(None), + additional_metadata_uri: DataOrNoVec::from(None), + media_uri: Some(uri).into(), + media_hash: "123456".as_bytes().to_vec(), + }, + }); + let hash_lock = HashedTimelockContract { + secret_hash: common::chain::htlc::HtlcSecretHash([1; 20]), + spend_key: Destination::AnyoneCanSpend, + refund_timelock: OutputTimeLock::UntilHeight(BlockHeight::new(10)), + refund_key: Destination::AnyoneCanSpend, + }; - for i in 0..sig_tx.inputs().len() { - let destination = get_tx_output_destination( - utxos_ref[i].unwrap(), + let order_data = OrderData::new( + Destination::AnyoneCanSpend, + OutputValue::Coin(amount_1), + OutputValue::Coin(amount_1), + ); + + let outputs = vec![ + TxOutput::Transfer(OutputValue::Coin(amount_1), Destination::AnyoneCanSpend), + TxOutput::LockThenTransfer( + OutputValue::Coin(amount_1), + Destination::AnyoneCanSpend, + OutputTimeLock::UntilHeight(BlockHeight::new(10)), + ), + TxOutput::LockThenTransfer( + OutputValue::Coin(amount_1), + Destination::AnyoneCanSpend, + OutputTimeLock::UntilTime(BlockTimestamp::from_int_seconds(10)), + ), + TxOutput::LockThenTransfer( + OutputValue::Coin(amount_1), + Destination::AnyoneCanSpend, + OutputTimeLock::ForBlockCount(10), + ), + TxOutput::LockThenTransfer( + OutputValue::Coin(amount_1), + Destination::AnyoneCanSpend, + OutputTimeLock::ForSeconds(10), + ), + TxOutput::Burn(OutputValue::Coin(amount_1)), + TxOutput::CreateStakePool(pool_id, Box::new(pool_data)), + TxOutput::CreateDelegationId(Destination::AnyoneCanSpend, pool_id), + TxOutput::DelegateStaking(amount_1, delegation_id), + TxOutput::IssueFungibleToken(Box::new(token_issuance)), + TxOutput::IssueNft( + token_id, + Box::new(nft_issuance.clone()), + Destination::AnyoneCanSpend, + ), + TxOutput::DataDeposit(vec![1, 2, 3]), + TxOutput::Htlc(OutputValue::Coin(amount_1), Box::new(hash_lock)), + TxOutput::CreateOrder(Box::new(order_data)), + ]; + + let req = SendRequest::new() + .with_inputs(inputs.clone().into_iter().zip(utxos.clone()), &|_| None) + .unwrap() + .with_inputs( + [multisig_input.clone()].into_iter().zip([multisig_utxo.clone()]), &|_| None, - HtlcSpendingCondition::Skip, ) - .unwrap(); + .unwrap() + .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) + .with_outputs(outputs); + let destinations = req.destinations().to_vec(); + let additional_info = BTreeMap::new(); + let ptx = req.into_partially_signed_tx(&additional_info).unwrap(); + + let utxos_ref = utxos + .iter() + .map(Some) + .chain([Some(&multisig_utxo)]) + .chain(acc_dests.iter().map(|_| None)) + .collect::>(); + + let multisig_signatures = [ + (0, "7a99714dc6cc917faa2afded8028159a5048caf6f8382f67e6b61623fbe62c60423f8f7983f88f40c6f42924594f3de492a232e9e703b241c3b17b130f8daa59"), + (2, "0a0a17d71bc98fa5c24ea611c856d0d08c6a765ea3c4c8f068668e0bdff710b82b0d2eead83d059386cd3cbdf4308418d4b81e6f52c001a9141ec477a8d24845"), + ]; + + let mut current_signatures = AuthorizedClassicalMultisigSpend::new_empty(challenge.clone()); + + for (idx, sig) in multisig_signatures { + let mut signature = hex::decode(sig).unwrap(); + signature.insert(0, 0); + let sig = Signature::from_data(signature).unwrap(); + current_signatures.add_signature(idx as u8, sig); + } + + let sighash_type: SigHashType = SigHashType::ALL.try_into().unwrap(); + let multisig_sig = StandardInputSignature::new(sighash_type, current_signatures.encode()); + + let sig = "7a99714dc6cc917faa2afded8028159a5048caf6f8382f67e6b61623fbe62c60423f8f7983f88f40c6f42924594f3de492a232e9e703b241c3b17b130f8daa59"; + let mut bytes = hex::decode(sig).unwrap(); + bytes.insert(0, 0); + + let sig = Signature::from_data(bytes).unwrap(); + let sig = AuthorizedPublicKeyHashSpend::new(wallet_pk0.clone(), sig); + let sig = StandardInputSignature::new(SigHashType::ALL.try_into().unwrap(), sig.encode()); + + let mut sigs = vec![Some(InputWitness::Standard(sig)); ptx.count_inputs()]; + sigs[1] = Some(InputWitness::Standard(multisig_sig)); + let ptx = ptx.with_witnesses(sigs); + + assert!(ptx.all_signatures_available()); + for (i, dest) in destinations.iter().enumerate() { tx_verifier::input_check::signature_only_check::verify_tx_signature( - &config, - &destination, - &sig_tx, + &chain_config, + dest, + &ptx, &utxos_ref, i, ) From 1d766e5debe716f1224f1e2a029a8e1fe720dcf2 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 2 Dec 2024 20:48:05 +0100 Subject: [PATCH 43/48] fix comments --- Cargo.lock | 4 +- common/src/chain/tokens/tokens_utils.rs | 12 +- crypto/src/key/mod.rs | 5 +- crypto/src/key/signature/mod.rs | 8 + node-gui/backend/Cargo.toml | 3 + node-gui/backend/src/backend_impl.rs | 48 +--- node-gui/backend/src/error.rs | 2 + node-gui/src/main_window/main_menu.rs | 6 +- node-gui/src/main_window/mod.rs | 29 ++- node-gui/src/widgets/create_hw_wallet.rs | 2 +- node-gui/src/widgets/wallet_mnemonic.rs | 8 +- wallet/src/send_request/mod.rs | 4 +- wallet/src/signer/mod.rs | 27 +- wallet/src/signer/trezor_signer/mod.rs | 238 +++++++----------- wallet/src/wallet/mod.rs | 4 +- .../src/command_handler/mod.rs | 33 +-- .../wallet-cli-commands/src/helper_types.rs | 10 + wallet/wallet-cli-commands/src/lib.rs | 15 +- wallet/wallet-cli-lib/src/config.rs | 5 + wallet/wallet-cli-lib/src/lib.rs | 15 +- .../tests/cli_test_framework.rs | 2 + wallet/wallet-controller/Cargo.toml | 2 - wallet/wallet-controller/src/read.rs | 49 +--- .../wallet-controller/src/runtime_wallet.rs | 15 ++ wallet/wallet-controller/src/types/mod.rs | 2 +- .../src/handles_client/mod.rs | 37 +-- .../src/rpc_client/client_impl.rs | 20 +- .../src/wallet_rpc_traits.rs | 9 +- wallet/wallet-rpc-lib/src/cmdline.rs | 27 +- wallet/wallet-rpc-lib/src/config.rs | 7 + wallet/wallet-rpc-lib/src/lib.rs | 14 +- wallet/wallet-rpc-lib/src/rpc/server_impl.rs | 4 +- wallet/wallet-rpc-lib/src/rpc/types.rs | 2 +- wallet/wallet-rpc-lib/src/service/worker.rs | 2 +- wallet/wallet-rpc-lib/tests/utils.rs | 9 +- 35 files changed, 323 insertions(+), 356 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6951835bc8..1234005362 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8377,7 +8377,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#554dbfd9f60afc879a033df07ca0a9ea321ac553" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#c929c9a8f71ed9edfc679b96e3d4815fd8f3316b" dependencies = [ "bitcoin", "byteorder", @@ -8922,14 +8922,12 @@ dependencies = [ "mempool-types", "node-comm", "p2p-types", - "pos-accounting", "randomness", "rpc-description", "rstest", "serde", "serialization", "storage", - "storage-inmemory", "test-utils", "thiserror", "tokio", diff --git a/common/src/chain/tokens/tokens_utils.rs b/common/src/chain/tokens/tokens_utils.rs index cd8c9fe570..04caf8a3df 100644 --- a/common/src/chain/tokens/tokens_utils.rs +++ b/common/src/chain/tokens/tokens_utils.rs @@ -91,16 +91,16 @@ pub fn is_token_or_nft_issuance(output: &TxOutput) -> bool { } } -/// Get any referenced token by this output +/// Get any token referenced by this output /// ignore tokens V0 pub fn get_referenced_token_ids(output: &TxOutput) -> BTreeSet { match output { TxOutput::Transfer(v, _) | TxOutput::LockThenTransfer(v, _, _) | TxOutput::Burn(v) - | TxOutput::Htlc(v, _) => referenced_token_id(v), + | TxOutput::Htlc(v, _) => referenced_token_id(v).into_iter().collect(), | TxOutput::CreateOrder(data) => { - let mut tokens = referenced_token_id(data.ask()); + let mut tokens: BTreeSet<_> = referenced_token_id(data.ask()).into_iter().collect(); tokens.extend(referenced_token_id(data.give())); tokens } @@ -114,9 +114,9 @@ pub fn get_referenced_token_ids(output: &TxOutput) -> BTreeSet { } } -fn referenced_token_id(v: &OutputValue) -> BTreeSet { +fn referenced_token_id(v: &OutputValue) -> Option { match v { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => BTreeSet::new(), - OutputValue::TokenV1(token_id, _) => BTreeSet::from_iter([*token_id]), + OutputValue::Coin(_) | OutputValue::TokenV0(_) => None, + OutputValue::TokenV1(token_id, _) => Some(*token_id), } } diff --git a/crypto/src/key/mod.rs b/crypto/src/key/mod.rs index 83aee5a66b..db9558f801 100644 --- a/crypto/src/key/mod.rs +++ b/crypto/src/key/mod.rs @@ -30,7 +30,10 @@ pub use signature::Signature; use self::key_holder::{PrivateKeyHolder, PublicKeyHolder}; #[derive(thiserror::Error, Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] -pub enum SignatureError {} +pub enum SignatureError { + #[error("Failed to construct a valid signature")] + SignatureConstructionError, +} #[must_use] #[derive(Debug, PartialEq, Eq, Clone, Decode, Encode)] diff --git a/crypto/src/key/signature/mod.rs b/crypto/src/key/signature/mod.rs index 8bfefa9d8e..8f0cc1620a 100644 --- a/crypto/src/key/signature/mod.rs +++ b/crypto/src/key/signature/mod.rs @@ -19,6 +19,8 @@ use std::io::BufWriter; use num_derive::FromPrimitive; use serialization::{hex_encoded::HexEncoded, Decode, DecodeAll, Encode}; +use super::SignatureError; + #[derive(FromPrimitive)] pub enum SignatureKind { Secp256k1Schnorr = 0, @@ -77,6 +79,12 @@ impl Signature { Ok(decoded_sig) } + pub fn from_raw_data>(data: T) -> Result { + let decoded_sig = secp256k1::schnorr::Signature::from_slice(data.as_ref()) + .map_err(|_| SignatureError::SignatureConstructionError)?; + Ok(Self::Secp256k1Schnorr(decoded_sig)) + } + pub fn is_aggregable(&self) -> bool { match self { Self::Secp256k1Schnorr(_) => false, diff --git a/node-gui/backend/Cargo.toml b/node-gui/backend/Cargo.toml index efc8cb055e..f82e15fff9 100644 --- a/node-gui/backend/Cargo.toml +++ b/node-gui/backend/Cargo.toml @@ -41,3 +41,6 @@ test-utils = { path = "../../test-utils" } rstest.workspace = true serde_json.workspace = true + +[features] +trezor = ["wallet/trezor", "wallet-controller/trezor", "wallet-types/trezor", "wallet-rpc-lib/trezor", "wallet-rpc-client/trezor"] diff --git a/node-gui/backend/src/backend_impl.rs b/node-gui/backend/src/backend_impl.rs index 25eb460535..c5fd2350c4 100644 --- a/node-gui/backend/src/backend_impl.rs +++ b/node-gui/backend/src/backend_impl.rs @@ -351,26 +351,7 @@ impl Backend { } #[cfg(feature = "trezor")] (WalletType::Trezor, ColdHotNodeController::Cold) => { - let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); - - let (wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self - .create_wallet( - client, - file_path.clone(), - wallet_args, - import, - wallet_events, - ) - .await?; - - let wallet_data = WalletData { - controller: GuiHotColdController::Cold(wallet_rpc, command_handler), - accounts: accounts_data, - best_block, - updated: false, - }; - - (wallet_data, accounts_info, best_block) + return Err(BackendError::ColdTrezorNotSupported) } (WalletType::Hot, ColdHotNodeController::Cold) => { return Err(BackendError::HotNotSupported) @@ -577,32 +558,7 @@ impl Backend { } #[cfg(feature = "trezor")] (WalletType::Trezor, ColdHotNodeController::Cold) => { - let client = make_cold_wallet_rpc_client(Arc::clone(&self.chain_config)); - - let ( - wallet_rpc, - command_handler, - encryption_state, - best_block, - accounts_info, - accounts_data, - ) = self - .open_wallet( - client, - file_path.clone(), - wallet_events, - Some(HardwareWalletType::Trezor), - ) - .await?; - - let wallet_data = WalletData { - controller: GuiHotColdController::Cold(wallet_rpc, command_handler), - accounts: accounts_data, - best_block, - updated: false, - }; - - (wallet_data, accounts_info, best_block, encryption_state) + return Err(BackendError::ColdTrezorNotSupported) } (WalletType::Hot, ColdHotNodeController::Cold) => { return Err(BackendError::HotNotSupported) diff --git a/node-gui/backend/src/error.rs b/node-gui/backend/src/error.rs index f99af2cb0f..b9444799aa 100644 --- a/node-gui/backend/src/error.rs +++ b/node-gui/backend/src/error.rs @@ -41,6 +41,8 @@ pub enum BackendError { ColdWallet, #[error("Cannot interact with a hot wallet when in Cold wallet mode")] HotNotSupported, + #[error("Cannot use a Trezor wallet in a Cold wallet mode")] + ColdTrezorNotSupported, #[error("Invalid console command: {0}")] InvalidConsoleCommand(String), #[error("Empty console command")] diff --git a/node-gui/src/main_window/main_menu.rs b/node-gui/src/main_window/main_menu.rs index 4445cc6e96..120d492e51 100644 --- a/node-gui/src/main_window/main_menu.rs +++ b/node-gui/src/main_window/main_menu.rs @@ -110,19 +110,19 @@ fn make_menu_file<'a>(wallet_mode: WalletMode) -> Item<'a, MenuMessage, Theme, i WalletMode::Hot => { let menu = vec![ menu_item( - "Create new Hot wallet", + "Create new Software wallet", MenuMessage::CreateNewWallet { wallet_type: WalletType::Hot, }, ), menu_item( - "Recover Hot wallet", + "Recover Software wallet", MenuMessage::RecoverWallet { wallet_type: WalletType::Hot, }, ), menu_item( - "Open Hot wallet", + "Open Software wallet", MenuMessage::OpenWallet { wallet_type: WalletType::Hot, }, diff --git a/node-gui/src/main_window/mod.rs b/node-gui/src/main_window/mod.rs index aa1ea8d10f..1b10608c25 100644 --- a/node-gui/src/main_window/mod.rs +++ b/node-gui/src/main_window/mod.rs @@ -59,7 +59,7 @@ mod main_widget; enum ActiveDialog { None, WalletCreate { - generated_mnemonic: wallet_controller::mnemonic::Mnemonic, + wallet_args: WalletArgs, wallet_type: WalletType, }, WalletRecover { @@ -148,7 +148,7 @@ pub struct MainWindow { wallet_msg: Option, } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum WalletArgs { Software { mnemonic: String, @@ -261,11 +261,20 @@ impl MainWindow { MainWindowMessage::MenuMessage(menu_message) => match menu_message { MenuMessage::NoOp => Command::none(), MenuMessage::CreateNewWallet { wallet_type } => { - let generated_mnemonic = - wallet_controller::mnemonic::generate_new_mnemonic(self.language); + let wallet_args = match wallet_type { + WalletType::Hot | WalletType::Cold => WalletArgs::Software { + mnemonic: wallet_controller::mnemonic::generate_new_mnemonic( + self.language, + ) + .to_string(), + }, + #[cfg(feature = "trezor")] + WalletType::Trezor => WalletArgs::Trezor, + }; + self.active_dialog = ActiveDialog::WalletCreate { - generated_mnemonic, wallet_type, + wallet_args, }; Command::none() } @@ -786,13 +795,13 @@ impl MainWindow { ActiveDialog::None => Text::new("Nothing to show").into(), ActiveDialog::WalletCreate { - generated_mnemonic, wallet_type, + wallet_args, } => { let wallet_type = *wallet_type; - match wallet_type { - WalletType::Hot | WalletType::Cold => wallet_mnemonic_dialog( - Some(generated_mnemonic.clone()), + match wallet_args { + WalletArgs::Software { mnemonic } => wallet_mnemonic_dialog( + Some(mnemonic.clone()), Box::new(move |mnemonic| MainWindowMessage::ImportWalletMnemonic { args: WalletArgs::Software { mnemonic }, import: ImportOrCreate::Create, @@ -802,7 +811,7 @@ impl MainWindow { ) .into(), #[cfg(feature = "trezor")] - WalletType::Trezor => hw_wallet_create_dialog( + WalletArgs::Trezor => hw_wallet_create_dialog( Box::new(move || MainWindowMessage::ImportWalletMnemonic { args: WalletArgs::Trezor, import: ImportOrCreate::Create, diff --git a/node-gui/src/widgets/create_hw_wallet.rs b/node-gui/src/widgets/create_hw_wallet.rs index 4ab707b62c..fa6d4ab1ae 100644 --- a/node-gui/src/widgets/create_hw_wallet.rs +++ b/node-gui/src/widgets/create_hw_wallet.rs @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::main_window::ImportOrCreate; use iced::{ alignment::Horizontal, widget::{self, container, text, Button, Component, Text}, Element, Length, Theme, }; use iced_aw::Card; +use node_gui_backend::ImportOrCreate; pub struct CreateHwWalletDialog { on_import: Box Message>, diff --git a/node-gui/src/widgets/wallet_mnemonic.rs b/node-gui/src/widgets/wallet_mnemonic.rs index 9d52effd86..62d210baf1 100644 --- a/node-gui/src/widgets/wallet_mnemonic.rs +++ b/node-gui/src/widgets/wallet_mnemonic.rs @@ -21,13 +21,13 @@ use iced::{ use iced_aw::Card; pub struct WalletMnemonicDialog { - generated_mnemonic_opt: Option, + generated_mnemonic_opt: Option, on_import: Box Message>, on_close: Box Message>, } pub fn wallet_mnemonic_dialog( - generated_mnemonic_opt: Option, + generated_mnemonic_opt: Option, on_import: Box Message>, on_close: Box Message>, ) -> WalletMnemonicDialog { @@ -67,7 +67,7 @@ impl Component for WalletMnemonicDialog ImportEvent::Ok => { state.importing = true; let mnemonic = match &self.generated_mnemonic_opt { - Some(generated_mnemonic) => generated_mnemonic.to_string(), + Some(generated_mnemonic) => generated_mnemonic.clone(), None => state.entered_mnemonic.clone(), }; Some((self.on_import)(mnemonic)) @@ -78,7 +78,7 @@ impl Component for WalletMnemonicDialog fn view(&self, state: &Self::State) -> Element { let (mnemonic, action_text) = match &self.generated_mnemonic_opt { - Some(generated_mnemonic) => (generated_mnemonic.to_string(), "Create"), + Some(generated_mnemonic) => (generated_mnemonic.clone(), "Create"), None => (state.entered_mnemonic.clone(), "Recover"), }; diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 0bf5c6aa7b..1c21f2410e 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -332,7 +332,7 @@ impl SendRequest { } } -/// Find aditional data for TxOutput, mainly for UI purposes +/// Find additional data for TxOutput, mainly for UI purposes fn find_additional_info( utxo: &TxOutput, additional_info: &BTreeMap, @@ -388,7 +388,7 @@ fn find_token_additional_info( UtxoAdditionalInfo::TokenInfo(data) => Ok(Some(data.clone())), UtxoAdditionalInfo::PoolInfo { staker_balance: _ } | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => { - Err(WalletError::MissmatchedTokenAdditionalData(*token_id)) + Err(WalletError::MismatchedTokenAdditionalData(*token_id)) } })?, } diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index a057932bea..0e2f62174c 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -15,17 +15,24 @@ use std::sync::Arc; -use common::chain::{ - signature::{ - inputsig::{ - arbitrary_message::{ArbitraryMessageSignature, SignArbitraryMessageError}, - classical_multisig::multisig_partial_signature::PartiallySignedMultisigStructureError, +use common::{ + address::AddressError, + chain::{ + signature::{ + inputsig::{ + arbitrary_message::{ArbitraryMessageSignature, SignArbitraryMessageError}, + classical_multisig::multisig_partial_signature::PartiallySignedMultisigStructureError, + }, + DestinationSigError, }, - DestinationSigError, + ChainConfig, Destination, SignedTransactionIntent, SignedTransactionIntentError, + Transaction, }, - ChainConfig, Destination, SignedTransactionIntent, SignedTransactionIntentError, Transaction, }; -use crypto::key::hdkd::{derivable::DerivationError, u31::U31}; +use crypto::key::{ + hdkd::{derivable::DerivationError, u31::U31}, + SignatureError, +}; use wallet_storage::{ WalletStorageReadLocked, WalletStorageReadUnlocked, WalletStorageWriteUnlocked, }; @@ -82,6 +89,10 @@ pub enum SignerError { UnsupportedTokensV0, #[error("Invalid TxOutput type as UTXO, cannot be spent")] InvalidUtxo, + #[error("Address error: {0}")] + AddressError(#[from] AddressError), + #[error("Signature error: {0}")] + SignatureError(#[from] SignatureError), } type SignerResult = Result; diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index c26255633e..424eb31e20 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -50,7 +50,7 @@ use crypto::key::{ extended::ExtendedPublicKey, hdkd::{chain_code::ChainCode, derivable::Derivable, u31::U31}, secp256k1::{extended_keys::Secp256k1ExtendedPublicKey, Secp256k1PublicKey}, - Signature, + Signature, SignatureError, }; use itertools::Itertools; use serialization::Encode; @@ -102,6 +102,10 @@ pub enum TrezorError { NoDeviceFound, #[error("Trezor device error: {0}")] DeviceError(String), + #[error("Invalid public key returned from trezor")] + InvalidKey, + #[error("Invalid Signature error: {0}")] + SignatureError(#[from] SignatureError), } pub struct TrezorSigner { @@ -126,7 +130,7 @@ impl TrezorSigner { secret: Option, key_chain: &impl AccountKeyChains, ) -> SignerResult<(Option, SignatureStatus)> { - let add_secret = |sig: StandardInputSignature| { + let add_secret_if_needed = |sig: StandardInputSignature| { let sig = if let Some(htlc_secret) = secret { let sig_with_secret = AuthorizedHashedTimelockContractSpend::Secret( htlc_secret, @@ -149,13 +153,17 @@ impl TrezorSigner { )), Destination::PublicKeyHash(_) => { if let Some(signature) = signature.first() { - let pk = - key_chain.find_public_key(destination).expect("found").into_public_key(); - let mut signature = signature.signature.clone(); - signature.insert(0, 0); - let sig = Signature::from_data(signature)?; + let pk = key_chain + .find_public_key(destination) + .ok_or(SignerError::DestinationNotFromThisWallet)? + .into_public_key(); + let sig = Signature::from_raw_data(&signature.signature) + .map_err(TrezorError::SignatureError)?; let sig = AuthorizedPublicKeyHashSpend::new(pk, sig); - let sig = add_secret(StandardInputSignature::new(sighash_type, sig.encode())); + let sig = add_secret_if_needed(StandardInputSignature::new( + sighash_type, + sig.encode(), + )); Ok((Some(sig), SignatureStatus::FullySigned)) } else { @@ -164,11 +172,13 @@ impl TrezorSigner { } Destination::PublicKey(_) => { if let Some(signature) = signature.first() { - let mut signature = signature.signature.clone(); - signature.insert(0, 0); - let sig = Signature::from_data(signature)?; + let sig = Signature::from_raw_data(&signature.signature) + .map_err(TrezorError::SignatureError)?; let sig = AuthorizedPublicKeySpend::new(sig); - let sig = add_secret(StandardInputSignature::new(sighash_type, sig.encode())); + let sig = add_secret_if_needed(StandardInputSignature::new( + sighash_type, + sig.encode(), + )); Ok((Some(sig), SignatureStatus::FullySigned)) } else { @@ -182,9 +192,8 @@ impl TrezorSigner { for sig in signature { if let Some(idx) = sig.multisig_idx { - let mut signature = sig.signature.clone(); - signature.insert(0, 0); - let sig = Signature::from_data(signature)?; + let sig = Signature::from_raw_data(&sig.signature) + .map_err(TrezorError::SignatureError)?; current_signatures.add_signature(idx as u8, sig); } } @@ -214,7 +223,7 @@ impl TrezorSigner { } }; - let sig = add_secret(StandardInputSignature::new( + let sig = add_secret_if_needed(StandardInputSignature::new( sighash_type, current_signatures.encode(), )); @@ -313,9 +322,8 @@ impl Signer for TrezorSigner { if let Some(signature) = new_signatures.get(i) { for sig in signature { if let Some(idx) = sig.multisig_idx { - let mut signature = sig.signature.clone(); - signature.insert(0, 0); - let sig = Signature::from_data(signature)?; + let sig = Signature::from_raw_data(&sig.signature) + .map_err(TrezorError::SignatureError)?; current_signatures.add_signature(idx as u8, sig); } } @@ -424,9 +432,7 @@ impl Signer for TrezorSigner { .map(|c| c.into_encoded_index()) .collect(); - let addr = Address::new(&self.chain_config, destination.clone()) - .expect("addressable") - .into_string(); + let addr = Address::new(&self.chain_config, destination.clone())?.into_string(); let sig = self .client @@ -434,9 +440,8 @@ impl Signer for TrezorSigner { .expect("poisoned lock") .mintlayer_sign_message(address_n, addr, message.to_vec()) .map_err(|err| TrezorError::DeviceError(err.to_string()))?; - let mut signature = sig; - signature.insert(0, 0); - let signature = Signature::from_data(signature)?; + let signature = + Signature::from_raw_data(&sig).map_err(TrezorError::SignatureError)?; match &destination { Destination::PublicKey(_) => AuthorizedPublicKeySpend::new(signature).encode(), @@ -497,12 +502,9 @@ fn to_trezor_input_msgs( (TxInput::Utxo(outpoint), Some(_), Some(dest)) => { to_trezor_utxo_input(outpoint, chain_config, dest, key_chain) } - (TxInput::Account(outpoint), _, Some(dest)) => Ok(to_trezor_account_input( - chain_config, - dest, - key_chain, - outpoint, - )), + (TxInput::Account(outpoint), _, Some(dest)) => { + to_trezor_account_input(chain_config, dest, key_chain, outpoint) + } (TxInput::AccountCommand(nonce, command), _, Some(dest)) => { to_trezor_account_command_input(chain_config, dest, key_chain, nonce, command) } @@ -520,90 +522,67 @@ fn to_trezor_account_command_input( command: &AccountCommand, ) -> SignerResult { let mut inp_req = MintlayerAccountCommandTxInput::new(); - inp_req - .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); + inp_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); inp_req.address_n = destination_to_address_paths(key_chain, dest); inp_req.set_nonce(nonce.value()); match command { AccountCommand::MintTokens(token_id, amount) => { let mut req = MintlayerMintTokens::new(); - req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); + req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); inp_req.mint = Some(req).into(); } AccountCommand::UnmintTokens(token_id) => { let mut req = MintlayerUnmintTokens::new(); - req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); + req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); inp_req.unmint = Some(req).into(); } AccountCommand::FreezeToken(token_id, unfreezable) => { let mut req = MintlayerFreezeToken::new(); - req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); + req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); req.set_is_token_unfreezabe(unfreezable.as_bool()); inp_req.freeze_token = Some(req).into(); } AccountCommand::UnfreezeToken(token_id) => { let mut req = MintlayerUnfreezeToken::new(); - req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); + req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); inp_req.unfreeze_token = Some(req).into(); } AccountCommand::LockTokenSupply(token_id) => { let mut req = MintlayerLockTokenSupply::new(); - req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); + req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); inp_req.lock_token_supply = Some(req).into(); } AccountCommand::ChangeTokenAuthority(token_id, dest) => { let mut req = MintlayerChangeTokenAuhtority::new(); - req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); - req.set_destination( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); + req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); + req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); inp_req.change_token_authority = Some(req).into(); } AccountCommand::ChangeTokenMetadataUri(token_id, uri) => { let mut req = MintlayerChangeTokenMetadataUri::new(); - req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); + req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); req.set_metadata_uri(uri.clone()); inp_req.change_token_metadata_uri = Some(req).into(); } AccountCommand::ConcludeOrder(order_id) => { let mut req = MintlayerConcludeOrder::new(); - req.set_order_id( - Address::new(chain_config, *order_id).expect("addressable").into_string(), - ); + req.set_order_id(Address::new(chain_config, *order_id)?.into_string()); inp_req.conclude_order = Some(req).into(); } AccountCommand::FillOrder(order_id, amount, dest) => { let mut req = MintlayerFillOrder::new(); - req.set_order_id( - Address::new(chain_config, *order_id).expect("addressable").into_string(), - ); + req.set_order_id(Address::new(chain_config, *order_id)?.into_string()); req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - req.set_destination( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); + req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); inp_req.fill_order = Some(req).into(); } @@ -618,17 +597,14 @@ fn to_trezor_account_input( dest: &Destination, key_chain: &impl AccountKeyChains, outpoint: &common::chain::AccountOutPoint, -) -> MintlayerTxInput { +) -> SignerResult { let mut inp_req = MintlayerAccountTxInput::new(); - inp_req - .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); + inp_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); inp_req.address_n = destination_to_address_paths(key_chain, dest); inp_req.set_nonce(outpoint.nonce().value()); match outpoint.account() { AccountSpending::DelegationBalance(delegation_id, amount) => { - inp_req.set_delegation_id( - Address::new(chain_config, *delegation_id).expect("addressable").into_string(), - ); + inp_req.set_delegation_id(Address::new(chain_config, *delegation_id)?.into_string()); let mut value = MintlayerOutputValue::new(); value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); inp_req.value = Some(value).into(); @@ -636,7 +612,7 @@ fn to_trezor_account_input( } let mut inp = MintlayerTxInput::new(); inp.account = Some(inp_req).into(); - inp + Ok(inp) } fn to_trezor_utxo_input( @@ -659,8 +635,7 @@ fn to_trezor_utxo_input( inp_req.set_prev_hash(id.to_vec()); inp_req.set_prev_index(outpoint.output_index()); - inp_req - .set_address(Address::new(chain_config, dest.clone()).expect("addressable").into_string()); + inp_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); inp_req.address_n = destination_to_address_paths(key_chain, dest); let mut inp = MintlayerTxInput::new(); @@ -741,9 +716,11 @@ fn to_trezor_utxo_msgs( chain_config: &ChainConfig, ) -> SignerResult>> { let mut utxos: BTreeMap<[u8; 32], BTreeMap> = BTreeMap::new(); + for (utxo, inp) in ptx.input_utxos().iter().zip(ptx.tx().inputs()) { - match (inp, utxo) { - (TxInput::Utxo(outpoint), Some(utxo)) => { + match inp { + TxInput::Utxo(outpoint) => { + let utxo = utxo.as_ref().ok_or(SignerError::MissingUtxo)?; let id = match outpoint.source_id() { OutPointSourceId::Transaction(id) => id.to_hash().0, OutPointSourceId::BlockReward(id) => id.to_hash().0, @@ -751,11 +728,7 @@ fn to_trezor_utxo_msgs( let out = to_trezor_output_msg(chain_config, &utxo.utxo, &utxo.additional_info)?; utxos.entry(id).or_default().insert(outpoint.output_index(), out); } - (TxInput::Utxo(_), None) => unimplemented!("missing utxo"), - (TxInput::Account(_) | TxInput::AccountCommand(_, _), Some(_)) => { - panic!("can't have accounts as UTXOs") - } - (TxInput::Account(_) | TxInput::AccountCommand(_, _), _) => {} + TxInput::Account(_) | TxInput::AccountCommand(_, _) => {} } } @@ -776,9 +749,7 @@ fn to_trezor_output_msg( chain_config, )?) .into(); - out_req.set_address( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); + out_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); let mut out = MintlayerTxOutput::new(); out.transfer = Some(out_req).into(); @@ -792,9 +763,7 @@ fn to_trezor_output_msg( chain_config, )?) .into(); - out_req.set_address( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); + out_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); out_req.lock = Some(to_trezor_output_lock(lock)).into(); @@ -817,21 +786,15 @@ fn to_trezor_output_msg( } TxOutput::CreateDelegationId(dest, pool_id) => { let mut out_req = MintlayerCreateDelegationIdTxOutput::new(); - out_req.set_pool_id( - Address::new(chain_config, *pool_id).expect("addressable").into_string(), - ); - out_req.set_destination( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); + out_req.set_pool_id(Address::new(chain_config, *pool_id)?.into_string()); + out_req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); let mut out = MintlayerTxOutput::new(); out.create_delegation_id = Some(out_req).into(); out } TxOutput::DelegateStaking(amount, delegation_id) => { let mut out_req = MintlayerDelegateStakingTxOutput::new(); - out_req.set_delegation_id( - Address::new(chain_config, *delegation_id).expect("addressable").into_string(), - ); + out_req.set_delegation_id(Address::new(chain_config, *delegation_id)?.into_string()); out_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); let mut out = MintlayerTxOutput::new(); out.delegate_staking = Some(out_req).into(); @@ -839,25 +802,16 @@ fn to_trezor_output_msg( } TxOutput::CreateStakePool(pool_id, pool_data) => { let mut out_req = MintlayerCreateStakePoolTxOutput::new(); - out_req.set_pool_id( - Address::new(chain_config, *pool_id).expect("addressable").into_string(), - ); + out_req.set_pool_id(Address::new(chain_config, *pool_id)?.into_string()); out_req.set_pledge(pool_data.pledge().into_atoms().to_be_bytes().to_vec()); - out_req.set_staker( - Address::new(chain_config, pool_data.staker().clone()) - .expect("addressable") - .into_string(), - ); + out_req + .set_staker(Address::new(chain_config, pool_data.staker().clone())?.into_string()); out_req.set_decommission_key( - Address::new(chain_config, pool_data.decommission_key().clone()) - .expect("addressable") - .into_string(), + Address::new(chain_config, pool_data.decommission_key().clone())?.into_string(), ); out_req.set_vrf_public_key( - Address::new(chain_config, pool_data.vrf_public_key().clone()) - .expect("addressable") - .into_string(), + Address::new(chain_config, pool_data.vrf_public_key().clone())?.into_string(), ); out_req .set_cost_per_block(pool_data.cost_per_block().into_atoms().to_be_bytes().to_vec()); @@ -871,12 +825,17 @@ fn to_trezor_output_msg( } TxOutput::ProduceBlockFromStake(dest, pool_id) => { let mut out_req = MintlayerProduceBlockFromStakeTxOutput::new(); - out_req.set_pool_id( - Address::new(chain_config, *pool_id).expect("addressable").into_string(), - ); - out_req.set_destination( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); + out_req.set_pool_id(Address::new(chain_config, *pool_id)?.into_string()); + out_req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); + let staker_balance = additional_info + .as_ref() + .and_then(|info| match info { + UtxoAdditionalInfo::PoolInfo { staker_balance } => Some(staker_balance), + UtxoAdditionalInfo::TokenInfo(_) + | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => None, + }) + .ok_or(SignerError::MissingUtxoExtraInfo)?; + out_req.set_staker_balance(staker_balance.into_atoms().to_be_bytes().to_vec()); let mut out = MintlayerTxOutput::new(); out.produce_block_from_stake = Some(out_req).into(); out @@ -887,9 +846,7 @@ fn to_trezor_output_msg( match token_data.as_ref() { TokenIssuance::V1(data) => { out_req.set_authority( - Address::new(chain_config, data.authority.clone()) - .expect("addressable") - .into_string(), + Address::new(chain_config, data.authority.clone())?.into_string(), ); out_req.set_token_ticker(data.token_ticker.clone()); out_req.set_metadata_uri(data.metadata_uri.clone()); @@ -919,12 +876,8 @@ fn to_trezor_output_msg( } TxOutput::IssueNft(token_id, nft_data, dest) => { let mut out_req = MintlayerIssueNftTxOutput::new(); - out_req.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); - out_req.set_destination( - Address::new(chain_config, dest.clone()).expect("addressable").into_string(), - ); + out_req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); + out_req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); match nft_data.as_ref() { NftIssuance::V0(data) => { // @@ -950,8 +903,7 @@ fn to_trezor_output_msg( Address::new( chain_config, Destination::PublicKey(creator.public_key.clone()), - ) - .expect("addressable") + )? .into_string(), ); } @@ -978,16 +930,10 @@ fn to_trezor_output_msg( .into(); out_req.secret_hash = Some(lock.secret_hash.as_bytes().to_vec()); - out_req.set_spend_key( - Address::new(chain_config, lock.spend_key.clone()) - .expect("addressable") - .into_string(), - ); - out_req.set_refund_key( - Address::new(chain_config, lock.refund_key.clone()) - .expect("addressable") - .into_string(), - ); + out_req + .set_spend_key(Address::new(chain_config, lock.spend_key.clone())?.into_string()); + out_req + .set_refund_key(Address::new(chain_config, lock.refund_key.clone())?.into_string()); out_req.refund_timelock = Some(to_trezor_output_lock(&lock.refund_timelock)).into(); @@ -999,9 +945,7 @@ fn to_trezor_output_msg( let mut out_req = MintlayerCreateOrderTxOutput::new(); out_req.set_conclude_key( - Address::new(chain_config, data.conclude_key().clone()) - .expect("addressable") - .into_string(), + Address::new(chain_config, data.conclude_key().clone())?.into_string(), ); match additional_info { @@ -1049,9 +993,7 @@ fn to_trezor_output_value_with_token_info( let mut value = MintlayerOutputValue::new(); value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); let mut token_value = MintlayerTokenOutputValue::new(); - token_value.set_token_id( - Address::new(chain_config, *token_id).expect("addressable").into_string(), - ); + token_value.set_token_id(Address::new(chain_config, *token_id)?.into_string()); match &token_info { Some(info) => { token_value.set_number_of_decimals(info.num_decimals as u32); @@ -1125,7 +1067,7 @@ impl TrezorSignerProvider { &self, chain_config: &Arc, account_index: U31, - ) -> Result { + ) -> SignerResult { let derivation_path = make_account_path(chain_config, account_index); let account_path = derivation_path.as_slice().iter().map(|c| c.into_encoded_index()).collect(); @@ -1139,7 +1081,8 @@ impl TrezorSignerProvider { let account_pubkey = Secp256k1ExtendedPublicKey::new( derivation_path, chain_code, - Secp256k1PublicKey::from_bytes(&xpub.public_key.serialize()).expect(""), + Secp256k1PublicKey::from_bytes(&xpub.public_key.serialize()) + .map_err(|_| SignerError::TrezorError(TrezorError::InvalidKey))?, ); let account_pubkey = ExtendedPublicKey::new(account_pubkey); Ok(account_pubkey) @@ -1175,7 +1118,8 @@ fn find_trezor_device() -> Result { .into_iter() .find(|device| device.model == Model::Trezor) .ok_or(TrezorError::NoDeviceFound)?; - let client = device.connect().map_err(|e| TrezorError::DeviceError(e.to_string()))?; + let mut client = device.connect().map_err(|e| TrezorError::DeviceError(e.to_string()))?; + client.init_device(None).map_err(|e| TrezorError::DeviceError(e.to_string()))?; Ok(client) } diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index c74fba6488..da22b16d1e 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -263,8 +263,8 @@ pub enum WalletError { MissingPoolAdditionalData(PoolId), #[error("Missing additional data for Token {0}")] MissingTokenAdditionalData(TokenId), - #[error("Missmatched additional data for token {0}")] - MissmatchedTokenAdditionalData(TokenId), + #[error("Mismatched additional data for token {0}")] + MismatchedTokenAdditionalData(TokenId), #[error("Unsupported operation for a Hardware wallet")] UnsupportedHardwareWalletOperation, } diff --git a/wallet/wallet-cli-commands/src/command_handler/mod.rs b/wallet/wallet-cli-commands/src/command_handler/mod.rs index de8378c37a..bdc45439ee 100644 --- a/wallet/wallet-cli-commands/src/command_handler/mod.rs +++ b/wallet/wallet-cli-commands/src/command_handler/mod.rs @@ -33,7 +33,7 @@ use node_comm::node_traits::NodeInterface; use serialization::{hex::HexEncode, hex_encoded::HexEncoded}; use utils::qrcode::{QrCode, QrCodeError}; use wallet::version::get_version; -use wallet_controller::types::GenericTokenTransfer; +use wallet_controller::types::{GenericTokenTransfer, WalletTypeArgs}; use wallet_rpc_client::wallet_rpc_traits::{PartialOrSignedTx, WalletInterface}; use wallet_rpc_lib::types::{ Balances, ComposedTransaction, ControllerConfig, MnemonicInfo, NewTransaction, NftMetadata, @@ -45,7 +45,9 @@ use wallet_rpc_lib::types::{ use crate::helper_types::CliHardwareWalletType; #[cfg(feature = "trezor")] use wallet_rpc_lib::types::HardwareWalletType; -use wallet_types::partially_signed_transaction::PartiallySignedTransaction; +use wallet_types::{ + partially_signed_transaction::PartiallySignedTransaction, seed_phrase::StoreSeedPhrase, +}; use crate::{ errors::WalletCliCommandError, helper_types::parse_generic_token_transfer, @@ -152,22 +154,21 @@ where passphrase, hardware_wallet, } => { - let hardware_wallet = hardware_wallet.map(|t| match t { - #[cfg(feature = "trezor")] - CliHardwareWalletType::Trezor => HardwareWalletType::Trezor, - }); - - let newly_generated_mnemonic = self - .wallet() - .await? - .create_wallet( - wallet_path, - whether_to_store_seed_phrase.map_or(false, |x| x.to_bool()), + let store_seed_phrase = + whether_to_store_seed_phrase.map_or(StoreSeedPhrase::DoNotStore, Into::into); + let wallet_args = hardware_wallet.map_or( + WalletTypeArgs::Software { mnemonic, passphrase, - hardware_wallet, - ) - .await?; + store_seed_phrase, + }, + |t| match t { + #[cfg(feature = "trezor")] + CliHardwareWalletType::Trezor => WalletTypeArgs::Trezor, + }, + ); + let newly_generated_mnemonic = + self.wallet().await?.create_wallet(wallet_path, wallet_args).await?; self.wallet.update_wallet::().await; diff --git a/wallet/wallet-cli-commands/src/helper_types.rs b/wallet/wallet-cli-commands/src/helper_types.rs index 42c76cde4d..57e9c669a8 100644 --- a/wallet/wallet-cli-commands/src/helper_types.rs +++ b/wallet/wallet-cli-commands/src/helper_types.rs @@ -25,6 +25,7 @@ use common::{ use wallet_controller::types::{GenericCurrencyTransfer, GenericTokenTransfer}; use wallet_rpc_lib::types::{NodeInterface, PoolInfo, TokenTotalSupply}; use wallet_types::{ + seed_phrase::StoreSeedPhrase, utxo_types::{UtxoState, UtxoType}, with_locked::WithLocked, }; @@ -142,6 +143,15 @@ impl CliStoreSeedPhrase { } } +impl From for StoreSeedPhrase { + fn from(value: CliStoreSeedPhrase) -> Self { + match value { + CliStoreSeedPhrase::StoreSeedPhrase => StoreSeedPhrase::Store, + CliStoreSeedPhrase::DoNotStoreSeedPhrase => StoreSeedPhrase::DoNotStore, + } + } +} + #[derive(Debug, Clone, Copy, ValueEnum)] pub enum EnableOrDisable { Enable, diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index 6109999224..a47d11ff53 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -19,7 +19,8 @@ mod helper_types; pub use command_handler::CommandHandler; pub use errors::WalletCliCommandError; -use helper_types::{CliHardwareWalletType, YesNo}; +pub use helper_types::CliHardwareWalletType; +use helper_types::YesNo; use rpc::description::{Described, Module}; use wallet_rpc_lib::{types::NodeInterface, ColdWalletRpcDescription, WalletRpcDescription}; @@ -65,7 +66,8 @@ pub enum WalletManagementCommand { passphrase: Option, /// Create a wallet using a connected hardware wallet. Only the public keys will be kept in - /// the software wallet + /// the software wallet. Cannot specify a mnemonic or passphrase here, input them on the + /// hardware wallet instead when initializing the device. #[arg(long, conflicts_with_all(["mnemonic", "passphrase"]))] hardware_wallet: Option, }, @@ -76,14 +78,14 @@ pub enum WalletManagementCommand { wallet_path: PathBuf, /// If 'store-seed-phrase', the seed-phrase will be stored in the wallet file. - /// If 'do-not-store-seed-phrase', the seed-phrase will only be printed on the screen. /// Not storing the seed-phrase can be seen as a security measure /// to ensure sufficient secrecy in case that seed-phrase is reused /// elsewhere if this wallet is compromised. #[arg(required_unless_present("hardware_wallet"))] whether_to_store_seed_phrase: Option, - /// Mnemonic phrase (12, 15, or 24 words as a single quoted argument). If not specified, a new mnemonic phrase is generated and printed. + /// Mnemonic phrase (12, 15, or 24 words as a single quoted argument). + #[arg(required_unless_present("hardware_wallet"))] mnemonic: Option, /// Passphrase along the mnemonic @@ -91,8 +93,9 @@ pub enum WalletManagementCommand { passphrase: Option, /// Create a wallet using a connected hardware wallet. Only the public keys will be kept in - /// the software wallet - #[arg(long, conflicts_with_all(["mnemonic", "passphrase"]))] + /// the software wallet. Cannot specify a mnemonic or passphrase here, input them on the + /// hardware wallet instead when initializing the device. + #[arg(long, conflicts_with_all(["passphrase"]))] hardware_wallet: Option, }, diff --git a/wallet/wallet-cli-lib/src/config.rs b/wallet/wallet-cli-lib/src/config.rs index 436d7844a9..87e5923e31 100644 --- a/wallet/wallet-cli-lib/src/config.rs +++ b/wallet/wallet-cli-lib/src/config.rs @@ -20,6 +20,7 @@ use common::chain::config::{regtest_options::ChainConfigOptions, ChainType}; use crypto::key::hdkd::u31::U31; use utils::clap_utils; use utils_networking::NetworkAddressWithPort; +use wallet_rpc_lib::cmdline::CliHardwareWalletType; #[derive(Subcommand, Clone, Debug)] pub enum Network { @@ -84,6 +85,10 @@ pub struct CliArgs { #[clap(long, requires("wallet_file"))] pub force_change_wallet_type: bool, + /// Specified if the wallet file is of a hardware wallet type e.g. Trezor + #[arg(long, requires("wallet_file"))] + pub hardware_wallet: Option, + /// DEPRECATED: use start_staking_for_account instead! /// Start staking for the DEFAULT account after starting the wallet #[clap(long, requires("wallet_file"))] diff --git a/wallet/wallet-cli-lib/src/lib.rs b/wallet/wallet-cli-lib/src/lib.rs index 5fc3a8321b..385b0ad532 100644 --- a/wallet/wallet-cli-lib/src/lib.rs +++ b/wallet/wallet-cli-lib/src/lib.rs @@ -36,9 +36,10 @@ use node_comm::{make_cold_wallet_rpc_client, make_rpc_client, rpc_client::ColdWa use rpc::RpcAuthData; use tokio::sync::mpsc; use utils::{cookie::COOKIE_FILENAME, default_data_dir::default_data_dir_for_chain, ensure}; -use wallet_cli_commands::{ManageableWalletCommand, WalletCommand, WalletManagementCommand}; -use wallet_rpc_lib::types::NodeInterface; -use wallet_rpc_lib::{cmdline::make_wallet_config, config::WalletRpcConfig}; +use wallet_cli_commands::{ + CliHardwareWalletType, ManageableWalletCommand, WalletCommand, WalletManagementCommand, +}; +use wallet_rpc_lib::{cmdline::make_wallet_config, config::WalletRpcConfig, types::NodeInterface}; enum Mode { Interactive { @@ -284,8 +285,12 @@ fn setup_events_and_repl( wallet_path, encryption_password: args.wallet_password, force_change_wallet_type: args.force_change_wallet_type, - // TODO: add support for opening a hardware_wallet - hardware_wallet: None, + hardware_wallet: args.hardware_wallet.map(|hw| match hw { + #[cfg(feature = "trezor")] + wallet_rpc_lib::cmdline::CliHardwareWalletType::Trezor => { + CliHardwareWalletType::Trezor + } + }), }, ), res_tx, diff --git a/wallet/wallet-cli-lib/tests/cli_test_framework.rs b/wallet/wallet-cli-lib/tests/cli_test_framework.rs index 2e559a08bf..f9eb8dffa2 100644 --- a/wallet/wallet-cli-lib/tests/cli_test_framework.rs +++ b/wallet/wallet-cli-lib/tests/cli_test_framework.rs @@ -98,6 +98,7 @@ impl CliTestFramework { wallet_file: None, wallet_password: None, force_change_wallet_type: false, + hardware_wallet: None, start_staking: false, start_staking_for_account: vec![], node_rpc_address: Some(rpc_address.into()), @@ -127,6 +128,7 @@ impl CliTestFramework { wallet_file: None, wallet_password: None, force_change_wallet_type: false, + hardware_wallet: None, start_staking: false, start_staking_for_account: vec![], node_rpc_address: Some(rpc_address.into()), diff --git a/wallet/wallet-controller/Cargo.toml b/wallet/wallet-controller/Cargo.toml index a1a0c055ec..66f3afcae9 100644 --- a/wallet/wallet-controller/Cargo.toml +++ b/wallet/wallet-controller/Cargo.toml @@ -21,8 +21,6 @@ rpc-description = { path = "../../rpc/description" } randomness = { path = "../../randomness" } serialization = { path = "../../serialization" } storage = { path = "../../storage" } -storage-inmemory = { path = "../../storage/inmemory" } -pos-accounting = { path = "../../pos-accounting" } utils = { path = "../../utils" } utils-networking = { path = "../../utils/networking" } wallet = { path = ".." } diff --git a/wallet/wallet-controller/src/read.rs b/wallet/wallet-controller/src/read.rs index bd0ee4220c..2e9d1b2ab2 100644 --- a/wallet/wallet-controller/src/read.rs +++ b/wallet/wallet-controller/src/read.rs @@ -308,45 +308,22 @@ where pub async fn get_delegations( &self, ) -> Result, ControllerError> { - let delegations = match &self.wallet { - RuntimeWallet::Software(w) => { - let delegations = - w.get_delegations(self.account_index).map_err(ControllerError::WalletError)?; - let tasks: FuturesUnordered<_> = delegations - .into_iter() - .map(|(delegation_id, delegation_data)| { - self.get_delegation_share(delegation_data, *delegation_id).map(|res| { - res.map(|opt| { - opt.map(|(delegation_id, amount)| { - (delegation_id, delegation_data.pool_id, amount) - }) - }) - }) - }) - .collect(); - - tasks.try_collect::>().await?.into_iter().flatten().collect() - } - #[cfg(feature = "trezor")] - RuntimeWallet::Trezor(w) => { - let delegations = - w.get_delegations(self.account_index).map_err(ControllerError::WalletError)?; - let tasks: FuturesUnordered<_> = delegations - .into_iter() - .map(|(delegation_id, delegation_data)| { - self.get_delegation_share(delegation_data, *delegation_id).map(|res| { - res.map(|opt| { - opt.map(|(delegation_id, amount)| { - (delegation_id, delegation_data.pool_id, amount) - }) - }) + let tasks: FuturesUnordered<_> = self + .wallet + .get_delegations(self.account_index) + .map_err(ControllerError::WalletError)? + .map(|(delegation_id, delegation_data)| { + self.get_delegation_share(delegation_data, *delegation_id).map(|res| { + res.map(|opt| { + opt.map(|(delegation_id, amount)| { + (delegation_id, delegation_data.pool_id, amount) }) }) - .collect(); + }) + }) + .collect(); - tasks.try_collect::>().await?.into_iter().flatten().collect() - } - }; + let delegations = tasks.try_collect::>().await?.into_iter().flatten().collect(); Ok(delegations) } diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs index 63ab0ae5eb..107f149029 100644 --- a/wallet/wallet-controller/src/runtime_wallet.rs +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -1265,4 +1265,19 @@ impl RuntimeWallet { } } } + + pub fn get_delegations( + &self, + account_index: U31, + ) -> WalletResult + '_>> { + match self { + RuntimeWallet::Software(w) => w + .get_delegations(account_index) + .map(|it| -> Box> { Box::new(it) }), + #[cfg(feature = "trezor")] + RuntimeWallet::Trezor(w) => w + .get_delegations(account_index) + .map(|it| -> Box> { Box::new(it) }), + } + } } diff --git a/wallet/wallet-controller/src/types/mod.rs b/wallet/wallet-controller/src/types/mod.rs index ed6e307316..d7f5ecadbd 100644 --- a/wallet/wallet-controller/src/types/mod.rs +++ b/wallet/wallet-controller/src/types/mod.rs @@ -188,7 +188,7 @@ impl WalletTypeArgs { } } - pub fn parse_mnemonic( + pub fn parse_or_generate_mnemonic_if_needed( self, ) -> Result<(WalletTypeArgsComputed, CreatedWallet), mnemonic::Error> { match self { diff --git a/wallet/wallet-rpc-client/src/handles_client/mod.rs b/wallet/wallet-rpc-client/src/handles_client/mod.rs index 2a2fe37377..7558687889 100644 --- a/wallet/wallet-rpc-client/src/handles_client/mod.rs +++ b/wallet/wallet-rpc-client/src/handles_client/mod.rs @@ -124,42 +124,11 @@ where async fn create_wallet( &self, path: PathBuf, - store_seed_phrase: bool, - mnemonic: Option, - passphrase: Option, - hardware_wallet: Option, + wallet_args: WalletTypeArgs, ) -> Result { - let store_seed_phrase = if store_seed_phrase { - StoreSeedPhrase::Store - } else { - StoreSeedPhrase::DoNotStore - }; - - let args = match hardware_wallet { - None => WalletTypeArgs::Software { - mnemonic, - passphrase, - store_seed_phrase, - }, - #[cfg(feature = "trezor")] - Some(HardwareWalletType::Trezor) => { - ensure!( - mnemonic.is_none() - && passphrase.is_none() - && store_seed_phrase == StoreSeedPhrase::DoNotStore, - RpcError::HardwareWalletWithMnemonic - ); - WalletTypeArgs::Trezor - } - #[cfg(not(feature = "trezor"))] - Some(_) => { - return Err(RpcError::::InvalidHardwareWallet)?; - } - }; - let scan_blockchain = false; self.wallet_rpc - .create_wallet(path, args, false, scan_blockchain) + .create_wallet(path, wallet_args, false, scan_blockchain) .await .map(Into::into) .map_err(WalletRpcHandlesClientError::WalletRpcError) @@ -191,7 +160,7 @@ where mnemonic.is_none() && passphrase.is_none() && store_seed_phrase == StoreSeedPhrase::DoNotStore, - RpcError::HardwareWalletWithMnemonic + RpcError::HardwareWalletWithMnemonicOrPassphrase ); WalletTypeArgs::Trezor } diff --git a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs index c51502d8e0..08a3829079 100644 --- a/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs +++ b/wallet/wallet-rpc-client/src/rpc_client/client_impl.rs @@ -37,7 +37,10 @@ use serialization::DecodeAll; use utils_networking::IpOrSocketAddress; use wallet::account::TxInfo; use wallet_controller::{ - types::{Balances, CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo}, + types::{ + Balances, CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo, + WalletTypeArgs, + }, ConnectedPeer, ControllerConfig, UtxoState, UtxoType, }; use wallet_rpc_lib::{ @@ -83,11 +86,18 @@ impl WalletInterface for ClientWalletRpc { async fn create_wallet( &self, path: PathBuf, - store_seed_phrase: bool, - mnemonic: Option, - passphrase: Option, - hardware_wallet: Option, + wallet_args: WalletTypeArgs, ) -> Result { + let (mnemonic, passphrase, store_seed_phrase, hardware_wallet) = match wallet_args { + WalletTypeArgs::Software { + mnemonic, + passphrase, + store_seed_phrase, + } => (mnemonic, passphrase, store_seed_phrase.should_save(), None), + #[cfg(feature = "trezor")] + WalletTypeArgs::Trezor => (None, None, false, Some(HardwareWalletType::Trezor)), + }; + ColdWalletRpcClient::create_wallet( &self.http_client, path.to_string_lossy().to_string(), diff --git a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs index ff5c3a0f59..2ee41679a2 100644 --- a/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs +++ b/wallet/wallet-rpc-client/src/wallet_rpc_traits.rs @@ -29,7 +29,9 @@ use serialization::hex_encoded::HexEncoded; use utils_networking::IpOrSocketAddress; use wallet::account::TxInfo; use wallet_controller::{ - types::{CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo}, + types::{ + CreatedBlockInfo, GenericTokenTransfer, SeedWithPassPhrase, WalletInfo, WalletTypeArgs, + }, ConnectedPeer, ControllerConfig, UtxoState, UtxoType, }; use wallet_rpc_lib::types::{ @@ -70,10 +72,7 @@ pub trait WalletInterface { async fn create_wallet( &self, path: PathBuf, - store_seed_phrase: bool, - mnemonic: Option, - passphrase: Option, - hardware_wallet: Option, + wallet_args: WalletTypeArgs, ) -> Result; async fn recover_wallet( diff --git a/wallet/wallet-rpc-lib/src/cmdline.rs b/wallet/wallet-rpc-lib/src/cmdline.rs index c5b677720c..0893d2d310 100644 --- a/wallet/wallet-rpc-lib/src/cmdline.rs +++ b/wallet/wallet-rpc-lib/src/cmdline.rs @@ -15,6 +15,7 @@ use std::path::PathBuf; +use clap::ValueEnum; use common::chain::config::{regtest_options::ChainConfigOptions, ChainType}; use crypto::key::hdkd::u31::U31; use rpc::{ @@ -26,7 +27,10 @@ use utils::{ }; use utils_networking::NetworkAddressWithPort; -use crate::config::{WalletRpcConfig, WalletServiceConfig}; +use crate::{ + config::{WalletRpcConfig, WalletServiceConfig}, + types::HardwareWalletType, +}; /// Service providing an RPC interface to a wallet #[derive(clap::Parser)] @@ -78,6 +82,21 @@ impl WalletRpcDaemonCommand { } } +#[derive(Debug, Clone, Copy, ValueEnum)] +pub enum CliHardwareWalletType { + #[cfg(feature = "trezor")] + Trezor, +} + +impl From for HardwareWalletType { + fn from(value: CliHardwareWalletType) -> Self { + match value { + #[cfg(feature = "trezor")] + CliHardwareWalletType::Trezor => Self::Trezor, + } + } +} + #[derive(clap::Args)] #[command( version, @@ -98,6 +117,10 @@ pub struct WalletRpcDaemonChainArgs { #[arg(long, requires("wallet_file"))] force_change_wallet_type: bool, + /// Specified if the wallet file is of a hardware wallet type e.g. Trezor + #[arg(long, requires("wallet_file"))] + hardware_wallet: Option, + /// Start staking for the specified account after starting the wallet #[arg(long, value_name("ACC_NUMBER"), requires("wallet_file"))] start_staking_for_account: Vec, @@ -161,6 +184,7 @@ impl WalletRpcDaemonChainArgs { let Self { wallet_file, force_change_wallet_type, + hardware_wallet, rpc_bind_address, start_staking_for_account, node_rpc_address, @@ -185,6 +209,7 @@ impl WalletRpcDaemonChainArgs { wallet_file, force_change_wallet_type, start_staking_for_account, + hardware_wallet.map(Into::into), ); if cold_wallet { diff --git a/wallet/wallet-rpc-lib/src/config.rs b/wallet/wallet-rpc-lib/src/config.rs index c2029d2673..6bf0e55d07 100644 --- a/wallet/wallet-rpc-lib/src/config.rs +++ b/wallet/wallet-rpc-lib/src/config.rs @@ -22,6 +22,8 @@ use common::chain::config::{ use crypto::key::hdkd::u31::U31; use rpc::{rpc_creds::RpcCreds, RpcAuthData}; +use crate::types::HardwareWalletType; + #[derive(Clone)] pub enum NodeRpc { ColdWallet, @@ -45,6 +47,9 @@ pub struct WalletServiceConfig { /// Force change the wallet type from hot to cold or from cold to hot pub force_change_wallet_type: bool, + /// Specified if the wallet file is of a hardware wallet type e.g. Trezor + pub hardware_wallet_type: Option, + /// Start staking for account after starting the wallet pub start_staking_for_account: Vec, @@ -58,6 +63,7 @@ impl WalletServiceConfig { wallet_file: Option, force_change_wallet_type: bool, start_staking_for_account: Vec, + hardware_wallet_type: Option, ) -> Self { Self { chain_config: Arc::new(common::chain::config::Builder::new(chain_type).build()), @@ -65,6 +71,7 @@ impl WalletServiceConfig { force_change_wallet_type, start_staking_for_account, node_rpc: NodeRpc::ColdWallet, + hardware_wallet_type, } } diff --git a/wallet/wallet-rpc-lib/src/lib.rs b/wallet/wallet-rpc-lib/src/lib.rs index c4e9e476da..1b0e8f49d5 100644 --- a/wallet/wallet-rpc-lib/src/lib.rs +++ b/wallet/wallet-rpc-lib/src/lib.rs @@ -18,12 +18,14 @@ pub mod config; mod rpc; mod service; +use rpc::types::HardwareWalletType; pub use rpc::{ types, ColdWalletRpcClient, ColdWalletRpcDescription, ColdWalletRpcServer, RpcCreds, RpcError, WalletEventsRpcServer, WalletRpc, WalletRpcClient, WalletRpcDescription, WalletRpcServer, }; pub use service::{Event, EventStream, TxState, WalletHandle, /* WalletResult, */ WalletService,}; use wallet_controller::{NodeInterface, NodeRpcClient}; +use wallet_types::wallet_type::WalletType; use std::{fmt::Debug, time::Duration}; @@ -98,13 +100,17 @@ pub async fn start_services( where N: NodeInterface + Clone + Sync + Send + 'static + Debug, { + let wallet_type = wallet_config.hardware_wallet_type.map_or_else( + || node_rpc.is_cold_wallet_node().into(), + |hw| match hw { + #[cfg(feature = "trezor")] + HardwareWalletType::Trezor => WalletType::Trezor, + }, + ); // Start the wallet service let wallet_service = WalletService::start( wallet_config.chain_config, - // TODO add support for trezor wallet - wallet_config - .wallet_file - .map(|file| (file, node_rpc.is_cold_wallet_node().into())), + wallet_config.wallet_file.map(|file| (file, wallet_type)), wallet_config.force_change_wallet_type, wallet_config.start_staking_for_account, node_rpc, diff --git a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs index 72627c191c..509ccb8300 100644 --- a/wallet/wallet-rpc-lib/src/rpc/server_impl.rs +++ b/wallet/wallet-rpc-lib/src/rpc/server_impl.rs @@ -114,7 +114,7 @@ where mnemonic.is_none() && passphrase.is_none() && store_seed_phrase == StoreSeedPhrase::DoNotStore, - RpcError::::HardwareWalletWithMnemonic + RpcError::::HardwareWalletWithMnemonicOrPassphrase ); WalletTypeArgs::Trezor } @@ -161,7 +161,7 @@ where mnemonic.is_none() && passphrase.is_none() && store_seed_phrase == StoreSeedPhrase::DoNotStore, - RpcError::::HardwareWalletWithMnemonic + RpcError::::HardwareWalletWithMnemonicOrPassphrase ); WalletTypeArgs::Trezor } diff --git a/wallet/wallet-rpc-lib/src/rpc/types.rs b/wallet/wallet-rpc-lib/src/rpc/types.rs index 13e2c63d2d..00c75f6614 100644 --- a/wallet/wallet-rpc-lib/src/rpc/types.rs +++ b/wallet/wallet-rpc-lib/src/rpc/types.rs @@ -97,7 +97,7 @@ pub enum RpcError { EmptyMnemonic, #[error("Cannot specify a mnemonic or passphrase when using a hardware wallet")] - HardwareWalletWithMnemonic, + HardwareWalletWithMnemonicOrPassphrase, #[error("Invalid hardware wallet selection")] InvalidHardwareWallet, diff --git a/wallet/wallet-rpc-lib/src/service/worker.rs b/wallet/wallet-rpc-lib/src/service/worker.rs index 8acfac81b4..cc6597e541 100644 --- a/wallet/wallet-rpc-lib/src/service/worker.rs +++ b/wallet/wallet-rpc-lib/src/service/worker.rs @@ -193,7 +193,7 @@ where ); let wallet_type = args.wallet_type(self.node_rpc.is_cold_wallet_node()); let (computed_args, wallet_created) = - args.parse_mnemonic().map_err(RpcError::InvalidMnemonic)?; + args.parse_or_generate_mnemonic_if_needed().map_err(RpcError::InvalidMnemonic)?; let wallet = if scan_blockchain { WalletController::recover_wallet( diff --git a/wallet/wallet-rpc-lib/tests/utils.rs b/wallet/wallet-rpc-lib/tests/utils.rs index a54cda825b..d631f9c852 100644 --- a/wallet/wallet-rpc-lib/tests/utils.rs +++ b/wallet/wallet-rpc-lib/tests/utils.rs @@ -110,10 +110,11 @@ impl TestFramework { // Start the wallet service let (wallet_service, rpc_server) = { - let ws_config = WalletServiceConfig::new(chain_type, Some(wallet_path), false, vec![]) - .with_regtest_options(chain_config_options) - .unwrap() - .with_custom_chain_config(chain_config.clone()); + let ws_config = + WalletServiceConfig::new(chain_type, Some(wallet_path), false, vec![], None) + .with_regtest_options(chain_config_options) + .unwrap() + .with_custom_chain_config(chain_config.clone()); let bind_addr = "127.0.0.1:0".parse().unwrap(); let rpc_config = wallet_rpc_lib::config::WalletRpcConfig { bind_addr, From 511bba38b42470471bcc695c4c9f1375eb6e900b Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 9 Dec 2024 17:05:17 +0100 Subject: [PATCH 44/48] Implement sign tx intent for Trezor signer --- Cargo.lock | 1172 ++++++++--------- .../transaction/signed_transaction_intent.rs | 7 + wallet/Cargo.toml | 2 + wallet/src/signer/software_signer/tests.rs | 68 + wallet/src/signer/trezor_signer/mod.rs | 26 +- wallet/src/signer/trezor_signer/tests.rs | 72 + wallet/src/wallet/mod.rs | 3 +- .../wallet-controller/src/runtime_wallet.rs | 3 + .../src/synced_controller.rs | 8 + 9 files changed, 755 insertions(+), 606 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1234005362..57bffb251c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.28" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79faae4620f45232f599d9bc7b290f88247a0834162c4495ab2f02d60004adfb" +checksum = "ec3672c180e71eeaaac3a541fbbc5f5ad4def8b747c595ad30d674e43049f7b0" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -43,19 +43,13 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -138,9 +132,9 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-activity" @@ -192,9 +186,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -207,43 +201,43 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "api-blockchain-scanner-daemon" @@ -418,9 +412,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arraytools" @@ -508,9 +502,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ "async-lock", "cfg-if", @@ -538,9 +532,9 @@ dependencies = [ [[package]] name = "async-process" -version = "2.2.4" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a07789659a4d385b79b18b9127fc27e1a59e1e89117c78c5ea3b806f016374" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel", "async-io", @@ -553,7 +547,6 @@ dependencies = [ "futures-lite", "rustix", "tracing", - "windows-sys 0.59.0", ] [[package]] @@ -564,7 +557,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -593,13 +586,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -610,24 +603,24 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "axum" -version = "0.7.5" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.1", "hyper-util", "itoa", "matchit", @@ -640,9 +633,9 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tokio", - "tower", + "tower 0.5.1", "tower-layer", "tower-service", "tracing", @@ -650,20 +643,20 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", "tracing", @@ -671,17 +664,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -710,9 +703,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bb8" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10cf871f3ff2ce56432fddc2615ac7acc3aa22ca321f8fea800846fbb32f188" +checksum = "d89aabfae550a5c44b43ab941844ffcd2e993cb6900b342debf59e9ea74acdb8" dependencies = [ "async-trait", "futures-util", @@ -770,11 +763,11 @@ dependencies = [ [[package]] name = "bip39" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +checksum = "33415e24172c1b7d6066f6d999545375ab8e1d95421d6784bdfff9496f292387" dependencies = [ - "bitcoin_hashes 0.11.0", + "bitcoin_hashes", "serde", "unicode-normalization", "zeroize", @@ -803,7 +796,7 @@ checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" dependencies = [ "bech32 0.10.0-beta", "bitcoin-internals", - "bitcoin_hashes 0.13.0", + "bitcoin_hashes", "hex-conservative", "hex_lit", "secp256k1 0.28.2", @@ -824,12 +817,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" -[[package]] -name = "bitcoin_hashes" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" - [[package]] name = "bitcoin_hashes" version = "0.13.0" @@ -982,9 +969,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" dependencies = [ "borsh-derive", "cfg_aliases 0.2.1", @@ -992,26 +979,25 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.87", - "syn_derive", + "syn 2.0.90", ] [[package]] name = "bstr" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" dependencies = [ "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.9", "serde", ] @@ -1035,9 +1021,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-unit" -version = "5.1.4" +version = "5.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" +checksum = "e1cd29c3c585209b0cbc7309bfe3ed7efd8c84c21b7af29c8bfae908f8777174" dependencies = [ "rust_decimal", "serde", @@ -1068,22 +1054,22 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.17.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" +checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1094,9 +1080,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "calloop" @@ -1158,9 +1144,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.14" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" +checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ "jobserver", "libc", @@ -1384,9 +1370,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1437,9 +1423,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -1447,9 +1433,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -1459,21 +1445,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "clipboard-win" @@ -1486,13 +1472,13 @@ dependencies = [ [[package]] name = "clipboard_macos" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145a7f9e9b89453bc0a5e32d166456405d389cea5b578f57f1274b1397588a95" +checksum = "9b7f4aaa047ba3c3630b080bb9860894732ff23e2aee290a418909aa6d5df38f" dependencies = [ - "objc", - "objc-foundation", - "objc_id", + "objc2 0.5.2", + "objc2-app-kit", + "objc2-foundation", ] [[package]] @@ -1526,9 +1512,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "com" @@ -1683,6 +1669,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1696,8 +1692,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "foreign-types 0.5.0", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", + "core-graphics-types 0.2.0", "foreign-types 0.5.0", "libc", ] @@ -1709,7 +1718,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "libc", ] @@ -1736,9 +1756,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -1869,7 +1889,7 @@ checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ "bitflags 2.6.0", "crossterm_winapi", - "mio 1.0.2", + "mio 1.0.3", "parking_lot 0.12.3", "rustix", "signal-hook", @@ -1914,7 +1934,7 @@ dependencies = [ "rpc-description", "rstest", "schnorrkel", - "secp256k1 0.29.0", + "secp256k1 0.29.1", "serde", "serialization", "sha-1 0.10.1", @@ -1939,9 +1959,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" dependencies = [ "csv-core", "itoa", @@ -1960,12 +1980,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" dependencies = [ "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2013,7 +2033,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2023,7 +2043,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" dependencies = [ "bitflags 2.6.0", - "libloading 0.8.5", + "libloading 0.8.6", "winapi", ] @@ -2048,7 +2068,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2059,7 +2079,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2096,7 +2116,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "unicode-xid", ] @@ -2182,7 +2202,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2197,7 +2217,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.5", + "libloading 0.8.6", ] [[package]] @@ -2310,9 +2330,9 @@ checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -2331,14 +2351,14 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "enum-as-inner" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2358,7 +2378,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2379,7 +2399,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2390,19 +2410,19 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "error-code" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" +checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" [[package]] name = "escape8259" @@ -2422,9 +2442,9 @@ dependencies = [ [[package]] name = "euclid" -version = "0.22.10" +version = "0.22.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f0eb73b934648cd7a4a61f1b15391cd95dab0b4da6e2e66c2a072c144b4a20" +checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48" dependencies = [ "num-traits", ] @@ -2442,9 +2462,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener", "pin-project-lite", @@ -2486,9 +2506,9 @@ checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1" [[package]] name = "fastrand" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fd-lock" @@ -2503,9 +2523,9 @@ dependencies = [ [[package]] name = "fdeflate" -version = "0.3.4" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" dependencies = [ "simd-adler32", ] @@ -2550,12 +2570,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -2570,11 +2590,17 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "font-types" -version = "0.6.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0189ccb084f77c5523e08288d418cbaa09c451a08515678a0aa265df9a8b60" +checksum = "b3971f9a5ca983419cdc386941ba3b9e1feba01a0ab888adf78739feb2798492" dependencies = [ "bytemuck", ] @@ -2629,7 +2655,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2687,9 +2713,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -2702,9 +2728,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -2712,15 +2738,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -2730,15 +2756,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ "fastrand", "futures-core", @@ -2749,26 +2775,26 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-timer" @@ -2778,9 +2804,9 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -2796,9 +2822,9 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "979f00864edc7516466d6b3157706e06c032f22715700ddd878228a91d02bc56" +checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" dependencies = [ "cfg-if", "libc", @@ -2873,9 +2899,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gl_generator" @@ -3020,7 +3046,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.4.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -3056,6 +3082,17 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + [[package]] name = "hashlink" version = "0.9.1" @@ -3074,7 +3111,7 @@ dependencies = [ "bitflags 2.6.0", "com", "libc", - "libloading 0.8.5", + "libloading 0.8.6", "thiserror", "widestring", "winapi", @@ -3166,7 +3203,7 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 1.0.3", + "idna", "ipnet", "once_cell", "rand 0.8.5", @@ -3219,9 +3256,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -3246,7 +3283,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -3257,7 +3294,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "pin-project-lite", ] @@ -3270,9 +3307,9 @@ checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -3288,9 +3325,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -3312,14 +3349,14 @@ dependencies = [ [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "httparse", "httpdate", @@ -3337,7 +3374,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.30", + "hyper 0.14.31", "log", "rustls 0.21.12", "rustls-native-certs 0.6.3", @@ -3352,7 +3389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.30", + "hyper 0.14.31", "native-tls", "tokio", "tokio-native-tls", @@ -3360,24 +3397,25 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", - "hyper 1.4.1", + "hyper 1.5.1", "pin-project-lite", "tokio", + "tower-service", ] [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3710,7 +3748,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -3719,16 +3757,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -3752,13 +3780,13 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.90", ] [[package]] @@ -3774,12 +3802,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "serde", ] @@ -3809,9 +3837,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" @@ -3859,9 +3887,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jni" @@ -3896,10 +3924,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -3929,7 +3958,7 @@ dependencies = [ "http 0.2.12", "jsonrpsee-core", "pin-project", - "rustls-native-certs 0.7.2", + "rustls-native-certs 0.7.3", "rustls-pki-types", "soketto", "thiserror", @@ -3951,7 +3980,7 @@ dependencies = [ "beef", "futures-timer", "futures-util", - "hyper 0.14.30", + "hyper 0.14.31", "jsonrpsee-types", "parking_lot 0.12.3", "pin-project", @@ -3972,7 +4001,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ccf93fc4a0bfe05d851d37d7c32b7f370fe94336b52a2f0efc5f1981895c2e5" dependencies = [ "async-trait", - "hyper 0.14.30", + "hyper 0.14.31", "hyper-rustls", "jsonrpsee-core", "jsonrpsee-types", @@ -3980,7 +4009,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tower", + "tower 0.4.13", "tracing", "url", ] @@ -3995,7 +4024,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -4006,7 +4035,7 @@ checksum = "12d8b6a9674422a8572e0b0abb12feeb3f2aeda86528c80d0350c2bd0923ab41" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.30", + "hyper 0.14.31", "jsonrpsee-core", "jsonrpsee-types", "pin-project", @@ -4018,7 +4047,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "tower", + "tower 0.4.13", "tracing", ] @@ -4064,7 +4093,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading 0.8.5", + "libloading 0.8.6", "pkg-config", ] @@ -4092,9 +4121,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libloading" @@ -4108,9 +4137,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -4118,20 +4147,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "libredox" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" -dependencies = [ - "bitflags 2.6.0", - "libc", - "redox_syscall 0.4.1", -] +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libredox" @@ -4141,6 +4159,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", + "redox_syscall 0.5.7", ] [[package]] @@ -4243,7 +4262,7 @@ dependencies = [ "logging", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "tracing", "utils", ] @@ -4274,11 +4293,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.15.2", ] [[package]] @@ -4293,9 +4312,9 @@ dependencies = [ [[package]] name = "lyon_algorithms" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3bca95f9a4955b3e4a821fbbcd5edfbd9be2a9a50bb5758173e5358bfb4c623" +checksum = "f13c9be19d257c7d37e70608ed858e8eab4b2afcea2e3c9a622e892acbf43c08" dependencies = [ "lyon_path", "num-traits", @@ -4303,9 +4322,9 @@ dependencies = [ [[package]] name = "lyon_geom" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edecfb8d234a2b0be031ab02ebcdd9f3b9ee418fb35e265f7a540a48d197bff9" +checksum = "8af69edc087272df438b3ee436c4bb6d7c04aa8af665cfd398feae627dbd8570" dependencies = [ "arrayvec", "euclid", @@ -4314,9 +4333,9 @@ dependencies = [ [[package]] name = "lyon_path" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c08a606c7a59638d6c6aa18ac91a06aa9fb5f765a7efb27e6a4da58700740d7" +checksum = "8e0b8aec2f58586f6eef237985b9a9b7cb3a3aff4417c575075cf95bf925252e" dependencies = [ "lyon_geom", "num-traits", @@ -4384,9 +4403,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" +checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" dependencies = [ "libc", ] @@ -4483,7 +4502,7 @@ checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" dependencies = [ "bitflags 2.6.0", "block", - "core-graphics-types", + "core-graphics-types 0.1.3", "foreign-types 0.5.0", "log", "objc", @@ -4496,16 +4515,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", - "simd-adler32", -] - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -4513,6 +4522,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ "adler2", + "simd-adler32", ] [[package]] @@ -4584,11 +4594,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi 0.3.9", "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", @@ -4618,7 +4627,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -4651,7 +4660,7 @@ dependencies = [ "bitflags 2.6.0", "codespan-reporting", "hexf-parse", - "indexmap 2.4.0", + "indexmap 2.7.0", "log", "num-traits", "rustc-hash", @@ -4777,7 +4786,7 @@ dependencies = [ "subsystem", "thiserror", "tokio", - "tower", + "tower 0.4.13", "utils-networking", "wallet-types", ] @@ -4957,7 +4966,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5029,7 +5038,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5148,7 +5157,6 @@ checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ "bitflags 2.6.0", "block2 0.5.1", - "dispatch", "libc", "objc2 0.5.2", ] @@ -5198,18 +5206,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oneshot" @@ -5231,9 +5239,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -5252,7 +5260,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5263,9 +5271,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -5281,11 +5289,11 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "orbclient" -version = "0.3.47" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" +checksum = "ba0b26cec2e24f08ed8bb31519a9333140a6599b867dac464bb150bdb796fd43" dependencies = [ - "libredox 0.0.2", + "libredox", ] [[package]] @@ -5339,7 +5347,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5350,11 +5358,11 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "owned_ttf_parser" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490d3a563d3122bf7c911a59b0add9389e5ec0f5f0c3ac6b91ff235a0e6a7f90" +checksum = "22ec719bbf3b2a81c109a4e20b1f129b5566b7dce654bc3872f6a05abf82b2c4" dependencies = [ - "ttf-parser 0.24.1", + "ttf-parser 0.25.1", ] [[package]] @@ -5480,7 +5488,7 @@ dependencies = [ "by_address", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5511,9 +5519,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -5558,7 +5566,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.3", + "redox_syscall 0.5.7", "smallvec", "windows-targets 0.52.6", ] @@ -5616,7 +5624,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5630,29 +5638,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -5673,15 +5681,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plotters" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -5692,37 +5700,37 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] [[package]] name = "png" -version = "0.17.13" +version = "0.17.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +checksum = "b67582bd5b65bdff614270e2ea89a1cf15bef71245cc1e5f7ea126977144211d" dependencies = [ "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.4", + "miniz_oxide", ] [[package]] name = "polling" -version = "3.7.3" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", @@ -5800,9 +5808,9 @@ dependencies = [ [[package]] name = "postgres-types" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02048d9e032fb3cc3413bbf7b83a15d84a5d419778e2628751896d856498eee9" +checksum = "f66ea23a2d0e5734297357705193335e0a957696f34bed2f2faefacb2fec336f" dependencies = [ "bytes", "fallible-iterator 0.2.0", @@ -5893,34 +5901,11 @@ dependencies = [ "toml_edit", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -5933,16 +5918,16 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "version_check", "yansi", ] [[package]] name = "profiling" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" +checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" [[package]] name = "proptest" @@ -5958,7 +5943,7 @@ dependencies = [ "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift 0.3.0", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "rusty-fork", "tempfile", "unarray", @@ -5986,9 +5971,9 @@ dependencies = [ [[package]] name = "psl" -version = "2.1.55" +version = "2.1.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce9398ad066421139b2e3afe16ea46772ffda30bd9ba57554dc035df5e26edc8" +checksum = "0b12d418db33ae2247c46f2685d2b1530b315de16b253da8fc964eeeb8eb8371" dependencies = [ "psl-types", ] @@ -6033,9 +6018,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-xml" -version = "0.34.0" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f24d770aeca0eacb81ac29dfbc55ebcc09312fdd1f8bbecdc7e4a84e000e3b4" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" dependencies = [ "memchr", ] @@ -6201,9 +6186,9 @@ dependencies = [ [[package]] name = "read-fonts" -version = "0.20.0" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c141b9980e1150201b2a3a32879001c8f975fe313ec3df5471a9b5c79a880cd" +checksum = "4a04b892cb6f91951f144c33321843790c8574c825aafdb16d815fd7183b5229" dependencies = [ "bytemuck", "font-types", @@ -6229,18 +6214,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -6252,7 +6228,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", - "libredox 0.1.3", + "libredox", "thiserror", ] @@ -6294,19 +6270,19 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -6320,13 +6296,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -6337,9 +6313,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "relative-path" @@ -6382,7 +6358,7 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.30", + "hyper 0.14.31", "hyper-tls", "ipnet", "js-sys", @@ -6486,9 +6462,9 @@ dependencies = [ [[package]] name = "rlimit" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3560f70f30a0f16d11d01ed078a07740fe6b489667abc7c7b029155d9f21c3d8" +checksum = "7043b63bd0cd1aaa628e476b80e6d4023a3b50eb32789f2728908107bd0c793a" dependencies = [ "libc", ] @@ -6515,7 +6491,7 @@ dependencies = [ "crypto", "expect-test", "http 0.2.12", - "hyper 0.14.30", + "hyper 0.14.31", "jsonrpsee", "logging", "randomness", @@ -6529,7 +6505,7 @@ dependencies = [ "test-utils", "thiserror", "tokio", - "tower", + "tower 0.4.13", "tower-http 0.4.4", "utils", "utils-networking", @@ -6549,7 +6525,7 @@ version = "1.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6591,7 +6567,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.87", + "syn 2.0.90", "unicode-ident", ] @@ -6664,15 +6640,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys 0.4.14", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6696,7 +6672,7 @@ dependencies = [ "log", "ring", "rustls-pki-types", - "rustls-webpki 0.102.6", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] @@ -6715,12 +6691,12 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.3", + "rustls-pemfile 2.2.0", "rustls-pki-types", "schannel", "security-framework", @@ -6737,19 +6713,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" @@ -6763,9 +6738,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -6774,9 +6749,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "rusty-fork" @@ -6824,20 +6799,20 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.16" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb7ac86243095b70a7920639507b71d51a63390d1ba26c4f60a552fbb914a37" +checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" dependencies = [ "sdd", ] [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6908,16 +6883,16 @@ checksum = "70b31447ca297092c5a9916fc3b955203157b37c19ca8edde4f52e9843e602c7" dependencies = [ "ab_glyph", "log", - "memmap2 0.9.4", + "memmap2 0.9.5", "smithay-client-toolkit 0.18.1", "tiny-skia", ] [[package]] name = "sdd" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0495e4577c672de8254beb68d01a9b62d0e8a13c099edecdbedccce3223cd29f" +checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" [[package]] name = "seahash" @@ -6931,18 +6906,18 @@ version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ - "bitcoin_hashes 0.13.0", + "bitcoin_hashes", "secp256k1-sys 0.9.2", ] [[package]] name = "secp256k1" -version = "0.29.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ "rand 0.8.5", - "secp256k1-sys 0.10.0", + "secp256k1-sys 0.10.1", ] [[package]] @@ -6956,9 +6931,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" dependencies = [ "cc", ] @@ -6970,7 +6945,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", "core-foundation-sys", "libc", "security-framework-sys", @@ -6978,9 +6953,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -6988,9 +6963,9 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" +checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe" [[package]] name = "semver" @@ -7000,9 +6975,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -7018,20 +6993,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -7057,14 +7032,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -7092,15 +7067,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.4.0", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -7110,21 +7085,21 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "serial_test" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ "futures", "log", @@ -7136,13 +7111,13 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -7187,7 +7162,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -7279,7 +7254,7 @@ checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", "mio 0.8.11", - "mio 1.0.2", + "mio 1.0.3", "signal-hook", ] @@ -7300,9 +7275,9 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" @@ -7318,9 +7293,9 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "skrifa" -version = "0.20.0" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abea4738067b1e628c6ce28b2c216c19e9ea95715cdb332680e821c3bec2ef23" +checksum = "8e1c44ad1f6c5bdd4eefed8326711b7dbda9ea45dfd36068c427d332aa382cbe" dependencies = [ "bytemuck", "read-fonts", @@ -7371,7 +7346,7 @@ dependencies = [ "cursor-icon", "libc", "log", - "memmap2 0.9.4", + "memmap2 0.9.5", "rustix", "thiserror", "wayland-backend", @@ -7396,15 +7371,15 @@ dependencies = [ "cursor-icon", "libc", "log", - "memmap2 0.9.4", + "memmap2 0.9.5", "rustix", "thiserror", "wayland-backend", "wayland-client", "wayland-csd-frame", "wayland-cursor", - "wayland-protocols 0.32.3", - "wayland-protocols-wlr 0.3.3", + "wayland-protocols 0.32.5", + "wayland-protocols-wlr 0.3.5", "wayland-scanner", "xkeysym", ] @@ -7463,9 +7438,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -7473,26 +7448,25 @@ dependencies = [ [[package]] name = "softbuffer" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d623bff5d06f60d738990980d782c8c866997d9194cfe79ecad00aa2f76826dd" +checksum = "18051cdd562e792cad055119e0cdb2cfc137e44e3987532e0f9659a77931bb08" dependencies = [ "as-raw-xcb-connection", "bytemuck", "cfg_aliases 0.2.1", - "core-graphics", + "core-graphics 0.24.0", "drm", "fastrand", "foreign-types 0.5.0", "js-sys", "log", - "memmap2 0.9.4", + "memmap2 0.9.5", "objc2 0.5.2", - "objc2-app-kit", "objc2-foundation", "objc2-quartz-core", "raw-window-handle", - "redox_syscall 0.5.3", + "redox_syscall 0.5.7", "rustix", "tiny-xlib", "wasm-bindgen", @@ -7500,7 +7474,7 @@ dependencies = [ "wayland-client", "wayland-sys", "web-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "x11rb", ] @@ -7687,7 +7661,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -7715,15 +7689,15 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "svg_fmt" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20e16a0f46cf5fd675563ef54f26e83e20f2366bcf027bcb3cc3ed2b98aaf2ca" +checksum = "ce5d813d71d82c4cbc1742135004e4a79fd870214c155443451c139c9470a0aa" [[package]] name = "swash" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93cdc334a50fcc2aa3f04761af3b28196280a6aaadb1ef11215c478ae32615ac" +checksum = "cbd59f3f359ddd2c95af4758c18270eddd9c730dde98598023cdabff472c2ca2" dependencies = [ "skrifa", "yazi", @@ -7743,27 +7717,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.87" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -7772,9 +7734,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" [[package]] name = "synstructure" @@ -7784,14 +7746,14 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "sys-locale" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801cf239ecd6ccd71f03d270d67dd53d13e90aab208bf4b8fe4ad957ea949b0" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" dependencies = [ "libc", ] @@ -7803,7 +7765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -7825,9 +7787,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -7913,22 +7875,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -7943,9 +7905,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -7966,9 +7928,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -8002,13 +7964,13 @@ dependencies = [ [[package]] name = "tiny-xlib" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d52f22673960ad13af14ff4025997312def1223bfa7c8e4949d099e6b3d5d1c" +checksum = "0324504befd01cab6e0c994f34b2ffa257849ee019d3fb3b64fb2c858887d89e" dependencies = [ "as-raw-xcb-connection", "ctor-lite", - "libloading 0.8.5", + "libloading 0.8.6", "pkg-config", "tracing", ] @@ -8069,14 +8031,14 @@ dependencies = [ [[package]] name = "tokio" -version = "1.39.3" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.2", + "mio 1.0.3", "parking_lot 0.12.3", "pin-project-lite", "signal-hook-registry", @@ -8094,7 +8056,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -8109,9 +8071,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03adcf0147e203b6032c0b2d30be1415ba03bc348901f3ff1cc0df6a733e60c3" +checksum = "3b5d3742945bc7d7f210693b0c58ae542c6fd47b17adbbda0885f3dcb34a6bdb" dependencies = [ "async-trait", "byteorder", @@ -8168,9 +8130,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -8180,9 +8142,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -8224,11 +8186,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", @@ -8245,6 +8207,21 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", "tokio", "tower-layer", "tower-service", @@ -8279,7 +8256,7 @@ checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "bitflags 2.6.0", "bytes", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "pin-project-lite", @@ -8301,9 +8278,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -8313,20 +8290,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -8345,9 +8322,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" dependencies = [ "serde", "tracing-core", @@ -8355,9 +8332,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term 0.46.0", @@ -8409,9 +8386,9 @@ checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" [[package]] name = "ttf-parser" -version = "0.24.1" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" [[package]] name = "tx-verifier" @@ -8456,7 +8433,7 @@ version = "1.0.0" dependencies = [ "itertools 0.13.0", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -8484,9 +8461,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-bidi-mirroring" @@ -8523,33 +8500,33 @@ dependencies = [ [[package]] name = "unicode-properties" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-script" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d71f5726e5f285a935e9fe8edfd53f0491eb6e9a5774097fdabee7cd8c9cd" +checksum = "9fb421b350c9aff471779e262955939f565ec18b86c15364e6bdf0d662ca7c1f" [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "universal-hash" @@ -8569,12 +8546,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", "serde", ] @@ -8673,9 +8650,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" [[package]] name = "valuable" @@ -8960,7 +8937,7 @@ dependencies = [ "subsystem", "thiserror", "tokio", - "tower", + "tower 0.4.13", "utils", "utils-networking", "wallet", @@ -9117,9 +9094,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -9128,24 +9105,23 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -9155,9 +9131,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -9165,22 +9141,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-doc-gen" @@ -9188,7 +9164,7 @@ version = "1.0.0" dependencies = [ "anyhow", "clap", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -9229,9 +9205,9 @@ dependencies = [ [[package]] name = "wayland-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90e11ce2ca99c97b940ee83edbae9da2d56a08f9ea8158550fd77fa31722993" +checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" dependencies = [ "cc", "downcast-rs", @@ -9243,9 +9219,9 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.5" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e321577a0a165911bdcfb39cf029302479d7527b517ee58ab0f6ad09edf0943" +checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" dependencies = [ "bitflags 2.6.0", "rustix", @@ -9266,9 +9242,9 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.31.5" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef9489a8df197ebf3a8ce8a7a7f0a2320035c3743f3c1bd0bdbccf07ce64f95" +checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c" dependencies = [ "rustix", "wayland-client", @@ -9289,9 +9265,9 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.32.3" +version = "0.32.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62989625a776e827cc0f15d41444a3cea5205b963c3a25be48ae1b52d6b4daaa" +checksum = "7cd0ade57c4e6e9a8952741325c30bf82f4246885dca8bf561898b86d0c1f58e" dependencies = [ "bitflags 2.6.0", "wayland-backend", @@ -9327,22 +9303,22 @@ dependencies = [ [[package]] name = "wayland-protocols-wlr" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd993de54a40a40fbe5601d9f1fbcaef0aebcc5fda447d7dc8f6dcbaae4f8953" +checksum = "782e12f6cd923c3c316130d56205ebab53f55d6666b7faddfad36cecaeeb4022" dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client", - "wayland-protocols 0.32.3", + "wayland-protocols 0.32.5", "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.31.4" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7b56f89937f1cf2ee1f1259cf2936a17a1f45d8f0aa1019fae6d470d304cfa6" +checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" dependencies = [ "proc-macro2", "quick-xml", @@ -9351,9 +9327,9 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.31.4" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43676fe2daf68754ecf1d72026e4e6c15483198b5d24e888b74d3f22f887a148" +checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09" dependencies = [ "dlib", "log", @@ -9417,7 +9393,7 @@ dependencies = [ "bitflags 2.6.0", "cfg_aliases 0.1.1", "codespan-reporting", - "indexmap 2.4.0", + "indexmap 2.7.0", "log", "naga", "once_cell", @@ -9445,7 +9421,7 @@ dependencies = [ "bitflags 2.6.0", "block", "cfg_aliases 0.1.1", - "core-graphics-types", + "core-graphics-types 0.1.3", "d3d12", "glow", "glutin_wgl_sys", @@ -9456,7 +9432,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.5", + "libloading 0.8.6", "log", "metal", "naga", @@ -9490,11 +9466,11 @@ dependencies = [ [[package]] name = "whoami" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" dependencies = [ - "redox_syscall 0.4.1", + "redox_syscall 0.5.7", "wasite", "web-sys", ] @@ -9600,7 +9576,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -9611,7 +9587,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -9860,14 +9836,14 @@ dependencies = [ "bytemuck", "calloop 0.12.4", "cfg_aliases 0.1.1", - "core-foundation", - "core-graphics", + "core-foundation 0.9.4", + "core-graphics 0.23.2", "cursor-icon", "icrate", "js-sys", "libc", "log", - "memmap2 0.9.4", + "memmap2 0.9.5", "ndk", "ndk-sys", "objc2 0.4.1", @@ -9897,9 +9873,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -9964,7 +9940,7 @@ dependencies = [ "as-raw-xcb-connection", "gethostname", "libc", - "libloading 0.8.5", + "libloading 0.8.6", "once_cell", "rustix", "x11rb-protocol", @@ -10025,9 +10001,9 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" [[package]] name = "xml-rs" -version = "0.8.21" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601" +checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432" [[package]] name = "xxhash-rust" @@ -10067,7 +10043,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -10113,7 +10089,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "zvariant_utils", ] @@ -10152,7 +10128,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -10172,7 +10148,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -10193,7 +10169,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -10215,7 +10191,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -10241,7 +10217,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "zvariant_utils", ] @@ -10253,5 +10229,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] diff --git a/common/src/chain/transaction/signed_transaction_intent.rs b/common/src/chain/transaction/signed_transaction_intent.rs index 6b68536dc5..9285393d0a 100644 --- a/common/src/chain/transaction/signed_transaction_intent.rs +++ b/common/src/chain/transaction/signed_transaction_intent.rs @@ -66,6 +66,13 @@ pub struct SignedTransactionIntent { } impl SignedTransactionIntent { + pub fn new_unchecked(signed_message: String, signatures: Vec>) -> Self { + Self { + signed_message, + signatures, + } + } + /// Create a signed intent given the id of the transaction and its input destinations. /// /// Only PublicKeyHash and PublicKey destinations are supported by this function. diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 0828513199..35b342c30d 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -45,3 +45,5 @@ tempfile.workspace = true [features] trezor = ["dep:trezor-client", "wallet-types/trezor"] trezor-emulator = [] + +default = ["trezor"] diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index 2ba09d800b..96838e610f 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -83,6 +83,74 @@ fn sign_message(#[case] seed: Seed) { res.verify_signature(&config, &destination, &message_challenge).unwrap(); } +#[rstest] +#[trace] +#[case(Seed::from_entropy())] +fn sign_transaction_intent(#[case] seed: Seed) { + use common::primitives::Idable; + + let mut rng = make_seedable_rng(seed); + + let config = Arc::new(create_regtest()); + let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); + let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); + + let master_key_chain = MasterKeyChain::new_from_mnemonic( + config.clone(), + &mut db_tx, + MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + ) + .unwrap(); + + let key_chain = master_key_chain + .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) + .unwrap(); + let mut account = Account::new(config.clone(), &mut db_tx, key_chain, None).unwrap(); + + let mut signer = SoftwareSigner::new(config.clone(), DEFAULT_ACCOUNT_INDEX); + + let inputs: Vec = (0..rng.gen_range(1..5)) + .map(|_| { + let source_id = if rng.gen_bool(0.5) { + Id::::new(H256::random_using(&mut rng)).into() + } else { + Id::::new(H256::random_using(&mut rng)).into() + }; + TxInput::from_utxo(source_id, rng.next_u32()) + }) + .collect(); + let input_destinations: Vec<_> = (0..inputs.len()) + .map(|_| account.get_new_address(&mut db_tx, ReceiveFunds).unwrap().1.into_object()) + .collect(); + + let tx = Transaction::new( + 0, + inputs, + vec![TxOutput::Transfer( + OutputValue::Coin(Amount::from_atoms(rng.gen())), + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), + )], + ) + .unwrap(); + + let intent: String = [rng.gen::(), rng.gen::(), rng.gen::()].iter().collect(); + let res = signer + .sign_transaction_intent( + &tx, + &input_destinations, + &intent, + account.key_chain(), + &db_tx, + ) + .unwrap(); + + let expected_signed_message = + SignedTransactionIntent::get_message_to_sign(&intent, &tx.get_id()); + res.verify(&config, &input_destinations, &expected_signed_message).unwrap(); +} + #[rstest] #[trace] #[case(Seed::from_entropy())] diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 424eb31e20..6352c2ae84 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -44,7 +44,7 @@ use common::{ AccountCommand, AccountSpending, ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, TxOutput, }, - primitives::H256, + primitives::{Idable, H256}, }; use crypto::key::{ extended::ExtendedPublicKey, @@ -478,13 +478,25 @@ impl Signer for TrezorSigner { fn sign_transaction_intent( &mut self, - _transaction: &Transaction, - _input_destinations: &[Destination], - _intent: &str, - _key_chain: &impl AccountKeyChains, - _db_tx: &impl WalletStorageReadUnlocked, + transaction: &Transaction, + input_destinations: &[Destination], + intent: &str, + key_chain: &impl AccountKeyChains, + db_tx: &impl WalletStorageReadUnlocked, ) -> SignerResult { - unimplemented!("FIXME") + let tx_id = transaction.get_id(); + let message_to_sign = SignedTransactionIntent::get_message_to_sign(intent, &tx_id); + + let mut signatures = Vec::with_capacity(input_destinations.len()); + for dest in input_destinations { + let sig = self.sign_challenge(message_to_sign.as_bytes(), dest, key_chain, db_tx)?; + signatures.push(sig.into_raw()); + } + + Ok(SignedTransactionIntent::new_unchecked( + message_to_sign, + signatures, + )) } } diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 26cd47d4c2..ad3c9fad39 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -84,6 +84,78 @@ fn sign_message(#[case] seed: Seed) { res.verify_signature(&chain_config, &destination, &message_challenge).unwrap(); } +#[rstest] +#[trace] +#[case(Seed::from_entropy())] +fn sign_transaction_intent(#[case] seed: Seed) { + use common::primitives::Idable; + + let mut rng = make_seedable_rng(seed); + + let config = Arc::new(create_regtest()); + let db = Arc::new(Store::new(DefaultBackend::new_in_memory()).unwrap()); + let mut db_tx = db.transaction_rw_unlocked(None).unwrap(); + + let master_key_chain = MasterKeyChain::new_from_mnemonic( + config.clone(), + &mut db_tx, + MNEMONIC, + None, + StoreSeedPhrase::DoNotStore, + ) + .unwrap(); + + let key_chain = master_key_chain + .create_account_key_chain(&mut db_tx, DEFAULT_ACCOUNT_INDEX, LOOKAHEAD_SIZE) + .unwrap(); + let mut account = Account::new(config.clone(), &mut db_tx, key_chain, None).unwrap(); + + let mut devices = find_devices(false); + assert!(!devices.is_empty()); + let client = devices.pop().unwrap().connect().unwrap(); + + let mut signer = TrezorSigner::new(config.clone(), Arc::new(Mutex::new(client))); + + let inputs: Vec = (0..rng.gen_range(1..5)) + .map(|_| { + let source_id = if rng.gen_bool(0.5) { + Id::::new(H256::random_using(&mut rng)).into() + } else { + Id::::new(H256::random_using(&mut rng)).into() + }; + TxInput::from_utxo(source_id, rng.next_u32()) + }) + .collect(); + let input_destinations: Vec<_> = (0..inputs.len()) + .map(|_| account.get_new_address(&mut db_tx, ReceiveFunds).unwrap().1.into_object()) + .collect(); + + let tx = Transaction::new( + 0, + inputs, + vec![TxOutput::Transfer( + OutputValue::Coin(Amount::from_atoms(rng.gen())), + account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), + )], + ) + .unwrap(); + + let intent: String = [rng.gen::(), rng.gen::(), rng.gen::()].iter().collect(); + let res = signer + .sign_transaction_intent( + &tx, + &input_destinations, + &intent, + account.key_chain(), + &db_tx, + ) + .unwrap(); + + let expected_signed_message = + SignedTransactionIntent::get_message_to_sign(&intent, &tx.get_id()); + res.verify(&config, &input_destinations, &expected_signed_message).unwrap(); +} + #[rstest] #[trace] #[case(Seed::from_entropy())] diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index da22b16d1e..03f29f8887 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -1452,6 +1452,7 @@ where intent: String, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult<(SignedTransaction, SignedTransactionIntent)> { let (signed_tx, input_destinations) = self.create_transaction_to_addresses_impl( account_index, @@ -1461,7 +1462,7 @@ where current_fee_rate, consolidate_fee_rate, |send_request| send_request.destinations().to_owned(), - &BTreeMap::new(), // FIXME + additional_utxo_infos, )?; let signed_intent = self.for_account_rw_unlocked( diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs index 107f149029..f883de2de1 100644 --- a/wallet/wallet-controller/src/runtime_wallet.rs +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -1213,6 +1213,7 @@ impl RuntimeWallet { intent: String, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, + additional_utxo_infos: &BTreeMap, ) -> WalletResult<(SignedTransaction, SignedTransactionIntent)> { match self { RuntimeWallet::Software(w) => w.create_transaction_to_addresses_with_intent( @@ -1223,6 +1224,7 @@ impl RuntimeWallet { intent, current_fee_rate, consolidate_fee_rate, + additional_utxo_infos, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_transaction_to_addresses_with_intent( @@ -1233,6 +1235,7 @@ impl RuntimeWallet { intent, current_fee_rate, consolidate_fee_rate, + additional_utxo_infos, ), } } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index e5ed678afd..bf4ab36c94 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -998,6 +998,13 @@ where account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; + let additional_info = BTreeMap::from_iter([( + PoolOrTokenId::TokenId(token_info.token_id()), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: token_info.num_decimals(), + ticker: token_info.token_ticker().to_vec(), + }), + )]); wallet.create_transaction_to_addresses_with_intent( account_index, [output], @@ -1006,6 +1013,7 @@ where intent, current_fee_rate, consolidate_fee_rate, + &additional_info, ) }, ) From 46cf688fa09ad91a80e8fa7ec37e50ce353c3c27 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 11 Dec 2024 10:06:24 +0100 Subject: [PATCH 45/48] remove default feature --- node-gui/Cargo.toml | 2 +- node-gui/backend/Cargo.toml | 2 +- wallet/Cargo.toml | 2 -- wallet/wallet-rpc-lib/src/lib.rs | 2 ++ 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/node-gui/Cargo.toml b/node-gui/Cargo.toml index cb62a562b0..3036e6d200 100644 --- a/node-gui/Cargo.toml +++ b/node-gui/Cargo.toml @@ -40,4 +40,4 @@ tokio.workspace = true winres = "0.1" [features] -trezor = ["wallet-controller/trezor", "wallet-types/trezor"] +trezor = ["wallet-controller/trezor", "wallet-types/trezor", "wallet-cli-commands/trezor", "node-gui-backend/trezor"] diff --git a/node-gui/backend/Cargo.toml b/node-gui/backend/Cargo.toml index f82e15fff9..424ce99f0c 100644 --- a/node-gui/backend/Cargo.toml +++ b/node-gui/backend/Cargo.toml @@ -43,4 +43,4 @@ rstest.workspace = true serde_json.workspace = true [features] -trezor = ["wallet/trezor", "wallet-controller/trezor", "wallet-types/trezor", "wallet-rpc-lib/trezor", "wallet-rpc-client/trezor"] +trezor = ["wallet/trezor", "wallet-controller/trezor", "wallet-types/trezor", "wallet-rpc-lib/trezor", "wallet-rpc-client/trezor", "wallet-cli-commands/trezor"] diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 35b342c30d..0828513199 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -45,5 +45,3 @@ tempfile.workspace = true [features] trezor = ["dep:trezor-client", "wallet-types/trezor"] trezor-emulator = [] - -default = ["trezor"] diff --git a/wallet/wallet-rpc-lib/src/lib.rs b/wallet/wallet-rpc-lib/src/lib.rs index 1b0e8f49d5..98affde076 100644 --- a/wallet/wallet-rpc-lib/src/lib.rs +++ b/wallet/wallet-rpc-lib/src/lib.rs @@ -18,6 +18,7 @@ pub mod config; mod rpc; mod service; +#[cfg(feature = "trezor")] use rpc::types::HardwareWalletType; pub use rpc::{ types, ColdWalletRpcClient, ColdWalletRpcDescription, ColdWalletRpcServer, RpcCreds, RpcError, @@ -25,6 +26,7 @@ pub use rpc::{ }; pub use service::{Event, EventStream, TxState, WalletHandle, /* WalletResult, */ WalletService,}; use wallet_controller::{NodeInterface, NodeRpcClient}; +#[cfg(feature = "trezor")] use wallet_types::wallet_type::WalletType; use std::{fmt::Debug, time::Duration}; From dc77e896a5213456b44aca03e0f3ed3f270b6ca2 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 23 Dec 2024 19:39:50 +0100 Subject: [PATCH 46/48] update trezor lib --- Cargo.lock | 1 - wallet/Cargo.toml | 5 +- wallet/src/signer/trezor_signer/mod.rs | 58 ++++++++++++++++-------- wallet/src/signer/trezor_signer/tests.rs | 29 +++++++----- 4 files changed, 62 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 57bffb251c..14d9f391e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8354,7 +8354,6 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#c929c9a8f71ed9edfc679b96e3d4815fd8f3316b" dependencies = [ "bitcoin", "byteorder", diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 0828513199..384409e340 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -26,7 +26,8 @@ utils-networking = { path = "../utils/networking" } utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } -trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer-pk", features = ["bitcoin", "mintlayer"], optional = true } +# trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer-pk", features = ["bitcoin", "mintlayer"], optional = true } +trezor-client = { path = "../../trezor-firmware/rust/trezor-client", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } hex.workspace = true @@ -45,3 +46,5 @@ tempfile.workspace = true [features] trezor = ["dep:trezor-client", "wallet-types/trezor"] trezor-emulator = [] + +default = ["trezor"] diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index 6352c2ae84..adff053df2 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -58,9 +58,10 @@ use trezor_client::{ client::mintlayer::MintlayerSignature, find_devices, protos::{ - MintlayerAccountCommandTxInput, MintlayerAccountTxInput, MintlayerAddressPath, - MintlayerBurnTxOutput, MintlayerChangeTokenAuhtority, MintlayerChangeTokenMetadataUri, - MintlayerConcludeOrder, MintlayerCreateDelegationIdTxOutput, MintlayerCreateOrderTxOutput, + MintlayerAccountCommandTxInput, MintlayerAccountSpendingDelegationBalance, + MintlayerAccountTxInput, MintlayerAddressPath, MintlayerAddressType, MintlayerBurnTxOutput, + MintlayerChangeTokenAuthority, MintlayerChangeTokenMetadataUri, MintlayerConcludeOrder, + MintlayerCreateDelegationIdTxOutput, MintlayerCreateOrderTxOutput, MintlayerCreateStakePoolTxOutput, MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFillOrder, MintlayerFreezeToken, MintlayerHtlcTxOutput, MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, @@ -267,12 +268,13 @@ impl Signer for TrezorSigner { let inputs = to_trezor_input_msgs(&ptx, key_chain, &self.chain_config)?; let outputs = self.to_trezor_output_msgs(&ptx)?; let utxos = to_trezor_utxo_msgs(&ptx, &self.chain_config)?; + let coin_name = self.chain_config.chain_type().name().to_owned(); let new_signatures = self .client .lock() .expect("poisoned lock") - .mintlayer_sign_tx(inputs, outputs, utxos) + .mintlayer_sign_tx(coin_name, inputs, outputs, utxos) .map_err(|err| TrezorError::DeviceError(err.to_string()))?; let inputs_utxo_refs: Vec<_> = @@ -432,13 +434,33 @@ impl Signer for TrezorSigner { .map(|c| c.into_encoded_index()) .collect(); - let addr = Address::new(&self.chain_config, destination.clone())?.into_string(); + let addr_type = match destination { + Destination::PublicKey(_) => MintlayerAddressType::PUBLIC_KEY, + Destination::PublicKeyHash(_) => MintlayerAddressType::PUBLIC_KEY_HASH, + Destination::AnyoneCanSpend => { + return Err(SignerError::SigningError( + DestinationSigError::AttemptedToProduceSignatureForAnyoneCanSpend, + )) + } + Destination::ClassicMultisig(_) => { + return Err(SignerError::SigningError( + DestinationSigError::AttemptedToProduceClassicalMultisigSignatureInUnipartySignatureCode, + )) + } + Destination::ScriptHash(_) => { + return Err(SignerError::SigningError( + DestinationSigError::Unsupported, + )) + } + }; + + let coin_name = self.chain_config.chain_type().name().to_owned(); let sig = self .client .lock() .expect("poisoned lock") - .mintlayer_sign_message(address_n, addr, message.to_vec()) + .mintlayer_sign_message(coin_name, address_n, addr_type, message.to_vec()) .map_err(|err| TrezorError::DeviceError(err.to_string()))?; let signature = Signature::from_raw_data(&sig).map_err(TrezorError::SignatureError)?; @@ -534,8 +556,7 @@ fn to_trezor_account_command_input( command: &AccountCommand, ) -> SignerResult { let mut inp_req = MintlayerAccountCommandTxInput::new(); - inp_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); - inp_req.address_n = destination_to_address_paths(key_chain, dest); + inp_req.addresses = destination_to_address_paths(key_chain, dest); inp_req.set_nonce(nonce.value()); match command { AccountCommand::MintTokens(token_id, amount) => { @@ -554,7 +575,7 @@ fn to_trezor_account_command_input( AccountCommand::FreezeToken(token_id, unfreezable) => { let mut req = MintlayerFreezeToken::new(); req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); - req.set_is_token_unfreezabe(unfreezable.as_bool()); + req.set_is_token_unfreezable(unfreezable.as_bool()); inp_req.freeze_token = Some(req).into(); } @@ -571,7 +592,7 @@ fn to_trezor_account_command_input( inp_req.lock_token_supply = Some(req).into(); } AccountCommand::ChangeTokenAuthority(token_id, dest) => { - let mut req = MintlayerChangeTokenAuhtority::new(); + let mut req = MintlayerChangeTokenAuthority::new(); req.set_token_id(Address::new(chain_config, *token_id)?.into_string()); req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); @@ -611,15 +632,15 @@ fn to_trezor_account_input( outpoint: &common::chain::AccountOutPoint, ) -> SignerResult { let mut inp_req = MintlayerAccountTxInput::new(); - inp_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); - inp_req.address_n = destination_to_address_paths(key_chain, dest); + inp_req.addresses = destination_to_address_paths(key_chain, dest); inp_req.set_nonce(outpoint.nonce().value()); match outpoint.account() { AccountSpending::DelegationBalance(delegation_id, amount) => { - inp_req.set_delegation_id(Address::new(chain_config, *delegation_id)?.into_string()); - let mut value = MintlayerOutputValue::new(); - value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); - inp_req.value = Some(value).into(); + let mut deleg_balance_req = MintlayerAccountSpendingDelegationBalance::new(); + deleg_balance_req + .set_delegation_id(Address::new(chain_config, *delegation_id)?.into_string()); + deleg_balance_req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + inp_req.delegation_balance = Some(deleg_balance_req).into(); } } let mut inp = MintlayerTxInput::new(); @@ -648,7 +669,7 @@ fn to_trezor_utxo_input( inp_req.set_prev_index(outpoint.output_index()); inp_req.set_address(Address::new(chain_config, dest.clone())?.into_string()); - inp_req.address_n = destination_to_address_paths(key_chain, dest); + inp_req.addresses = destination_to_address_paths(key_chain, dest); let mut inp = MintlayerTxInput::new(); inp.utxo = Some(inp_req).into(); @@ -1083,11 +1104,12 @@ impl TrezorSignerProvider { let derivation_path = make_account_path(chain_config, account_index); let account_path = derivation_path.as_slice().iter().map(|c| c.into_encoded_index()).collect(); + let coin_name = chain_config.chain_type().name().to_owned(); let xpub = self .client .lock() .expect("poisoned lock") - .mintlayer_get_public_key(account_path) + .mintlayer_get_public_key(coin_name, account_path) .map_err(|e| SignerError::TrezorError(TrezorError::DeviceError(e.to_string())))?; let chain_code = ChainCode::from(xpub.chain_code.0); let account_pubkey = Secp256k1ExtendedPublicKey::new( diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index ad3c9fad39..70b7b4c68a 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -18,6 +18,7 @@ use std::ops::{Add, Div, Mul, Sub}; use super::*; use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; +use crate::send_request::PoolOrTokenId; use crate::{Account, SendRequest}; use common::chain::config::create_regtest; use common::chain::htlc::HashedTimelockContract; @@ -198,6 +199,7 @@ fn sign_transaction(#[case] seed: Seed) { .collect(); let total_amount = amounts.iter().fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); + eprintln!("total utxo amounts: {total_amount:?}"); let utxos: Vec = amounts .iter() @@ -260,20 +262,18 @@ fn sign_transaction(#[case] seed: Seed) { let multisig_input = TxInput::from_utxo(source_id, rng.next_u32()); let multisig_utxo = TxOutput::Transfer(OutputValue::Coin(Amount::from_atoms(1)), multisig_dest); + let token_id = TokenId::new(H256::random_using(&mut rng)); let acc_inputs = vec![ TxInput::Account(AccountOutPoint::new( AccountNonce::new(1), AccountSpending::DelegationBalance( DelegationId::new(H256::random_using(&mut rng)), - Amount::from_atoms(rng.next_u32() as u128), + Amount::from_atoms(1 as u128), ), )), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::MintTokens( - TokenId::new(H256::random_using(&mut rng)), - Amount::from_atoms(100), - ), + AccountCommand::MintTokens(token_id, Amount::from_atoms(100)), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), @@ -349,7 +349,7 @@ fn sign_transaction(#[case] seed: Seed) { let pool_id = PoolId::new(H256::random()); let delegation_id = DelegationId::new(H256::random()); let pool_data = StakePoolData::new( - Amount::from_atoms(5000000), + Amount::from_atoms(5), Destination::PublicKey(dest_pub.clone()), vrf_public_key, Destination::PublicKey(dest_pub.clone()), @@ -393,6 +393,10 @@ fn sign_transaction(#[case] seed: Seed) { ); let outputs = vec![ + TxOutput::Transfer( + OutputValue::TokenV1(token_id, dest_amount), + Destination::PublicKey(dest_pub.clone()), + ), TxOutput::Transfer( OutputValue::Coin(dest_amount), Destination::PublicKey(dest_pub), @@ -418,10 +422,6 @@ fn sign_transaction(#[case] seed: Seed) { TxOutput::DataDeposit(vec![1, 2, 3]), TxOutput::Htlc(OutputValue::Coin(burn_amount), Box::new(hash_lock)), TxOutput::CreateOrder(Box::new(order_data)), - TxOutput::Transfer( - OutputValue::Coin(Amount::from_atoms(100_000_000_000)), - account.get_new_address(&mut db_tx, Change).unwrap().1.into_object(), - ), ]; let req = SendRequest::new() @@ -435,7 +435,14 @@ fn sign_transaction(#[case] seed: Seed) { .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); let destinations = req.destinations().to_vec(); - let additional_info = BTreeMap::new(); + let mut additional_info = BTreeMap::new(); + additional_info.insert( + PoolOrTokenId::TokenId(token_id), + UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: 1, + ticker: "TKN".as_bytes().to_vec(), + }), + ); let ptx = req.into_partially_signed_tx(&additional_info).unwrap(); let mut devices = find_devices(false); From 3ec3d1f127d1940b9b1469c3e6690952b77806bb Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 8 Jan 2025 10:09:43 +0100 Subject: [PATCH 47/48] change tx additional info to handle orders --- Cargo.lock | 1 + .../chain/transaction/output/output_value.rs | 18 +- test/functional/test_framework/__init__.py | 23 +- test/functional/wallet_htlc_refund.py | 8 +- wallet/Cargo.toml | 5 +- wallet/src/account/mod.rs | 9 +- wallet/src/send_request/mod.rs | 93 +------- wallet/src/signer/mod.rs | 6 +- wallet/src/signer/software_signer/mod.rs | 3 +- wallet/src/signer/software_signer/tests.rs | 4 +- wallet/src/signer/trezor_signer/mod.rs | 202 +++++++++++++----- wallet/src/signer/trezor_signer/tests.rs | 95 ++++---- wallet/src/wallet/mod.rs | 75 ++++--- wallet/src/wallet/tests.rs | 163 +++++++------- .../types/src/partially_signed_transaction.rs | 69 +++--- wallet/wallet-cli-lib/src/lib.rs | 7 +- wallet/wallet-controller/src/helpers.rs | 135 +++++++++--- wallet/wallet-controller/src/lib.rs | 41 ++-- .../wallet-controller/src/runtime_wallet.rs | 29 +-- .../src/synced_controller.rs | 50 ++--- wallet/wallet-rpc-lib/src/rpc/mod.rs | 9 +- 21 files changed, 565 insertions(+), 480 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14d9f391e0..e440c933a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8354,6 +8354,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#1768ae882544791239303dbe2e25e82f6dda0c81" dependencies = [ "bitcoin", "byteorder", diff --git a/common/src/chain/transaction/output/output_value.rs b/common/src/chain/transaction/output/output_value.rs index 167c9954b4..55e275f734 100644 --- a/common/src/chain/transaction/output/output_value.rs +++ b/common/src/chain/transaction/output/output_value.rs @@ -75,7 +75,14 @@ impl From for OutputValue { } #[derive( - Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, rpc_description::HasValueHint, + Debug, + Clone, + Copy, + PartialEq, + Eq, + serde::Serialize, + serde::Deserialize, + rpc_description::HasValueHint, )] #[serde(tag = "type", content = "content")] pub enum RpcOutputValue { @@ -107,3 +114,12 @@ impl RpcOutputValue { } } } + +impl From for OutputValue { + fn from(value: RpcOutputValue) -> Self { + match value { + RpcOutputValue::Coin { amount } => OutputValue::Coin(amount), + RpcOutputValue::Token { id, amount } => OutputValue::TokenV1(id, amount), + } + } +} diff --git a/test/functional/test_framework/__init__.py b/test/functional/test_framework/__init__.py index 674e1210b4..5de34600c7 100644 --- a/test/functional/test_framework/__init__.py +++ b/test/functional/test_framework/__init__.py @@ -206,21 +206,22 @@ def init_mintlayer_types(): ] }, - "UtxoAdditionalInfo": { + "InfoId": { "type": "enum", "type_mapping": [ - ["TokenInfo", "TokenAdditionalInfo"], - ["PoolInfo", "(Amount)"], - ["AnyoneCanTake", ""], # TODO + ["TokenId", "H256"], + ["PoolId", "H256"], + ["OrderId", "H256"], ], }, - "UtxoWithAdditionalInfo": { - "type": "struct", + "TxAdditionalInfo": { + "type": "enum", "type_mapping": [ - ["utxo", "TxOutput"], - ["additional_info", "Option"], - ] + ["TokenInfo", "TokenAdditionalInfo"], + ["PoolInfo", "(Amount)"], + ["OrderInfo", ""], # TODO + ], }, "StandardInputSignature": { @@ -244,10 +245,10 @@ def init_mintlayer_types(): "type_mapping": [ ["tx", "TransactionV1"], ["witnesses", "Vec>"], - ["input_utxos", "Vec>"], + ["input_utxos", "Vec>"], ["destinations", "Vec>"], ["htlc_secrets", "Vec>"], - ["output_additional_infos", "Vec>"], + ["additional_infos", "BTreeMap"], ] }, diff --git a/test/functional/wallet_htlc_refund.py b/test/functional/wallet_htlc_refund.py index 8cf4309d71..e45d437849 100644 --- a/test/functional/wallet_htlc_refund.py +++ b/test/functional/wallet_htlc_refund.py @@ -184,10 +184,10 @@ async def async_test(self): alice_refund_ptx = { 'tx': tx['transaction'], 'witnesses': [None, None], - 'input_utxos': [{'utxo': out, 'additional_info': None} for out in alice_htlc_outputs], + 'input_utxos': alice_htlc_outputs, 'destinations': [refund_dest_obj, alice_htlc_change_dest], 'htlc_secrets': [None, None], - 'output_additional_infos': [None] + 'additional_infos': [] } alice_refund_tx_hex = scalecodec.base.RuntimeConfiguration().create_scale_object('PartiallySignedTransaction').encode(alice_refund_ptx).to_hex()[2:] @@ -213,10 +213,10 @@ async def async_test(self): bob_refund_ptx = { 'tx': tx['transaction'], 'witnesses': [None, None], - 'input_utxos': [{'utxo': out, 'additional_info': None} for out in bob_htlc_outputs], + 'input_utxos': bob_htlc_outputs, 'destinations': [refund_dest_obj, bob_htlc_change_dest], 'htlc_secrets': [None, None], - 'output_additional_infos': [None] + 'additional_infos': [] } bob_refund_tx_hex = scalecodec.base.RuntimeConfiguration().create_scale_object('PartiallySignedTransaction').encode(bob_refund_ptx).to_hex()[2:] diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 384409e340..0828513199 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -26,8 +26,7 @@ utils-networking = { path = "../utils/networking" } utxo = { path = "../utxo" } wallet-storage = { path = "./storage" } wallet-types = { path = "./types" } -# trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer-pk", features = ["bitcoin", "mintlayer"], optional = true } -trezor-client = { path = "../../trezor-firmware/rust/trezor-client", features = ["bitcoin", "mintlayer"], optional = true } +trezor-client = { git = "https://github.com/mintlayer/mintlayer-trezor-firmware", branch = "feature/mintlayer-pk", features = ["bitcoin", "mintlayer"], optional = true } bip39 = { workspace = true, default-features = false, features = ["std", "zeroize"] } hex.workspace = true @@ -46,5 +45,3 @@ tempfile.workspace = true [features] trezor = ["dep:trezor-client", "wallet-types/trezor"] trezor-emulator = [] - -default = ["trezor"] diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index 0b8254d613..b840a56054 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -38,7 +38,9 @@ use utils::ensure; pub use utxo_selector::UtxoSelectorError; use wallet_types::account_id::AccountPrefixedId; use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; -use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; +use wallet_types::partially_signed_transaction::{ + InfoId, PartiallySignedTransaction, TxAdditionalInfo, +}; use wallet_types::with_locked::WithLocked; use crate::account::utxo_selector::{select_coins, OutputGroup}; @@ -47,8 +49,7 @@ use crate::key_chain::{AccountKeyChains, KeyChainError, VRFAccountKeyChains}; use crate::send_request::{ make_address_output, make_address_output_from_delegation, make_address_output_token, make_decommission_stake_pool_output, make_mint_token_outputs, make_stake_output, - make_unmint_token_outputs, IssueNftArguments, PoolOrTokenId, SelectedInputs, - StakePoolDataArguments, + make_unmint_token_outputs, IssueNftArguments, SelectedInputs, StakePoolDataArguments, }; use crate::wallet::WalletPoolsFilter; use crate::wallet_events::{WalletEvents, WalletEventsNoOp}; @@ -633,7 +634,7 @@ impl Account { change_addresses: BTreeMap>, median_time: BlockTimestamp, fee_rate: CurrentFeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { let mut request = self.select_inputs_for_send_request( request, diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 1c21f2410e..8c4d4f8bb8 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -20,7 +20,7 @@ use common::address::Address; use common::chain::output_value::OutputValue; use common::chain::stakelock::StakePoolData; use common::chain::timelock::OutputTimeLock::ForBlockCount; -use common::chain::tokens::{Metadata, NftIssuance, TokenId, TokenIssuance}; +use common::chain::tokens::{Metadata, TokenId, TokenIssuance}; use common::chain::{ ChainConfig, Destination, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, }; @@ -30,19 +30,13 @@ use crypto::vrf::VRFPublicKey; use utils::ensure; use wallet_types::currency::Currency; use wallet_types::partially_signed_transaction::{ - PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + InfoId, PartiallySignedTransaction, TxAdditionalInfo, }; use crate::account::PoolData; use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; use crate::{WalletError, WalletResult}; -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] -pub enum PoolOrTokenId { - PoolId(PoolId), - TokenId(TokenId), -} - /// The `SendRequest` struct provides the necessary information to the wallet /// on the precise method of sending funds to a designated destination. #[derive(Debug, Clone)] @@ -298,26 +292,11 @@ impl SendRequest { pub fn into_partially_signed_tx( self, - additional_info: &BTreeMap, + additional_info: BTreeMap, ) -> WalletResult { let num_inputs = self.inputs.len(); let destinations = self.destinations.into_iter().map(Some).collect(); - let utxos = self - .utxos - .into_iter() - .map(|utxo| { - utxo.map(|utxo| { - let additional_info = find_additional_info(&utxo, additional_info)?; - Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) - }) - .transpose() - }) - .collect::>>()?; - let output_additional_infos = self - .outputs - .iter() - .map(|utxo| find_additional_info(utxo, additional_info)) - .collect::>>()?; + let utxos = self.utxos; let tx = Transaction::new(self.flags, self.inputs, self.outputs)?; let ptx = PartiallySignedTransaction::new( @@ -326,74 +305,12 @@ impl SendRequest { utxos, destinations, None, - output_additional_infos, + additional_info, )?; Ok(ptx) } } -/// Find additional data for TxOutput, mainly for UI purposes -fn find_additional_info( - utxo: &TxOutput, - additional_info: &BTreeMap, -) -> Result, WalletError> { - let additional_info = match utxo { - TxOutput::Burn(value) - | TxOutput::Htlc(value, _) - | TxOutput::Transfer(value, _) - | TxOutput::LockThenTransfer(value, _, _) => { - find_token_additional_info(value, additional_info)?.map(UtxoAdditionalInfo::TokenInfo) - } - TxOutput::CreateOrder(data) => { - let ask = find_token_additional_info(data.ask(), additional_info)?; - let give = find_token_additional_info(data.give(), additional_info)?; - - Some(UtxoAdditionalInfo::CreateOrder { ask, give }) - } - TxOutput::IssueNft(_, data, _) => { - Some(UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { - num_decimals: 0, - ticker: match data.as_ref() { - NftIssuance::V0(data) => data.metadata.ticker().clone(), - }, - })) - } - TxOutput::CreateStakePool(_, data) => Some(UtxoAdditionalInfo::PoolInfo { - staker_balance: data.pledge(), - }), - TxOutput::ProduceBlockFromStake(_, pool_id) => additional_info - .get(&PoolOrTokenId::PoolId(*pool_id)) - .ok_or(WalletError::MissingPoolAdditionalData(*pool_id)) - .map(Some)? - .cloned(), - TxOutput::DataDeposit(_) - | TxOutput::IssueFungibleToken(_) - | TxOutput::DelegateStaking(_, _) - | TxOutput::CreateDelegationId(_, _) => None, - }; - Ok(additional_info) -} - -fn find_token_additional_info( - value: &OutputValue, - additional_info: &BTreeMap, -) -> WalletResult> { - match value { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(None), - OutputValue::TokenV1(token_id, _) => additional_info - .get(&PoolOrTokenId::TokenId(*token_id)) - .ok_or(WalletError::MissingTokenAdditionalData(*token_id)) - .cloned() - .map(|data| match data { - UtxoAdditionalInfo::TokenInfo(data) => Ok(Some(data.clone())), - UtxoAdditionalInfo::PoolInfo { staker_balance: _ } - | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => { - Err(WalletError::MismatchedTokenAdditionalData(*token_id)) - } - })?, - } -} - pub enum SelectedInputs { Utxos(Vec), Inputs(Vec<(UtxoOutPoint, TxOutput)>), diff --git a/wallet/src/signer/mod.rs b/wallet/src/signer/mod.rs index 0e2f62174c..f4e3473cc9 100644 --- a/wallet/src/signer/mod.rs +++ b/wallet/src/signer/mod.rs @@ -83,8 +83,8 @@ pub enum SignerError { MissingDestinationInTransaction, #[error("Partially signed tx is missing UTXO type input's UTXO")] MissingUtxo, - #[error("Partially signed tx is missing extra info for UTXO")] - MissingUtxoExtraInfo, + #[error("Partially signed tx is missing extra info")] + MissingTxExtraInfo, #[error("Tokens V0 are not supported")] UnsupportedTokensV0, #[error("Invalid TxOutput type as UTXO, cannot be spent")] @@ -93,6 +93,8 @@ pub enum SignerError { AddressError(#[from] AddressError), #[error("Signature error: {0}")] SignatureError(#[from] SignatureError), + #[error("Order was filled more than the available balance")] + OrderFillUnderflow, } type SignerResult = Result; diff --git a/wallet/src/signer/software_signer/mod.rs b/wallet/src/signer/software_signer/mod.rs index dad8908f92..c0c545e4d6 100644 --- a/wallet/src/signer/software_signer/mod.rs +++ b/wallet/src/signer/software_signer/mod.rs @@ -264,8 +264,7 @@ impl Signer for SoftwareSigner { Vec, Vec, )> { - let inputs_utxo_refs: Vec<_> = - ptx.input_utxos().iter().map(|u| u.as_ref().map(|x| &x.utxo)).collect(); + let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); let (witnesses, prev_statuses, new_statuses) = ptx .witnesses() diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index 96838e610f..edc07aadc8 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -437,7 +437,7 @@ fn sign_transaction(#[case] seed: Seed) { .with_outputs(outputs); let destinations = req.destinations().to_vec(); let additional_info = BTreeMap::new(); - let ptx = req.into_partially_signed_tx(&additional_info).unwrap(); + let ptx = req.into_partially_signed_tx(additional_info).unwrap(); let mut signer = SoftwareSigner::new(chain_config.clone(), DEFAULT_ACCOUNT_INDEX); let (ptx, _, _) = signer.sign_tx(ptx, account.key_chain(), &db_tx).unwrap(); @@ -688,7 +688,7 @@ fn fixed_signatures() { .with_outputs(outputs); let destinations = req.destinations().to_vec(); let additional_info = BTreeMap::new(); - let ptx = req.into_partially_signed_tx(&additional_info).unwrap(); + let ptx = req.into_partially_signed_tx(additional_info).unwrap(); let utxos_ref = utxos .iter() diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index adff053df2..de89affba9 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -40,7 +40,7 @@ use common::{ DestinationSigError, }, timelock::OutputTimeLock, - tokens::{NftIssuance, TokenIssuance, TokenTotalSupply}, + tokens::{NftIssuance, TokenId, TokenIssuance, TokenTotalSupply}, AccountCommand, AccountSpending, ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, TxOutput, }, @@ -83,7 +83,7 @@ use wallet_storage::{ use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, partially_signed_transaction::{ - PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, + InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, }, signature_status::SignatureStatus, AccountId, @@ -245,10 +245,7 @@ impl TrezorSigner { .tx() .outputs() .iter() - .zip(ptx.output_additional_infos()) - .map(|(out, additional_info)| { - to_trezor_output_msg(&self.chain_config, out, additional_info) - }) + .map(|out| to_trezor_output_msg(&self.chain_config, out, ptx.additional_infos())) .collect(); outputs } @@ -277,8 +274,7 @@ impl Signer for TrezorSigner { .mintlayer_sign_tx(coin_name, inputs, outputs, utxos) .map_err(|err| TrezorError::DeviceError(err.to_string()))?; - let inputs_utxo_refs: Vec<_> = - ptx.input_utxos().iter().map(|u| u.as_ref().map(|x| &x.utxo)).collect(); + let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); let (witnesses, prev_statuses, new_statuses) = ptx .witnesses() @@ -540,7 +536,14 @@ fn to_trezor_input_msgs( to_trezor_account_input(chain_config, dest, key_chain, outpoint) } (TxInput::AccountCommand(nonce, command), _, Some(dest)) => { - to_trezor_account_command_input(chain_config, dest, key_chain, nonce, command) + to_trezor_account_command_input( + chain_config, + dest, + key_chain, + nonce, + command, + ptx.additional_infos(), + ) } (_, _, None) => Err(SignerError::MissingDestinationInTransaction), (TxInput::Utxo(_), _, _) => Err(SignerError::MissingUtxo), @@ -554,6 +557,7 @@ fn to_trezor_account_command_input( key_chain: &impl AccountKeyChains, nonce: &common::chain::AccountNonce, command: &AccountCommand, + additional_infos: &BTreeMap, ) -> SignerResult { let mut inp_req = MintlayerAccountCommandTxInput::new(); inp_req.addresses = destination_to_address_paths(key_chain, dest); @@ -609,6 +613,50 @@ fn to_trezor_account_command_input( let mut req = MintlayerConcludeOrder::new(); req.set_order_id(Address::new(chain_config, *order_id)?.into_string()); + match additional_infos.get(&InfoId::OrderId(*order_id)) { + Some(TxAdditionalInfo::OrderInfo { + initially_asked, + initially_given, + ask_balance, + give_balance, + }) => { + let filled_value = match initially_asked { + OutputValue::Coin(amount) => OutputValue::Coin( + (*amount - *ask_balance).ok_or(SignerError::OrderFillUnderflow)?, + ), + OutputValue::TokenV1(id, amount) => OutputValue::TokenV1( + *id, + (*amount - *ask_balance).ok_or(SignerError::OrderFillUnderflow)?, + ), + OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), + }; + let give_value = match initially_given { + OutputValue::Coin(_) => OutputValue::Coin(*give_balance), + OutputValue::TokenV1(id, _) => OutputValue::TokenV1(*id, *give_balance), + OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), + }; + + req.filled_ask_amount = Some(to_trezor_output_value( + &filled_value, + additional_infos, + chain_config, + )?) + .into(); + + req.give_balance = Some(to_trezor_output_value( + &give_value, + additional_infos, + chain_config, + )?) + .into(); + } + Some( + TxAdditionalInfo::TokenInfo(_) + | TxAdditionalInfo::PoolInfo { staker_balance: _ }, + ) + | None => return Err(SignerError::MissingTxExtraInfo), + } + inp_req.conclude_order = Some(req).into(); } AccountCommand::FillOrder(order_id, amount, dest) => { @@ -617,6 +665,45 @@ fn to_trezor_account_command_input( req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); + match additional_infos.get(&InfoId::OrderId(*order_id)) { + Some(TxAdditionalInfo::OrderInfo { + initially_asked, + initially_given, + ask_balance, + give_balance, + }) => { + let ask_value = match initially_asked { + OutputValue::Coin(_) => OutputValue::Coin(*ask_balance), + OutputValue::TokenV1(id, _) => OutputValue::TokenV1(*id, *ask_balance), + OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), + }; + let give_value = match initially_given { + OutputValue::Coin(_) => OutputValue::Coin(*give_balance), + OutputValue::TokenV1(id, _) => OutputValue::TokenV1(*id, *give_balance), + OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), + }; + + req.ask_balance = Some(to_trezor_output_value( + &ask_value, + additional_infos, + chain_config, + )?) + .into(); + + req.give_balance = Some(to_trezor_output_value( + &give_value, + additional_infos, + chain_config, + )?) + .into(); + } + Some( + TxAdditionalInfo::TokenInfo(_) + | TxAdditionalInfo::PoolInfo { staker_balance: _ }, + ) + | None => return Err(SignerError::MissingTxExtraInfo), + } + inp_req.fill_order = Some(req).into(); } } @@ -732,16 +819,25 @@ fn destination_to_address_paths( fn to_trezor_output_value( output_value: &OutputValue, - additional_info: &Option, + additional_info: &BTreeMap, chain_config: &ChainConfig, ) -> SignerResult { - let token_info = additional_info.as_ref().and_then(|info| match info { - UtxoAdditionalInfo::TokenInfo(token_info) => Some(token_info), - UtxoAdditionalInfo::PoolInfo { staker_balance: _ } - | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => None, - }); - - to_trezor_output_value_with_token_info(output_value, &token_info, chain_config) + to_trezor_output_value_with_token_info( + output_value, + |token_id| { + additional_info.get(&InfoId::TokenId(token_id)).and_then(|info| match info { + TxAdditionalInfo::TokenInfo(info) => Some(info), + TxAdditionalInfo::PoolInfo { staker_balance: _ } + | TxAdditionalInfo::OrderInfo { + initially_asked: _, + initially_given: _, + ask_balance: _, + give_balance: _, + } => None, + }) + }, + chain_config, + ) } fn to_trezor_utxo_msgs( @@ -758,7 +854,7 @@ fn to_trezor_utxo_msgs( OutPointSourceId::Transaction(id) => id.to_hash().0, OutPointSourceId::BlockReward(id) => id.to_hash().0, }; - let out = to_trezor_output_msg(chain_config, &utxo.utxo, &utxo.additional_info)?; + let out = to_trezor_output_msg(chain_config, utxo, ptx.additional_infos())?; utxos.entry(id).or_default().insert(outpoint.output_index(), out); } TxInput::Account(_) | TxInput::AccountCommand(_, _) => {} @@ -771,7 +867,7 @@ fn to_trezor_utxo_msgs( fn to_trezor_output_msg( chain_config: &ChainConfig, out: &TxOutput, - additional_info: &Option, + additional_info: &BTreeMap, ) -> SignerResult { let res = match out { TxOutput::Transfer(value, dest) => { @@ -861,13 +957,18 @@ fn to_trezor_output_msg( out_req.set_pool_id(Address::new(chain_config, *pool_id)?.into_string()); out_req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); let staker_balance = additional_info - .as_ref() + .get(&InfoId::PoolId(*pool_id)) .and_then(|info| match info { - UtxoAdditionalInfo::PoolInfo { staker_balance } => Some(staker_balance), - UtxoAdditionalInfo::TokenInfo(_) - | UtxoAdditionalInfo::CreateOrder { ask: _, give: _ } => None, + TxAdditionalInfo::PoolInfo { staker_balance } => Some(staker_balance), + TxAdditionalInfo::TokenInfo(_) + | TxAdditionalInfo::OrderInfo { + initially_asked: _, + initially_given: _, + ask_balance: _, + give_balance: _, + } => None, }) - .ok_or(SignerError::MissingUtxoExtraInfo)?; + .ok_or(SignerError::MissingTxExtraInfo)?; out_req.set_staker_balance(staker_balance.into_atoms().to_be_bytes().to_vec()); let mut out = MintlayerTxOutput::new(); out.produce_block_from_stake = Some(out_req).into(); @@ -981,27 +1082,18 @@ fn to_trezor_output_msg( Address::new(chain_config, data.conclude_key().clone())?.into_string(), ); - match additional_info { - Some(UtxoAdditionalInfo::CreateOrder { ask, give }) => { - out_req.ask = Some(to_trezor_output_value_with_token_info( - data.ask(), - &ask.as_ref(), - chain_config, - )?) - .into(); - out_req.give = Some(to_trezor_output_value_with_token_info( - data.give(), - &give.as_ref(), - chain_config, - )?) - .into(); - } - Some( - UtxoAdditionalInfo::PoolInfo { staker_balance: _ } - | UtxoAdditionalInfo::TokenInfo(_), - ) - | None => return Err(SignerError::MissingUtxoExtraInfo), - } + out_req.ask = Some(to_trezor_output_value( + data.ask(), + additional_info, + chain_config, + )?) + .into(); + out_req.give = Some(to_trezor_output_value( + data.give(), + additional_info, + chain_config, + )?) + .into(); let mut out = MintlayerTxOutput::new(); out.create_order = Some(out_req).into(); @@ -1011,11 +1103,14 @@ fn to_trezor_output_msg( Ok(res) } -fn to_trezor_output_value_with_token_info( +fn to_trezor_output_value_with_token_info<'a, F>( value: &OutputValue, - token_info: &Option<&TokenAdditionalInfo>, + additional_info: F, chain_config: &ChainConfig, -) -> Result { +) -> Result +where + F: Fn(TokenId) -> Option<&'a TokenAdditionalInfo>, +{ match value { OutputValue::Coin(amount) => { let mut value = MintlayerOutputValue::new(); @@ -1025,15 +1120,12 @@ fn to_trezor_output_value_with_token_info( OutputValue::TokenV1(token_id, amount) => { let mut value = MintlayerOutputValue::new(); value.set_amount(amount.into_atoms().to_be_bytes().to_vec()); + let info = additional_info(*token_id).ok_or(SignerError::MissingTxExtraInfo)?; + let mut token_value = MintlayerTokenOutputValue::new(); token_value.set_token_id(Address::new(chain_config, *token_id)?.into_string()); - match &token_info { - Some(info) => { - token_value.set_number_of_decimals(info.num_decimals as u32); - token_value.set_token_ticker(info.ticker.clone()); - } - None => return Err(SignerError::MissingUtxoExtraInfo), - } + token_value.set_number_of_decimals(info.num_decimals as u32); + token_value.set_token_ticker(info.ticker.clone()); value.token = Some(token_value).into(); Ok(value) } diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 70b7b4c68a..7c371679e0 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -14,34 +14,37 @@ // limitations under the License. use core::panic; -use std::ops::{Add, Div, Mul, Sub}; +use std::ops::{Add, Div, Sub}; use super::*; -use crate::key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}; -use crate::send_request::PoolOrTokenId; -use crate::{Account, SendRequest}; -use common::chain::config::create_regtest; -use common::chain::htlc::HashedTimelockContract; -use common::chain::output_value::OutputValue; -use common::chain::signature::inputsig::arbitrary_message::produce_message_challenge; -use common::chain::stakelock::StakePoolData; -use common::chain::timelock::OutputTimeLock; -use common::chain::tokens::{NftIssuanceV0, TokenId}; +use crate::{ + key_chain::{MasterKeyChain, LOOKAHEAD_SIZE}, + Account, SendRequest, +}; use common::chain::{ + config::create_regtest, + htlc::HashedTimelockContract, + output_value::OutputValue, + signature::inputsig::arbitrary_message::produce_message_challenge, + stakelock::StakePoolData, + timelock::OutputTimeLock, + tokens::{NftIssuanceV0, TokenId}, AccountNonce, AccountOutPoint, DelegationId, Destination, GenBlock, OrderData, PoolId, Transaction, TxInput, }; -use common::primitives::per_thousand::PerThousand; -use common::primitives::{Amount, BlockHeight, Id, H256}; +use common::primitives::{per_thousand::PerThousand, Amount, BlockHeight, Id, H256}; use crypto::key::{KeyKind, PrivateKey}; use randomness::{Rng, RngCore}; use rstest::rstest; use test_utils::random::{make_seedable_rng, Seed}; use trezor_client::find_devices; use wallet_storage::{DefaultBackend, Store, Transactional}; -use wallet_types::account_info::DEFAULT_ACCOUNT_INDEX; -use wallet_types::seed_phrase::StoreSeedPhrase; -use wallet_types::KeyPurpose::{Change, ReceiveFunds}; +use wallet_types::{ + account_info::DEFAULT_ACCOUNT_INDEX, + partially_signed_transaction::InfoId, + seed_phrase::StoreSeedPhrase, + KeyPurpose::{Change, ReceiveFunds}, +}; const MNEMONIC: &str = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"; @@ -195,7 +198,7 @@ fn sign_transaction(#[case] seed: Seed) { let mut account = Account::new(chain_config.clone(), &mut db_tx, key_chain, None).unwrap(); let amounts: Vec = (0..(2 + rng.next_u32() % 5)) - .map(|_| Amount::from_atoms(rng.gen_range(1..10) as UnsignedIntType)) + .map(|_| Amount::from_atoms(rng.gen_range(10..100) as UnsignedIntType)) .collect(); let total_amount = amounts.iter().fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); @@ -263,36 +266,44 @@ fn sign_transaction(#[case] seed: Seed) { let multisig_utxo = TxOutput::Transfer(OutputValue::Coin(Amount::from_atoms(1)), multisig_dest); let token_id = TokenId::new(H256::random_using(&mut rng)); + let order_id = OrderId::new(H256::random_using(&mut rng)); + + let dest_amount = total_amount.div(10).unwrap(); + let lock_amount = total_amount.div(10).unwrap(); + let burn_amount = total_amount.div(10).unwrap(); + let change_amount = total_amount.div(10).unwrap(); + let outputs_amounts_sum = [dest_amount, lock_amount, burn_amount, change_amount] + .iter() + .fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); + let _fee_amount = total_amount.sub(outputs_amounts_sum).unwrap(); + let acc_inputs = vec![ TxInput::Account(AccountOutPoint::new( AccountNonce::new(1), AccountSpending::DelegationBalance( DelegationId::new(H256::random_using(&mut rng)), - Amount::from_atoms(1 as u128), + Amount::from_atoms(1_u128), ), )), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::MintTokens(token_id, Amount::from_atoms(100)), + AccountCommand::MintTokens(token_id, (dest_amount + Amount::from_atoms(100)).unwrap()), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::UnmintTokens(TokenId::new(H256::random_using(&mut rng))), + AccountCommand::UnmintTokens(token_id), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::LockTokenSupply(TokenId::new(H256::random_using(&mut rng))), + AccountCommand::LockTokenSupply(token_id), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::FreezeToken( - TokenId::new(H256::random_using(&mut rng)), - IsTokenUnfreezable::Yes, - ), + AccountCommand::FreezeToken(token_id, IsTokenUnfreezable::Yes), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::UnfreezeToken(TokenId::new(H256::random_using(&mut rng))), + AccountCommand::UnfreezeToken(token_id), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), @@ -303,15 +314,11 @@ fn sign_transaction(#[case] seed: Seed) { ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::ConcludeOrder(OrderId::new(H256::random_using(&mut rng))), + AccountCommand::ConcludeOrder(order_id), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), - AccountCommand::FillOrder( - OrderId::new(H256::random_using(&mut rng)), - Amount::from_atoms(123), - Destination::AnyoneCanSpend, - ), + AccountCommand::FillOrder(order_id, Amount::from_atoms(1), Destination::AnyoneCanSpend), ), TxInput::AccountCommand( AccountNonce::new(rng.next_u64()), @@ -334,15 +341,6 @@ fn sign_transaction(#[case] seed: Seed) { }) .collect(); - let dest_amount = total_amount.div(10).unwrap().mul(5).unwrap(); - let lock_amount = total_amount.div(10).unwrap().mul(1).unwrap(); - let burn_amount = total_amount.div(10).unwrap().mul(1).unwrap(); - let change_amount = total_amount.div(10).unwrap().mul(2).unwrap(); - let outputs_amounts_sum = [dest_amount, lock_amount, burn_amount, change_amount] - .iter() - .fold(Amount::ZERO, |acc, a| acc.add(*a).unwrap()); - let _fee_amount = total_amount.sub(outputs_amounts_sum).unwrap(); - let (_dest_prv, dest_pub) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr); let (_, vrf_public_key) = VRFPrivateKey::new_from_entropy(crypto::vrf::VRFKeyKind::Schnorrkel); @@ -437,13 +435,22 @@ fn sign_transaction(#[case] seed: Seed) { let destinations = req.destinations().to_vec(); let mut additional_info = BTreeMap::new(); additional_info.insert( - PoolOrTokenId::TokenId(token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: 1, ticker: "TKN".as_bytes().to_vec(), }), ); - let ptx = req.into_partially_signed_tx(&additional_info).unwrap(); + additional_info.insert( + InfoId::OrderId(order_id), + TxAdditionalInfo::OrderInfo { + ask_balance: Amount::from_atoms(10), + give_balance: Amount::from_atoms(100), + initially_asked: OutputValue::Coin(Amount::from_atoms(20)), + initially_given: OutputValue::TokenV1(token_id, Amount::from_atoms(200)), + }, + ); + let ptx = req.into_partially_signed_tx(additional_info).unwrap(); let mut devices = find_devices(false); assert!(!devices.is_empty()); diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index 03f29f8887..ce828bc11e 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -26,8 +26,7 @@ use crate::key_chain::{ MasterKeyChain, LOOKAHEAD_SIZE, VRF_INDEX, }; use crate::send_request::{ - make_issue_token_outputs, IssueNftArguments, PoolOrTokenId, SelectedInputs, - StakePoolDataArguments, + make_issue_token_outputs, IssueNftArguments, SelectedInputs, StakePoolDataArguments, }; use crate::signer::{Signer, SignerError, SignerProvider}; use crate::wallet_events::{WalletEvents, WalletEventsNoOp}; @@ -75,8 +74,8 @@ use wallet_storage::{ use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; use wallet_types::chain_info::ChainInfo; use wallet_types::partially_signed_transaction::{ - PartiallySignedTransaction, PartiallySignedTransactionCreationError, TokenAdditionalInfo, - UtxoAdditionalInfo, + InfoId, PartiallySignedTransaction, PartiallySignedTransactionCreationError, + TokenAdditionalInfo, TxAdditionalInfo, }; use wallet_types::seed_phrase::SerializableSeedPhrase; use wallet_types::signature_status::SignatureStatus; @@ -1042,7 +1041,7 @@ where fn for_account_rw_unlocked_and_check_tx_generic( &mut self, account_index: U31, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, f: impl FnOnce( &mut Account, &mut StoreTxRwUnlocked, @@ -1063,7 +1062,7 @@ where let ptx = signer.sign_tx(ptx, account.key_chain(), db_tx).map(|(ptx, _, _)| ptx)?; let inputs_utxo_refs: Vec<_> = - ptx.input_utxos().iter().map(|u| u.as_ref().map(|x| &x.utxo)).collect(); + ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); let is_fully_signed = ptx.destinations().iter().enumerate().zip(ptx.witnesses()).all( |((i, destination), witness)| match (witness, destination) { @@ -1100,7 +1099,7 @@ where fn for_account_rw_unlocked_and_check_tx( &mut self, account_index: U31, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked) -> WalletResult, ) -> WalletResult { Ok(self @@ -1424,7 +1423,7 @@ where change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { Ok(self .create_transaction_to_addresses_impl( @@ -1452,7 +1451,7 @@ where intent: String, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(SignedTransaction, SignedTransactionIntent)> { let (signed_tx, input_destinations) = self.create_transaction_to_addresses_impl( account_index, @@ -1494,7 +1493,7 @@ where current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, additional_data_getter: impl Fn(&SendRequest) -> AddlData, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(SignedTransaction, AddlData)> { let request = SendRequest::new().with_outputs(outputs); let latest_median_time = self.latest_median_time; @@ -1531,7 +1530,7 @@ where change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { let request = SendRequest::new().with_outputs(outputs); let latest_median_time = self.latest_median_time; @@ -1558,7 +1557,7 @@ where destination: Destination, inputs: Vec<(UtxoOutPoint, TxOutput)>, current_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { let request = SendRequest::new().with_inputs( inputs.into_iter().map(|(outpoint, output)| (TxInput::Utxo(outpoint), output)), @@ -1580,7 +1579,7 @@ where delegation_share: Amount, current_fee_rate: FeeRate, ) -> WalletResult { - self.for_account_rw_unlocked_and_check_tx(account_index, &BTreeMap::new(), |account, _| { + self.for_account_rw_unlocked_and_check_tx(account_index, BTreeMap::new(), |account, _| { account.sweep_delegation(address, delegation_id, delegation_share, current_fee_rate) }) } @@ -1594,7 +1593,7 @@ where delegation_share: Amount, current_fee_rate: FeeRate, ) -> WalletResult { - self.for_account_rw_unlocked_and_check_tx(account_index, &BTreeMap::new(), |account, _| { + self.for_account_rw_unlocked_and_check_tx(account_index, BTreeMap::new(), |account, _| { account.spend_from_delegation( address, amount, @@ -1618,7 +1617,7 @@ where let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { account.mint_tokens( db_tx, @@ -1647,7 +1646,7 @@ where let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { account.unmint_tokens( db_tx, @@ -1674,7 +1673,7 @@ where let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { account.lock_token_supply( db_tx, @@ -1701,7 +1700,7 @@ where let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { account.freeze_token( db_tx, @@ -1728,7 +1727,7 @@ where let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { account.unfreeze_token( db_tx, @@ -1755,7 +1754,7 @@ where let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { account.change_token_authority( db_tx, @@ -1783,7 +1782,7 @@ where let additional_utxo_infos = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { account.change_token_metadata_uri( db_tx, @@ -1830,7 +1829,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - &BTreeMap::new(), + BTreeMap::new(), )?; let input0_outpoint = crate::utils::get_first_utxo_outpoint(tx.transaction().inputs())?; let delegation_id = make_delegation_id(input0_outpoint); @@ -1853,7 +1852,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - &BTreeMap::new(), + BTreeMap::new(), )?; let token_id = make_token_id(tx.transaction().inputs()).ok_or(WalletError::MissingTokenId)?; @@ -1873,7 +1872,7 @@ where let signed_transaction = self.for_account_rw_unlocked_and_check_tx( account_index, - &BTreeMap::new(), + BTreeMap::new(), |account, db_tx| { account.create_issue_nft_tx( db_tx, @@ -1904,13 +1903,13 @@ where current_fee_rate: FeeRate, ) -> WalletResult { let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::PoolId(pool_id), - UtxoAdditionalInfo::PoolInfo { staker_balance }, + InfoId::PoolId(pool_id), + TxAdditionalInfo::PoolInfo { staker_balance }, )]); Ok(self .for_account_rw_unlocked_and_check_tx_generic( account_index, - &additional_utxo_infos, + additional_utxo_infos, |account, db_tx| { Ok(( account.decommission_stake_pool( @@ -1937,8 +1936,8 @@ where current_fee_rate: FeeRate, ) -> WalletResult { let additional_utxo_infos = BTreeMap::from_iter([( - PoolOrTokenId::PoolId(pool_id), - UtxoAdditionalInfo::PoolInfo { staker_balance }, + InfoId::PoolId(pool_id), + TxAdditionalInfo::PoolInfo { staker_balance }, )]); self.for_account_rw_unlocked( account_index, @@ -1951,7 +1950,7 @@ where current_fee_rate, )?; - let ptx = request.into_partially_signed_tx(&additional_utxo_infos)?; + let ptx = request.into_partially_signed_tx(additional_utxo_infos)?; let mut signer = signer_provider.provide(Arc::new(chain_config.clone()), account_index); @@ -1972,7 +1971,7 @@ where htlc: HashedTimelockContract, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( @@ -2002,7 +2001,7 @@ where conclude_key: Address, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(OrderId, SignedTransaction)> { let latest_median_time = self.latest_median_time; let tx = self.for_account_rw_unlocked_and_check_tx( @@ -2036,7 +2035,7 @@ where output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( @@ -2068,7 +2067,7 @@ where output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( @@ -2299,10 +2298,10 @@ where fn to_token_additional_info( token_info: &UnconfirmedTokenInfo, -) -> BTreeMap { +) -> BTreeMap { BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_info.token_id()), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), }), @@ -2349,7 +2348,7 @@ where let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - &BTreeMap::new(), + BTreeMap::new(), |account, db_tx| { account.create_stake_pool_tx( db_tx, diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index 7cbaf29456..b1ab9af465 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -55,8 +55,7 @@ use wallet_storage::{schema, WalletStorageEncryptionRead}; use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, partially_signed_transaction::{ - PartiallySignedTransaction, PartiallySignedTransactionCreationError, UtxoAdditionalInfo, - UtxoWithAdditionalInfo, + PartiallySignedTransaction, PartiallySignedTransactionCreationError, TxAdditionalInfo, }, seed_phrase::{PassPhrase, StoreSeedPhrase}, utxo_types::{UtxoState, UtxoType}, @@ -999,7 +998,7 @@ fn wallet_accounts_creation() { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -1159,7 +1158,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ), Err(WalletError::DatabaseError( wallet_storage::Error::WalletLocked @@ -1177,7 +1176,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); } else { @@ -1207,7 +1206,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); } @@ -1235,7 +1234,7 @@ fn wallet_get_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -1295,7 +1294,7 @@ fn wallet_list_mainchain_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -1318,7 +1317,7 @@ fn wallet_list_mainchain_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); let spend_from_tx_id = tx.transaction().get_id(); @@ -1373,7 +1372,7 @@ fn wallet_transaction_with_fees(#[case] seed: Seed) { BTreeMap::new(), very_big_feerate, very_big_feerate, - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap_err(); @@ -1401,7 +1400,7 @@ fn wallet_transaction_with_fees(#[case] seed: Seed) { BTreeMap::new(), feerate, feerate, - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -1488,7 +1487,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap_err(); assert_eq!(err, WalletError::CannotFindUtxo(missing_utxo.clone())); @@ -1515,7 +1514,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -1553,7 +1552,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap_err(); @@ -1851,7 +1850,7 @@ fn send_to_unknown_delegation(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -1999,7 +1998,7 @@ fn create_spend_from_delegations(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -2266,7 +2265,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); wallet @@ -2331,7 +2330,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); (issued_token_id, vec![nft_issuance_transaction, transfer_tx]) @@ -2370,8 +2369,8 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { ); let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(*token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(*token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: number_of_decimals, ticker: token_ticker.clone(), }), @@ -2384,7 +2383,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info.clone(), ) .unwrap(); wallet @@ -2438,7 +2437,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .err() .unwrap(); @@ -2502,7 +2501,7 @@ fn check_tokens_v0_are_ignored(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ); matches!( @@ -2721,8 +2720,8 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { ); let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -2735,7 +2734,7 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); @@ -3583,7 +3582,7 @@ fn lock_then_transfer(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); wallet @@ -3705,7 +3704,7 @@ fn wallet_multiple_transactions_in_single_block(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3797,7 +3796,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -3833,7 +3832,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3873,7 +3872,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap_err(); assert_eq!( @@ -3900,7 +3899,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3985,7 +3984,7 @@ fn wallet_abandone_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); wallet @@ -4357,14 +4356,13 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { // remove the signatures and try to sign it again let tx = stake_pool_transaction.transaction().clone(); let inps = tx.inputs().len(); - let outs = tx.outputs().len(); let ptx = PartiallySignedTransaction::new( tx, vec![None; inps], - vec![Some(UtxoWithAdditionalInfo::new(utxo, None))], + vec![Some(utxo)], vec![Some(addr.into_object())], None, - vec![None; outs], + BTreeMap::new(), ) .unwrap(); let stake_pool_transaction = wallet @@ -4653,7 +4651,7 @@ fn sign_send_request_cold_wallet(#[case] seed: Seed) { [(Currency::Coin, cold_wallet_address.clone())].into(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); @@ -4756,7 +4754,7 @@ fn test_not_exhaustion_of_keys(#[case] seed: Seed) { [].into(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); } @@ -4890,14 +4888,13 @@ fn test_add_standalone_multisig(#[case] seed: Seed) { )], ) .unwrap(); - let outs = tx.outputs().len(); let spend_multisig_tx = PartiallySignedTransaction::new( spend_multisig_tx, vec![None; 1], - vec![Some(UtxoWithAdditionalInfo::new(tx.outputs()[0].clone(), None))], + vec![Some(tx.outputs()[0].clone())], vec![Some(multisig_address.as_object().clone())], None, - vec![None; outs], + BTreeMap::new(), ) .unwrap(); @@ -4991,7 +4988,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { htlc.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); let create_htlc_tx_id = create_htlc_tx.transaction().get_id(); @@ -5043,20 +5040,14 @@ fn create_htlc_and_spend(#[case] seed: Seed) { vec![TxOutput::Transfer(output_value, address2.into_object())], ) .unwrap(); - let spend_utxos = vec![create_htlc_tx - .transaction() - .outputs() - .first() - .cloned() - .map(|out| UtxoWithAdditionalInfo::new(out, None))]; - let outs = create_htlc_tx.outputs().len(); + let spend_utxos = vec![create_htlc_tx.transaction().outputs().first().cloned()]; let spend_ptx = PartiallySignedTransaction::new( spend_tx, vec![None], spend_utxos, vec![Some(spend_key.into_object())], Some(vec![Some(secret)]), - vec![None; outs], + BTreeMap::new(), ) .unwrap(); @@ -5137,7 +5128,7 @@ fn create_htlc_and_refund(#[case] seed: Seed) { htlc.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &BTreeMap::new(), + BTreeMap::new(), ) .unwrap(); let create_htlc_tx_id = create_htlc_tx.transaction().get_id(); @@ -5148,20 +5139,14 @@ fn create_htlc_and_refund(#[case] seed: Seed) { vec![TxOutput::Transfer(output_value, address1.into_object())], ) .unwrap(); - let refund_utxos = vec![create_htlc_tx - .transaction() - .outputs() - .first() - .cloned() - .map(|out| UtxoWithAdditionalInfo::new(out, None))]; - let outs = create_htlc_tx.outputs().len(); + let refund_utxos = vec![create_htlc_tx.transaction().outputs().first().cloned()]; let refund_ptx = PartiallySignedTransaction::new( refund_tx, vec![None], refund_utxos, vec![Some(refund_key)], None, - vec![None; outs], + BTreeMap::new(), ) .unwrap(); @@ -5331,8 +5316,8 @@ fn create_order(#[case] seed: Seed) { let ask_value = OutputValue::Coin(Amount::from_atoms(111)); let give_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5345,7 +5330,7 @@ fn create_order(#[case] seed: Seed) { address2.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); @@ -5457,8 +5442,8 @@ fn create_order_and_conclude(#[case] seed: Seed) { let ask_value = OutputValue::Coin(Amount::from_atoms(111)); let give_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5471,7 +5456,7 @@ fn create_order_and_conclude(#[case] seed: Seed) { address2.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); let order_info = RpcOrderInfo { @@ -5501,8 +5486,8 @@ fn create_order_and_conclude(#[case] seed: Seed) { assert!(token_balances.is_empty()); let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5515,7 +5500,7 @@ fn create_order_and_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); @@ -5646,8 +5631,8 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { let sell_amount = Amount::from_atoms(1000); let give_value = OutputValue::Coin(sell_amount); let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5660,7 +5645,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { address1.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); let order_info = RpcOrderInfo { @@ -5704,8 +5689,8 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { ); } let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5721,7 +5706,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); @@ -5770,8 +5755,8 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { }; let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5785,7 +5770,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); @@ -5827,8 +5812,8 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { nonce: Some(AccountNonce::new(1)), }; let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5841,7 +5826,7 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); @@ -5983,8 +5968,8 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { let sell_amount = Amount::from_atoms(1000); let give_value = OutputValue::Coin(sell_amount); let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -5997,7 +5982,7 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { address1.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); let order_info = RpcOrderInfo { @@ -6042,8 +6027,8 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { } let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -6058,7 +6043,7 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); @@ -6107,8 +6092,8 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { }; let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(issued_token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(issued_token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), }), @@ -6121,7 +6106,7 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { None, FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - &additional_info, + additional_info, ) .unwrap(); diff --git a/wallet/types/src/partially_signed_transaction.rs b/wallet/types/src/partially_signed_transaction.rs index 44e7336f09..eeed7254ef 100644 --- a/wallet/types/src/partially_signed_transaction.rs +++ b/wallet/types/src/partially_signed_transaction.rs @@ -13,11 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::collections::BTreeMap; + use common::{ chain::{ htlc::HtlcSecret, + output_value::OutputValue, signature::{inputsig::InputWitness, Signable, Transactable}, - Destination, SignedTransaction, Transaction, TransactionCreationError, TxInput, TxOutput, + tokens::TokenId, + Destination, OrderId, PoolId, SignedTransaction, Transaction, TransactionCreationError, + TxInput, TxOutput, }, primitives::Amount, }; @@ -30,8 +35,6 @@ use utils::ensure; pub enum PartiallySignedTransactionCreationError { #[error("Failed to convert partially signed tx to signed")] FailedToConvertPartiallySignedTx(PartiallySignedTransaction), - #[error("The number of output additional infos does not match the number of outputs")] - InvalidOutputAdditionalInfoCount, #[error("Failed to create transaction: {0}")] TxCreationError(#[from] TransactionCreationError), #[error("The number of input utxos does not match the number of inputs")] @@ -42,60 +45,55 @@ pub enum PartiallySignedTransactionCreationError { InvalidHtlcSecretsCount, } +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)] +pub enum InfoId { + PoolId(PoolId), + TokenId(TokenId), + OrderId(OrderId), +} + #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub struct TokenAdditionalInfo { pub num_decimals: u8, pub ticker: Vec, } -/// Additional info for UTXOs +/// Additional info for a partially signed Tx mainly used by hardware wallets to show info to the +/// user #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] -pub enum UtxoAdditionalInfo { +pub enum TxAdditionalInfo { TokenInfo(TokenAdditionalInfo), PoolInfo { staker_balance: Amount, }, - CreateOrder { - ask: Option, - give: Option, + OrderInfo { + initially_asked: OutputValue, + initially_given: OutputValue, + ask_balance: Amount, + give_balance: Amount, }, } -#[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] -pub struct UtxoWithAdditionalInfo { - pub utxo: TxOutput, - pub additional_info: Option, -} - -impl UtxoWithAdditionalInfo { - pub fn new(utxo: TxOutput, additional_info: Option) -> Self { - Self { - utxo, - additional_info, - } - } -} - #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub struct PartiallySignedTransaction { tx: Transaction, witnesses: Vec>, - input_utxos: Vec>, + input_utxos: Vec>, destinations: Vec>, htlc_secrets: Vec>, - output_additional_infos: Vec>, + additional_infos: BTreeMap, } impl PartiallySignedTransaction { pub fn new( tx: Transaction, witnesses: Vec>, - input_utxos: Vec>, + input_utxos: Vec>, destinations: Vec>, htlc_secrets: Option>>, - output_additional_infos: Vec>, + additional_infos: BTreeMap, ) -> Result { let htlc_secrets = htlc_secrets.unwrap_or_else(|| vec![None; tx.inputs().len()]); @@ -105,7 +103,7 @@ impl PartiallySignedTransaction { input_utxos, destinations, htlc_secrets, - output_additional_infos, + additional_infos, }; this.ensure_consistency()?; @@ -134,11 +132,6 @@ impl PartiallySignedTransaction { PartiallySignedTransactionCreationError::InvalidHtlcSecretsCount ); - ensure!( - self.tx.outputs().len() == self.output_additional_infos.len(), - PartiallySignedTransactionCreationError::InvalidOutputAdditionalInfoCount - ); - Ok(()) } @@ -155,7 +148,7 @@ impl PartiallySignedTransaction { self.tx } - pub fn input_utxos(&self) -> &[Option] { + pub fn input_utxos(&self) -> &[Option] { self.input_utxos.as_ref() } @@ -175,10 +168,6 @@ impl PartiallySignedTransaction { self.tx.inputs().len() } - pub fn output_additional_infos(&self) -> &[Option] { - &self.output_additional_infos - } - pub fn all_signatures_available(&self) -> bool { self.witnesses .iter() @@ -203,6 +192,10 @@ impl PartiallySignedTransaction { Err(PartiallySignedTransactionCreationError::FailedToConvertPartiallySignedTx(self)) } } + + pub fn additional_infos(&self) -> &BTreeMap { + &self.additional_infos + } } impl Signable for PartiallySignedTransaction { diff --git a/wallet/wallet-cli-lib/src/lib.rs b/wallet/wallet-cli-lib/src/lib.rs index 385b0ad532..d947591d3e 100644 --- a/wallet/wallet-cli-lib/src/lib.rs +++ b/wallet/wallet-cli-lib/src/lib.rs @@ -36,11 +36,12 @@ use node_comm::{make_cold_wallet_rpc_client, make_rpc_client, rpc_client::ColdWa use rpc::RpcAuthData; use tokio::sync::mpsc; use utils::{cookie::COOKIE_FILENAME, default_data_dir::default_data_dir_for_chain, ensure}; -use wallet_cli_commands::{ - CliHardwareWalletType, ManageableWalletCommand, WalletCommand, WalletManagementCommand, -}; +use wallet_cli_commands::{ManageableWalletCommand, WalletCommand, WalletManagementCommand}; use wallet_rpc_lib::{cmdline::make_wallet_config, config::WalletRpcConfig, types::NodeInterface}; +#[cfg(feature = "trezor")] +use wallet_cli_commands::CliHardwareWalletType; + enum Mode { Interactive { logger: repl::interactive::log::InteractiveLogger, diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index f0d3134b9c..542e13836a 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -22,7 +22,8 @@ use common::{ chain::{ output_value::OutputValue, tokens::{RPCTokenInfo, TokenId}, - ChainConfig, Destination, PoolId, Transaction, TxInput, TxOutput, UtxoOutPoint, + AccountCommand, ChainConfig, Destination, PoolId, Transaction, TxInput, TxOutput, + UtxoOutPoint, }, primitives::{amount::RpcAmountOut, Amount}, }; @@ -37,7 +38,7 @@ use wallet::{ }; use wallet_types::{ partially_signed_transaction::{ - PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, UtxoWithAdditionalInfo, + InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, }, Currency, }; @@ -138,10 +139,12 @@ fn pool_id_from_txo(utxo: &TxOutput) -> Option { } } +pub type AdditionalInfos = BTreeMap; + async fn fetch_token_extra_info( rpc_client: &T, value: &OutputValue, -) -> Result, ControllerError> +) -> Result, ControllerError> where T: NodeInterface, { @@ -149,10 +152,13 @@ where OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(None), OutputValue::TokenV1(token_id, _) => { let info = fetch_token_info(rpc_client, *token_id).await?; - Ok(Some(TokenAdditionalInfo { - num_decimals: info.token_number_of_decimals(), - ticker: info.token_ticker().to_vec(), - })) + Ok(Some(( + InfoId::TokenId(*token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + num_decimals: info.token_number_of_decimals(), + ticker: info.token_ticker().to_vec(), + }), + ))) } } } @@ -160,7 +166,7 @@ where pub async fn fetch_utxo_extra_info( rpc_client: &T, utxo: TxOutput, -) -> Result> +) -> Result<(TxOutput, AdditionalInfos), ControllerError> where T: NodeInterface, { @@ -169,34 +175,35 @@ where | TxOutput::Transfer(value, _) | TxOutput::LockThenTransfer(value, _, _) | TxOutput::Htlc(value, _) => { - let additional_info = fetch_token_extra_info(rpc_client, value) - .await? - .map(UtxoAdditionalInfo::TokenInfo); - Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) + let additional_info = fetch_token_extra_info(rpc_client, value).await?; + Ok((utxo, additional_info.into_iter().collect())) } TxOutput::CreateOrder(order) => { - let ask = fetch_token_extra_info(rpc_client, order.ask()).await?; - let give = fetch_token_extra_info(rpc_client, order.ask()).await?; - let additional_info = Some(UtxoAdditionalInfo::CreateOrder { ask, give }); - Ok(UtxoWithAdditionalInfo::new(utxo, additional_info)) + let ask_info = fetch_token_extra_info(rpc_client, order.ask()).await?; + let give_info = fetch_token_extra_info(rpc_client, order.ask()).await?; + let additional_info = ask_info.into_iter().chain(give_info).collect(); + Ok((utxo, additional_info)) } TxOutput::ProduceBlockFromStake(_, pool_id) => { - let staker_balance = rpc_client + let additional_infos = rpc_client .get_staker_balance(*pool_id) .await .map_err(ControllerError::NodeCallError)? + .map(|staker_balance| { + BTreeMap::from([( + InfoId::PoolId(*pool_id), + TxAdditionalInfo::PoolInfo { staker_balance }, + )]) + }) .ok_or(WalletError::UnknownPoolId(*pool_id))?; - Ok(UtxoWithAdditionalInfo::new( - utxo, - Some(UtxoAdditionalInfo::PoolInfo { staker_balance }), - )) + Ok((utxo, additional_infos)) } TxOutput::IssueNft(_, _, _) | TxOutput::IssueFungibleToken(_) | TxOutput::CreateStakePool(_, _) | TxOutput::DelegateStaking(_, _) | TxOutput::CreateDelegationId(_, _) - | TxOutput::DataDeposit(_) => Ok(UtxoWithAdditionalInfo::new(utxo, None)), + | TxOutput::DataDeposit(_) => Ok((utxo, BTreeMap::new())), } } @@ -238,7 +245,17 @@ pub async fn tx_to_partially_signed_tx( .iter() .map(|inp| into_utxo_and_destination(rpc_client, wallet, inp)) .collect(); - let (input_utxos, destinations) = tasks.try_collect::>().await?.into_iter().unzip(); + let (input_utxos, additional_infos, destinations) = + tasks.try_collect::>().await?.into_iter().fold( + (Vec::new(), BTreeMap::new(), Vec::new()), + |(mut input_utxos, mut additional_infos, mut destinations), (x, y, z)| { + input_utxos.push(x); + additional_infos.extend(y); + destinations.push(z); + (input_utxos, additional_infos, destinations) + }, + ); + let num_inputs = tx.inputs().len(); let tasks: FuturesOrdered<_> = tx @@ -246,12 +263,13 @@ pub async fn tx_to_partially_signed_tx( .iter() .map(|out| fetch_utxo_extra_info(rpc_client, out.clone())) .collect(); - let output_additional_infos = tasks - .try_collect::>() - .await? - .into_iter() - .map(|x| x.additional_info) - .collect(); + let additional_infos = tasks.try_collect::>().await?.into_iter().fold( + additional_infos, + |mut acc, (_, info)| { + acc.extend(info); + acc + }, + ); let ptx = PartiallySignedTransaction::new( tx, @@ -259,7 +277,7 @@ pub async fn tx_to_partially_signed_tx( input_utxos, destinations, None, - output_additional_infos, + additional_infos, ) .map_err(WalletError::PartiallySignedTransactionCreation)?; Ok(ptx) @@ -269,12 +287,12 @@ async fn into_utxo_and_destination( rpc_client: &T, wallet: &RuntimeWallet, tx_inp: &TxInput, -) -> Result<(Option, Option), ControllerError> { +) -> Result<(Option, AdditionalInfos, Option), ControllerError> { Ok(match tx_inp { TxInput::Utxo(outpoint) => { let (utxo, dest) = fetch_utxo_with_destination(rpc_client, outpoint, wallet).await?; - let utxo_with_extra_info = fetch_utxo_extra_info(rpc_client, utxo).await?; - (Some(utxo_with_extra_info), Some(dest)) + let (utxo, additional_infos) = fetch_utxo_extra_info(rpc_client, utxo).await?; + (Some(utxo), additional_infos, Some(dest)) } TxInput::Account(acc_outpoint) => { // find delegation destination @@ -283,7 +301,7 @@ async fn into_utxo_and_destination( #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.find_account_destination(acc_outpoint), }; - (None, dest) + (None, BTreeMap::new(), dest) } TxInput::AccountCommand(_, cmd) => { // find authority of the token @@ -292,7 +310,54 @@ async fn into_utxo_and_destination( #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.find_account_command_destination(cmd), }; - (None, dest) + + let additional_infos = match cmd { + AccountCommand::FillOrder(order_id, _, _) + | AccountCommand::ConcludeOrder(order_id) => { + let order_info = rpc_client + .get_order_info(*order_id) + .await + .map_err(ControllerError::NodeCallError)? + .ok_or(ControllerError::WalletError(WalletError::OrderInfoMissing( + *order_id, + )))?; + + let ask_token_info = fetch_token_extra_info( + rpc_client, + &Currency::from_rpc_output_value(&order_info.initially_asked) + .into_output_value(order_info.ask_balance), + ) + .await?; + let give_token_info = fetch_token_extra_info( + rpc_client, + &Currency::from_rpc_output_value(&order_info.initially_given) + .into_output_value(order_info.give_balance), + ) + .await?; + + ask_token_info + .into_iter() + .chain(give_token_info) + .chain([( + InfoId::OrderId(*order_id), + TxAdditionalInfo::OrderInfo { + initially_asked: order_info.initially_asked.into(), + initially_given: order_info.initially_given.into(), + ask_balance: order_info.ask_balance, + give_balance: order_info.give_balance, + }, + )]) + .collect() + } + AccountCommand::MintTokens(_, _) + | AccountCommand::UnmintTokens(_) + | AccountCommand::FreezeToken(_, _) + | AccountCommand::UnfreezeToken(_) + | AccountCommand::LockTokenSupply(_) + | AccountCommand::ChangeTokenAuthority(_, _) + | AccountCommand::ChangeTokenMetadataUri(_, _) => BTreeMap::new(), + }; + (None, additional_infos, dest) } }) } diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index 3674aa21cb..a4f2b708f6 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -31,7 +31,9 @@ use chainstate::tx_verifier::{ self, error::ScriptError, input_check::signature_only_check::SignatureOnlyVerifiable, }; use futures::{never::Never, stream::FuturesOrdered, TryStreamExt}; -use helpers::{fetch_token_info, fetch_utxo, fetch_utxo_extra_info, into_balances}; +use helpers::{ + fetch_token_info, fetch_utxo, fetch_utxo_extra_info, into_balances, AdditionalInfos, +}; use node_comm::rpc_client::ColdWalletClient; use runtime_wallet::RuntimeWallet; use std::{ @@ -100,7 +102,7 @@ pub use wallet_types::{ utxo_types::{UtxoState, UtxoStates, UtxoType, UtxoTypes}, }; use wallet_types::{ - partially_signed_transaction::{PartiallySignedTransaction, UtxoWithAdditionalInfo}, + partially_signed_transaction::PartiallySignedTransaction, signature_status::SignatureStatus, wallet_type::{WalletControllerMode, WalletType}, with_locked::WithLocked, @@ -912,14 +914,9 @@ where &self, ptx: PartiallySignedTransaction, ) -> Result> { - let input_utxos: Vec<_> = - ptx.input_utxos().iter().flatten().map(|utxo| &utxo.utxo).cloned().collect(); + let input_utxos: Vec<_> = ptx.input_utxos().iter().flatten().cloned().collect(); let fees = self.get_fees(&input_utxos, ptx.tx().outputs()).await?; - let inputs_utxos_refs: Vec<_> = ptx - .input_utxos() - .iter() - .map(|out| out.as_ref().map(|utxo| &utxo.utxo)) - .collect(); + let inputs_utxos_refs: Vec<_> = ptx.input_utxos().iter().map(|out| out.as_ref()).collect(); let signature_statuses: Vec<_> = ptx .witnesses() .iter() @@ -1056,20 +1053,31 @@ where .collect::, WalletError>>() .map_err(ControllerError::WalletError)?; - let input_utxos = self.fetch_utxos_extra_info(input_utxos).await?; - let output_additional_infos = self + let (input_utxos, additional_infos) = + self.fetch_utxos_extra_info(input_utxos).await?.into_iter().fold( + (Vec::new(), BTreeMap::new()), + |(mut input_utxos, mut additional_infos), (x, y)| { + input_utxos.push(x); + additional_infos.extend(y); + (input_utxos, additional_infos) + }, + ); + + let additional_infos = self .fetch_utxos_extra_info(tx.outputs().to_vec()) .await? .into_iter() - .map(|x| x.additional_info) - .collect(); + .fold(additional_infos, |mut acc, (_, info)| { + acc.extend(info); + acc + }); let tx = PartiallySignedTransaction::new( tx, vec![None; num_inputs], input_utxos.into_iter().map(Option::Some).collect(), destinations.into_iter().map(Option::Some).collect(), htlc_secrets, - output_additional_infos, + additional_infos, ) .map_err(WalletError::PartiallySignedTransactionCreation)?; @@ -1155,13 +1163,12 @@ where async fn fetch_utxos_extra_info( &self, inputs: Vec, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { let tasks: FuturesOrdered<_> = inputs .into_iter() .map(|input| fetch_utxo_extra_info(&self.rpc_client, input)) .collect(); - let input_utxos: Vec = tasks.try_collect().await?; - Ok(input_utxos) + tasks.try_collect().await } async fn fetch_opt_utxo( diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs index f883de2de1..fc9ad5ef98 100644 --- a/wallet/wallet-controller/src/runtime_wallet.rs +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -35,19 +35,22 @@ use crypto::vrf::VRFPublicKey; use mempool::FeeRate; use wallet::account::transaction_list::TransactionList; use wallet::account::{CoinSelectionAlgo, DelegationData, PoolData, TxInfo, UnconfirmedTokenInfo}; -use wallet::send_request::{PoolOrTokenId, SelectedInputs, StakePoolDataArguments}; +use wallet::send_request::{SelectedInputs, StakePoolDataArguments}; use wallet::signer::software_signer::SoftwareSignerProvider; use wallet::wallet::WalletPoolsFilter; use wallet::wallet_events::WalletEvents; use wallet::{Wallet, WalletError, WalletResult}; -use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; -use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, UtxoAdditionalInfo}; +use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, TxAdditionalInfo}; use wallet_types::seed_phrase::SerializableSeedPhrase; use wallet_types::signature_status::SignatureStatus; use wallet_types::utxo_types::{UtxoStates, UtxoTypes}; use wallet_types::wallet_tx::TxData; use wallet_types::with_locked::WithLocked; +use wallet_types::{ + account_info::{StandaloneAddressDetails, StandaloneAddresses}, + partially_signed_transaction::InfoId, +}; use wallet_types::{Currency, KeychainUsageState}; #[cfg(feature = "trezor")] @@ -784,7 +787,7 @@ impl RuntimeWallet { change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_transaction_to_addresses( @@ -815,7 +818,7 @@ impl RuntimeWallet { destination_address: Destination, filtered_inputs: Vec<(UtxoOutPoint, TxOutput)>, current_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_sweep_transaction( @@ -823,7 +826,7 @@ impl RuntimeWallet { destination_address, filtered_inputs, current_fee_rate, - &additional_utxo_infos, + additional_utxo_infos, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_sweep_transaction( @@ -831,7 +834,7 @@ impl RuntimeWallet { destination_address, filtered_inputs, current_fee_rate, - &additional_utxo_infos, + additional_utxo_infos, ), } } @@ -885,7 +888,7 @@ impl RuntimeWallet { change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { match self { RuntimeWallet::Software(w) => w.create_unsigned_transaction_to_addresses( @@ -1046,7 +1049,7 @@ impl RuntimeWallet { htlc: HashedTimelockContract, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_htlc_tx( @@ -1078,7 +1081,7 @@ impl RuntimeWallet { conclude_key: Address, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(OrderId, SignedTransaction)> { match self { RuntimeWallet::Software(w) => w.create_order_tx( @@ -1112,7 +1115,7 @@ impl RuntimeWallet { output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_conclude_order_tx( @@ -1147,7 +1150,7 @@ impl RuntimeWallet { output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_fill_order_tx( @@ -1213,7 +1216,7 @@ impl RuntimeWallet { intent: String, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> WalletResult<(SignedTransaction, SignedTransactionIntent)> { match self { RuntimeWallet::Software(w) => w.create_transaction_to_addresses_with_intent( diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index bf4ab36c94..8979837a1b 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -50,7 +50,7 @@ use wallet::{ destination_getters::{get_tx_output_destination, HtlcSpendingCondition}, send_request::{ make_address_output, make_address_output_token, make_create_delegation_output, - make_data_deposit_output, PoolOrTokenId, SelectedInputs, StakePoolDataArguments, + make_data_deposit_output, SelectedInputs, StakePoolDataArguments, }, wallet::WalletPoolsFilter, wallet_events::WalletEvents, @@ -58,7 +58,7 @@ use wallet::{ }; use wallet_types::{ partially_signed_transaction::{ - PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, + InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, }, signature_status::SignatureStatus, utxo_types::{UtxoState, UtxoType}, @@ -161,7 +161,7 @@ where ) -> Result< ( Vec<(UtxoOutPoint, TxOutput)>, - BTreeMap, + BTreeMap, ), ControllerError, > { @@ -197,8 +197,8 @@ where result.push(utxo); for token_info in token_infos { additional_utxo_infos.insert( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_info.token_id()), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.token_number_of_decimals(), ticker: token_info.token_ticker().to_vec(), }), @@ -531,7 +531,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - &BTreeMap::new(), + BTreeMap::new(), ) }, ) @@ -563,7 +563,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - &BTreeMap::new(), + BTreeMap::new(), ) }, ) @@ -694,7 +694,7 @@ where [(Currency::Coin, change_address)].into(), current_fee_rate, consolidate_fee_rate, - &BTreeMap::new(), + BTreeMap::new(), ) .map_err(ControllerError::WalletError)?; @@ -745,8 +745,8 @@ where for (token_id, outputs_vec) in outputs { let token_info = fetch_token_info(&self.rpc_client, token_id).await?; additional_utxo_infos.insert( - PoolOrTokenId::TokenId(token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.token_number_of_decimals(), ticker: token_info.token_ticker().to_vec(), }), @@ -846,7 +846,7 @@ where change_addresses, current_fee_rate, consolidate_fee_rate, - &additional_utxo_infos, + additional_utxo_infos, )?; let fees = into_balances(&self.rpc_client, self.chain_config, fees).await?; @@ -899,7 +899,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - &BTreeMap::new(), + BTreeMap::new(), ) }, ) @@ -961,8 +961,8 @@ where token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_info.token_id()), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), }), @@ -974,7 +974,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - &additional_info, + additional_info, ) }, ) @@ -999,8 +999,8 @@ where token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; let additional_info = BTreeMap::from_iter([( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_info.token_id()), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), }), @@ -1013,7 +1013,7 @@ where intent, current_fee_rate, consolidate_fee_rate, - &additional_info, + additional_info, ) }, ) @@ -1113,7 +1113,7 @@ where &mut self, output_value: OutputValue, htlc: HashedTimelockContract, - additional_utxo_infos: &BTreeMap, + additional_utxo_infos: BTreeMap, ) -> Result> { let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; @@ -1150,7 +1150,7 @@ where conclude_key, current_fee_rate, consolidate_fee_rate, - &additional_info, + additional_info, ) }, ) @@ -1177,7 +1177,7 @@ where output_address, current_fee_rate, consolidate_fee_rate, - &additional_info, + additional_info, ) }, ) @@ -1206,7 +1206,7 @@ where output_address, current_fee_rate, consolidate_fee_rate, - &additional_info, + additional_info, ) }, ) @@ -1216,15 +1216,15 @@ where fn additional_token_infos( &mut self, token_infos: Vec, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { token_infos .into_iter() .map(|token_info| { let token_info = self.unconfiremd_token_info(token_info)?; Ok(( - PoolOrTokenId::TokenId(token_info.token_id()), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_info.token_id()), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), }), diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index d24f82edcf..4a14342833 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -39,7 +39,6 @@ use utils::{ensure, shallow_clone::ShallowClone}; use utils_networking::IpOrSocketAddress; use wallet::{ account::{transaction_list::TransactionList, PoolData, TransactionToSign, TxInfo}, - send_request::PoolOrTokenId, WalletError, }; @@ -79,7 +78,7 @@ use wallet_controller::{ use wallet_types::{ account_info::StandaloneAddressDetails, partially_signed_transaction::{ - PartiallySignedTransaction, TokenAdditionalInfo, UtxoAdditionalInfo, + InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, }, signature_status::SignatureStatus, wallet_tx::TxData, @@ -1509,8 +1508,8 @@ where .to_amount(token_info.token_number_of_decimals()) .ok_or(RpcError::InvalidCoinAmount)?; additional_utxo_infos.insert( - PoolOrTokenId::TokenId(token_id), - UtxoAdditionalInfo::TokenInfo(TokenAdditionalInfo { + InfoId::TokenId(token_id), + TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { num_decimals: token_info.token_number_of_decimals(), ticker: token_info.token_ticker().to_vec(), }), @@ -1528,7 +1527,7 @@ where controller .synced_controller(account_index, config) .await? - .create_htlc_tx(value, htlc, &additional_utxo_infos) + .create_htlc_tx(value, htlc, additional_utxo_infos) .await .map_err(RpcError::Controller) }) From f1c3a070f221f413329edb208bb3715812ca969d Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Sun, 12 Jan 2025 12:50:43 +0100 Subject: [PATCH 48/48] fix comments --- Cargo.lock | 2 +- test/functional/test_framework/__init__.py | 27 ++- test/functional/wallet_htlc_refund.py | 4 +- wallet/src/account/mod.rs | 8 +- wallet/src/send_request/mod.rs | 6 +- wallet/src/signer/software_signer/tests.rs | 6 +- wallet/src/signer/trezor_signer/mod.rs | 212 ++++++++---------- wallet/src/signer/trezor_signer/tests.rs | 20 +- wallet/src/wallet/mod.rs | 152 ++++++------- wallet/src/wallet/tests.rs | 184 +++++++-------- .../types/src/partially_signed_transaction.rs | 102 +++++++-- wallet/wallet-controller/src/helpers.rs | 85 ++++--- wallet/wallet-controller/src/lib.rs | 20 +- .../wallet-controller/src/runtime_wallet.rs | 53 +++-- .../src/synced_controller.rs | 100 ++++----- wallet/wallet-rpc-lib/src/rpc/mod.rs | 27 +-- 16 files changed, 519 insertions(+), 489 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e440c933a4..99b75fe600 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8354,7 +8354,7 @@ dependencies = [ [[package]] name = "trezor-client" version = "0.1.4" -source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#1768ae882544791239303dbe2e25e82f6dda0c81" +source = "git+https://github.com/mintlayer/mintlayer-trezor-firmware?branch=feature/mintlayer-pk#04bd932277f0eeba3561f0adca45a0e11e724044" dependencies = [ "bitcoin", "byteorder", diff --git a/test/functional/test_framework/__init__.py b/test/functional/test_framework/__init__.py index 5de34600c7..aca434b4f0 100644 --- a/test/functional/test_framework/__init__.py +++ b/test/functional/test_framework/__init__.py @@ -206,6 +206,23 @@ def init_mintlayer_types(): ] }, + "PoolAdditionalInfo": { + "type": "struct", + "type_mapping": [ + ["staker_balance", "Amount"], + ] + }, + + "OrderAdditionalInfo": { + "type": "struct", + "type_mapping": [ + ["initially_asked", "OutputValue"], + ["initially_given", "OutputValue"], + ["ask_balance", "Amount"], + ["give_balance", "Amount"], + ] + }, + "InfoId": { "type": "enum", "type_mapping": [ @@ -216,11 +233,11 @@ def init_mintlayer_types(): }, "TxAdditionalInfo": { - "type": "enum", + "type": "struct", "type_mapping": [ - ["TokenInfo", "TokenAdditionalInfo"], - ["PoolInfo", "(Amount)"], - ["OrderInfo", ""], # TODO + ["token_info", "BTreeMap"], + ["pool_info", "BTreeMap"], + ["order_info", "BTreeMap"], ], }, @@ -248,7 +265,7 @@ def init_mintlayer_types(): ["input_utxos", "Vec>"], ["destinations", "Vec>"], ["htlc_secrets", "Vec>"], - ["additional_infos", "BTreeMap"], + ["additional_infos", "TxAdditionalInfo"], ] }, diff --git a/test/functional/wallet_htlc_refund.py b/test/functional/wallet_htlc_refund.py index e45d437849..e7b35a2d1d 100644 --- a/test/functional/wallet_htlc_refund.py +++ b/test/functional/wallet_htlc_refund.py @@ -187,7 +187,7 @@ async def async_test(self): 'input_utxos': alice_htlc_outputs, 'destinations': [refund_dest_obj, alice_htlc_change_dest], 'htlc_secrets': [None, None], - 'additional_infos': [] + 'additional_infos': {'token_info': [], 'pool_info': [], 'order_info': []} } alice_refund_tx_hex = scalecodec.base.RuntimeConfiguration().create_scale_object('PartiallySignedTransaction').encode(alice_refund_ptx).to_hex()[2:] @@ -216,7 +216,7 @@ async def async_test(self): 'input_utxos': bob_htlc_outputs, 'destinations': [refund_dest_obj, bob_htlc_change_dest], 'htlc_secrets': [None, None], - 'additional_infos': [] + 'additional_infos': {'token_info': [], 'pool_info': [], 'order_info': []} } bob_refund_tx_hex = scalecodec.base.RuntimeConfiguration().create_scale_object('PartiallySignedTransaction').encode(bob_refund_ptx).to_hex()[2:] diff --git a/wallet/src/account/mod.rs b/wallet/src/account/mod.rs index b840a56054..a3c13c8f08 100644 --- a/wallet/src/account/mod.rs +++ b/wallet/src/account/mod.rs @@ -38,9 +38,7 @@ use utils::ensure; pub use utxo_selector::UtxoSelectorError; use wallet_types::account_id::AccountPrefixedId; use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; -use wallet_types::partially_signed_transaction::{ - InfoId, PartiallySignedTransaction, TxAdditionalInfo, -}; +use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, TxAdditionalInfo}; use wallet_types::with_locked::WithLocked; use crate::account::utxo_selector::{select_coins, OutputGroup}; @@ -634,7 +632,7 @@ impl Account { change_addresses: BTreeMap>, median_time: BlockTimestamp, fee_rate: CurrentFeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { let mut request = self.select_inputs_for_send_request( request, @@ -648,7 +646,7 @@ impl Account { )?; let fees = request.get_fees(); - let ptx = request.into_partially_signed_tx(additional_utxo_infos)?; + let ptx = request.into_partially_signed_tx(additional_info)?; Ok((ptx, fees)) } diff --git a/wallet/src/send_request/mod.rs b/wallet/src/send_request/mod.rs index 8c4d4f8bb8..2e43e2ea38 100644 --- a/wallet/src/send_request/mod.rs +++ b/wallet/src/send_request/mod.rs @@ -29,9 +29,7 @@ use common::primitives::{Amount, BlockHeight}; use crypto::vrf::VRFPublicKey; use utils::ensure; use wallet_types::currency::Currency; -use wallet_types::partially_signed_transaction::{ - InfoId, PartiallySignedTransaction, TxAdditionalInfo, -}; +use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, TxAdditionalInfo}; use crate::account::PoolData; use crate::destination_getters::{get_tx_output_destination, HtlcSpendingCondition}; @@ -292,7 +290,7 @@ impl SendRequest { pub fn into_partially_signed_tx( self, - additional_info: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { let num_inputs = self.inputs.len(); let destinations = self.destinations.into_iter().map(Some).collect(); diff --git a/wallet/src/signer/software_signer/tests.rs b/wallet/src/signer/software_signer/tests.rs index edc07aadc8..565c5e475e 100644 --- a/wallet/src/signer/software_signer/tests.rs +++ b/wallet/src/signer/software_signer/tests.rs @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::BTreeMap; use std::ops::{Add, Div, Mul, Sub}; use super::*; @@ -42,6 +41,7 @@ use serialization::Encode; use test_utils::random::{make_seedable_rng, Seed}; use wallet_storage::{DefaultBackend, Store, Transactional}; use wallet_types::account_info::DEFAULT_ACCOUNT_INDEX; +use wallet_types::partially_signed_transaction::TxAdditionalInfo; use wallet_types::seed_phrase::StoreSeedPhrase; use wallet_types::KeyPurpose::{Change, ReceiveFunds}; @@ -436,7 +436,7 @@ fn sign_transaction(#[case] seed: Seed) { .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); let destinations = req.destinations().to_vec(); - let additional_info = BTreeMap::new(); + let additional_info = TxAdditionalInfo::new(); let ptx = req.into_partially_signed_tx(additional_info).unwrap(); let mut signer = SoftwareSigner::new(chain_config.clone(), DEFAULT_ACCOUNT_INDEX); @@ -687,7 +687,7 @@ fn fixed_signatures() { .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); let destinations = req.destinations().to_vec(); - let additional_info = BTreeMap::new(); + let additional_info = TxAdditionalInfo::new(); let ptx = req.into_partially_signed_tx(additional_info).unwrap(); let utxos_ref = utxos diff --git a/wallet/src/signer/trezor_signer/mod.rs b/wallet/src/signer/trezor_signer/mod.rs index de89affba9..7fd1e7ec9e 100644 --- a/wallet/src/signer/trezor_signer/mod.rs +++ b/wallet/src/signer/trezor_signer/mod.rs @@ -21,6 +21,7 @@ use std::{ use common::{ address::Address, chain::{ + config::ChainType, htlc::HtlcSecret, output_value::OutputValue, signature::{ @@ -44,7 +45,7 @@ use common::{ AccountCommand, AccountSpending, ChainConfig, Destination, OutPointSourceId, SignedTransactionIntent, Transaction, TxInput, TxOutput, }, - primitives::{Idable, H256}, + primitives::{Amount, Idable, H256}, }; use crypto::key::{ extended::ExtendedPublicKey, @@ -60,8 +61,8 @@ use trezor_client::{ protos::{ MintlayerAccountCommandTxInput, MintlayerAccountSpendingDelegationBalance, MintlayerAccountTxInput, MintlayerAddressPath, MintlayerAddressType, MintlayerBurnTxOutput, - MintlayerChangeTokenAuthority, MintlayerChangeTokenMetadataUri, MintlayerConcludeOrder, - MintlayerCreateDelegationIdTxOutput, MintlayerCreateOrderTxOutput, + MintlayerChainType, MintlayerChangeTokenAuthority, MintlayerChangeTokenMetadataUri, + MintlayerConcludeOrder, MintlayerCreateDelegationIdTxOutput, MintlayerCreateOrderTxOutput, MintlayerCreateStakePoolTxOutput, MintlayerDataDepositTxOutput, MintlayerDelegateStakingTxOutput, MintlayerFillOrder, MintlayerFreezeToken, MintlayerHtlcTxOutput, MintlayerIssueFungibleTokenTxOutput, MintlayerIssueNftTxOutput, @@ -83,7 +84,7 @@ use wallet_storage::{ use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, partially_signed_transaction::{ - InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, + OrderAdditionalInfo, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, }, signature_status::SignatureStatus, AccountId, @@ -265,13 +266,13 @@ impl Signer for TrezorSigner { let inputs = to_trezor_input_msgs(&ptx, key_chain, &self.chain_config)?; let outputs = self.to_trezor_output_msgs(&ptx)?; let utxos = to_trezor_utxo_msgs(&ptx, &self.chain_config)?; - let coin_name = self.chain_config.chain_type().name().to_owned(); + let chain_type = to_trezor_chain_type(&self.chain_config); let new_signatures = self .client .lock() .expect("poisoned lock") - .mintlayer_sign_tx(coin_name, inputs, outputs, utxos) + .mintlayer_sign_tx(chain_type, inputs, outputs, utxos) .map_err(|err| TrezorError::DeviceError(err.to_string()))?; let inputs_utxo_refs: Vec<_> = ptx.input_utxos().iter().map(|u| u.as_ref()).collect(); @@ -450,13 +451,13 @@ impl Signer for TrezorSigner { } }; - let coin_name = self.chain_config.chain_type().name().to_owned(); + let chain_type = to_trezor_chain_type(&self.chain_config); let sig = self .client .lock() .expect("poisoned lock") - .mintlayer_sign_message(coin_name, address_n, addr_type, message.to_vec()) + .mintlayer_sign_message(chain_type, address_n, addr_type, message.to_vec()) .map_err(|err| TrezorError::DeviceError(err.to_string()))?; let signature = Signature::from_raw_data(&sig).map_err(TrezorError::SignatureError)?; @@ -557,7 +558,7 @@ fn to_trezor_account_command_input( key_chain: &impl AccountKeyChains, nonce: &common::chain::AccountNonce, command: &AccountCommand, - additional_infos: &BTreeMap, + additional_info: &TxAdditionalInfo, ) -> SignerResult { let mut inp_req = MintlayerAccountCommandTxInput::new(); inp_req.addresses = destination_to_address_paths(key_chain, dest); @@ -613,49 +614,40 @@ fn to_trezor_account_command_input( let mut req = MintlayerConcludeOrder::new(); req.set_order_id(Address::new(chain_config, *order_id)?.into_string()); - match additional_infos.get(&InfoId::OrderId(*order_id)) { - Some(TxAdditionalInfo::OrderInfo { - initially_asked, - initially_given, - ask_balance, - give_balance, - }) => { - let filled_value = match initially_asked { - OutputValue::Coin(amount) => OutputValue::Coin( - (*amount - *ask_balance).ok_or(SignerError::OrderFillUnderflow)?, - ), - OutputValue::TokenV1(id, amount) => OutputValue::TokenV1( - *id, - (*amount - *ask_balance).ok_or(SignerError::OrderFillUnderflow)?, - ), - OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), - }; - let give_value = match initially_given { - OutputValue::Coin(_) => OutputValue::Coin(*give_balance), - OutputValue::TokenV1(id, _) => OutputValue::TokenV1(*id, *give_balance), - OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), - }; + let OrderAdditionalInfo { + initially_asked, + initially_given, + ask_balance, + give_balance, + } = additional_info + .get_order_info(order_id) + .ok_or(SignerError::MissingTxExtraInfo)?; - req.filled_ask_amount = Some(to_trezor_output_value( - &filled_value, - additional_infos, - chain_config, - )?) - .into(); - - req.give_balance = Some(to_trezor_output_value( - &give_value, - additional_infos, - chain_config, - )?) - .into(); - } - Some( - TxAdditionalInfo::TokenInfo(_) - | TxAdditionalInfo::PoolInfo { staker_balance: _ }, - ) - | None => return Err(SignerError::MissingTxExtraInfo), - } + let filled_value = match initially_asked { + OutputValue::Coin(amount) => OutputValue::Coin( + (*amount - *ask_balance).ok_or(SignerError::OrderFillUnderflow)?, + ), + OutputValue::TokenV1(id, amount) => OutputValue::TokenV1( + *id, + (*amount - *ask_balance).ok_or(SignerError::OrderFillUnderflow)?, + ), + OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), + }; + let give_value = value_with_new_amount(initially_given, give_balance)?; + + req.filled_ask_amount = Some(to_trezor_output_value( + &filled_value, + additional_info, + chain_config, + )?) + .into(); + + req.give_balance = Some(to_trezor_output_value( + &give_value, + additional_info, + chain_config, + )?) + .into(); inp_req.conclude_order = Some(req).into(); } @@ -665,44 +657,31 @@ fn to_trezor_account_command_input( req.set_amount(amount.into_atoms().to_be_bytes().to_vec()); req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); - match additional_infos.get(&InfoId::OrderId(*order_id)) { - Some(TxAdditionalInfo::OrderInfo { - initially_asked, - initially_given, - ask_balance, - give_balance, - }) => { - let ask_value = match initially_asked { - OutputValue::Coin(_) => OutputValue::Coin(*ask_balance), - OutputValue::TokenV1(id, _) => OutputValue::TokenV1(*id, *ask_balance), - OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), - }; - let give_value = match initially_given { - OutputValue::Coin(_) => OutputValue::Coin(*give_balance), - OutputValue::TokenV1(id, _) => OutputValue::TokenV1(*id, *give_balance), - OutputValue::TokenV0(_) => return Err(SignerError::UnsupportedTokensV0), - }; + let OrderAdditionalInfo { + initially_asked, + initially_given, + ask_balance, + give_balance, + } = additional_info + .get_order_info(order_id) + .ok_or(SignerError::MissingTxExtraInfo)?; - req.ask_balance = Some(to_trezor_output_value( - &ask_value, - additional_infos, - chain_config, - )?) - .into(); - - req.give_balance = Some(to_trezor_output_value( - &give_value, - additional_infos, - chain_config, - )?) - .into(); - } - Some( - TxAdditionalInfo::TokenInfo(_) - | TxAdditionalInfo::PoolInfo { staker_balance: _ }, - ) - | None => return Err(SignerError::MissingTxExtraInfo), - } + let ask_value = value_with_new_amount(initially_asked, ask_balance)?; + let give_value = value_with_new_amount(initially_given, give_balance)?; + + req.ask_balance = Some(to_trezor_output_value( + &ask_value, + additional_info, + chain_config, + )?) + .into(); + + req.give_balance = Some(to_trezor_output_value( + &give_value, + additional_info, + chain_config, + )?) + .into(); inp_req.fill_order = Some(req).into(); } @@ -712,6 +691,18 @@ fn to_trezor_account_command_input( Ok(inp) } +/// Construct a new OutputValue with a new amount +fn value_with_new_amount( + initially_value: &OutputValue, + new_amount: &Amount, +) -> Result { + match initially_value { + OutputValue::Coin(_) => Ok(OutputValue::Coin(*new_amount)), + OutputValue::TokenV1(id, _) => Ok(OutputValue::TokenV1(*id, *new_amount)), + OutputValue::TokenV0(_) => Err(SignerError::UnsupportedTokensV0), + } +} + fn to_trezor_account_input( chain_config: &ChainConfig, dest: &Destination, @@ -819,23 +810,12 @@ fn destination_to_address_paths( fn to_trezor_output_value( output_value: &OutputValue, - additional_info: &BTreeMap, + additional_info: &TxAdditionalInfo, chain_config: &ChainConfig, ) -> SignerResult { to_trezor_output_value_with_token_info( output_value, - |token_id| { - additional_info.get(&InfoId::TokenId(token_id)).and_then(|info| match info { - TxAdditionalInfo::TokenInfo(info) => Some(info), - TxAdditionalInfo::PoolInfo { staker_balance: _ } - | TxAdditionalInfo::OrderInfo { - initially_asked: _, - initially_given: _, - ask_balance: _, - give_balance: _, - } => None, - }) - }, + |token_id| additional_info.get_token_info(&token_id), chain_config, ) } @@ -867,7 +847,7 @@ fn to_trezor_utxo_msgs( fn to_trezor_output_msg( chain_config: &ChainConfig, out: &TxOutput, - additional_info: &BTreeMap, + additional_info: &TxAdditionalInfo, ) -> SignerResult { let res = match out { TxOutput::Transfer(value, dest) => { @@ -957,18 +937,9 @@ fn to_trezor_output_msg( out_req.set_pool_id(Address::new(chain_config, *pool_id)?.into_string()); out_req.set_destination(Address::new(chain_config, dest.clone())?.into_string()); let staker_balance = additional_info - .get(&InfoId::PoolId(*pool_id)) - .and_then(|info| match info { - TxAdditionalInfo::PoolInfo { staker_balance } => Some(staker_balance), - TxAdditionalInfo::TokenInfo(_) - | TxAdditionalInfo::OrderInfo { - initially_asked: _, - initially_given: _, - ask_balance: _, - give_balance: _, - } => None, - }) - .ok_or(SignerError::MissingTxExtraInfo)?; + .get_pool_info(pool_id) + .ok_or(SignerError::MissingTxExtraInfo)? + .staker_balance; out_req.set_staker_balance(staker_balance.into_atoms().to_be_bytes().to_vec()); let mut out = MintlayerTxOutput::new(); out.produce_block_from_stake = Some(out_req).into(); @@ -1196,12 +1167,12 @@ impl TrezorSignerProvider { let derivation_path = make_account_path(chain_config, account_index); let account_path = derivation_path.as_slice().iter().map(|c| c.into_encoded_index()).collect(); - let coin_name = chain_config.chain_type().name().to_owned(); + let chain_type = to_trezor_chain_type(chain_config); let xpub = self .client .lock() .expect("poisoned lock") - .mintlayer_get_public_key(coin_name, account_path) + .mintlayer_get_public_key(chain_type, account_path) .map_err(|e| SignerError::TrezorError(TrezorError::DeviceError(e.to_string())))?; let chain_code = ChainCode::from(xpub.chain_code.0); let account_pubkey = Secp256k1ExtendedPublicKey::new( @@ -1215,6 +1186,15 @@ impl TrezorSignerProvider { } } +fn to_trezor_chain_type(chain_config: &ChainConfig) -> MintlayerChainType { + match chain_config.chain_type() { + ChainType::Mainnet => MintlayerChainType::Mainnet, + ChainType::Testnet => MintlayerChainType::Testnet, + ChainType::Regtest => MintlayerChainType::Regtest, + ChainType::Signet => MintlayerChainType::Signet, + } +} + /// Check that the public keys in the DB are the same as the ones with the connected hardware /// wallet fn check_public_keys( diff --git a/wallet/src/signer/trezor_signer/tests.rs b/wallet/src/signer/trezor_signer/tests.rs index 7c371679e0..1eaea17d67 100644 --- a/wallet/src/signer/trezor_signer/tests.rs +++ b/wallet/src/signer/trezor_signer/tests.rs @@ -41,7 +41,6 @@ use trezor_client::find_devices; use wallet_storage::{DefaultBackend, Store, Transactional}; use wallet_types::{ account_info::DEFAULT_ACCOUNT_INDEX, - partially_signed_transaction::InfoId, seed_phrase::StoreSeedPhrase, KeyPurpose::{Change, ReceiveFunds}, }; @@ -433,23 +432,22 @@ fn sign_transaction(#[case] seed: Seed) { .with_inputs_and_destinations(acc_inputs.into_iter().zip(acc_dests.clone())) .with_outputs(outputs); let destinations = req.destinations().to_vec(); - let mut additional_info = BTreeMap::new(); - additional_info.insert( - InfoId::TokenId(token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + token_id, + TokenAdditionalInfo { num_decimals: 1, ticker: "TKN".as_bytes().to_vec(), - }), - ); - additional_info.insert( - InfoId::OrderId(order_id), - TxAdditionalInfo::OrderInfo { + }, + ) + .join(TxAdditionalInfo::with_order_info( + order_id, + OrderAdditionalInfo { ask_balance: Amount::from_atoms(10), give_balance: Amount::from_atoms(100), initially_asked: OutputValue::Coin(Amount::from_atoms(20)), initially_given: OutputValue::TokenV1(token_id, Amount::from_atoms(200)), }, - ); + )); let ptx = req.into_partially_signed_tx(additional_info).unwrap(); let mut devices = find_devices(false); diff --git a/wallet/src/wallet/mod.rs b/wallet/src/wallet/mod.rs index ce828bc11e..1dad831b86 100644 --- a/wallet/src/wallet/mod.rs +++ b/wallet/src/wallet/mod.rs @@ -74,7 +74,7 @@ use wallet_storage::{ use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; use wallet_types::chain_info::ChainInfo; use wallet_types::partially_signed_transaction::{ - InfoId, PartiallySignedTransaction, PartiallySignedTransactionCreationError, + PartiallySignedTransaction, PartiallySignedTransactionCreationError, PoolAdditionalInfo, TokenAdditionalInfo, TxAdditionalInfo, }; use wallet_types::seed_phrase::SerializableSeedPhrase; @@ -1041,7 +1041,7 @@ where fn for_account_rw_unlocked_and_check_tx_generic( &mut self, account_index: U31, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, f: impl FnOnce( &mut Account, &mut StoreTxRwUnlocked, @@ -1055,7 +1055,7 @@ where |account, db_tx, chain_config, signer_provider| { let (request, additional_data) = f(account, db_tx)?; - let ptx = request.into_partially_signed_tx(additional_utxo_infos)?; + let ptx = request.into_partially_signed_tx(additional_info)?; let mut signer = signer_provider.provide(Arc::new(chain_config.clone()), account_index); @@ -1099,13 +1099,13 @@ where fn for_account_rw_unlocked_and_check_tx( &mut self, account_index: U31, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, f: impl FnOnce(&mut Account, &mut StoreTxRwUnlocked) -> WalletResult, ) -> WalletResult { Ok(self .for_account_rw_unlocked_and_check_tx_generic( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| Ok((f(account, db_tx)?, ())), |err| err, )? @@ -1408,7 +1408,7 @@ where /// current_fee_rate is lower than the consolidate_fee_rate then the wallet will tend to /// use and consolidate multiple smaller inputs, else if the current_fee_rate is higher it will /// tend to use inputs with lowest fee. - /// * `additional_utxo_infos` - Any additional info for Tokens or Pools used in the UTXOs of + /// * `additional__info` - Any additional info for Tokens or Pools used in the UTXOs of /// the transaction to be created /// /// # Returns @@ -1423,7 +1423,7 @@ where change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { Ok(self .create_transaction_to_addresses_impl( @@ -1434,7 +1434,7 @@ where current_fee_rate, consolidate_fee_rate, |_s| (), - additional_utxo_infos, + additional_info, )? .0) } @@ -1451,7 +1451,7 @@ where intent: String, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(SignedTransaction, SignedTransactionIntent)> { let (signed_tx, input_destinations) = self.create_transaction_to_addresses_impl( account_index, @@ -1461,7 +1461,7 @@ where current_fee_rate, consolidate_fee_rate, |send_request| send_request.destinations().to_owned(), - additional_utxo_infos, + additional_info, )?; let signed_intent = self.for_account_rw_unlocked( @@ -1493,13 +1493,13 @@ where current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, additional_data_getter: impl Fn(&SendRequest) -> AddlData, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(SignedTransaction, AddlData)> { let request = SendRequest::new().with_outputs(outputs); let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx_generic( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { let send_request = account.process_send_request_and_sign( db_tx, @@ -1530,7 +1530,7 @@ where change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { let request = SendRequest::new().with_outputs(outputs); let latest_median_time = self.latest_median_time; @@ -1546,7 +1546,7 @@ where current_fee_rate, consolidate_fee_rate, }, - additional_utxo_infos, + additional_info, ) }) } @@ -1557,18 +1557,16 @@ where destination: Destination, inputs: Vec<(UtxoOutPoint, TxOutput)>, current_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { let request = SendRequest::new().with_inputs( inputs.into_iter().map(|(outpoint, output)| (TxInput::Utxo(outpoint), output)), &|_| None, )?; - self.for_account_rw_unlocked_and_check_tx( - account_index, - additional_utxo_infos, - |account, _| account.sweep_addresses(destination, request, current_fee_rate), - ) + self.for_account_rw_unlocked_and_check_tx(account_index, additional_info, |account, _| { + account.sweep_addresses(destination, request, current_fee_rate) + }) } pub fn create_sweep_from_delegation_transaction( @@ -1579,9 +1577,13 @@ where delegation_share: Amount, current_fee_rate: FeeRate, ) -> WalletResult { - self.for_account_rw_unlocked_and_check_tx(account_index, BTreeMap::new(), |account, _| { - account.sweep_delegation(address, delegation_id, delegation_share, current_fee_rate) - }) + self.for_account_rw_unlocked_and_check_tx( + account_index, + TxAdditionalInfo::new(), + |account, _| { + account.sweep_delegation(address, delegation_id, delegation_share, current_fee_rate) + }, + ) } pub fn create_transaction_to_addresses_from_delegation( @@ -1593,15 +1595,19 @@ where delegation_share: Amount, current_fee_rate: FeeRate, ) -> WalletResult { - self.for_account_rw_unlocked_and_check_tx(account_index, BTreeMap::new(), |account, _| { - account.spend_from_delegation( - address, - amount, - delegation_id, - delegation_share, - current_fee_rate, - ) - }) + self.for_account_rw_unlocked_and_check_tx( + account_index, + TxAdditionalInfo::new(), + |account, _| { + account.spend_from_delegation( + address, + amount, + delegation_id, + delegation_share, + current_fee_rate, + ) + }, + ) } pub fn mint_tokens( @@ -1614,10 +1620,10 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = to_token_additional_info(token_info); + let additional_info = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.mint_tokens( db_tx, @@ -1643,10 +1649,10 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = to_token_additional_info(token_info); + let additional_info = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.unmint_tokens( db_tx, @@ -1670,10 +1676,10 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = to_token_additional_info(token_info); + let additional_info = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.lock_token_supply( db_tx, @@ -1697,10 +1703,10 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = to_token_additional_info(token_info); + let additional_info = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.freeze_token( db_tx, @@ -1724,10 +1730,10 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = to_token_additional_info(token_info); + let additional_info = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.unfreeze_token( db_tx, @@ -1751,10 +1757,10 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = to_token_additional_info(token_info); + let additional_info = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.change_token_authority( db_tx, @@ -1779,10 +1785,10 @@ where consolidate_fee_rate: FeeRate, ) -> WalletResult { let latest_median_time = self.latest_median_time; - let additional_utxo_infos = to_token_additional_info(token_info); + let additional_info = to_token_additional_info(token_info); self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.change_token_metadata_uri( db_tx, @@ -1829,7 +1835,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - BTreeMap::new(), + TxAdditionalInfo::new(), )?; let input0_outpoint = crate::utils::get_first_utxo_outpoint(tx.transaction().inputs())?; let delegation_id = make_delegation_id(input0_outpoint); @@ -1852,7 +1858,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - BTreeMap::new(), + TxAdditionalInfo::new(), )?; let token_id = make_token_id(tx.transaction().inputs()).ok_or(WalletError::MissingTokenId)?; @@ -1872,7 +1878,7 @@ where let signed_transaction = self.for_account_rw_unlocked_and_check_tx( account_index, - BTreeMap::new(), + TxAdditionalInfo::new(), |account, db_tx| { account.create_issue_nft_tx( db_tx, @@ -1902,14 +1908,12 @@ where output_address: Option, current_fee_rate: FeeRate, ) -> WalletResult { - let additional_utxo_infos = BTreeMap::from_iter([( - InfoId::PoolId(pool_id), - TxAdditionalInfo::PoolInfo { staker_balance }, - )]); + let additional_info = + TxAdditionalInfo::with_pool_info(pool_id, PoolAdditionalInfo { staker_balance }); Ok(self .for_account_rw_unlocked_and_check_tx_generic( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { Ok(( account.decommission_stake_pool( @@ -1935,10 +1939,8 @@ where output_address: Option, current_fee_rate: FeeRate, ) -> WalletResult { - let additional_utxo_infos = BTreeMap::from_iter([( - InfoId::PoolId(pool_id), - TxAdditionalInfo::PoolInfo { staker_balance }, - )]); + let additional_info = + TxAdditionalInfo::with_pool_info(pool_id, PoolAdditionalInfo { staker_balance }); self.for_account_rw_unlocked( account_index, |account, db_tx, chain_config, signer_provider| { @@ -1950,7 +1952,7 @@ where current_fee_rate, )?; - let ptx = request.into_partially_signed_tx(additional_utxo_infos)?; + let ptx = request.into_partially_signed_tx(additional_info)?; let mut signer = signer_provider.provide(Arc::new(chain_config.clone()), account_index); @@ -1971,12 +1973,12 @@ where htlc: HashedTimelockContract, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.create_htlc_tx( db_tx, @@ -2001,12 +2003,12 @@ where conclude_key: Address, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(OrderId, SignedTransaction)> { let latest_median_time = self.latest_median_time; let tx = self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.create_order_tx( db_tx, @@ -2035,12 +2037,12 @@ where output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.create_conclude_order_tx( db_tx, @@ -2067,12 +2069,12 @@ where output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - additional_utxo_infos, + additional_info, |account, db_tx| { account.create_fill_order_tx( db_tx, @@ -2296,16 +2298,14 @@ where } } -fn to_token_additional_info( - token_info: &UnconfirmedTokenInfo, -) -> BTreeMap { - BTreeMap::from_iter([( - InfoId::TokenId(token_info.token_id()), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { +fn to_token_additional_info(token_info: &UnconfirmedTokenInfo) -> TxAdditionalInfo { + TxAdditionalInfo::with_token_info( + token_info.token_id(), + TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), - }), - )]) + }, + ) } impl Wallet @@ -2348,7 +2348,7 @@ where let latest_median_time = self.latest_median_time; self.for_account_rw_unlocked_and_check_tx( account_index, - BTreeMap::new(), + TxAdditionalInfo::new(), |account, db_tx| { account.create_stake_pool_tx( db_tx, diff --git a/wallet/src/wallet/tests.rs b/wallet/src/wallet/tests.rs index b1ab9af465..40f7cc4b32 100644 --- a/wallet/src/wallet/tests.rs +++ b/wallet/src/wallet/tests.rs @@ -998,7 +998,7 @@ fn wallet_accounts_creation() { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -1158,7 +1158,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ), Err(WalletError::DatabaseError( wallet_storage::Error::WalletLocked @@ -1176,7 +1176,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); } else { @@ -1206,7 +1206,7 @@ fn locked_wallet_cant_sign_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); } @@ -1234,7 +1234,7 @@ fn wallet_get_transaction(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -1294,7 +1294,7 @@ fn wallet_list_mainchain_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -1317,7 +1317,7 @@ fn wallet_list_mainchain_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); let spend_from_tx_id = tx.transaction().get_id(); @@ -1372,7 +1372,7 @@ fn wallet_transaction_with_fees(#[case] seed: Seed) { BTreeMap::new(), very_big_feerate, very_big_feerate, - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap_err(); @@ -1400,7 +1400,7 @@ fn wallet_transaction_with_fees(#[case] seed: Seed) { BTreeMap::new(), feerate, feerate, - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -1487,7 +1487,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap_err(); assert_eq!(err, WalletError::CannotFindUtxo(missing_utxo.clone())); @@ -1514,7 +1514,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -1552,7 +1552,7 @@ fn spend_from_user_specified_utxos(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap_err(); @@ -1850,7 +1850,7 @@ fn send_to_unknown_delegation(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -1998,7 +1998,7 @@ fn create_spend_from_delegations(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -2265,7 +2265,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); wallet @@ -2330,7 +2330,7 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); (issued_token_id, vec![nft_issuance_transaction, transfer_tx]) @@ -2368,13 +2368,13 @@ fn issue_and_transfer_tokens(#[case] seed: Seed) { Destination::PublicKeyHash(some_other_address), ); - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(*token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + *token_id, + TokenAdditionalInfo { num_decimals: number_of_decimals, ticker: token_ticker.clone(), - }), - )]); + }, + ); let transfer_tokens_transaction = wallet .create_transaction_to_addresses( DEFAULT_ACCOUNT_INDEX, @@ -2501,7 +2501,7 @@ fn check_tokens_v0_are_ignored(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ); matches!( @@ -2719,13 +2719,13 @@ fn freeze_and_unfreeze_tokens(#[case] seed: Seed) { Destination::PublicKeyHash(some_other_address), ); - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let transfer_tokens_transaction = wallet .create_transaction_to_addresses( DEFAULT_ACCOUNT_INDEX, @@ -3582,7 +3582,7 @@ fn lock_then_transfer(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); wallet @@ -3704,7 +3704,7 @@ fn wallet_multiple_transactions_in_single_block(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3796,7 +3796,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -3832,7 +3832,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3872,7 +3872,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap_err(); assert_eq!( @@ -3899,7 +3899,7 @@ fn wallet_scan_multiple_transactions_from_mempool(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); wallet.add_unconfirmed_tx(transaction.clone(), &WalletEventsNoOp).unwrap(); @@ -3984,7 +3984,7 @@ fn wallet_abandone_transactions(#[case] seed: Seed) { BTreeMap::new(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); wallet @@ -4362,7 +4362,7 @@ fn sign_decommission_pool_request_between_accounts(#[case] seed: Seed) { vec![Some(utxo)], vec![Some(addr.into_object())], None, - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); let stake_pool_transaction = wallet @@ -4651,7 +4651,7 @@ fn sign_send_request_cold_wallet(#[case] seed: Seed) { [(Currency::Coin, cold_wallet_address.clone())].into(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -4754,7 +4754,7 @@ fn test_not_exhaustion_of_keys(#[case] seed: Seed) { [].into(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); } @@ -4894,7 +4894,7 @@ fn test_add_standalone_multisig(#[case] seed: Seed) { vec![Some(tx.outputs()[0].clone())], vec![Some(multisig_address.as_object().clone())], None, - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -4988,7 +4988,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { htlc.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); let create_htlc_tx_id = create_htlc_tx.transaction().get_id(); @@ -5047,7 +5047,7 @@ fn create_htlc_and_spend(#[case] seed: Seed) { spend_utxos, vec![Some(spend_key.into_object())], Some(vec![Some(secret)]), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -5128,7 +5128,7 @@ fn create_htlc_and_refund(#[case] seed: Seed) { htlc.clone(), FeeRate::from_amount_per_kb(Amount::ZERO), FeeRate::from_amount_per_kb(Amount::ZERO), - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); let create_htlc_tx_id = create_htlc_tx.transaction().get_id(); @@ -5146,7 +5146,7 @@ fn create_htlc_and_refund(#[case] seed: Seed) { refund_utxos, vec![Some(refund_key)], None, - BTreeMap::new(), + TxAdditionalInfo::new(), ) .unwrap(); @@ -5315,13 +5315,13 @@ fn create_order(#[case] seed: Seed) { // Create an order selling tokens for coins let ask_value = OutputValue::Coin(Amount::from_atoms(111)); let give_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let (_, create_order_tx) = wallet .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5441,13 +5441,13 @@ fn create_order_and_conclude(#[case] seed: Seed) { // Create an order selling tokens for coins let ask_value = OutputValue::Coin(Amount::from_atoms(111)); let give_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let (order_id, create_order_tx) = wallet .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5485,13 +5485,13 @@ fn create_order_and_conclude(#[case] seed: Seed) { assert_eq!(coin_balance, expected_balance); assert!(token_balances.is_empty()); - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let conclude_order_tx = wallet .create_conclude_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5630,13 +5630,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { let ask_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); let sell_amount = Amount::from_atoms(1000); let give_value = OutputValue::Coin(sell_amount); - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let (order_id, create_order_tx) = wallet1 .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5688,13 +5688,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { Some(&(issued_token_id, token_amount_to_mint)) ); } - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); // Fill order partially let fill_order_tx_1 = wallet2 @@ -5754,13 +5754,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { nonce: Some(AccountNonce::new(0)), }; - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let fill_order_tx_2 = wallet2 .create_fill_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5811,13 +5811,13 @@ fn create_order_fill_completely_conclude(#[case] seed: Seed) { ask_balance: Amount::ZERO, nonce: Some(AccountNonce::new(1)), }; - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let conclude_order_tx = wallet1 .create_conclude_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -5967,13 +5967,13 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { let ask_value = OutputValue::TokenV1(issued_token_id, token_amount_to_mint); let sell_amount = Amount::from_atoms(1000); let give_value = OutputValue::Coin(sell_amount); - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let (order_id, create_order_tx) = wallet1 .create_order_tx( DEFAULT_ACCOUNT_INDEX, @@ -6026,13 +6026,13 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { ); } - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); // Fill order partially let fill_order_tx_1 = wallet2 .create_fill_order_tx( @@ -6091,13 +6091,13 @@ fn create_order_fill_partially_conclude(#[case] seed: Seed) { nonce: Some(AccountNonce::new(0)), }; - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(issued_token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + issued_token_id, + TokenAdditionalInfo { num_decimals: unconfirmed_token_info.num_decimals(), ticker: unconfirmed_token_info.token_ticker().to_vec(), - }), - )]); + }, + ); let conclude_order_tx = wallet1 .create_conclude_order_tx( DEFAULT_ACCOUNT_INDEX, diff --git a/wallet/types/src/partially_signed_transaction.rs b/wallet/types/src/partially_signed_transaction.rs index eeed7254ef..561a9a6b0a 100644 --- a/wallet/types/src/partially_signed_transaction.rs +++ b/wallet/types/src/partially_signed_transaction.rs @@ -45,33 +45,93 @@ pub enum PartiallySignedTransactionCreationError { InvalidHtlcSecretsCount, } -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)] -pub enum InfoId { - PoolId(PoolId), - TokenId(TokenId), - OrderId(OrderId), -} - #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] pub struct TokenAdditionalInfo { pub num_decimals: u8, pub ticker: Vec, } +#[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] +pub struct PoolAdditionalInfo { + pub staker_balance: Amount, +} + +#[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] +pub struct OrderAdditionalInfo { + pub initially_asked: OutputValue, + pub initially_given: OutputValue, + pub ask_balance: Amount, + pub give_balance: Amount, +} + /// Additional info for a partially signed Tx mainly used by hardware wallets to show info to the /// user #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] -pub enum TxAdditionalInfo { - TokenInfo(TokenAdditionalInfo), - PoolInfo { - staker_balance: Amount, - }, - OrderInfo { - initially_asked: OutputValue, - initially_given: OutputValue, - ask_balance: Amount, - give_balance: Amount, - }, +pub struct TxAdditionalInfo { + token_info: BTreeMap, + pool_info: BTreeMap, + order_info: BTreeMap, +} + +impl TxAdditionalInfo { + pub fn new() -> Self { + Self { + token_info: BTreeMap::new(), + pool_info: BTreeMap::new(), + order_info: BTreeMap::new(), + } + } + + pub fn with_token_info(token_id: TokenId, info: TokenAdditionalInfo) -> Self { + Self { + token_info: BTreeMap::from([(token_id, info)]), + pool_info: BTreeMap::new(), + order_info: BTreeMap::new(), + } + } + + pub fn with_pool_info(pool_id: PoolId, info: PoolAdditionalInfo) -> Self { + Self { + token_info: BTreeMap::new(), + pool_info: BTreeMap::from([(pool_id, info)]), + order_info: BTreeMap::new(), + } + } + + pub fn with_order_info(order_id: OrderId, info: OrderAdditionalInfo) -> Self { + Self { + token_info: BTreeMap::new(), + pool_info: BTreeMap::new(), + order_info: BTreeMap::from([(order_id, info)]), + } + } + + pub fn add_token_info(&mut self, token_id: TokenId, info: TokenAdditionalInfo) { + self.token_info.insert(token_id, info); + } + + pub fn join(mut self, other: Self) -> Self { + self.token_info.extend(other.token_info); + self.pool_info.extend(other.pool_info); + self.order_info.extend(other.order_info); + Self { + token_info: self.token_info, + pool_info: self.pool_info, + order_info: self.order_info, + } + } + + pub fn get_token_info(&self, token_id: &TokenId) -> Option<&TokenAdditionalInfo> { + self.token_info.get(token_id) + } + + pub fn get_pool_info(&self, pool_id: &PoolId) -> Option<&PoolAdditionalInfo> { + self.pool_info.get(pool_id) + } + + pub fn get_order_info(&self, order_id: &OrderId) -> Option<&OrderAdditionalInfo> { + self.order_info.get(order_id) + } } #[derive(Debug, Eq, PartialEq, Clone, Encode, Decode)] @@ -83,7 +143,7 @@ pub struct PartiallySignedTransaction { destinations: Vec>, htlc_secrets: Vec>, - additional_infos: BTreeMap, + additional_infos: TxAdditionalInfo, } impl PartiallySignedTransaction { @@ -93,7 +153,7 @@ impl PartiallySignedTransaction { input_utxos: Vec>, destinations: Vec>, htlc_secrets: Option>>, - additional_infos: BTreeMap, + additional_infos: TxAdditionalInfo, ) -> Result { let htlc_secrets = htlc_secrets.unwrap_or_else(|| vec![None; tx.inputs().len()]); @@ -193,7 +253,7 @@ impl PartiallySignedTransaction { } } - pub fn additional_infos(&self) -> &BTreeMap { + pub fn additional_infos(&self) -> &TxAdditionalInfo { &self.additional_infos } } diff --git a/wallet/wallet-controller/src/helpers.rs b/wallet/wallet-controller/src/helpers.rs index 542e13836a..ac40091f54 100644 --- a/wallet/wallet-controller/src/helpers.rs +++ b/wallet/wallet-controller/src/helpers.rs @@ -38,7 +38,8 @@ use wallet::{ }; use wallet_types::{ partially_signed_transaction::{ - InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, + OrderAdditionalInfo, PartiallySignedTransaction, PoolAdditionalInfo, TokenAdditionalInfo, + TxAdditionalInfo, }, Currency, }; @@ -139,26 +140,24 @@ fn pool_id_from_txo(utxo: &TxOutput) -> Option { } } -pub type AdditionalInfos = BTreeMap; - async fn fetch_token_extra_info( rpc_client: &T, value: &OutputValue, -) -> Result, ControllerError> +) -> Result> where T: NodeInterface, { match value { - OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(None), + OutputValue::Coin(_) | OutputValue::TokenV0(_) => Ok(TxAdditionalInfo::new()), OutputValue::TokenV1(token_id, _) => { let info = fetch_token_info(rpc_client, *token_id).await?; - Ok(Some(( - InfoId::TokenId(*token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + Ok(TxAdditionalInfo::with_token_info( + *token_id, + TokenAdditionalInfo { num_decimals: info.token_number_of_decimals(), ticker: info.token_ticker().to_vec(), - }), - ))) + }, + )) } } } @@ -166,7 +165,7 @@ where pub async fn fetch_utxo_extra_info( rpc_client: &T, utxo: TxOutput, -) -> Result<(TxOutput, AdditionalInfos), ControllerError> +) -> Result<(TxOutput, TxAdditionalInfo), ControllerError> where T: NodeInterface, { @@ -176,12 +175,12 @@ where | TxOutput::LockThenTransfer(value, _, _) | TxOutput::Htlc(value, _) => { let additional_info = fetch_token_extra_info(rpc_client, value).await?; - Ok((utxo, additional_info.into_iter().collect())) + Ok((utxo, additional_info)) } TxOutput::CreateOrder(order) => { let ask_info = fetch_token_extra_info(rpc_client, order.ask()).await?; - let give_info = fetch_token_extra_info(rpc_client, order.ask()).await?; - let additional_info = ask_info.into_iter().chain(give_info).collect(); + let give_info = fetch_token_extra_info(rpc_client, order.give()).await?; + let additional_info = ask_info.join(give_info); Ok((utxo, additional_info)) } TxOutput::ProduceBlockFromStake(_, pool_id) => { @@ -190,10 +189,10 @@ where .await .map_err(ControllerError::NodeCallError)? .map(|staker_balance| { - BTreeMap::from([( - InfoId::PoolId(*pool_id), - TxAdditionalInfo::PoolInfo { staker_balance }, - )]) + TxAdditionalInfo::with_pool_info( + *pool_id, + PoolAdditionalInfo { staker_balance }, + ) }) .ok_or(WalletError::UnknownPoolId(*pool_id))?; Ok((utxo, additional_infos)) @@ -203,7 +202,7 @@ where | TxOutput::CreateStakePool(_, _) | TxOutput::DelegateStaking(_, _) | TxOutput::CreateDelegationId(_, _) - | TxOutput::DataDeposit(_) => Ok((utxo, BTreeMap::new())), + | TxOutput::DataDeposit(_) => Ok((utxo, TxAdditionalInfo::new())), } } @@ -247,12 +246,12 @@ pub async fn tx_to_partially_signed_tx( .collect(); let (input_utxos, additional_infos, destinations) = tasks.try_collect::>().await?.into_iter().fold( - (Vec::new(), BTreeMap::new(), Vec::new()), - |(mut input_utxos, mut additional_infos, mut destinations), (x, y, z)| { + (Vec::new(), TxAdditionalInfo::new(), Vec::new()), + |(mut input_utxos, additional_info, mut destinations), (x, y, z)| { input_utxos.push(x); - additional_infos.extend(y); + let additional_info = additional_info.join(y); destinations.push(z); - (input_utxos, additional_infos, destinations) + (input_utxos, additional_info, destinations) }, ); @@ -263,13 +262,11 @@ pub async fn tx_to_partially_signed_tx( .iter() .map(|out| fetch_utxo_extra_info(rpc_client, out.clone())) .collect(); - let additional_infos = tasks.try_collect::>().await?.into_iter().fold( - additional_infos, - |mut acc, (_, info)| { - acc.extend(info); - acc - }, - ); + let additional_infos = tasks + .try_collect::>() + .await? + .into_iter() + .fold(additional_infos, |acc, (_, info)| acc.join(info)); let ptx = PartiallySignedTransaction::new( tx, @@ -287,7 +284,7 @@ async fn into_utxo_and_destination( rpc_client: &T, wallet: &RuntimeWallet, tx_inp: &TxInput, -) -> Result<(Option, AdditionalInfos, Option), ControllerError> { +) -> Result<(Option, TxAdditionalInfo, Option), ControllerError> { Ok(match tx_inp { TxInput::Utxo(outpoint) => { let (utxo, dest) = fetch_utxo_with_destination(rpc_client, outpoint, wallet).await?; @@ -301,7 +298,7 @@ async fn into_utxo_and_destination( #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.find_account_destination(acc_outpoint), }; - (None, BTreeMap::new(), dest) + (None, TxAdditionalInfo::new(), dest) } TxInput::AccountCommand(_, cmd) => { // find authority of the token @@ -335,19 +332,15 @@ async fn into_utxo_and_destination( ) .await?; - ask_token_info - .into_iter() - .chain(give_token_info) - .chain([( - InfoId::OrderId(*order_id), - TxAdditionalInfo::OrderInfo { - initially_asked: order_info.initially_asked.into(), - initially_given: order_info.initially_given.into(), - ask_balance: order_info.ask_balance, - give_balance: order_info.give_balance, - }, - )]) - .collect() + ask_token_info.join(give_token_info).join(TxAdditionalInfo::with_order_info( + *order_id, + OrderAdditionalInfo { + initially_asked: order_info.initially_asked.into(), + initially_given: order_info.initially_given.into(), + ask_balance: order_info.ask_balance, + give_balance: order_info.give_balance, + }, + )) } AccountCommand::MintTokens(_, _) | AccountCommand::UnmintTokens(_) @@ -355,7 +348,7 @@ async fn into_utxo_and_destination( | AccountCommand::UnfreezeToken(_) | AccountCommand::LockTokenSupply(_) | AccountCommand::ChangeTokenAuthority(_, _) - | AccountCommand::ChangeTokenMetadataUri(_, _) => BTreeMap::new(), + | AccountCommand::ChangeTokenMetadataUri(_, _) => TxAdditionalInfo::new(), }; (None, additional_infos, dest) } diff --git a/wallet/wallet-controller/src/lib.rs b/wallet/wallet-controller/src/lib.rs index a4f2b708f6..d793394841 100644 --- a/wallet/wallet-controller/src/lib.rs +++ b/wallet/wallet-controller/src/lib.rs @@ -31,9 +31,7 @@ use chainstate::tx_verifier::{ self, error::ScriptError, input_check::signature_only_check::SignatureOnlyVerifiable, }; use futures::{never::Never, stream::FuturesOrdered, TryStreamExt}; -use helpers::{ - fetch_token_info, fetch_utxo, fetch_utxo_extra_info, into_balances, AdditionalInfos, -}; +use helpers::{fetch_token_info, fetch_utxo, fetch_utxo_extra_info, into_balances}; use node_comm::rpc_client::ColdWalletClient; use runtime_wallet::RuntimeWallet; use std::{ @@ -102,7 +100,7 @@ pub use wallet_types::{ utxo_types::{UtxoState, UtxoStates, UtxoType, UtxoTypes}, }; use wallet_types::{ - partially_signed_transaction::PartiallySignedTransaction, + partially_signed_transaction::{PartiallySignedTransaction, TxAdditionalInfo}, signature_status::SignatureStatus, wallet_type::{WalletControllerMode, WalletType}, with_locked::WithLocked, @@ -1055,11 +1053,10 @@ where let (input_utxos, additional_infos) = self.fetch_utxos_extra_info(input_utxos).await?.into_iter().fold( - (Vec::new(), BTreeMap::new()), - |(mut input_utxos, mut additional_infos), (x, y)| { + (Vec::new(), TxAdditionalInfo::new()), + |(mut input_utxos, additional_info), (x, y)| { input_utxos.push(x); - additional_infos.extend(y); - (input_utxos, additional_infos) + (input_utxos, additional_info.join(y)) }, ); @@ -1067,10 +1064,7 @@ where .fetch_utxos_extra_info(tx.outputs().to_vec()) .await? .into_iter() - .fold(additional_infos, |mut acc, (_, info)| { - acc.extend(info); - acc - }); + .fold(additional_infos, |acc, (_, info)| acc.join(info)); let tx = PartiallySignedTransaction::new( tx, vec![None; num_inputs], @@ -1163,7 +1157,7 @@ where async fn fetch_utxos_extra_info( &self, inputs: Vec, - ) -> Result, ControllerError> { + ) -> Result, ControllerError> { let tasks: FuturesOrdered<_> = inputs .into_iter() .map(|input| fetch_utxo_extra_info(&self.rpc_client, input)) diff --git a/wallet/wallet-controller/src/runtime_wallet.rs b/wallet/wallet-controller/src/runtime_wallet.rs index fc9ad5ef98..2a042b7533 100644 --- a/wallet/wallet-controller/src/runtime_wallet.rs +++ b/wallet/wallet-controller/src/runtime_wallet.rs @@ -41,16 +41,13 @@ use wallet::signer::software_signer::SoftwareSignerProvider; use wallet::wallet::WalletPoolsFilter; use wallet::wallet_events::WalletEvents; use wallet::{Wallet, WalletError, WalletResult}; +use wallet_types::account_info::{StandaloneAddressDetails, StandaloneAddresses}; use wallet_types::partially_signed_transaction::{PartiallySignedTransaction, TxAdditionalInfo}; use wallet_types::seed_phrase::SerializableSeedPhrase; use wallet_types::signature_status::SignatureStatus; use wallet_types::utxo_types::{UtxoStates, UtxoTypes}; use wallet_types::wallet_tx::TxData; use wallet_types::with_locked::WithLocked; -use wallet_types::{ - account_info::{StandaloneAddressDetails, StandaloneAddresses}, - partially_signed_transaction::InfoId, -}; use wallet_types::{Currency, KeychainUsageState}; #[cfg(feature = "trezor")] @@ -787,7 +784,7 @@ impl RuntimeWallet { change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_transaction_to_addresses( @@ -797,7 +794,7 @@ impl RuntimeWallet { change_addresses, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_transaction_to_addresses( @@ -807,7 +804,7 @@ impl RuntimeWallet { change_addresses, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), } } @@ -818,7 +815,7 @@ impl RuntimeWallet { destination_address: Destination, filtered_inputs: Vec<(UtxoOutPoint, TxOutput)>, current_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_sweep_transaction( @@ -826,7 +823,7 @@ impl RuntimeWallet { destination_address, filtered_inputs, current_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_sweep_transaction( @@ -834,7 +831,7 @@ impl RuntimeWallet { destination_address, filtered_inputs, current_fee_rate, - additional_utxo_infos, + additional_info, ), } } @@ -888,7 +885,7 @@ impl RuntimeWallet { change_addresses: BTreeMap>, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(PartiallySignedTransaction, BTreeMap)> { match self { RuntimeWallet::Software(w) => w.create_unsigned_transaction_to_addresses( @@ -899,7 +896,7 @@ impl RuntimeWallet { change_addresses, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_unsigned_transaction_to_addresses( @@ -910,7 +907,7 @@ impl RuntimeWallet { change_addresses, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), } } @@ -1049,7 +1046,7 @@ impl RuntimeWallet { htlc: HashedTimelockContract, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_htlc_tx( @@ -1058,7 +1055,7 @@ impl RuntimeWallet { htlc, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_htlc_tx( @@ -1067,7 +1064,7 @@ impl RuntimeWallet { htlc, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), } } @@ -1081,7 +1078,7 @@ impl RuntimeWallet { conclude_key: Address, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(OrderId, SignedTransaction)> { match self { RuntimeWallet::Software(w) => w.create_order_tx( @@ -1091,7 +1088,7 @@ impl RuntimeWallet { conclude_key, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_order_tx( @@ -1101,7 +1098,7 @@ impl RuntimeWallet { conclude_key, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), } } @@ -1115,7 +1112,7 @@ impl RuntimeWallet { output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_conclude_order_tx( @@ -1125,7 +1122,7 @@ impl RuntimeWallet { output_address, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_conclude_order_tx( @@ -1135,7 +1132,7 @@ impl RuntimeWallet { output_address, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), } } @@ -1150,7 +1147,7 @@ impl RuntimeWallet { output_address: Option, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult { match self { RuntimeWallet::Software(w) => w.create_fill_order_tx( @@ -1161,7 +1158,7 @@ impl RuntimeWallet { output_address, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_fill_order_tx( @@ -1172,7 +1169,7 @@ impl RuntimeWallet { output_address, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), } } @@ -1216,7 +1213,7 @@ impl RuntimeWallet { intent: String, current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> WalletResult<(SignedTransaction, SignedTransactionIntent)> { match self { RuntimeWallet::Software(w) => w.create_transaction_to_addresses_with_intent( @@ -1227,7 +1224,7 @@ impl RuntimeWallet { intent, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), #[cfg(feature = "trezor")] RuntimeWallet::Trezor(w) => w.create_transaction_to_addresses_with_intent( @@ -1238,7 +1235,7 @@ impl RuntimeWallet { intent, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, ), } } diff --git a/wallet/wallet-controller/src/synced_controller.rs b/wallet/wallet-controller/src/synced_controller.rs index 8979837a1b..a353f7cd47 100644 --- a/wallet/wallet-controller/src/synced_controller.rs +++ b/wallet/wallet-controller/src/synced_controller.rs @@ -40,7 +40,6 @@ use crypto::{ vrf::VRFPublicKey, }; use futures::{stream::FuturesUnordered, TryStreamExt}; -use itertools::Itertools; use logging::log; use mempool::FeeRate; use node_comm::node_traits::NodeInterface; @@ -58,7 +57,7 @@ use wallet::{ }; use wallet_types::{ partially_signed_transaction::{ - InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, + PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, }, signature_status::SignatureStatus, utxo_types::{UtxoState, UtxoType}, @@ -158,15 +157,9 @@ where async fn filter_out_utxos_with_frozen_tokens( &self, input_utxos: Vec<(UtxoOutPoint, TxOutput)>, - ) -> Result< - ( - Vec<(UtxoOutPoint, TxOutput)>, - BTreeMap, - ), - ControllerError, - > { + ) -> Result<(Vec<(UtxoOutPoint, TxOutput)>, TxAdditionalInfo), ControllerError> { let mut result = vec![]; - let mut additional_utxo_infos = BTreeMap::new(); + let mut additional_info = TxAdditionalInfo::new(); for utxo in input_utxos { let token_ids = get_referenced_token_ids(&utxo.1); if token_ids.is_empty() { @@ -196,19 +189,19 @@ where if ok_to_use { result.push(utxo); for token_info in token_infos { - additional_utxo_infos.insert( - InfoId::TokenId(token_info.token_id()), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + additional_info.add_token_info( + token_info.token_id(), + TokenAdditionalInfo { num_decimals: token_info.token_number_of_decimals(), ticker: token_info.token_ticker().to_vec(), - }), + }, ); } } } } - Ok((result, additional_utxo_infos)) + Ok((result, additional_info)) } pub fn abandon_transaction( @@ -531,7 +524,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - BTreeMap::new(), + TxAdditionalInfo::new(), ) }, ) @@ -563,7 +556,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - BTreeMap::new(), + TxAdditionalInfo::new(), ) }, ) @@ -584,7 +577,7 @@ where WithLocked::Unlocked, )?; - let (inputs, additional_utxo_infos) = + let (inputs, additional_info) = self.filter_out_utxos_with_frozen_tokens(selected_utxos).await?; let filtered_inputs = inputs @@ -605,7 +598,7 @@ where destination_address, filtered_inputs, current_fee_rate, - additional_utxo_infos, + additional_info, ) }, ) @@ -694,7 +687,7 @@ where [(Currency::Coin, change_address)].into(), current_fee_rate, consolidate_fee_rate, - BTreeMap::new(), + TxAdditionalInfo::new(), ) .map_err(ControllerError::WalletError)?; @@ -738,18 +731,18 @@ where ControllerError::::ExpectingNonEmptyOutputs ); - let (outputs, additional_utxo_infos) = { + let (outputs, additional_info) = { let mut result = Vec::new(); - let mut additional_utxo_infos = BTreeMap::new(); + let mut additional_info = TxAdditionalInfo::new(); for (token_id, outputs_vec) in outputs { let token_info = fetch_token_info(&self.rpc_client, token_id).await?; - additional_utxo_infos.insert( - InfoId::TokenId(token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + additional_info.add_token_info( + token_id, + TokenAdditionalInfo { num_decimals: token_info.token_number_of_decimals(), ticker: token_info.token_ticker().to_vec(), - }), + }, ); match &token_info { @@ -768,7 +761,7 @@ where .map_err(ControllerError::InvalidTxOutput)?; } - (result, additional_utxo_infos) + (result, additional_info) }; let (inputs, change_addresses) = { @@ -846,7 +839,7 @@ where change_addresses, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, )?; let fees = into_balances(&self.rpc_client, self.chain_config, fees).await?; @@ -899,7 +892,7 @@ where BTreeMap::new(), current_fee_rate, consolidate_fee_rate, - BTreeMap::new(), + TxAdditionalInfo::new(), ) }, ) @@ -960,13 +953,13 @@ where account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(token_info.token_id()), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + token_info.token_id(), + TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), - }), - )]); + }, + ); wallet.create_transaction_to_addresses( account_index, [output], @@ -998,13 +991,13 @@ where account_index: U31, token_info: &UnconfirmedTokenInfo| { token_info.check_can_be_used()?; - let additional_info = BTreeMap::from_iter([( - InfoId::TokenId(token_info.token_id()), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + let additional_info = TxAdditionalInfo::with_token_info( + token_info.token_id(), + TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), - }), - )]); + }, + ); wallet.create_transaction_to_addresses_with_intent( account_index, [output], @@ -1113,7 +1106,7 @@ where &mut self, output_value: OutputValue, htlc: HashedTimelockContract, - additional_utxo_infos: BTreeMap, + additional_info: TxAdditionalInfo, ) -> Result> { let (current_fee_rate, consolidate_fee_rate) = self.get_current_and_consolidation_fee_rate().await?; @@ -1124,7 +1117,7 @@ where htlc, current_fee_rate, consolidate_fee_rate, - additional_utxo_infos, + additional_info, )?; Ok(result) } @@ -1136,7 +1129,7 @@ where conclude_key: Address, token_infos: Vec, ) -> Result<(SignedTransaction, OrderId), ControllerError> { - let additional_info = self.additional_token_infos(token_infos)?; + let additional_info = self.additional_token_info(token_infos)?; self.create_and_send_tx_with_id( move |current_fee_rate: FeeRate, @@ -1164,7 +1157,7 @@ where output_address: Option, token_infos: Vec, ) -> Result> { - let additional_info = self.additional_token_infos(token_infos)?; + let additional_info = self.additional_token_info(token_infos)?; self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, @@ -1192,7 +1185,7 @@ where output_address: Option, token_infos: Vec, ) -> Result> { - let additional_info = self.additional_token_infos(token_infos)?; + let additional_info = self.additional_token_info(token_infos)?; self.create_and_send_tx( move |current_fee_rate: FeeRate, consolidate_fee_rate: FeeRate, @@ -1213,24 +1206,25 @@ where .await } - fn additional_token_infos( + fn additional_token_info( &mut self, token_infos: Vec, - ) -> Result, ControllerError> { + ) -> Result> { token_infos .into_iter() - .map(|token_info| { + .try_fold(TxAdditionalInfo::new(), |mut acc, token_info| { let token_info = self.unconfiremd_token_info(token_info)?; - Ok(( - InfoId::TokenId(token_info.token_id()), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { + acc.add_token_info( + token_info.token_id(), + TokenAdditionalInfo { num_decimals: token_info.num_decimals(), ticker: token_info.token_ticker().to_vec(), - }), - )) + }, + ); + + Ok(acc) }) - .try_collect() } /// Checks if the wallet has stake pools and marks this account for staking. diff --git a/wallet/wallet-rpc-lib/src/rpc/mod.rs b/wallet/wallet-rpc-lib/src/rpc/mod.rs index 4a14342833..344ee0f92a 100644 --- a/wallet/wallet-rpc-lib/src/rpc/mod.rs +++ b/wallet/wallet-rpc-lib/src/rpc/mod.rs @@ -78,7 +78,7 @@ use wallet_controller::{ use wallet_types::{ account_info::StandaloneAddressDetails, partially_signed_transaction::{ - InfoId, PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, + PartiallySignedTransaction, TokenAdditionalInfo, TxAdditionalInfo, }, signature_status::SignatureStatus, wallet_tx::TxData, @@ -1500,34 +1500,35 @@ where self.wallet .call_async(move |controller| { Box::pin(async move { - let mut additional_utxo_infos = BTreeMap::new(); - let value = match token_id { + let (value, additional_info) = match token_id { Some(token_id) => { let token_info = controller.get_token_info(token_id).await?; let amount = amount .to_amount(token_info.token_number_of_decimals()) .ok_or(RpcError::InvalidCoinAmount)?; - additional_utxo_infos.insert( - InfoId::TokenId(token_id), - TxAdditionalInfo::TokenInfo(TokenAdditionalInfo { - num_decimals: token_info.token_number_of_decimals(), - ticker: token_info.token_ticker().to_vec(), - }), - ); - OutputValue::TokenV1(token_id, amount) + ( + OutputValue::TokenV1(token_id, amount), + TxAdditionalInfo::with_token_info( + token_id, + TokenAdditionalInfo { + num_decimals: token_info.token_number_of_decimals(), + ticker: token_info.token_ticker().to_vec(), + }, + ), + ) } None => { let amount = amount .to_amount(coin_decimals) .ok_or(RpcError::InvalidCoinAmount)?; - OutputValue::Coin(amount) + (OutputValue::Coin(amount), TxAdditionalInfo::new()) } }; controller .synced_controller(account_index, config) .await? - .create_htlc_tx(value, htlc, additional_utxo_infos) + .create_htlc_tx(value, htlc, additional_info) .await .map_err(RpcError::Controller) })